Hi,
I created a bin file for a project containing code for ADC by selecting Project properties -> C++ build -> settings -> GNU ARM Cross Create Flash image -> General ->output file format -> Raw binary. The created bin file was of 1 Gb size as shown in the image attached. Is there any way to reduce that size?
It is the .id_code_1 section that is causing the large size of the binary file. The code flash starts at 0x0, and the .id_code_1 section is located at address 0x40120050 :-
.id_code_1 0x40120050 0x10
With a bin, the linker is going to have to put in 0x00 or 0xff to put the sections where you placed them. Look at the .map file to see where they are going. You may have a large code or ram section you've specified. Reduce the sizes of each section if you can will also help.
Did you ask the linker to fill unused flash with a pattern using =fill? That could do it as well.
Post your .ld also.
It could be caused by the ID_CODE section, or maybe you have constant data in the Data Flash section.
I checked section : - j .text and section : -j . data checkbox . after that , the bin file has gone down to 22 KB .But don't know what it does. can u share any document or details regarding the project settings that are available in e2 studio? Thanks.
All you are doing with those options is only copying the .text and .data sections from the elf object into the binary file (https://sourceware.org/binutils/docs/binutils/objcopy.html)
You need to look at the .map file that is output from the linker to work out the sections that are causing the binary file to be so large.