How to shrink compiled image size?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
DiDi_4439146
Level 3
Level 3
First solution authored 10 sign-ins 10 replies posted

Hi, I am already using ARM GCC and -O3, but I need my image to get even smaller to fit on EEPROM. My max file size is 118,528 bytes, and I'm slightly over that.

Is there anything I can strip out of the libraries? Please advise.

0 Likes
1 Solution
JayakrishnaT_76
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hello,

Please refer to the following KBA to understand the ways that we recommend to reduce the image size:

https://community.infineon.com/t5/Knowledge-Base-Articles/Optimizing-Code-Size-in-FX3-SDK-KBA230335/...

We do not have any other recommendations other than the ones recommended in the KBA. Also, please ensure that sufficient tests are done after optimizing the size of the image.

Best Regards,
Jayakrishna

View solution in original post

0 Likes
3 Replies
JayakrishnaT_76
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hello,

Please refer to the following KBA to understand the ways that we recommend to reduce the image size:

https://community.infineon.com/t5/Knowledge-Base-Articles/Optimizing-Code-Size-in-FX3-SDK-KBA230335/...

We do not have any other recommendations other than the ones recommended in the KBA. Also, please ensure that sufficient tests are done after optimizing the size of the image.

Best Regards,
Jayakrishna
0 Likes

I'm already doing all of those optimizations, my image still needs to get smaller. There are no other tips?

 

When I try to use the command from the page you linked I get an error:
C:\Users\didi>arm-none-eabi-nm --print-size -sort-size --radix=d "fw.img"
arm-none-eabi-nm: -size: invalid radix

0 Likes

Hello,

I hope you are building the project in Release mode. If yes, then we do not have any other suggestion.

Regarding the error, please try using the following command and let me know if you still face any errors:

arm-none-eabi-nm --print-size --size-sort --radix=d “path of elf file”
It should be the name of elf file or the path of elf file and not the image file. Also, there are 2 "--" before "size-sort". The KBA shows only 1 "-" before "size-sort". We will correct this in the upcoming revision of the KBA. Please test and let me know if you still face any issues.

Best Regards,
Jayakrishna
0 Likes