lpcware

Weird compilation behavior after starting LPCXpresso 7 (missing: -specs=redlib.specs flag)

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by OldManVimes on Mon Mar 10 12:15:43 MST 2014
Hello support,

I've noticed something weird after migrating to LPCXpresso v7.0.0 [Build 92] [2014-02-20].
My project targets an LPC1227 using the MCU compiler and the CodeRed library.

If I start the IDE, perform "Clean Project" followed by a "Build Project" I get compilation errors related to "_printf" not being defined. _printf gets used in my code (yes I know what I'm doing). My guess is that the compilation does not use the MCU compiler/settings. I can compile as much as I like, but the result is the same. It keeps failing with the same errors.

To fix this, I open the project properties and then go to  the "C/C++ Build" tab. Then I press "Cancel" (this is exactly what I do!). If I then compile, it succeeds. Note that this does not touch the .project file and it is not being checked out as a result of opening the properties.

My project file uses a managed makefile and uses the external builder.

Output from a failed compilation:
arm-none-eabi-gcc -D__REDLIB__ -DNDEBUG -D__CODE_RED -DCORE_M0 -D__USE_ROMDIVIDE -D__USE_CMSIS=CMSIS_CORE_LPC12xx -D__LPC12XX__ -DCR_INTEGER_PRINTF -I"C:\Users\xxx\Documents\LPCXpresso_7.0.0_92\workspace\xxx\inc" -I"C:\Users\xxx\Documents\LPCXpresso_7.0.0_92\workspace\xxx\inc\CMSIS" -Os -g -Wall -Werror -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -std=gnu99 -mcpu=cortex-m0 -mthumb -D__REDLIB__ -MMD -MP -MF"src/accelerometer.d" -MT"src/accelerometer.d" -o "src/accelerometer.o" "../src/accelerometer.c"
../src/accelerometer.c: In function 'accelerometerReadData':
Invoking: MCU C Compiler
../src/accelerometer.c:116:3: error: implicit declaration of function '_printf' [-Werror=implicit-function-declaration]
   Dprintf ("ADXL344_trigger(%u)", nofFifoEntries);

And from a succeeding compilation:
arm-none-eabi-gcc -D__REDLIB__ -DNDEBUG -D__CODE_RED -DCORE_M0 -D__USE_ROMDIVIDE -D__USE_CMSIS=CMSIS_CORE_LPC12xx -D__LPC12XX__ -DCR_INTEGER_PRINTF -I"C:\Users\xxx\Documents\LPCXpresso_7.0.0_92\workspace\xxx\inc" -I"C:\Users\xxx\Documents\LPCXpresso_7.0.0_92\workspace\xxx\inc\CMSIS" -Os -g -Wall -Werror -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -std=gnu99 -mcpu=cortex-m0 -mthumb -D__REDLIB__ -specs=redlib.specs -MMD -MP -MF"src/accelerometer.d" -MT"src/accelerometer.d" -o "src/accelerometer.o" "../src/accelerometer.c"

Note: xxx has been added to protect the innocent.

Question: why is the -specs flag missing from the compiler invocation until the C/C++ build tab in the project properties has been opened?

Outcomes