Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot compile with O0 optimization [nRF52-DK] [GCC-ARM] #6920

tkstreet opened this issue May 15, 2018 · 5 comments

Cannot compile with O0 optimization [nRF52-DK] [GCC-ARM] #6920

tkstreet opened this issue May 15, 2018 · 5 comments


Copy link

@tkstreet tkstreet commented May 15, 2018



Toolchain: GCC-ARM (7 2017-q4-major)
Mbed SHA: 2104d8a (HEAD) Merge pull request #6711 from marcuschangarm/cleanup-nrf5x
Issue: Will not compile with -O0 optimization.

After exporting my project from the mbed online compiler and changing the debug flags from -Os to -Og, I cannot compile mbed-os to produce the proper debugging output/symbols to debug. If I compile with -O0 (as is recommended several places for debugging), the compile fails with:

../mbed-os/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/sleep.c: In function 'hal_sleep':
../mbed-os/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/sleep.c:82:1: error: unrecognizable insn:
(insn 16 15 17 2 (unspec_volatile [
(mem/c:SI (plus:SI (reg/f:SI 105 virtual-stack-vars)
(const_int -4 [0xfffffffffffffffc])) [3 fpscr+0 S4 A32])
] VUNSPEC_SET_FPSCR) "../mbed-os/cmsis/TARGET_CORTEX_M/cmsis_gcc.h":734 -1
../mbed-os/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/sleep.c:82:1: internal compiler error: in extract_insn, at recog.c:2311

Issue request type

[ ] Question
[ ] Enhancement
[X] Bug

Copy link

@pan- pan- commented May 16, 2018

Toolchain: GCC-ARM (7 2017-q4-major)
We do not support gcc 7 yet; could you try with GCC 6 ?

Copy link

@0xc0170 0xc0170 commented May 17, 2018

@tkstreet Can you test it with GCC 6 ?

I set -O0 for GCC, and built the latest master

arm-none-eabi-g++ (GNU Tools for ARM Embedded Processors 6-2017-q2-update) 6.3.1 20170620 (release) [ARM/embedded-6-branch revision 249437]

Compile: arm-none-eabi-g++ -std=gnu++98 -fno-rtti -Wvla -c -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fmessage-length=0 -fno-exceptions -fno-builtin -ffunction-sections -fdata-sections -funsigned-char -MMD -fno-delete-null-pointer-checks -fomit-frame-pointer -O0 -g1 -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -DBOOTLOADER_ADDR=0x0 -DBOOTLOADER_SIZE=0x23000 -DAPPLICATION_ADDR=0x23000


Build successes:

cc @marcuschangarm

Copy link

@ciarmcom ciarmcom commented Jun 1, 2018

ARM Internal Ref: MBOTRIAGE-30

Copy link

@mtfurlan mtfurlan commented Jun 25, 2018

I only see this on debug builds with 7-2017-q4-major 7.2.1 20170904, works fine with 6-2017-q2-update 6.3.1 20170620

Copy link

@0xc0170 0xc0170 commented Jul 3, 2018

Thanks @mtfurlan for confirming. As this is not currently supported toolchain, I'll close this issue.

We will address this once we update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants