TQ2440之uboot---6.運行U-boot目錄examples中的hello_world.c
今天無竟中發(fā)現(xiàn)u-boot中還有一個examples目錄,編譯u-boot之后發(fā)現(xiàn)了好幾個測試程序,如hello_world 。
同時tq2440的bootloader中有選項可以下載程序sdram中并運行,
[7] Download Program (uCOS-II or TQ2440_Test) to SDRAM and Run it。
這樣如果hello_world可以直接在sdram中并跑起來的話,就省得每一次都要燒到nand flash中去了。
1. u-boot編譯時,修改 ./example/Makefile
ifeq ($(ARCH),arm)
#LOAD_ADDR = 0xc100000
LOAD_ADDR =0x30000000
endif
原先的LOAD_ADDR=0xc100000沒有在內(nèi)存中所以程序跑不起來,修改LOAD_ADDR到內(nèi)存的起始地址0x30000000.
2. 同時在燒寫時也要修改下載的地址
假設(shè)在windows下用dnw燒寫,則需要設(shè)置Options—>Download Address0x30000000, 下載的地址要和連接時的地址保持一致才能運行。
3. 程序運行打印信息如下:
Enter your selection: 7
USB host is connected. Waiting a download.
Now, Downloading [ADDRESS:30000000h,TOTAL:533]
RECEIVED FILE SIZE: 533 (0KB/S, 1S)
## Starting application at 0x30000000 ...
Example expects ABI version 3
Actual U-Boot ABI version 3
Hello World
argc = 1
argv[0] = "30000000"
argv[1] = ""
Hit any key to exit ...
## Application terminated, rc = 0x0