cancel
Showing results for 
Search instead for 
Did you mean: 

Data located in BKPRAM causes .bin Build output to jump in size.

paulcatherall9
Associate II

Hi I am using STM32CUBEIDE 

I can read and write to BKPRAM this all works STM32F407.

I have Modified Linker Script to include a BKRAM area 4k, however I have a situation I cannot understand whereby my Build output file .bin changes size dramatically when I locate data in this area. during compilation.

My USB Bootloader uses a .bin file so this is a problem due to the massive file, the extra size is basically just padded with zero's when I examine the file.

The .hex file increase a small amount.

File Size with Structure located in RAM

Output .bin 165,676 bytes

Output.hex 466,084 bytes

File Size with same Structure located in BKPRAM area

Output .bin 939,624,408 bytes 

Output.hex 471,755 bytes

The Build analyser show what looks like the correct amount of BKRAM 4K limit used.

Any ideas ?

Thanks

3 REPLIES 3

Exclude them from the .bin, see NOLOAD keyword; or in the postprocessing, when using objcopy, using -R switch (IIRC).

JW

paulcatherall9
Associate II

Jan, many thanks, that appears to have done the trick :-

Snippet for anyone else that's had the same issue.

BKRAM (rw) : ORIGIN = 0x40024000, LENGTH = 4K

 .backup (NOLOAD) :

 {

  . = ALIGN(4);

  *(.backup);

  *(.backup*);

  . = ALIGN(4);

  } >BKRAM  

.HEX can describe sparse memory, .BIN can't

Some tools can separate different sections into multiple binaries

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