Arm-Embedded-GCC Toolchain - Difference Version 7 and 9

301 views Asked by At

We use the ARM Embedded Toolchain based on GCC for our Cortex-M3 projects (arm-none-eabi maintained by ARM).

We lately upgraded from 7.2.1 to 9.3.1 in a project that uses GNU11 and GNU++14 and the newlib-nano (nano.specs) and the optimization level is set to Og.

We face some strange behavior that suddenly just at random one GPIO wont turn on/off anymore, this does not happen if we use 7.2.1. When stepping though the program to check why it wont turn toggle anylonger, all the commands are executed properly: initialization, and then writing a value to GPIO. Also noticable is, that if we change the optimization level to any other level (O0, 01, 02, 0s) it works again, seems that Og with 9.3.1 breaks something.

Then we went ahead and started searching which code section we must exclude from optimization (which function or which instruction) so it becomes runnable again. There we did not find a solution as its not one function call. At random by narrowing down, just by disabling optimization for a random function which has nothing to do with accessing GPIO, it works again.

Currently we have no idea how to proceed further in this matter, to find the root cause of this behavior.

Questions:

  • What did change between 7.2.1 and 9.3.1 when it comes to Gnu11/Gnu++14, the newlib-nano and Optimization for Debug (Og)?
  • How can this be explained that the older version seems to produce a runnable binary where the newer one causes issues?
  • How can you explain, why only Og causes trouble, but all other optimization levels seem to work just fine?

Any hint/input highly appreciated.

0

There are 0 answers