TQ2440之uboot---6.運(yùn)行U-boot目錄examples中的hello_world.c
今天無(wú)竟中發(fā)現(xiàn)u-boot中還有一個(gè)examples目錄,編譯u-boot之后發(fā)現(xiàn)了好幾個(gè)測(cè)試程序,如hello_world 。
同時(shí)tq2440的bootloader中有選項(xiàng)可以下載程序sdram中并運(yùn)行,
[7] Download Program (uCOS-II or TQ2440_Test) to SDRAM and Run it。
這樣如果hello_world可以直接在sdram中并跑起來(lái)的話(huà),就省得每一次都要燒到nand flash中去了。
1. u-boot編譯時(shí),修改 ./example/Makefile
ifeq ($(ARCH),arm)
#LOAD_ADDR = 0xc100000
LOAD_ADDR =0x30000000
endif
原先的LOAD_ADDR=0xc100000沒(méi)有在內(nèi)存中所以程序跑不起來(lái),修改LOAD_ADDR到內(nèi)存的起始地址0x30000000.
2. 同時(shí)在燒寫(xiě)時(shí)也要修改下載的地址
假設(shè)在windows下用dnw燒寫(xiě),則需要設(shè)置Options—>Download Address0x30000000, 下載的地址要和連接時(shí)的地址保持一致才能運(yùn)行。
3. 程序運(yùn)行打印信息如下:
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





