⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vectors.s

📁 基于EP7312的MP3播放器源代码,包括MCU和PC端代码.
💻 S
📖 第 1 页 / 共 2 页
字号:
    str      r3, [r0, _CONST_ HwPortE]    //    // Set up the stack pointer.    //    ldr     r13, =SVCStackEnd    //    // Initialize the value of ulEndOfRAM.    //    ldr     r0, =ulEndOfRAM    ldr     r1, =_RWLIMIT_    str     r1, [r0]    //    // Call the update code.    //    mov     r0, _CONST_ 0x00000000    mov     lr, pc    _IMPORT_ Update    ldr     pc, =Update    //    // Disable the MMU.    //    ldr     r0, =0x00000070    mcr     _CP15_, 0, r0, _CR1_, _CR0_    //    // There should always be two NOP instructions following the enable or    // disable of the MMU.    //    nop    nop    //    // Flush the cache and TLB.    //    ldr     r0, =0x00000000    mcr     _CP15_, 0, r0, _CR7_, _CR7_    mcr     _CP15_, 0, r0, _CR8_, _CR7_    //    // Branch back to the reset vector.    //    mov     pc, r0    //    // Tell the assembler to put in-line data here.    //    _LTORG_//****************************************************************************//// UpdateHandler is the routine which is called by the player when a software// update needs to be performed.////****************************************************************************UpdateHandler _LABEL_    //    // Disable the FIQ and IRQ interrupts.    //    mrs     r0, cpsr    orr     r0, r0, _CONST_ 0x000000c0    msr     cpsr_cf, r0    //    // Load pointers to the EP7209 internal registers.    //    ldr     r0, =HwBaseAddress    add     r1, r0, _CONST_ 0x00001000    add     r2, r0, _CONST_ 0x00002000    //    // Disable all the interrupt sources.    //    ldr     r3, =0x00000000    str     r3, [r0, _CONST_ HwIntMask]    str     r3, [r1, _CONST_ (HwIntMask2 - 0x1000)]    str     r3, [r2, _CONST_ (HwIntMask3 - 0x2000)]    //    // Disable the MMU.    //    ldr     r0, =0x00000070    mcr     _CP15_, 0, r0, _CR1_, _CR0_    //    // There should always be two NOP instructions following the enable or    // disable of the MMU.    //    nop    nop    //    // Flush the cache and TLB.    //    ldr     r0, =0x00000000    mcr     _CP15_, 0, r0, _CR7_, _CR7_    mcr     _CP15_, 0, r0, _CR8_, _CR7_    //    // Copy the code image from ROM to RAM.    //    ldr      r1, =0x00000000    ldr      r2, =0x60000000    ldr      r3, =_ROLIMIT_    bic      r3, r3, _CONST_ 0x00f00000update_copy_ro _LABEL_        ldr     r0, [r1], _CONST_ 4        str     r0, [r2], _CONST_ 4        subs    r3, r3, _CONST_ 4        bne     update_copy_ro    //    // Copy the read-write data block from ROM to RAM.    //    mov     r0, r1    ldr     r1, =_RWBASE_    bic     r1, r1, _CONST_ 0x00f00000    orr     r1, r1, _CONST_ 0x60000000    ldr     r2, =_ZIBASE_    bic     r2, r2, _CONST_ 0x00f00000    orr     r2, r2, _CONST_ 0x60000000update_copy_rw _LABEL_        cmp     r1, r2        ldrne   r3, [r0], _CONST_ 4        strne   r3, [r1], _CONST_ 4        bne     update_copy_rw    //    // Fill the zero initialized data block in RAM with zeros.    //    ldr     r2, =_RWLIMIT_    bic     r2, r2, _CONST_ 0x00f00000    orr     r2, r2, _CONST_ 0x60000000    ldr     r3, =0x00000000update_fill_zi _LABEL_        cmp     r1, r2        strne   r3, [r1], _CONST_ 4        bne     update_fill_zi    //    // Tell the MMU where to find the new page table.    //    _IMPORT_ PageTable    ldr     r0, =PageTable    bic     r0, r0, _CONST_ 0x00f00000    orr     r0, r0, _CONST_ 0x60000000    mcr     _CP15_, 0, r0, _CR2_, _CR0_    //    // Enable the MMU.    //    ldr     r0, =0x00000071    mcr     _CP15_, 0, r0, _CR1_, _CR0_    //    // There should always be two NOP instructions following the enable or    // disable of the MMU.    //    nop    nop    //    // Set up the stack pointer.    //    ldr     r13, =SVCStackEnd    //    // Initialize the value of ulEndOfRAM.    //    ldr     r0, =ulEndOfRAM    add     r1, r0, _CONST_ 0x00000004    str     r1, [r0]    //    // Call the update code.  We set the link register to zero so that when the    // update code returns, we will re-initialize the system.    //    mov     r0, _CONST_ 0x00000001    mov     lr, pc    ldr     pc, =Update    //    // Disable the MMU.    //    ldr     r0, =0x00000070    mcr     _CP15_, 0, r0, _CR1_, _CR0_    //    // There should always be two NOP instructions following the enable or    // disable of the MMU.    //    nop    nop    //    // Flush the cache and TLB.    //    ldr     r0, =0x00000000    mcr     _CP15_, 0, r0, _CR7_, _CR7_    mcr     _CP15_, 0, r0, _CR8_, _CR7_    //    // Branch back to the reset vector.    //    mov     pc, r0    //    // Tell the assembler to put in-line data here.    //    _LTORG_//****************************************************************************//// CheckImage determines if the image at the specified location is "valid".// We check to see that the hardware ID in the image matches the hardware ID of// the player and that the CRC32 of the image is correct.////****************************************************************************CheckImage _LABEL_    //    // Load the base address from the image.    //    ldr     r1, [r0, _CONST_ 0x20]    //    // Compare the base address of the image to its actual location in memory.    //    add     r2, r0, _CONST_ 0x20    cmp     r1, r2    movne   r0, _CONST_ 0x00000000    movne   pc, lr    //    // Load the hardware ID from the image.    //    ldr     r1, [r0, _CONST_ 0x28]    //    // Compare the hardware ID of the image to be sure that it matches the    // hardware ID of the player.    //    ldr     r2, =HardwareID    cmp     r1, r2    movne   r0, _CONST_ 0x00000000    movne   pc, lr    //    // Load a pointer to the CRC32 data table.    //    ldr     r1, =CRCTable    bic     r1, r1, _CONST_ 0x00f00000    //    // Get the length of the image.    //    ldr     r2, [r0, _CONST_ 0x24]    //    // If the length of the image is zero, greater than 1Meg, or not a multiple    // of 4 bytes, then assume there is an error with the image.    //    cmp     r2, _CONST_ 0x00000000    moveq   r0, _CONST_ 0x00000000    moveq   pc, lr    cmp     r2, _CONST_ 0x00100000    movhi   r0, _CONST_ 0x00000000    movhi   pc, lr    tst     r2, _CONST_ 0x00000003    movne   r0, _CONST_ 0x00000000    movne   pc, lr    //    // Get the CRC of the image.    //    ldr     r6, [r0, _CONST_ 0x2c]    //    // The CRC32 starts with the first word after the image descriptor    // structure.    //    add     r0, r0, _CONST_ 0x30    sub     r2, r2, _CONST_ 0x30    //    // Set the initial value of the CRC32.    //    mvn     r3, _CONST_ 0x00000000    //    // While there are more words in the image, load them and add them to the    // checksum.    //check_word _LABEL_        //        // Load the next word from the image.        //        ldr     r4, [r0], _CONST_ 4        //        // Generate the next CRC32 value based on the first byte.        //        eor     r5, r3, r4        and     r5, r5, _CONST_ 0xff        ldr     r5, [r1, r5, lsl _CONST_ 2]        mov     r3, r3, lsr _CONST_ 8        eor     r3, r3, r5        //        // Generate the next CRC32 value based on the second byte.        //        eor     r5, r3, r4, lsr _CONST_ 8        and     r5, r5, _CONST_ 0xff        ldr     r5, [r1, r5, lsl _CONST_ 2]        mov     r3, r3, lsr _CONST_ 8        eor     r3, r3, r5        //        // Generate the next CRC32 value based on the third byte.        //        eor     r5, r3, r4, lsr _CONST_ 16        and     r5, r5, _CONST_ 0xff        ldr     r5, [r1, r5, lsl _CONST_ 2]        mov     r3, r3, lsr _CONST_ 8        eor     r3, r3, r5        //        // Generate the next CRC32 value based on the fourth byte.        //        eor     r5, r3, r4, lsr _CONST_ 24        and     r5, r5, _CONST_ 0xff        ldr     r5, [r1, r5, lsl _CONST_ 2]        mov     r3, r3, lsr _CONST_ 8        eor     r3, r3, r5        //        // Decrement the count of bytes and loop back if there are more.        //        subs    r2, r2, _CONST_ 4        bne     check_word    //    // See if the CRC32 mataches.    //    cmp     r3, r6    //    // Indicate if the CRC32 matched.    //    movne   r0, _CONST_ 0x00000000    moveq   r0, _CONST_ 0x00000001    //    // Return.    //    mov     pc, lr    _END_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -