×
单片机 > 单片机程序设计 > 详情

TQ2440之uboot---6.运行U-boot目录examples中的hello_world.c

发布时间:2020-09-01 发布时间:
|

今天无竟中发现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




『本文转载自网络,版权归原作者所有,如有侵权请联系删除』

热门文章 更多
AVR熔丝位操作时的要点和需要注意的相关事项