cancel
Showing results for 
Search instead for 
Did you mean: 

Split .BIN in multiple regions

MMerc.1
Senior

Hi,

I want to split the .BIN file because it is too big... Here is the size of the files :

  • .BIN size : 2.13 Go
  • .HEX size : 30.5 Mo
  • .ELF size : 11.4 Mo

Here is the memory used :

0693W000006EImtQAG.pngI am using an USB flash drive to update my system program. I know I need to split .BIN file into multiple files which can describe multiple regions. I can use FromELF to do this but I don't know how to use it...

Could you help me ?

6 REPLIES 6

Seem to recall FromELF being able to output command line help.

Might also want to just read the ELF specs, and have the update code walk that, the thing isn't that complex if you just want to fish out the code/data sections. It provides addresses and sizes, and you don't need to get into the symbols or entry points.​

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

Hi,

I used the example of "STM32Cube_FW_F7_V1.16.0\Projects\STM32756G_EVAL\Applications\USB_Host\FWupgrade_Standalone" (you can see my other post).

First of all, I want to update only the FLASH/RAM section. Then, if the FLASH/RAM works, I will try to update the QSPI section.

How can I use FromELF to separate this two sections ?

I think the default behaviour of --bin is the split the binaries as outputting 2GB of empty space is stupid. Not sure you get to be selective. Something like objcopy might provide more options, but the file structure at the section level is relatively simple.

Product: MDK-ARM Lite 5.28
Component: ARM Compiler 5.06 update 6 (build 750)
Tool: fromelf [4d35e3]
 
ARM image conversion utility
fromelf [options] input_file
 
Options:
       --help         display this help screen
       --vsn          display version information
       --output file  the output file. (defaults to stdout for -text format)
       --nodebug      do not put debug areas in the output image
       --nolinkview   do not put sections in the output image
 
Binary Output Formats:
       --bin          Plain Binary
       --m32          Motorola 32 bit Hex
       --i32          Intel 32 bit Hex
       --vhx          Byte Oriented Hex format
 
       --base addr    Optionally set base address for m32,i32
 
Output Formats Requiring Debug Information
       --fieldoffsets Assembly Language Description of Structures/Classes
       --expandarrays Arrays inside and outside structures are expanded
 
Other Output Formats:
       --elf         ELF
       --text        Text Information
 
                Flags for Text Information
                -v          verbose
                -a          print data addresses (For images built with debug)
                -c          disassemble code
                -d          print contents of data section
                -e          print exception tables
                -g          print debug tables
                -r          print relocation information
                -s          print symbol table
                -t          print string table
                -y          print dynamic segment contents
                -z          print code and data size information

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

I used this 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

Size of file "ExtFlash.bin" : 10.3 Mo (good)

Size of file "STM32F746.bin" : 2.13 Go (not good)

I want only the FLASH section...

PFlor.2
Senior

Did you ever figure this out? I'm trying to do the same thing and like you mention I can separate out the external flash part fine but then application is left with the 2GB of 0's.

Thanks

I don't know if this will fix your issue, but I was able to separate the internal and external successfully without a 2GB large internal file. It was using a command similar to @MMerc.1 .At least with my project, I had an additional section in my external flash "FontFlashSection", so that section needed to be removed from the internal flash file and added to the external flash section. If I neglect to do this, I get the 2GB size internal flash size bin file.

 

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