可以,我就这么做的!
RSEG ICODE:CODE CODE32
PUBLIC IFlash_Write_Page
;--------------------------------------------------------------------;BOOL IFlash_Write_Page(unsigned int page, unsigned int *buff) IFlash_Write_Page: SUB sp,sp,#4 STMFD sp!,{r0-r3,lr} L0_16: LDR r1,=L1_00 LDR r2,=L1_88 ADD r2,r2,#4 SUB r0,r2,r1 SUB r0,sp,r0 STR r0,[sp,#20] L0_36: LDMIA r1!,{r3} STMIA r0!,{r3} CMP r1,r2 BCC L0_36 LDMFD sp!,{r0-r3,lr}
LDMFD sp!,{pc} ;Goto ram for write IFLASH
L1_00: MOV r2,#0x100000 ;IFLASH_ADDR_START: 0x100000 ADD r3,r2,r0,LSL #8 ;IFLASH_PAGE_SIZE: 64dword = 256byte MOV r2,#0 L1_12: LDR r12,[r1],#4 ADD r2,r2,#1 CMP r2,#0x40 STR r12,[r3],#4 BCC L1_12
MOV r1,#0x00480000 ;MCLK = 48M, FMCN = 72 ORR r2,r1,#0x100 MOV r1,#0 STR r2,[r1,#-0xa0]
LDR r1,L1_88 AND r0,r1,r0,LSL #8 ORR r0,r0,#1 ORR r0,r0,#0x5a000000 MOV r1,#0 STR r0,[r1,#-0x9c] L1_56: LDR r0,[r1,#-0x98] TST r0,#1 BEQ L1_56
; LDR r0,[r1,#-0x98] TST r0,#0xc MVNEQ r0,#0 MOVNE r0,#1
BX lr L1_88: DCD 0x0003ff00
;-------------------------------------------------------------------- PUBLIC ARMDisableInt ARMDisableInt: STMFD sp!, {r0} MRS r0, CPSR ORR r0, r0, #0x80 MSR CPSR_cxsf, r0 LDMFD sp!, {r0} BX lr
PUBLIC ARMEnableInt ARMEnableInt: STMFD sp!, {r0} MRS r0, CPSR BIC r0, r0, #0x80 MSR CPSR_cxsf, r0 LDMFD sp!, {r0} BX lr
;-------------------------------------------------------------------- END
根据你使用的编译工具和芯片做简单修改吧,这里提供思想方法! |
|