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
  • I agree with Broeker, if you are using a constant somewhere in your code.

    How I can disable any possible optimization?

    If you disable the optimization by setting the optimization to 0, you will get a completely different binary image, the timing of your application will be different, and the code and data size will be significantly higher. You probably don't want to do that. For example, if you define the version number of your application as an initialization value of a global const structure, the chances are much lower that some code changes. 

Reply
  • I agree with Broeker, if you are using a constant somewhere in your code.

    How I can disable any possible optimization?

    If you disable the optimization by setting the optimization to 0, you will get a completely different binary image, the timing of your application will be different, and the code and data size will be significantly higher. You probably don't want to do that. For example, if you define the version number of your application as an initialization value of a global const structure, the chances are much lower that some code changes. 

Children
No data