Hi,
I'm using LPC4078 with MCUXPresso.
By default, the file size of .bin is smaller than flash size, but I wanted to enlarge file size to 0x80000 (Whole flash), and locate 4-bytes data at 0x7fffc.
Is it possible?
Hi All,
Thank you guys for the answers, it helps a lot.
However, I have not solved the issue to be cleared.
What I wanted to is, put 4 bytes data at very end of bin file, regardless file size.
I did tried # pragma directive like:
#pragma address data_on_eof = 0x2f000
ULONG data_on_eof = 0x0000E1F1;
Note: Current file size is 179,356 bytes (0x2bc9c)
But line "#pragma" was ignored by gcc, and
.data.data_on_eof
0x10000000 0x4 ./src/test/test.o
0x10000000 data_on_eof
Is there any way to locate "data_on_eof" at the very end of .bin file anyway?
Regards,
Binary files are not intended for that purpose. They contain no meta information, just plain machine code. Here is a good explanation:https://software-dl.ti.com/ccs/esd/documents/sdto_cgt_an_introduction_to_binary_files.html
Your best option, as suggested, would be to switch to a format containing meta data, namely addresses. Like S19/S-Record, or Intel HEX. This is usually done in the linker settings of your project.
As the given link explains, you can always create a bin file from a S19/HEX file with the objcopy command.
Hi XiangJun Rong
Thank you for your reply.
Right after I posted this question, I was realized that the .bin file is not a flash image, and my question was so stupid...
Anyway, I'll check S-Record as you recommended to, but it is appreciated if you have some information about S-Record.
Thanx.
Hi,
For the S-Record file format, pls refer to the docs:
http://www.amelek.gda.pl/avr/uisp/srecord.htm
https://en.wikipedia.org/wiki/SREC_(file_format)
Hope it can help you
BR
XiangJun Rong
Hi XiangJun,
Thanks a lot!
Regards,
Hi,Atsuki,
As you know that the *.bin file only contains binary code and data, which does not contain any address, if you want to enlarge the data to 0x8_0000, you have to fill all the hole with data until it reach to 0x8_0000 address.
I suggest you generates S-Record file, which has address information, so you are not required to fill the empty address.
Hope it can help you
BR
XiangJun Rong
> As you know that the *.bin file only contains binary code and data, which does not contain any address, if you want to enlarge the data to 0x8_0000, you have to fill all the hole with data until it reach to 0x8_0000 address.
This should not be necessary.
If one defines variables/data at given addresses, the linker will place it there, and the BIN file will automatically fill up all the gaps.
This is why the question is usually the other way around : "Why is my BIN file so big ?"
The GCC toolchain uses the __attribute__ specifier to modify such features. Check the tutorial for details.
Hi Frank,
Thank you for your reply.
I understand and will check more based on your information.
Thanks a lot!
I never tried that with the MCUXpresso toolchain. You might need to to create a special linker section.
The syntax is very toolchain specific, and I did the same thing for the IAR and Keil enviroments a while ago, which use different compilers.