邮箱: wangcong02345@163.com
全部博文(438)
分类: LINUX
2012-04-24 15:43:43
今天无竟中发现u-boot中还有一个examples目录,编译u-boot之后发现了好几个测试程序,如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没有在内存中所以程序跑不起来,修改LOAD_ADDR到内存的起始地址0x30000000.
2. 同时在烧写时也要修改下载的地址
假设在windows下用dnw烧写,则需要设置Options—>Download Address 0x30000000, 下载的地址要和连接时的地址保持一致才能运行。
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