This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

bootloader_util.c fails to build without optimization

I'm trying to add debug information to ble_app_hrs using nRF5 SDK 10, softdevice s110 version 8.0.0, building for an nRF51-DK target (PCA10028) using ARMGCC. I've found that by changing the optimization level in the Makefile at line 123 the build will fail.

Has anyone else experienced this or know of a way to include debug info with DFU support?

SDK original code, build succeeds, Makefile line 123:

CFLAGS += -Wall -Werror -O3

Modified code, build succeeds for both optimization levels:

CFLAGS += -Wall -Werror -O2

CFLAGS += -Wall -Werror -O1

Modified code, build fails for both, optimization 0 is necessary with -g option:

CFLAGS += -Wall -Werror -O0

CFLAGS += -Wall -Werror -O0 -g3

Build output:

Compiling file: bootloader_util.c
<root-dir>/nRF51_SDK_10.0.0/components/libraries/bootloader_dfu/bootloader_util.c: In function 'bootloader_util_reset':
<root-dir>/nRF51_SDK_10.0.0/components/libraries/bootloader_dfu/bootloader_util.c:106:1: error: r7 cannot be used in asm here
Related