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

Beware of GNU-ARM compiler for Cortex-M0/M0+/M1

The popular GNU-ARM toolset has had long-known issues for the Cortex-M0/M0+/M1 (ARMv6-M architecture). Specifically, people have reported very inefficient code generated, see "Cortex M0/M0+/M1/M23 BAD Optimisation in GCC" https://embdev.net/topic/426508 . 

But while so far people reported only inefficient code, I would like to make people aware of *incorrect* code generated by GNU-ARM for Cortex-M0/M0+. 

The issue was detected with interrupt disabling and has been documented in a bug report for the QP framework, see https://sourceforge.net/p/qpc/bugs/184/. The experiments performed with the latest available GUN-ARM (GNU Tools for ARM Embedded Processors 6-2017-q2-update, 6.3.1 20170620 release) clearly show incorrect code generated at optimization level -O, while the same code compiled at -O2 level seemed to be correct. 

Please be careful with GNU-ARM for ARMv6-M architecture and preferably avoid using it for these CPUs as long as the issue remains unresolved. 

Miro Samek 
state-machine.com 
Parents
  • Hi Miro,

    We are aware of this sub-optimal code generation issue for M0 etc. It is on our list of things to fix. Rest assured we will get to it in the near future. In the meantime, the code generated for M3 looks like T1 code and mostly valid for M0. You could compile this code snippet for M3 and link for an M0 target if you wanted a work-around.

    Thanks,
    Tejas.

Reply
  • Hi Miro,

    We are aware of this sub-optimal code generation issue for M0 etc. It is on our list of things to fix. Rest assured we will get to it in the near future. In the meantime, the code generated for M3 looks like T1 code and mostly valid for M0. You could compile this code snippet for M3 and link for an M0 target if you wanted a work-around.

    Thanks,
    Tejas.

Children
No data