U-Boot

 U-Boot提供了一个go命令,可以用来启动操作系统的内核或者其他应用程序。当U-Boot还没有实现网络功能时,常常需要调试,而每次都用JTAG把u-boot.bin烧写到Flash是一件费时费力的事情,因此调试的时候最好让U-Boot从SDRAM里启动。
 
    如果不出差错,一般情况下,只要U-Boot跑起来了,它的loadb命令就是可用的。因此我们可以通过串口下载需要调试的u-boot.bin到SDRAM中,直接跳转到SDRAM中执行,这样就避免了反复烧写Flash。loadb命令和超级终端配合使用,可以方便的下载文件到SDRAM中。并且,u-boot.bin往往不像内核那么大,一般就100多K,用串口只需要花10多20秒就可以下载完毕;而内核比较大,1M多的内核用串口下载要好几分钟。
   
    下面介绍一个实现U-Boot从SDRAM启动的方法。
 
    需要注意几个地方:
 
    1、配置头文件的修改
    添加如下两行
   

   #define CONFIG_SKIP_LOWLEVEL_INIT
   #define CONFIG_SKIP_RELOCATE_UBOOT

    这两行使U-Boot不执行汇编代码段的cpu_init_critrelocate 代码段。

    2、修改config.mk文件

    config.mk文件中定义了一个TEXT_BASE,指定程序的入口地址。在博创的经典pxa270开发板上,我做的如下的定义:

    TEXT_BASE = 0xa3f80000

     表示U-Boot在RAM中的程序入口地址。U-Boot启动以后,在RAM中就运行在这个地址往上的空间。这样定义的U-Boot,将它烧写到Flash中。

     然后,在调试用的U-Boot中做如下设定:

    TEXT_BASE = 0xa3f00000

      这样,调试用的U-Boot就运行在RAM中从0xa3f00000往上的地址,两个U-Boot空间互不干扰。

      编译完调试用的U-Boot,执行如下命令:

[UP270 #]tftp 0xa3f00000 u-boot.bin
Found DM9000 ID:90000a46 at address 8000000 !
DM9000 work in 16 bus width
bd->bi_entaddr: 08:00:3e:26:0a:5b
[eth_init]MAC:8:0:3e:26:a:5b:
TFTP from server 192.168.1.132; our IP address is 192.168.1.56
Filename 'u-boot.bin'.
Load address: 0xa3f00000
Loading: T #########
done
Bytes transferred = 127072 (1f060 hex)
[UP270 #]go 0xa3f00000
## Starting application at 0xA3F00000 ...
 
 
U-Boot 1.3.2 (Nov 19 2008 - 10:08:49)
 
U-Boot code: A3F00000 -> A3F1F060 BSS: -> A3F53E84
DRAM: 64 MB
Flash: 16 MB
In: serial
Out: serial
Err: serial
Found DM9000 ID:90000a46 at address 8000000 !
DM9000 work in 16 bus width
bd->bi_entaddr: 08:00:3e:26:0a:5b
[eth_init]MAC:8:0:3e:26:a:5b:
Hit any key to stop autoboot: 0
[UP270 #]

可以看到,新的U-Boot就正确地启动了,代码空间从0xa3f00000到0xa3f1f060;BSS段从0xa3f1f060到0xa3f53e84。
### U-Boot Bootloader Documentation and Usage #### Overview of U-Boot on S5P6818 Development Board U-Boot is applicable to the S5P6818 development board, which will be used as a basis for introducing embedded systems further. The process involves obtaining U-Boot source code from repositories such as NXP's provided link at GitHub[^2]. #### Acquiring U-Boot Source Code For acquiring U-Boot source code specifically tailored or compatible with certain platforms like the S5P6818, one can refer to dedicated sources where developers share their work. For instance, NXP provides an accessible repository through its official channel. #### Compilation Process Insight via Makefile Analysis Understanding how U-Boot compiles requires delving into `Makefile`, especially when targeting specific boards like rk3568. This file orchestrates various tasks including setting up configurations based on selected board settings (e.g., `board config`), choosing appropriate compilation chains (`compilation chain`), adapting according to host machine environments among others[^3]. #### Challenges in Understanding Complex Build Systems Analyzing complex build systems within projects similar to U-Boot demands extensive knowledge not only about shell scripting but also familiarity with project-specific conventions. While many online resources provide insights into older models' makefiles—such as those related to s3c2440, s3c6410, and other variants—it remains true that newer architectures may introduce unique elements requiring specialized attention[^4]. ```bash git clone https://github.com/Freescale/u-boot-fslc.git cd u-boot-fslc/ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值