;========================================= //;表示註釋語句,不參與編譯 ; NAME: 2440INIT.S ; DESC: C start up codes ; Configure memory, ISR ,stacks ; Initialize C-variables ;=========================================
GET option.inc //GET即為包含文件,相當於c語言中的『#include』,option.inc定義了一些全局變數, memcfg.inc定義了關於內存bank的符號和數字常量, 2440addr.inc定義了用於彙編的2440寄存器變數和地址 GET memcfg.inc GET 2440addr.inc
$HandlerLabel sub sp,sp,#4 ;decrement sp(to store jump address) stmfd sp!,{r0} ;PUSH the work register to stack(lr does not push because it return to original address) ldr r0,=$HandleLabel;load the address of HandleXXX to r0 ldr r0,[r0] ;load the contents(service routine start address) of HandleXXX str r0,[sp,#4] ;store the contents(ISR) of HandleXXX to stack ldmfd sp!,{r0,pc} ;POP the work register and pc(jump to ISR) MEND
IMPORT |Image$$RO$$Base| ; Base of ROM code //IMPORT指示編譯器當前的符號不是在本源文件中定義的,而是在其他源文件中定義的,在本源文件中可能引用該符號 IMPORT |Image$$RO$$Limit| ; End of ROM code (=start of ROM data) IMPORT |Image$$RW$$Base| ; Base of RAM to initialise IMPORT |Image$$ZI$$Base| ; Base and limit of area IMPORT |Image$$ZI$$Limit| ; to zero initialise
IMPORT OS_CPU_IRQ_ISR ;add by YG IMPORT Main ; The main entry of mon program IMPORT RdNF2SDRAM ; Copy Image from Nand Flash to SDRAM EXPORT HandleEINT0; //EXPORT聲明一個符號可以被其它文件引用,相當於聲明一個全局變數