ARM-uboot介绍以及基于uboot编程
1. uboot介绍
是制作bootloader的源码集合,在arm的板子上所有的bootloader都是由uboot做出来的。
2. uboot的作用
引导和加载操作系统内核,本身不属于操作系统,是在操作运行之前执行的一小段代码,为操作系统的运行提供硬件环境。
3. 基于uboot编写helloworld程序
#define printf(...) (((int (*) (const char *, ...))0x43e11a2c)(__VA_ARGS__))
int _start(void)
{
printf("hello world\n");
return 0;
}
- 编译命令:
/*只编译不链接 */
arm-linux-gcc -c hello.c -o hello.o
/*手动链接,指令定程序入口地址 */
arm-linux-ld -Ttext=0x40008000 hello.o -o hello
/*生成纯净的二进制 */
arm-linux-objcopy -O binary hello hello.bin - 编译完成后将hello.bin程序下载到开发板内存40008000的内存地址
执行程序:go 4000