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

BUG: nrf_delay doesn't compile using nRF52 on GCC

Building nrf_delay.c (or anything else including nrf_delay.h) with NRF52 defined produces:

arm-none-eabi-gcc -I C:\Nordic\nRF5_SDK_11.0.0-2.alpha\components\device  -D_DEBUG -DNRF52 -DDEBUG -std=gnu11 -mcpu=cortex-m0 -mthumb -mabi=aapcs -Wall -Wno-switch -ffunction-sections -fdata-sections -ggdb -c C:\Nordic\nRF5_SDK_11.0.0-2.alpha\components\drivers_nrf\delay\nrf_delay.c -o build\nrf_delay.o
C:\Windows\ccESAXKg.s: Assembler messages:
C:\Windows\ccESAXKg.s:58: Error: instruction not supported in Thumb16 mode -- `subs r0,r0,#1'

(Using GCC ARM Tools for Embedded 5_2-2015q4, nRF5 SDK 11.0.0-2.alpha.)

If where nrf_delay.h has

#ifdef NRF51

I replace it with

#if defined(NRF51) || defined(NRF52)

the problem is fixed. There are other NRF52 checks in the file (mainly to add more NOPs).

Related