汇编代码:
.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