This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Embedded C++ project code size

Hi, 

We are working on STM32G070 micro-controller. Our code size is approximately 75KB. We are using Embedded C++ language, Keil uvision version 5 with code optimization level 2.

We were trying to reduce the code size and we observed some strange things during compilation as below.

1. If I remove one function call from a function, the code size is increased by over 100 Bytes.

Expected: Removing one function call inside a function shall reduce the code size. 

2. if we add a function call, code size is increased by over 100 bytes.

Expected: Code size shall be increased by maximum 10-20 bytes only as this function call was already made earlier from other functions in same file.

Do you know the reason for the above strange behavior? 

Parents
  • Why guess?  Use tools that examine the binary (objdump, nm, etc), and/or the output from the various build steps (linker map, assembly listing) and figure out exactly where the extra space is going.

Reply
  • Why guess?  Use tools that examine the binary (objdump, nm, etc), and/or the output from the various build steps (linker map, assembly listing) and figure out exactly where the extra space is going.

Children
No data