cancel
Showing results for 
Search instead for 
Did you mean: 

IDE generated elf file, unexpected behavior

iTTy
Associate III

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).

iTTy_0-1715694543737.png

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!

1 ACCEPTED SOLUTION

Accepted Solutions

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

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

2 REPLIES 2

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

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

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!