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
Big Binary
Moderators: RoccoMarco, barthess
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: Big Binary
Hi,
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.
Giovanni
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.
Giovanni
Re: Big Binary
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)....
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
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.
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.
Who is online
Users browsing this forum: No registered users and 17 guests