Reputation: 233
I'm new to embedded linux and I am trying to boot linux on stm32h7 with only internal flash and ram.
FLASH SIZE = 2MByte
RAM SIZE = 1MByte
I have downloaded the mainline linux kernel and I configured the kernel with stm32_def config and then customized it and I removed the unnecessary drivers from it. and I configured it to boot from flash (XIP).
I have a custom board and it does not have any external ram or flash but it is similar to stm32h743i_discovery board. so, I'm using the stm32h743i_disco device tree.
my output xipImage size is about 1.4MByte and I wrote a boot loader for it.
I merged the binaries together like this:
loader at offset: 0x08000000
device tree blob (dtb) at offset: 0x08000F00
xipImage at offset: 0x08008000
my loader program:
LDR R1, =0x0FFFFFFFF
LDR R2, =0x08000F00
LDR PC, =0x08008000
r1 is machine type and when I have dt, I should set it to 0x0ffffffff. and r2 is the address of dtb in the internal flash storage. and then I set the program counter register (PC) to the xipImage start address. and when I watch it in the debugger, when the linux wants to start booting, after a few moments, the PC (program counter) becomes 0x0 and the cpu goes to hardfault interrupt handler.
Note: I have a stlink v2 programmer/debugger.
this is my cpu registers when it crashes.
Upvotes: 1
Views: 1032
Reputation: 233
as dear @P__J__ mentioned in the first comment, it was a RAM problem! 1MB wasn't enough. And this 1MB was not linear. So, I config the external 8MB onboard dram.
Upvotes: 1