Too many binary changes with two byte varying in the source code. Why?

Hello,

I'm having a problem compiling my project with Keil 5.29 on microcontroller STM32H753

By simply changing the project version from 3.39 to 3.40 (defined as the union of two defines: define 0x03 and define 0x39 / 0x40), the compile result, comparing the 3.39 binary with the 3.40 binary, is different not only where the version reference is made but also in certain places where there are portions of code not related to the project version.

This behavior doesn't occur with every version increase, and I can't figure out why. Could you help me?

Compiler used on Keil is the "default compiler version 5"

Thanks!

Ivan.

Parents
  • In a nutshell, you're probably underestimating the capabilities of your compiler to optimize the generate code.  By quite a bit. E.g. a number like 0x40, with just a single bit set, might be constructed into a CPU register in ways you never thought of. 

    If you're still convinced you need to know, you'll have to look deeper than just the code size.  Inspect the actual machine code instead,e.g. in a disassembly view of your debugger.  

Reply
  • In a nutshell, you're probably underestimating the capabilities of your compiler to optimize the generate code.  By quite a bit. E.g. a number like 0x40, with just a single bit set, might be constructed into a CPU register in ways you never thought of. 

    If you're still convinced you need to know, you'll have to look deeper than just the code size.  Inspect the actual machine code instead,e.g. in a disassembly view of your debugger.  

Children