📄 boot.s
字号:
;---------------------------------------------------------------------------------------------
;File Name : boot.s
;Description: boot code
;---------------------------------------------------------------------------------------------
;EMI Boot ROM Struct
;type Name Offset
;UINT32 BootLength 0x00
;UINT8 Encrypt 0x04
;UINT8 Access Cycle 0x05
;UINT8 InterfaceWidth 0x06
;UINT8 t_sh 0x07
;UINT8 t_hld 0x08
;UINT8 Reserved 0x09
;UINT16 Reserved 0x0A
;UINT32 Reserved 0x0C
;---------------------------------------------------------------------------------------------
AREA Bootcode, CODE, READONLY
EXPORT boot
boot
ldr r13, =(TCM_RAM_BASE + TCM_RAM_LENGTH)
tst r0,#MODE_EMI ;select Nand Flash Boot
beq NFBoot
EMIBoot
mov r4,r0
mov r0,#(PMC_GPIO | PMC_EMI)
bl en_module_clk
mvn r0, #0
bl set_gpio_a_cfg
ldr r0, =((1<<22) | (0x3FFFF))
bl set_gpio_b_cfg
ldr r0, =(EMI_HLD | EMI_SH | EMI_WC7 | EMI_RC7 | EMI_EN | EMI_RO)
tst r4,#MODE_TEST
orrne r0,r0,#EMI_DATA16
bl set_emi_a_cfg
;read 16 bytes, protocol head
mov r1, #EMI_A_BASE
ldr r2,[r1],#4 ;BootLength
add r1,r1,#0x01 ;Reserved(Encrypt)
ldrb r3,[r1],#1 ;Access Cycle
ldrb r4,[r1],#1 ;InterfaceWidth
ldrb r5,[r1],#1 ;t_sh
ldrb r6,[r1],#1 ;t_hld
add r1,r1,#0x07 ;Reserved 7 bytes
;cfg CSA reg
ldr r7, =P_EMI_BASE
ldrh r8,[r7,#P_CSA_CFG]
ldr r0,=0xf9c3
and r8,r8,r0
and r3,r3,#0x07
cmp r3,#0
moveq r3,#0x07
orr r8,r8,r3,lsl #3
and r4,r4,#0x01
orr r8,r8,r4,lsl #2
and r5,r5,#0x01
orr r8,r8,r5,lsl #9
and r6,r6,#0x01
orr r8,r8,r6,lsl #10
strh r8,[r7,#P_CSA_CFG]
;convey code
mov r3,#TCM_RAM_BASE
EMIBoot_lab
ldr r0,[r1],#4
str r0,[r3],#4
subs r2,r2,#4
bgt EMIBoot_lab
b MEM_Remap
NFBoot
mov r0,#TCM_RAM_BASE
IMPORT boot_nand_flash
bl boot_nand_flash
MEM_Remap
ldr r0,=P_REMAP
mvn r1,#0
str r1,[r0] ;Memory remap
mov pc,#0 ;goto address 0
nop
nop
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -