Big Binary

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderators: barthess, RoccoMarco

Posts: 453
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 1 time
Been thanked: 13 times

Big Binary

Postby Tabulous » Fri Feb 08, 2019 1:19 pm

Does anyone have any ideas on how i can produce a binary output that fills the full flash area.

i need this to test a bootloader and ensure it can write the full flash image correctly.

currently my test app image is 100KB but the need to test images upto 448KB in size

User avatar
Site Admin
Posts: 11649
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 488 times
Been thanked: 409 times

Re: Big Binary

Postby Giovanni » Fri Feb 08, 2019 2:35 pm


In the linker script, advance the "." pointer up to the top location then put a word there using linker, all the space in between should be filled.


Posts: 248
Joined: Sat Jul 19, 2014 12:59 pm
Been thanked: 5 times

Re: Big Binary

Postby rew » Sun Feb 24, 2019 10:19 pm

Or define a static array:

static char dummy[DUMMY_SIZE] = { 1,2,3, };

Assigning the first few values means the array has to be initialized, I expect the compiler to do this in a "dumb" fashion, i.e. allocate an area as large as the dummy variable and fill it with the full initial value (i.e. three nonzero bytes followed by a bunch of zeroes)....

Posts: 2
Joined: Tue Mar 05, 2019 3:00 pm

Re: Big Binary

Postby mike_james » Tue Mar 05, 2019 3:20 pm

There is also the use of arm-none-eabi-objcopy to create a .elf file out of a .bin

For instance : where I wanted to append a CRC to a linked binary .elf file

The CRC program wrote a 2 byte binary file prog_crc.bin based on the CRC of a part of the binary file using the linker map to locate where to process the data. It could have been any amount of data.

This then was objcopy(ed) and assigned to the .crc_data section. An appropriate linker script then added it to the end of the fully linked .elf output file.

arm-none-eabi-objcopy --input-target=binary --output-target=elf32-littlearm --binary-architecture=arm --rename-section .data=.crc_data,alloc,load,readonly,data,contents prog_crc.bin prog_crc.elf

Simply create a binary file big enough, convert to ELF with objcopy and then link.

I have used this technique to convert audio samples into linkable files, which by using linker sections and linker defines end up with symbol names that can be referenced in C source code.

Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 7 guests