Uboot-Raspberry3b-Bare metal code

Little Tree littletreetrunk32 at gmail.com
Sat Apr 29 16:11:32 CEST 2023


Hi,
I have written (copied from here
https://github.com/bztsrc/raspi3-tutorial/tree/master/0F_executionlevel)  a
small bare metal program to switch exception level from EL2 to EL1 in
Raspberry Pi 3B. The program is linked to load at the address 0x80000. The
stripped version of the ELF is directly loaded through the "config.txt"
file (without U-Boot) and it works. It is able to access the mini UART and
print a message from EL1.

Now I have modified the same program to load at the address (0x1000000) by
modifying the linker (link.ld) file. Stripped it using objcopy. started the
board with U-Boot. From U-boot prompt loaded the binary to the address
0x1000000 (using tftpboot). Then initiated the execution using go 0x1000000.

This ends up in a board reset with the following error.

U-Boot> go 0x1000000
## Starting application at 0x01000000 ...
"Synchronous Abort" handler, esr 0x86000004, far 0x13af5d330
elr: 00000000ffc92330 lr : 00000000ffc92330 (reloc)
elr: 000000013af5d330 lr : 000000013af5d330
x0 : 0000000003000022 x1 : 0000000000000001
x2 : 0000000001000084 x3 : 0000000001000000
x4 : 0000000000000000 x5 : 0000000000001680
x6 : 0000000000000010 x7 : 0000000000000008
x8 : 0000000000000001 x9 : 0000000000000010
x10: 0000000000000004 x11: 000000003e96cea0
x12: 0000000000000001 x13: 000000003e96cea0
x14: 0000000000000000 x15: 0000000000000004
x16: 0000000000000000 x17: 0000000000000000
x18: 000000003af46d60 x19: 000000003af3e9c0
x20: 000000003b365f20 x21: 000000003af3eaa0
x22: 0000000000000000 x23: 000000000000000a
x24: 0000000000000000 x25: 000000003af5d310
x26: 0000000000000000 x27: 0000000000000000
x28: 000000003af5d400 x29: 0000000000000060

Code: "Synchronous Abort" handler, esr 0x96000004, far 0x13af5d320
elr: 0000000000082b10 lr : 0000000000082af0 (reloc)
elr: 000000003b34db10 lr : 000000003b34daf0
x0 : 000000003b3c05c5 x1 : 000000003ebe9a00
x2 : 0000000000000040 x3 : 000000000000003f
x4 : 0000000000000000 x5 : 0000000000001680
x6 : 0000000000000010 x7 : 0000000000000008
x8 : 0000000000000001 x9 : 0000000000000010
x10: 0000000000000004 x11: 000000003eb2ea40
x12: 0000000000000001 x13: 000000003eb2ea40
x14: 0000000000000000 x15: 0000000000000004
x16: 0000000000000000 x17: 0000000000000000
x18: 000000003af46d60 x19: 000000013af5d320
x20: 000000003b3c5000 x21: 00000000fffffffc
x22: 000000003b3c6dd5 x23: 000000003b3c05c5
x24: 0000000000000000 x25: 000000003af5d310
x26: 0000000000000000 x27: 0000000000000000
x28: 000000003af5d400 x29: 000000003af3e7f0

Code: d1004273 913756d6 aa0003f7 12800075 (b9400261)
Resetting CPU ...

I built U-Boot with default configuration for raspberry-pi3 and arm64. My
program crashed on both of them. This error log is from BCM2835-arm64
U-Boot build.

Is there any specific requirement for U-Boot which should be met by the
bare metal program?
I have been struggling with this for quite some time. Any help/hint is (to
some documentation at lleast) greatly appreciated.

Thanks a lot,
  Little


More information about the U-Boot mailing list