各位老大 小弟我不太会用汇编 请多多指教 谢谢 init.s GET memory.a GET snds.a
AREA Init, CODE, READONLY
; --- Define entry point EXPORT __main ; defined to ensure that C runtime system __main ; is not linked in ENTRY ; --- Setup interrupt / exception vectors IF :DEF: ROM_AT_ADDRESS_ZERO ; If the ROM is at address 0 this is just a sequence of branches B Reset_Handler B Undefined_Handler B SWI_Handler B Prefetch_Handler B Abort_Handler NOP ; Reserved vector B IRQ_Handler B FIQ_Handler ELSE ; Otherwise we copy a sequence of LDR PC instructions over the vectors ; (Note: We copy LDR PC instructions because branch instructions ; could not simply be copied, the offset in the branch instruction ; would have to be modified so that it branched into ROM. Also, a ; branch instructions might not reach if the ROM is at an address ; > 32M). MOV R8, #0 ADR R9, Vector_Init_Block LDMIA R9!, {R0-R7} STMIA R8!, {R0-R7} LDMIA R9!, {R0-R7} STMIA R8!, {R0-R7}
; Now fall into the LDR PC, Reset_Addr instruction which will continue ; execution at 'Reset_Handler'
Vector_Init_Block LDR PC, Reset_Addr LDR PC, Undefined_Addr LDR PC, SWI_Addr LDR PC, Prefetch_Addr LDR PC, Abort_Addr NOP LDR PC, IRQ_Addr LDR PC, FIQ_Addr
Reset_Addr DCD Reset_Handler Undefined_Addr DCD Undefined_Handler SWI_Addr DCD SWI_Handler Prefetch_Addr DCD Prefetch_Handler Abort_Addr DCD Abort_Handler DCD 0 ; Reserved vector IRQ_Addr DCD IRQ_Handler FIQ_Addr DCD FIQ_Handler ENDIF
;========================================================== ; The Default Exception Handler Vector Entry Pointer Setup ;========================================================== FIQ_Handler SUB sp, sp, #4 STMFD sp!, {r0} LDR r0, =HandleFiq LDR r0, [r0] STR r0, [sp, #4] LDMFD sp!, {r0, pc}
IRQ_Handler SUB sp, sp, #4 STMFD sp!, {r0} LDR r0, =HandleIrq LDR r0, [r0] STR r0, [sp, #4] LDMFD sp!, {r0, pc}
Prefetch_Handler SUB sp, sp, #4 STMFD sp!, {r0} LDR r0, =HandlePrefetch LDR r0, [r0] STR r0, [sp, #4] LDMFD sp!, {r0, pc}
Abort_Handler SUB sp, sp, #4 STMFD sp!, {r0} LDR r0, =HandleAbort LDR r0, [r0] STR r0, [sp, #4] LDMFD sp!, {r0, pc}
Undefined_Handler SUB sp, sp, #4 STMFD sp!, {r0} LDR r0, =HandleUndef LDR r0, [r0] STR r0, [sp, #4] LDMFD sp!, {r0, pc}
SWI_Handler SUB sp, sp, #4 STMFD sp!, {r0} LDR r0, =HandleSwi LDR r0, [r0] STR r0, [sp, #4] LDMFD sp!, {r0, pc}
AREA Main, CODE, READONLY
;========================================================== ; The Reset Entry Point ;========================================================== EXPORT Reset_Handler Reset_Handler ;/* Reset Entry Point */
LDR r1, =IntMask LDR r0, =0xFFFFFFFF STR r0, [r1]
[ ROM_AT_ADDRESS_ZERO /*151行错误*/ LDR r0, =HandleSwi ; SWI exception table address LDR r1, =SystemSwiHandler STR r1, ][r0] swi 0xff ;/* Call SWI Vector */
] |