2024-05-14 06:56 AM
Hi there,
I developed a custom bootloader for a STM32H755 MCU.
I successfully tested my bootloader on a NUCLEO H755 board (with small projects), and all seems ok.
Moving on my final board, with the actual Firmware to be downloaded I'm experiencing an unexpected behavior:
the .elf files contains also a memory addresses located in the SRAM4 (D3 domain), which cause a flashing error.
As you can see below, RAM addresses are _all_ written to 0x00 (I verified with cube programmer).
I actually located some memory section in this SRAM bank, to exchange data between cores but I would like to avoid that such addresses appears into the executable.
What can cause this behavior?
I already tried with the MPU configuration and with the linker script, but no way!
How can I avoid this?
Thank you in advance for your support!
Solved! Go to Solution.
2024-05-14 09:46 AM
Will need to fix the linker script (.LD) or the startup.s code
To initialize SRAM4 content you'd need to stage it in FLASH, and copy it into RAM. You can't have the section backed by data within the .ELF, need it to be NOBITS, not BITS
Could designate it (NOLOAD) in the linker script if you're just allocating space, not filling with content.
Can inspect file with OBJCOPY or OBJDUMP type tools
2024-05-14 09:46 AM
Will need to fix the linker script (.LD) or the startup.s code
To initialize SRAM4 content you'd need to stage it in FLASH, and copy it into RAM. You can't have the section backed by data within the .ELF, need it to be NOBITS, not BITS
Could designate it (NOLOAD) in the linker script if you're just allocating space, not filling with content.
Can inspect file with OBJCOPY or OBJDUMP type tools
2024-05-21 08:39 AM
Hi @Tesla DeLorean ,
thanks for your suggestion!
Defining sections I'm locating, actually fix my issue!
Just for my comprehension:
1) Why other sections such like .sbb or .data whitch are not "NOLOAD" dosn't give the same issue? What different with my custom section?
2) What if I define an initialized variable in a "NOLOAD" section? Its initialization will be skipped?
/*
** Note: .MY_SEC section is defined as (NOLOAD)
*/
uint32_t __attribute__((section(".MY_SEC"))) uiMyVar = 10U;
In the meantime, thanks for your support!