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

compiler_abstraction.h:57:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'asm'

I'm currently using a combination of the GNU ARM Eclipse plugin and the unofficial pure-gcc Makefiles to build my nRF51822 code. The build works fine with the pure-gcc Makefiles, but fails on the above error in Eclipse (using the plugin):

make all 
Building file: ../gps_antenova_m10478.c
Invoking: Cross ARM C Compiler
arm-none-eabi-gcc -mcpu=cortex-m0 -march=armv6-m -mthumb -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wall  -g3 -DNRF51 -DNRF51822_QFAA_CA -DDEBUG -DBOARD_NRF6310 -I.. -I/Users/Eliot/dev/nrf51_sdk_v5_1_0_36092/nrf51822/Include -I/Users/Eliot/dev/nrf51_sdk_v5_1_0_36092/nrf51822/Include/gcc -I/Users/Eliot/dev/nrf51_sdk_v5_1_0_36092/nrf51822/Include/app_common -I/Users/Eliot/dev/nrf51_sdk_v5_1_0_36092/nrf51822/Include/ble -I/Users/Eliot/dev/nrf51_sdk_v5_1_0_36092/nrf51822/Include/ble/ble_services -I/Users/Eliot/dev/nrf51_sdk_v5_1_0_36092/nrf51822/Include/s110 -I/Users/Eliot/dev/nrf51_sdk_v5_1_0_36092/nrf51822/Include/sd_common -std=c99 -MMD -MP -MF"gps_antenova_m10478.d" -MT"gps_antenova_m10478.d" -c -o "gps_antenova_m10478.o" "../gps_antenova_m10478.c"
In file included from /Users/Eliot/dev/nrf51_sdk_v5_1_0_36092/nrf51822/Include/app_common/app_util.h:26:0,
                 from /Users/Eliot/dev/nrf51_sdk_v5_1_0_36092/nrf51822/Include/app_common/app_uart.h:27,
                 from ../gps_antenova_m10478.c:4:
/Users/Eliot/dev/nrf51_sdk_v5_1_0_36092/nrf51822/Include/compiler_abstraction.h: In function 'gcc_current_sp':
/Users/Eliot/dev/nrf51_sdk_v5_1_0_36092/nrf51822/Include/compiler_abstraction.h:57:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'asm'
         register unsigned sp asm("sp");
                              ^
/Users/Eliot/dev/nrf51_sdk_v5_1_0_36092/nrf51822/Include/compiler_abstraction.h:57:30: warning: implicit declaration of function 'asm' [-Wimplicit-function-declaration]
/Users/Eliot/dev/nrf51_sdk_v5_1_0_36092/nrf51822/Include/compiler_abstraction.h:58:16: error: 'sp' undeclared (first use in this function)
         return sp;
                ^
/Users/Eliot/dev/nrf51_sdk_v5_1_0_36092/nrf51822/Include/compiler_abstraction.h:58:16: note: each undeclared identifier is reported only once for each function it appears in
make: *** [gps_antenova_m10478.o] Error 1

The Eclipse plugin works by generating a Makefile behind the scenes. Here's the line from it:

arm-none-eabi-gcc
-mcpu=cortex-m0
-march=armv6-m
-mthumb
-Os
-fmessage-length=0
-fsigned-char
-ffunction-sections
-fdata-sections
-Wall
-g3
-DNRF51
-DNRF51822_QFAA_CA
-DDEBUG
-DBOARD_NRF6310
-I..
-I/Users/Eliot/dev/nrf51_sdk_v5_1_0_36092/nrf51822/Include
-I/Users/Eliot/dev/nrf51_sdk_v5_1_0_36092/nrf51822/Include/gcc
-I/Users/Eliot/dev/nrf51_sdk_v5_1_0_36092/nrf51822/Include/app_common
-I/Users/Eliot/dev/nrf51_sdk_v5_1_0_36092/nrf51822/Include/ble
-I/Users/Eliot/dev/nrf51_sdk_v5_1_0_36092/nrf51822/Include/ble/ble_services
-I/Users/Eliot/dev/nrf51_sdk_v5_1_0_36092/nrf51822/Include/s110
-I/Users/Eliot/dev/nrf51_sdk_v5_1_0_36092/nrf51822/Include/sd_common
-std=c99
-MMD
-MP
-MF"gps_antenova_m10478.d"
-MT"gps_antenova_m10478.d"
-c
-o "gps_antenova_m10478.o"
"../gps_antenova_m10478.c"

And here's the corresponding line from the pure-gcc build:

/Users/Eliot/dev/gcc-arm-none-eabi-4_8-2013q4/bin/arm-none-eabi-gcc
-mthumb
-mcpu=cortex-m0
-march=armv6-m
-L /Users/Eliot/dev/nrf51-pure-gcc-setup/template/
-T gcc_nrf51_s110.ld
-Wl,-Map=_build/device-nordic_s110.Map
-Os
-DBLE_STACK_SUPPORT_REQD
-DDEBUG
-g3
-O0
-DBLE_STACK_SUPPORT_REQD
-std=gnu99
-c
-mthumb
-mcpu=cortex-m0
-march=armv6-m
-Wall
-DNRF51
-DBOARD_NRF6310
-I/Users/Eliot/dev/nrf51_sdk_v5_1_0_36092/nrf51822/Include/gcc
-I../
-I/Users/Eliot/dev/nrf51_sdk_v5_1_0_36092/nrf51822/Include/
-I/Users/Eliot/dev/nrf51_sdk_v5_1_0_36092/nrf51822/Include/ble/
-I/Users/Eliot/dev/nrf51_sdk_v5_1_0_36092/nrf51822/Include/ble/ble_services/
-I/Users/Eliot/dev/nrf51_sdk_v5_1_0_36092/nrf51822/Include/s110
-I/Users/Eliot/dev/nrf51_sdk_v5_1_0_36092/nrf51822/Include/app_common/
-I/Users/Eliot/dev/nrf51_sdk_v5_1_0_36092/nrf51822/Include/sd_common/
-I/Users/Eliot/dev/nrf51_sdk_v5_1_0_36092/nrf51822/Include/s110
-MD ../gps_antenova_m10478.c -o _build/gps_antenova_m10478.o

Which of the differences between these two lines is the likely cause of the error?

Related