Für ein Hallo Welt Uboot Projekt verwende ich this Tutorial.Uboot ein Hallo Welt Kernel
Ich habe GNU ARM Toolchain Heruntergeladene Uboot Quelle verwendet: u-boot-2017,09
es Zusammengestellt
make vexpress_ca9x4_defconfig ARCH=arm CROSS_COMPILE=../gcc-arm-none-eabi-6-2017-q2-update/bin/arm-none-eabi-
make all ARCH=arm CROSS_COMPILE=../gcc-arm-none-eabi-6-2017-q2-update/bin/arm-none-eabi-
Und das Hallo Welt Projekt sieht aus wie
test.c
volatile unsigned int * const UART0DR = (unsigned int *)0x101f1000;
void print_uart0(const char *s) {
while(*s != '\0') { /* Loop until end of string */
*UART0DR = (unsigned int)(*s); /* Transmit char */
s++; /* Next char */
}
}
void c_entry() {
print_uart0("Hello world!\n");
}
startup.s
.global _Reset
_Reset:
LDR sp, =stack_top
BL c_entry
B .
test.ld
ENTRY(_Reset)
SECTIONS
{
. = 0x100000; /*initial address*/
.startup . : { startup.o(.text) }
.text : { *(.text) }
.data : { *(.data) }
.bss : { *(.bss COMMON) }
. = ALIGN(8);
. = . + 0x1000; /* 4kB of stack memory */
stack_top = .;
}
Und die Kompilation
../gcc-arm-none-eabi-6-2017-q2-update/bin/arm-none-eabi-gcc -c -mcpu=arm926ej-s test.c -o test.o
../gcc-arm-none-eabi-6-2017-q2-update/bin/arm-none-eabi-as -mcpu=arm926ej-s startup.s -o startup.o
../gcc-arm-none-eabi-6-2017-q2-update/bin/arm-none-eabi-ld -T test.ld -Map=test.map test.o startup.o -o test.elf
../gcc-arm-none-eabi-6-2017-q2-update/bin/arm-none-eabi-objcopy -O binary test.elf test.bin
Bild erstellen:
mkimage -A arm -C none -O linux -T kernel -d test.bin -a 0x00100000 -e 0x00100000 test.uimg
Ausgang:
Image Name:
Created: Mon Oct 23 20:58:01 2017
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 146 Bytes = 0.14 kB = 0.00 MB
Load Address: 00100000
Entry Point: 00100000
Erstellen Sie eine einzelne binäre:
cat ../u-boot-2017.09/u-boot test.uimg > flash.bin
Berechnet uboot Binärgröße
printf "bootm 0x%X\n" $(expr $(stat -c%s u-boot.bin) + 65536)
bootm 0x218F20
Dann laufen:
qemu-system-arm -M vexpress-a9 -kernel flash.bin -m 128M -nographic
es Unterbrochen und dann bootm 0x218F20
laufen Aber es sagt
Wrong Image Format for bootm command
ERROR: can't get kernel image!
Jeder Vorschlag?