iv
目录
正文之前 .................................................................................................................................. ix
1. 本文内容 ...................................................................................................................... ix
2. 本文目标 ...................................................................................................................... ix
3. 代码来源 ...................................................................................................................... ix
4. 阅读此文所要具有的前提知识 ........................................................................................ ix
5. 声明 ............................................................................................................................ ix
1. start.S详解 ........................................................................................................................... 1
1.1. 设置CPU模式 ............................................................................................................. 1
1.1.1. globl .............................................................................................................. 1
1.1.2. _start ............................................................................................................. 2
1.1.3. ldr .................................................................................................................. 3
1.1.4. .word .............................................................................................................. 5
1.1.5. .balignl ........................................................................................................... 6
1.1.6. _TEXT_BASE _armboot_start .......................................................................... 7
1.1.7. _bss_start _bss_end ....................................................................................... 7
1.1.8. FREE_RAM_END FREE_RAM_SIZE ................................................................... 8
1.1.9. IRQ_STACK_START FIQ_STACK_START ............................................................ 9
1.1.10. cpsr ............................................................................................................ 10
1.1.11. bic ............................................................................................................. 12
1.1.12. orr .............................................................................................................. 12
1.1.13. msr ............................................................................................................ 13
1.2. 关闭看门狗 .............................................................................................................. 14
1.2.1. pWTCON INTMOD INTMSK INTSUBMSK CLKDIVN ..................................... 14
1.2.2. ldr pWTCON ................................................................................................ 15
1.2.3. mov ............................................................................................................. 17
1.2.4. str ................................................................................................................ 17
1.3. 关闭中断 .................................................................................................................. 19
1.3.1. set INTMSK ................................................................................................. 19
1.3.2. set INTSUBMSK ........................................................................................... 20
1.3.3. set CLKDIVN ................................................................................................ 21
1.3.4. bl ................................................................................................................. 22
1.4. 设置堆栈sp指针 ....................................................................................................... 23
1.4.1. stack_setup .................................................................................................. 23
1.4.2. calc stack ..................................................................................................... 25
1.4.3. clock_init ...................................................................................................... 26
1.4.4. adr ............................................................................................................... 27
1.4.5. clear_bss ...................................................................................................... 29
1.4.6. cal armboot size .......................................................................................... 29
1.4.7. cal armboot size .......................................................................................... 31
1.5. 清除bss段 ................................................................................................................ 33
1.5.1. clear_bss ...................................................................................................... 33
1.5.2. clear css loop .............................................................................................. 33
1.5.3. ldr pc ........................................................................................................... 33
1.5.4. cpu_init_crit ................................................................................................. 34
1.5.5. disable MMU ............................................................................................... 39
1.5.6. clear bits ...................................................................................................... 40
1.5.7. bl lowlevel_init ............................................................................................. 43
1.6. 异常中断处理 ........................................................................................................... 43
1.6.1. macros stmia ............................................................................................... 43
1.6.2. cal reg value and store ............................................................................... 47
1.6.3. irq_save_user_regs irq_restore_user_regs ..................................................... 48
1.6.4. exception handlers ...................................................................................... 50
1.6.5. Launch ......................................................................................................... 52
1.6.6. int_return ..................................................................................................... 53
2. start.S的总结 ...................................................................................................................... 55