Hi All,
For STM32f0 board we are using ARM compiler 6.6. I have few doubts regarding the bin size and linker files.
1. Why is it generating a big bin file (almost 400MB) (using arm-none-eabi-objcopy to convert *.axf file to *.bin)? Is there any issue with my scatter file?
Below is the scatter file content I'm using
LR_IROM1 0x08000000 0x40000 { ; load region size_region ER_RO +0 { ; load address = execution address *.o (RESET, +First) *(InRoot$$Sections) .ANY (+TEXT) }
ER_RW 0x20000000 0x00008000 { ; RW data .ANY (+DATA) }
ER_ZI +0 { .ANY (+BSS) }
ER_FS 0x0803FC00 FIXED 0x400 { flashSignatures_zero.o (+CONST) }}
2. I tried to use GNU linker script (*.ld) instead of scatter file but the *.axf file is too small when I compared it with the scatter file generated *.axf.
Link shows that armlink takes the scatter file as input, not the *.ld file.
Is that my understanding correct? If No then how to use the *.ld file instead of scatter file.
Thanks & Regards,
Bhargavi Ale
Hi there, I have moved your question to the Compilers and Libraries forum. Many thanks.
I see that the last execution region is defined as being at a FIXED address, meaning its load and execution addresses are the same.
ER_FS 0x0803FC00 FIXED 0x400 { flashSignatures_zero.o (+CONST)}
You state the binary is ~400MB, which I suspect is all the way up to the ER_RW region at 0x20000000.
Does reordering to move ER_FS above the ER_RW region fix the issue?Alternatively, you could place ER_FS in its own separate LOAD region.
You mention that you are using objcopy to convert to binary.The Arm tools provide fromelf to perform the same. Does the same issue occur if you use fromelf?https://developer.arm.com/documentation/101754/0617/fromelf-Reference
Hi Ronan,
Thank Ronan...
Apologize for late reply.
The issue of big bin size is solved after using fromelf instead of objcopy. But I'm getting bin size of 256KB which is the size of flash. The bin size depends on how much memory we are using, right?.
I'm not sure why 256KB.
This makes sense - in the first line of the scatter file you define the 'load region' LR_IROM1 to be 0x40000 (256K) bytes in size.
To explain the structure of the scatter file briefly, the load regions define where code/data reside at reset (usually in the flash). Therein, you define execution regions defining where these are located at main(). This may be the same address (for example your ER_RO region, which has a load and execution address starting at 0x08000000 - such a region is known as a 'root region'), or could be relocated to RAM/TCM for faster execution, or for global data, stack/heap, etc, such as your ER_RW region, which is at 0x20000000, presumably where SRAM is located on your device.