彙編代碼:
.text
.global _start
_start:
LDR R0,=0x56000010
MOV R1,# 0x00001000
STR R1, [R0]
LDR R0,=0x56000014
MOV R1,#0x00000000
STR R1, [R0]
MAIN_LOOP:
B MAIN_LOOP
相應的Makefile如下:
led_on.bin:led_on.S
arm-softfloat-linux-gnu-gcc -g -c -o led_on.o led_on.S
arm-softfloat-linux-gnu-ld -Ttext 0x0000000 -g led_on.o -o led_on_elf
arm-softfloat-linux-gnu-objcopy -O binary -S led_on_elf led_on.bin
clean:
rm -f led_on.bin led_on_elf *.o
用到的是S3C2410開發板,在開發板上用DNW工具下在led_on.bin文件。開發板是從NANDFLASH啓動,使用DNW顯示過程如下:
Power on reset
Env.Os_Auto_Flag=ff
<*******************************************>
<* *>
<* S3C2410 Board BIOS *>
<* *>
<* http://www.farsight.com.cn *>
<* *>
<* *>
<*******************************************>
NOR Flash Boot, Read ID is : 0x234b00bf
SST39VF1601 found
Please select function :
0 : USB download file
1 : Uart download file
2 : Write Nand flash with download file
3 : Load Pragram from Nand flash and run
4 : Erase Nand flash regions
5 : Write NOR flash with download file
6 : Set boot params
7 : Set AutoBoot parameter,1:linux 2:wince
選7
Please Input Number:9
.
Please select function :
0 : USB download file
1 : Uart download file
2 : Write Nand flash with download file
3 : Load Pragram from Nand flash and run
4 : Erase Nand flash regions
5 : Write NOR flash with download file
6 : Set boot params
7 : Set AutoBoot parameter,1:linux 2:wince
選4擦除NANDFALSH
Please select which region to erase : Esc to abort
0 : offset 0x0 , size 0x40000 [bootloader]
1 : offset 0x40000 , size 0x1c0000 [zImage]
2 : offset 0x200000 , size 0x1e00000 [cramfs]
3 : offset 0x2000000 , size 0x2000000 [WinCE]
Are you sure to erase nand flash from page 0x0, block count 0x10 ? [y/n]
................Erase Nand partition completed success
Please select function :
0 : USB download file
1 : Uart download file
2 : Write Nand flash with download file
3 : Load Pragram from Nand flash and run
4 : Erase Nand flash regions
5 : Write NOR flash with download file
6 : Set boot params
7 : Set AutoBoot parameter,1:linux 2:wince
選擇1通過串口下載bin文件。
Now download file from uart0...
Download File Size = 42
Are you sure to run? [y/n]
Please select function :
0 : USB download file
1 : Uart download file
2 : Write Nand flash with download file
3 : Load Pragram from Nand flash and run
4 : Erase Nand flash regions
5 : Write NOR flash with download file
6 : Set boot params
7 : Set AutoBoot parameter,1:linux 2:wince
現在2
將.bin下載到NANDFLASH
Please select which region to write : Esc to abort
0 : offset 0x0 , size 0x40000 [bootloader]
1 : offset 0x40000 , size 0x1c0000 [zImage]
2 : offset 0x200000 , size 0x1e00000 [cramfs]
3 : offset 0x2000000 , size 0x2000000 [WinCE]
Now write nand flash page 0x0 from ram address 0x30400000, filesize = 36
Are you sure? [y/n]
.Program nand flash partition success
下載成功
Please select function :
0 : USB download file
1 : Uart download file
2 : Write Nand flash with download file
3 : Load Pragram from Nand flash and run
4 : Erase Nand flash regions
5 : Write NOR flash with download file
6 : Set boot params
7 : Set AutoBoot parameter,1:linux 2:wince