CrossWorks for ARM slow?

Intro

We are using the CrossWorks IDE with bundled GCC compiler on my work as company’s standard embedded systems project tool. Nobody had noticed any issues with it until we were working on a project with “slightly higher” demands on waking up time from the sleep mode.

System I mentioned was a STM32L4 (ARM Cortex-M4 core) based solution with the piezo switch as one of the wakeup sources. The button is attached to one of the sensor lines and triggers interrupts when a user presses it. Necessity of speeding up wake up time come due to several reasons:

  • our piezo switch asserts MCU’s sensor line only for 100-200 ms when a user presses it in a effortles way without a goal to squeeze it out. If a mechanical button was used, we would not even notice any issues with our app. All mech buttons I have worked with assert a line for more than 500 ms
  • piezo button circuit did not include any debounce protection (the reason is not so important now). Due to that there were some spurious wakeups that have to be caught by the app

How we found that issue and overcome it with simple changes in CrossWorks’ CRT (C Runtime) implementation of the standard library I will describe below.

That may be especially interesting for ones who uses the following products:

  • CrossWorks for ARM (most likely all ARM Cortex-M MCUs will be affected by that)
  • Segger Embedded Studio (SES)
More …