cancel
Showing results for 
Search instead for 
Did you mean: 

Generated Binary file size is too large(~2.3GB)

Nikunj Patel
Associate III

Hello Community,

  1. I am working with "STM32F746G-DISCO" Board, "STM32CubeMX", "STM32CubeIDE", and "TouchGFX Designer" .
  2. I would like to program GRAPHICS Data in to "QUADSPI Flash".
  3. When i compile firmware in "DEBUG" mode,
    1. ".bin" file size = 2.3GB
    2. ".elf " file size = 5.5MB,
    3. But, It works fine for me. GRAPHICS Data are program in QUAD SPI Flash.
  4. When i compile firmware in "Release" mode.
    1. ".bin" file size = 2.3GB
    2. ".hex" file size = 3.3MB.
  5. I made below modification in "Linker Script" file to store data in "QUAD SPI FLASH"
    1. QUADSPI (rx)  : ORIGIN = 0x90000000, LENGTH = 16M

 ExtFlashSection :

 {

*(ExtFlashSection ExtFlashSection.*)

*(.gnu.linkonce.r.*)

  . = ALIGN(0x4);

 } >QUADSPI

6. Here, I also attached liker script file.

7. Is there any configuration missed by me or make some wrong implementation.

8. I required ".bin" file in "STLINK" utility while program the external flash because In STLink select the "External Loader" >>"N25Q128A_STM32F746G_DISCO">>"Program".

9. It opens the "Download" window.

10. It display "start address" as "0x08000000" and that "text box" is disabled when i choose the ".hex" file

11. When i choose the ".bin" binary file that "textbox" is enable. But Binary file size is too large(~2.3GB).

Can you please suggest me how can i reduce the binary file size.

My aim is to program the GRAPHICS Data in to External Flash(QUAD SPI FLASH)

Regards,

Nikunj Patel

16 REPLIES 16

@Nawres GHARBI​  can the .DFU be uses as a multi-sectional containing object, like .ELF/.AXF, for programming modes other than USB/DFU in STM32 Cube Programmer?

@Community member​  look at the command line options on objcopy or srecords to break into multiple binaries. ST typically distributes the demos as .HEX files, which can describe multiple regions. The .HEX will likely be 2.5x the size of the minimum binary, but it only this large on the hard-drive, the data is programmed in a binary fashion across the JTAG/SWD interface. So won't be materially faster or slower than any other method.

The in-built system loader can only handle DFU files describing internal FLASH, if you build your own DFU device, it can handle external memories.

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​ 

Thanks for great support.

As you suggested i have used the following command to split binaries in multiple section,

Here is below command.

arm-none-eabi-objcopy.exe -O binary --only-section=ExtFlashSection "${BuildArtifactFileBaseName}.elf" ExtFlash.bin;arm-none-eabi-objcopy.exe -O binary --remove-section=ExtFlashSection "${BuildArtifactFileBaseName}.elf" STM32F746.bin

Use Above command in

Project >> Properties >> c/c++ build >> Setting >> Build Steps >> Post-Build Steps >> Command.

Regards,

Nikunj Patel

陈宽.1
Associate

I have the same problem. I don't know how to solve it.

Don't use .BIN for SPARSE memory maps. Use .HEX, or split the binary sections. Tools like FromELF split it 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..

Hi @Community member​ , Good Morning

Thank you for posting this information and it worked for me.

As you mentioned i am able to generate the ExtFlash.bin file of TouchGFX assets.

As per my project requirement need two bin files, one is ExtFlash.bin which is generated 

as per your input but can you help me to generate the Application bin file of the project.

Thank You,

Warm Regards,

Ahmed Raza K. Mulla

if I include sections FontFlashSection and TextFlashSection (placing fonts and text into external flash), the size of the binary becomes big again. I wrote a command-line program in c# that will separate the binary into 2 files based on the address in this case hex 90000000 and that works but I would like to use the steps mentioned above. were you able to get the post-build script to work with FontFlashSection and TextFlashSection sections included in the linker?

i was able to solve it by:

arm-none-eabi-objcopy.exe -O binary --only-section=FontFlashSection --only-section=TextFlashSection --only-section=ExtFlashSection "${BuildArtifactFileBaseName}.elf" ExtFlash.bin;arm-none-eabi-objcopy.exe -O binary --remove-section=ExtFlashSection --remove-section=FontFlashSection --remove-section=TextFlashSection "${BuildArtifactFileBaseName}.elf" STM32F767.bin