openbouffalo/u-boot

Tring to get this integrated with buildroot... but

Closed this issue · 2 comments

Hey @smaeul
I'm trying to get this into buildroot, but still with our D0 low_load code and I'm failing.

Right now, just for testing, i'm building uboot/opensbi for D0 using your instructions outside of buildroot, copy fw_payload.bin into buildroot and burn the image.

D0 lowload copies fw_payload.bin to 0x51000000 and then passes control. OpenSBI runs, but when it hands over to u-boot, it dies:


OpenSBI bl808-2023-02-19
   ____                    _____ ____ _____
  / __ \                  / ____|  _ \_   _|
 | |  | |_ __   ___ _ __ | (___ | |_) || |
 | |  | | '_ \ / _ \ '_ \ \___ \|  _ < | |
 | |__| | |_) |  __/ | | |____) | |_) || |_
  \____/| .__/ \___|_| |_|_____/|___/_____|
        | |
        |_|

Platform Name             : Pine64 Ox64 (D0)
Platform Features         : medeleg
Platform HART Count       : 1
Platform IPI Device       : aclint-mswi
Platform Timer Device     : aclint-mtimer @ 1000000Hz
Platform Console Device   : bflb_uart
Platform HSM Device       : ---
Platform PMU Device       : ---
Platform Reboot Device    : ---
Platform Shutdown Device  : ---
Firmware Base             : 0x51000000
Firmware Size             : 360 KB
Firmware RW Offset        : 0x40000
Runtime SBI Version       : 1.0

Domain0 Name              : root
Domain0 Boot HART         : 0
Domain0 HARTs             : 0*
Domain0 Region00          : 0x00000000e4008000-0x00000000e400bfff M: (I,R,W) S/U: ()
Domain0 Region01          : 0x00000000e4000000-0x00000000e4007fff M: (I,R,W) S/U: ()
Domain0 Region02          : 0x0000000051040000-0x000000005105ffff M: (R,W) S/U: ()
Domain0 Region03          : 0x0000000051000000-0x000000005103ffff M: (R,X) S/U: ()
Domain0 Region04          : 0x0000000000000000-0xffffffffffffffff M: (R,W,X) S/U: (R,W,X)
Domain0 Next Address      : 0x0000000051100000
Domain0 Next Arg1         : 0x0000000050080000
Domain0 Next Mode         : S-mode
Domain0 SysReset          : yes

Boot HART ID              : 0
Boot HART Domain          : root
Boot HART Priv Version    : v1.11
Boot HART Base ISA        : rv64imafdcvx
Boot HART ISA Extensions  : time
Boot HART PMP Count       : 8
Boot HART PMP Granularity : 4096
Boot HART PMP Address Bits: 38
Boot HART MHPM Count      : 8
Boot HART MIDELEG         : 0x0000000000000222
Boot HART MEDELEG         : 0x000000000000b109

This is compiled using the t-head toolchain (that buildroot uses)

Any chance you can look at the opensbi output above and see if anything is amiss?

Can you paste the build command for OpenSBI?

Most likely the issue is that you need to load fw_payload.bin to 0x50000000, not 0x51000000. fw_payload.elf must be loaded at an offset, because the remoteproc loader parses the ELF headers and copies it to the right place, but the .bin file needs to be loaded to the final address directly.

OpenSBI is PIC, which is why it does not mind being run from 0x51000000, but U-Boot contains several hard-coded addresses, which are likely broken from being run from the wrong location.

You can also enable CONFIG_SBI_V01 and CONFIG_DEBUG_SBI_CONSOLE in your U-Boot build to get debugging output earlier.

Got it working!

One very simple patch, if you can apply, to set a default scriptaddr otherwise the distro_bootcmd will error out if it tries to load a /boot.scr from the SDCard:

https://github.com/openbouffalo/buildroot_bouffalo/blob/164c85f3b5f549f8394baaca8f558d7c2a34b7d3/board/pine64/ox64/patches/uboot/0001-add-default-script-address.patch