cancel
Showing results for 
Search instead for 
Did you mean: 

Generated binary file size in STM32L4

AP_040
Senior

Is there any specific address location in generated binary file so we can know the size of that binary file?

Using this, in the firmware to read the size of binary file from that location and use it in our application.

65 REPLIES 65

@Community member​ 

I am shocked that how the 3GB binary is generated?.

I suggest that please share your project to me so I can try to build it in my way then I will get back to with the result.

Hello @Community member​ 

Thank you for your suggestion.

The project is confidential and I cannot share it,

I should minimize the project and send you but I will take time.

Can you please explain your way?

Yacob Hassidim.

@Community member​ 

Can you please explain your way?

First send it to me then I will tried with 2 to 3 ways which I already suggest you after I will tell something to say.

Still it is very strange for me to 3GB binary.

.HEX files can be sparse, describing different memory regions, whereas .BIN must describe linear memory. If you have addresses that span 3GB the binary will be very large.

KEIL's tool will break into multiple binary sections.

You'd better understand what your linker script is generating​.

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

Hello @Community member​ 

After I will minimize the project, I will send you.

Thank you for your help and suggestions.

Yacob Hassidim.

Pavel A.
Evangelist III

@Community member​ 

The binary file is so large because you've chosen wrong start address (probably 0).

The start address of the flash is 0x08000000 and from there you need to copy the binary data.

If you start from 0, the size of course will be huge.

For manipulations on binary data, Python is very good and easy. No other linuxy stuff is needed on Windows.

And on Linux or Mac Python is great too.

-- pa

Hello @Pavel A.​ 

Thank you for your answer.

As I know the start address set in the linker file (*.ld) in the Flash region.

The Flash region started from 0x8000000.

I attached my linker file.

Can you please check if there is a wrong value?

Yacob Hassidim.

You're describing SDRAM, and not storing the content you initialize there in FLASH.

You will need to make it a NOLOAD/NOINIT type section,

Or use the >EXTRAM_REGION AT> FLASH

along with the code in startup.s to copy the data after you have brought up the external memory interface.

/* Memories definition */

MEMORY

{

  CCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 64K

  RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 192K

  FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 1024K

  EXTRAM_REGION (xrw) : ORIGIN = 0xD0000000, LENGTH = _Extram_Length /*CNT-32*/

}

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

Conservatively 0xD0000000-0x08000000 = 3,355,443,200

So you definitely have stuff being described in SDRAM that shouldn't be in the file at that location. When the device powers up the SDRAM will contain random junk, you need to unpack the content from FLASH.

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

Hello @Community member​ 

Thank you for your answer.

Can you please advise how I define The EXTRAM_REGION as NOLOAD/NOINIT type section?

Can you please explain what is mean "AT > FLASH"?

Yacob Hassidim.