2024-04-05 06:10 AM
Hi
I have an STM32L433CBT processor and created a project using STM32 IDE version 1.14. I created the project on STM32 MX version 6.9.1 . The project works in debug and I created a release version , but the elf file is far too large. I have the following running in the post build steps:
arm-none-eabi-objcopy -S -O binary "Project.elf" "Project.bin"
then use the bin file to program the chip out in the field. For some reason the elf file generated in release is 232KB, and the converted bin is 131,073KB. Compared to previous larger projects where the elf is size 176KB and converted bin is 68KB.
When I build the application I get the following in the console:
arm-none-eabi-gcc -o "Project.elf" @"objects.list" -mcpu=cortex-m4 -T"D:\Work\air\STM32\Project\STM32L433CBTX_FLASH.ld" --specs=nosys.specs -Wl,-Map="Project.map" -Wl,--gc-sections -static -u _printf_float --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -u _printf_float -Wl,--start-group -lc -lm -Wl,--end-group
Finished building target: Project.elf
arm-none-eabi-size Project.elf
arm-none-eabi-objdump -h -S Project.elf > "Project.list"
text data bss dec hex filename
57196 1190 14392 72778 11c4a Project.elf
Finished building: default.size.stdout
Finished building: Project.list
arm-none-eabi-objcopy -S -O binary "Project.elf" "Project.bin"
A previous project that works as expected, I get :
arm-none-eabi-gcc -o "Project2.elf" @"objects.list" -mcpu=cortex-m4 -T"../STM32L433VC_BM.ld" --specs=nosys.specs -Wl,-Map="Project2.map" -Wl,--gc-sections -static --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -u _printf_float -Wl,--start-group -lc -lm -Wl,--end-group
Finished building target: Project2.elf
arm-none-eabi-size Project2.elf
text data bss dec hex filename
68060 872 14104 83036 1445c Project2.elf
Finished building: default.size.stdout
arm-none-eabi-objdump -h -S Project2.elf > "Project2.list"
Finished building: Project2.list
arm-none-eabi-objcopy -S -O binary "Project2.elf" "Project2.bin"
Both projects have the same setup as below:
Preprocessor:
Link setup:
If someone can help, this would be great as I am stuck till I fix this issue.
Best Regards
Scott
Solved! Go to Solution.
2024-04-05 08:26 AM
You self reply, wrong way. Try use NOLOAD or other method.
memory - Understanding linker script NOLOAD sections in embedded software - Stack Overflow
2024-04-05 06:28 AM - edited 2024-04-05 06:28 AM
Do the files work?
Have you removed the Debug info, etc, from the ELF ?
Remember that an ELF can be "sparse", whereas a BIN must contain a value for every single byte within the range of the image.
2024-04-05 06:31 AM - edited 2024-04-05 06:33 AM
Try to compare .map files & get an idea whether all text sections grew bigger or the new toolchain added some new sections.
Or even better, just install the older toolchain into your new CubeIDE and call it done.
2024-04-05 06:52 AM
Hi
Thanks for the reply. What files are required to copy the older toolchain?
Many thanks
Scott
2024-04-05 06:55 AM
Hi
Thanks for your reply. Apart from the "DEBUG" in the PreProcessor tab within the compiler, how is this done?
Many thanks
Scott
2024-04-05 07:08 AM
Ok, but what's the actual issue?
That you don't know what's in the file, or what causes it to get bigger?
The .MAP file should let you know what's going into the file.
Object files contain a lot of information that doesn't go onto the chip itself. Perhaps review with objdump ?
2024-04-05 07:16 AM
Hi
Thanks for your reply. In previous projects I use the the command:
arm-none-eabi-objcopy -S -O binary "Project.elf" "Project.bin"
to create the binary to go into the chip , but this time the bin file size is converted bin is 131,073KB , too big for the chip.
Regards
Scott
2024-04-05 07:33 AM
2024-04-05 07:39 AM
Hi Andrew
Yes, older projects have been around 68K, see below directory.
2024-04-05 07:44 AM
Ok, so if it is 131MB, it suggests you've got it initializing very distant memory areas, not just 0x08000000 + 128KB to 256KB
Is it describing 0x20000000 or 0x90000000 ? These would tend to approach GB binaries, and the sections would need to be extracted individually, not as a single monolithic image.
DUMP the SECTIONS in the object file.
REVIEW the LINKER SCRIPT, where's it putting things?
UNDERSTAND what getting into the file