Hello,
Can you help me on how to reduce the generated .elf file size without changing the model?
What is the content of the .elf file?
Also I am curious why the project built in S32 Design studio presents the software size metrics different from the generated .elf file as shown below:
BaseMotorControl_DEV:
_____________________________________________________________________________________
Copy_of_BaseMotorControl_DEV:
________________________________________________________________________________________
Copy_2_of_BaseMotorControl_DEV:
Finally, which size shall be considered as the limitation when flashing the file into the microcontroller flash memory?
Kind Regards, Rafael
Solved! Go to Solution.
Hi Rafael,
Can you help me on how to reduce the generated .elf file size without changing the model?
You can reduce the elf size in 2 different modes:
What is the content of the .elf file?
ELF is just a container. The Bootloader do not use all the information from this file. For the application to work on the MCU all you need are specific sections of .text, .data, .bss
A very good explanation of the elf file can be found here: Executable and Linkable Format - Wikipedia
NXP is offering elf dump tools that allows you to parse the elf and see exactly what is inside. You can find this tools inside the ..\\tools\S32DS\build_tools\powerpc-eabivle-4_9\bin\ of your MBDT installation.
As you can see, almost half of the sections are related with debug information. These sections are NOT flashed into the MCU memory. They exist only in the elf and ONLY an IDE/Debugger running on the host PC can access such information.
Look for A flag. Only the sections that have A-allocation flag will be written to the target.
Also I am curious why the project built in S32 Design studio presents the software size metrics different from the generated .elf file as shown below:
The number reported by the ELF powerpc-eabivle-size resports only for .text, .data and .bss sections. The number returned is expressed in number of bytes/octets.
The number reported by the S32DS is for the entire file (will all the sections)
In Windows OS, the size = size on disk which is different than the file actual size.
Finally, which size shall be considered as the limitation when flashing the file into the microcontroller flash memory?
Assuming you want to flash the application permanently into the MCU, then you need to consider the .text and .data size.
BUT, it also depends on other key sections that might be added in the linker by the user. Anyone can define an allocate sections in the ELF. Hence is hard to pinpoint which section is limiting factor. I would say: compute the size of all sections that have the A flag and make sure the total size is smaller than the flash memory.
Hope this helps!
Daniel
Hi Rafael,
Can you help me on how to reduce the generated .elf file size without changing the model?
You can reduce the elf size in 2 different modes:
What is the content of the .elf file?
ELF is just a container. The Bootloader do not use all the information from this file. For the application to work on the MCU all you need are specific sections of .text, .data, .bss
A very good explanation of the elf file can be found here: Executable and Linkable Format - Wikipedia
NXP is offering elf dump tools that allows you to parse the elf and see exactly what is inside. You can find this tools inside the ..\\tools\S32DS\build_tools\powerpc-eabivle-4_9\bin\ of your MBDT installation.
As you can see, almost half of the sections are related with debug information. These sections are NOT flashed into the MCU memory. They exist only in the elf and ONLY an IDE/Debugger running on the host PC can access such information.
Look for A flag. Only the sections that have A-allocation flag will be written to the target.
Also I am curious why the project built in S32 Design studio presents the software size metrics different from the generated .elf file as shown below:
The number reported by the ELF powerpc-eabivle-size resports only for .text, .data and .bss sections. The number returned is expressed in number of bytes/octets.
The number reported by the S32DS is for the entire file (will all the sections)
In Windows OS, the size = size on disk which is different than the file actual size.
Finally, which size shall be considered as the limitation when flashing the file into the microcontroller flash memory?
Assuming you want to flash the application permanently into the MCU, then you need to consider the .text and .data size.
BUT, it also depends on other key sections that might be added in the linker by the user. Anyone can define an allocate sections in the ELF. Hence is hard to pinpoint which section is limiting factor. I would say: compute the size of all sections that have the A flag and make sure the total size is smaller than the flash memory.
Hope this helps!
Daniel