boot hangs on new board with SAMA5D27C-D5M
Hello,
I'm currently porting a brand new custom board with Microchip's 64 MiB SAMA5D2 SiP SoC. Second stage bootloader is at91bootstrap, for development I load U- Boot directly to RAM with SAM-BA to the same address (0x23f00000) and execute from there. RAM base address is 0x20000000 and size 0x04000000 (64 MiB). Code is based on the U-Boot v2021.07 upstream code of the SAMA5D2-SOM1-EK1 board (which has 128 MiB).
I get to a U-Boot shell and can access SD card and LEDs if I do not activate NAND flash support in menuconfig. The log with debug messages is attached. From IRC marex and I suspect some overwritten memory if the u-boot-dtb.bin file gets too big, but I can not spot any error in those addresses in debug output.
The last function called is initr_malloc() from common/board_r.c but I can not spot what's wrong with that, especially because mem_malloc_init() prints a probably valid memory area and malloc_bin_reloc() should be a noop.
If I disable CONFIG_SYS_MALLOC_CLEAR_ON_INIT, I get to a shell, if I enable it again, boot hangs.
So the memset() of the malloc area, which is supposed to be valid to my knowledge, causes the hang.
I can try one of the other boards (there are 4 prototype boards) to rule out an hardware issue, but I'm curious if anyone has an idea what's wrong here?
Greets
Alex
initcall: 23f0e150
initcall: 23f3f3bc
initcall: 23f13460
initcall: 23f0e148
initcall: 23f0e3e4
initcall: 23f0e170
initcall: 23f026b8
initcall: 23f0e400
initcall: 23f0e3dc
initcall: 23f0e440
initcall: 23f028e8/�+��������͙�����5)���э�����͙ɑ���5)���э������͙��͉�5)���э�����͙ɍ���5)�pinctrl_atmel_pio4 pinctrl: set_state_simple op missing gpio_atmel_pio4 gpio@fc038000: set_state_simple op missing
at91-pmc pmc@f0014000: set_state_simple op missing
sam9x5-periph-clk periph32ck: set_state_simple op missing
periph-clk pioA_clk@18: set_state_simple op missingsimple_bus apb: set_state_simple op missingsimple_bus ahb: set_state_simple op missing
pinconfig uart1_default: set_state_simple op missing
periph-clk uart1_clk@25: set_state_simple op missing
sama5d4-h32mx-clk h32mxck: set_state_simple op missing
initcall: 23f405dc
U-Boot 2021.07-00051-g0d4c3b9c41-dirty (Jul 22 2021 - 18:23:53 +0200)
initcall: 23f0e2ac
U-Boot code: 23F00000 -> 23F5F940 BSS: -> 23F66714
initcall: 23f0e190
initcall: 23f026e8
CPU: SAMA5D27 512M bits DDR2 SDRAM
Serial number 0: 0x4c41354b
1: 0x17032030 Crystal frequency: 24 MHz CPU clock : 492 MHz Master clock : 164 MHz initcall: 23f0ea04 Model: *** initcall: 23f0e398 DRAM: initcall: 23f02934 vera2: dram_init: called initcall: 23f0e5e8 Monitor len: 00066714 Ram size: 04000000 Ram top: 24000000 initcall: 23f0e178 initcall: 23f0221c initcall: 23f0e408 initcall: 23f0e410 initcall: 23f0e244 Reserving 409k for U-Boot at: 23f89000 initcall: 23f0e4a0 Reserving 4352k for malloc() at: 23b49000 initcall: 23f0e448
Reserving 96 Bytes for Board Info at: 23b48fa0
initcall: 23f0e4d0
Reserving 248 Bytes for Global Data at: 23b48ea0
initcall: 23f0e1d8
Reserving 13216 Bytes for FDT at: 23b45b00
initcall: 23f0e418
initcall: 23f0e420
initcall: 23f0e438
initcall: 23f0e654
initcall: 23f0e198
initcall: 23f0e514
RAM Configuration:
Bank #0: 20000000 64 MiB
Bank #1: 0 0 Bytes
Bank #2: 0 0 Bytes
Bank #3: 0 0 Bytes
DRAM: 64 MiB
initcall: 23f0e670
initcall: 23f0e1bc
New Stack Pointer is: 23b45ae0
initcall: 23f0e34c
initcall: 23f0e428
initcall: 23f0e430
initcall: 23f0e2dc
Relocation Offset is: 00089000
Relocating to 23f89000, new gd at 23b48ea0, sp at 23b45ae0
initcall: 23f0e3f8
initcall: 23f97728
initcall: 23f97730
initcall: 23f0e920 (relocated to 23f97920)
initcall: 23f0e8d4 (relocated to 23f978d4)
initcall: 23f0e938 (relocated to 23f97938)
initcall: 23f0e88c (relocated to 23f9788c) Pre-reloc malloc() used 0x1024 bytes (4 KB)malloc_start: 23b49000
using memory 0x23b49000-0x23f89000 for malloc()
Hello,
for the record … see below.
Am Donnerstag, 22. Juli 2021, 19:01:36 CEST schrieb Alexander Dahl:
Quoted 20 lines
Hello,
I'm currently porting a brand new custom board with Microchip's 64 MiB SAMA5D2 SiP SoC. Second stage bootloader is at91bootstrap, for development I load U- Boot directly to RAM with SAM-BA to the same address (
0x23f00000) and execute from there. RAM base address is0x20000000and size0x04000000(64 MiB). Code is based on the U-Boot v2021.07 upstream code of the SAMA5D2-SOM1-EK1 board (which has 128 MiB).I get to a U-Boot shell and can access SD card and LEDs if I do not activate NAND flash support in menuconfig. The log with debug messages is attached. From IRC marex and I suspect some overwritten memory if the u-boot-dtb.bin file gets too big, but I can not spot any error in those addresses in debug output.
The last function called is
initr_malloc()fromcommon/board_r.cbut I can not spot what's wrong with that, especially becausemem_malloc_init()prints a probably valid memory area andmalloc_bin_reloc()should be a noop.
Quoted 8 lines
If I disable
CONFIG_SYS_MALLOC_CLEAR_ON_INIT, I get to a shell, if I enable it again, boot hangs.So the
memset()of the malloc area, which is supposed to be valid to my knowledge, causes the hang.I can try one of the other boards (there are 4 prototype boards) to rule out an hardware issue, but I'm curious if anyone has an idea what's wrong here?
Not sure what was the root cause of the issue, but I changed the initial load address to 0x21f00000 which is 1 MiB below half of the RAM (at offset 31 MiB of 64 MiB, instead of at offset 63 MiB). Now U-Boot works without hangs or hiccups.
So the change in at91bootstrap3 was:
-CONFIG_JUMP_ADDR="0x23f00000"
+CONFIG_JUMP_ADDR="0x21f00000"
and in U-Boot:
-CONFIG_SYS_TEXT_BASE=0x23f00000
+CONFIG_SYS_TEXT_BASE=0x21f00000
Greets
Alex