ARM Cortex-M Broken Binaries with -O2 and -O3 (-fschedule-insns)

Iain Buclaw via D.gnu d.gnu at puremagic.com
Sat Jul 22 02:07:31 PDT 2017


On 22 July 2017 at 01:44, Mike via D.gnu <d.gnu at puremagic.com> wrote:
> My stm32 demo has now been updated and working with GDC/GCC 7.1.0.  Thanks
> for all your improvements.
>
> However, I'm getting broken binaries with -O2 and -O3.  I've nailed the
> culprit down to -fschedule-insns (i.e. if I add -fno-schedule-insns to -O2
> or -O3, the binary works fine).
>
> I disassembled '-O2' and '-O2 -fno-schedule-insns' and compared them, but
> they were quite different all the way through.  No only because of address
> locations, but also different registers and even different opcodes.  (e.g.
> 'str r2, [sp, #12]' vs 'strd r1, r2, [sp, #8]')
>
> Is there anything I can do to provide more actionable information to help
> identify the underlying cause?
>
> Mike

Hi Mike,

Is the stm discovery repository up to date on Github?

https://github.com/JinShil/stm32f42_discovery_demo/search?utf8=%E2%9C%93&q=cast%28shared&type=

Those should probably be volatileLoad, as they look to be used by setValue().

Iain.


More information about the D.gnu mailing list