AnsweredAssumed Answered

[SOLVED] LPC 1114 - Blinky example - building as release failed, debug is fine

Question asked by boris.fiedler@mpsd.mpg.de on Jul 3, 2019
Latest reply on Jul 15, 2019 by boris.fiedler@mpsd.mpg.de

I have a LPCXpresso board (with LPC 1114/302), MCUXpresso IDE v11 as IDE and for first steps with CMSIS source code Blinky & CMSISv2p00_LPC11xx used from the zip archive (LPC11xx-LPCXpresso-CMSIS-updateV1_01_0.zip from Where is lpc_chip_11xx_lib (e.g. for LPC1114)? 

 

Building the blinky example as a debug works fine, but if I want to build it as a release I get errors - and I tried to fix her.

   1. Path to "${workspace_loc:/Blinky/Common/inc}" only at debug include, not at release - fixed.

   2. At Linker checkmark for CRP removed.

 

Cause of the error message seems that he will not build all the files at the release mode ... Looking at the make-files shows that the release Make-file is missing an entry -> "Common/src/subdir.mk"

 

Were is the mistake?

 

The debugging via the LPC-Link of the LPCXpresso board also works fine, the LED flashes on the PCB. But flashing fails, however - is that only possible with an LPC-Link2 from the MCUXpresso IDE?

 

 

13:34:59 **** Build of configuration Debug for project Blinky ****
make -r -j12 all
Building file: ../src/blinky.c
Building file: ../src/cr_startup_lpc11.c
Building file: ../Common/src/clkconfig.c
Building file: ../Common/src/gpio.c
Building file: ../Common/src/timer16.c
Invoking: MCU C Compiler
Invoking: MCU C Compiler
arm-none-eabi-gcc -D__REDLIB__ -DDEBUG -D__CODE_RED -D__USE_CMSIS=CMSISv2p00_LPC11xx -I"C:\nxp\WorkSpace\CMSISv2p00_LPC11xx\inc" -I"C:\nxp\WorkSpace\Blinky\Common\inc" -O0 -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=cortex-m0 -mthumb -D__REDLIB__ -fstack-usage -specs=redlib.specs -MMD -MP -MF"src/blinky.d" -MT"src/blinky.o" -MT"src/blinky.d" -o "src/blinky.o" "../src/blinky.c"
Invoking: MCU C Compiler
arm-none-eabi-gcc -D__REDLIB__ -DDEBUG -D__CODE_RED -D__USE_CMSIS=CMSISv2p00_LPC11xx -I"C:\nxp\WorkSpace\CMSISv2p00_LPC11xx\inc" -I"C:\nxp\WorkSpace\Blinky\Common\inc" -Os -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=cortex-m0 -mthumb -D__REDLIB__ -fstack-usage -specs=redlib.specs -MMD -MP -MF"src/cr_startup_lpc11.d" -MT"src/cr_startup_lpc11.d" -o "src/cr_startup_lpc11.o" "../src/cr_startup_lpc11.c"
Invoking: MCU C Compiler
arm-none-eabi-gcc -D__REDLIB__ -DDEBUG -D__CODE_RED -D__USE_CMSIS=CMSISv2p00_LPC11xx -I"C:\nxp\WorkSpace\CMSISv2p00_LPC11xx\inc" -I"C:\nxp\WorkSpace\Blinky\Common\inc" -O0 -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=cortex-m0 -mthumb -D__REDLIB__ -fstack-usage -specs=redlib.specs -MMD -MP -MF"Common/src/clkconfig.d" -MT"Common/src/clkconfig.o" -MT"Common/src/clkconfig.d" -o "Common/src/clkconfig.o" "../Common/src/clkconfig.c"
arm-none-eabi-gcc -D__REDLIB__ -DDEBUG -D__CODE_RED -D__USE_CMSIS=CMSISv2p00_LPC11xx -I"C:\nxp\WorkSpace\CMSISv2p00_LPC11xx\inc" -I"C:\nxp\WorkSpace\Blinky\Common\inc" -O0 -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=cortex-m0 -mthumb -D__REDLIB__ -fstack-usage -specs=redlib.specs -MMD -MP -MF"Common/src/gpio.d" -MT"Common/src/gpio.o" -MT"Common/src/gpio.d" -o "Common/src/gpio.o" "../Common/src/gpio.c"
Invoking: MCU C Compiler
arm-none-eabi-gcc -D__REDLIB__ -DDEBUG -D__CODE_RED -D__USE_CMSIS=CMSISv2p00_LPC11xx -I"C:\nxp\WorkSpace\CMSISv2p00_LPC11xx\inc" -I"C:\nxp\WorkSpace\Blinky\Common\inc" -O0 -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=cortex-m0 -mthumb -D__REDLIB__ -fstack-usage -specs=redlib.specs -MMD -MP -MF"Common/src/timer16.d" -MT"Common/src/timer16.o" -MT"Common/src/timer16.d" -o "Common/src/timer16.o" "../Common/src/timer16.c"
Finished building: ../src/cr_startup_lpc11.c
Finished building: ../Common/src/gpio.c


Finished building: ../src/blinky.c
Finished building: ../Common/src/clkconfig.c

Finished building: ../Common/src/timer16.c


Building target: Blinky.axf
Invoking: MCU Linker
arm-none-eabi-gcc -nostdlib -L"C:\nxp\WorkSpace\CMSISv2p00_LPC11xx\Debug" -Xlinker -Map="Blinky.map" -Xlinker --gc-sections -mcpu=cortex-m0 -mthumb -T "Blinky_Debug.ld" -o "Blinky.axf"  ./src/blinky.o ./src/cr_startup_lpc11.o  ./Common/src/clkconfig.o ./Common/src/gpio.o ./Common/src/timer16.o   -lCMSISv2p00_LPC11xx
Finished building target: Blinky.axf

make --no-print-directory post-build
Performing post-build steps
arm-none-eabi-size "Blinky.axf"; # arm-none-eabi-objcopy -O binary "Blinky.axf" "Blinky.bin" ; checksum -p LPC1114_302 -d "Blinky.bin";
   text        data         bss         dec         hex     filename
   2512           4          48        2564         a04     Blinky.axf


13:35:00 Build Finished. 0 errors, 0 warnings. (took 710ms)






13:34:17 **** Clean-only build of configuration Release for project Blinky ****
make -r -j12 clean
rm -rf  ./src/blinky.o ./src/cr_startup_lpc11.o  ./src/blinky.d ./src/cr_startup_lpc11.d  Blinky.axf


13:34:17 Build Finished. 0 errors, 0 warnings. (took 101ms)

13:34:17 **** Build of configuration Release for project Blinky ****
make -r -j12 all
Building file: ../src/blinky.c
Building file: ../src/cr_startup_lpc11.c
Invoking: MCU C Compiler
Invoking: MCU C Compiler
arm-none-eabi-gcc -D__REDLIB__ -DNDEBUG -D__CODE_RED -D__USE_CMSIS=CMSISv2p00_LPC11xx -I"C:\nxp\WorkSpace\CMSISv2p00_LPC11xx\inc" -I"C:\nxp\WorkSpace\Blinky\Common\inc" -Os -g -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=cortex-m0 -mthumb -D__REDLIB__ -fstack-usage -specs=redlib.specs -MMD -MP -MF"src/blinky.d" -MT"src/blinky.o" -MT"src/blinky.d" -o "src/blinky.o" "../src/blinky.c"
arm-none-eabi-gcc -D__REDLIB__ -DNDEBUG -D__CODE_RED -D__USE_CMSIS=CMSISv2p00_LPC11xx -I"C:\nxp\WorkSpace\CMSISv2p00_LPC11xx\inc" -I"C:\nxp\WorkSpace\Blinky\Common\inc" -Os -g -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=cortex-m0 -mthumb -D__REDLIB__ -fstack-usage -specs=redlib.specs -MMD -MP -MF"src/cr_startup_lpc11.d" -MT"src/cr_startup_lpc11.o" -MT"src/cr_startup_lpc11.d" -o "src/cr_startup_lpc11.o" "../src/cr_startup_lpc11.c"
Finished building: ../src/cr_startup_lpc11.c

Finished building: ../src/blinky.c

Building target: Blinky.axf
Invoking: MCU Linker
arm-none-eabi-gcc -nostdlib -L"C:\nxp\WorkSpace\CMSISv2p00_LPC11xx\Release" -Xlinker -Map="Blinky.map" -Xlinker --gc-sections -mcpu=cortex-m0 -mthumb -T "Blinky_Release.ld" -o "Blinky.axf"  ./src/blinky.o ./src/cr_startup_lpc11.o   -lCMSISv2p00_LPC11xx
c:/nxp/mcuxpressoide_11.0.0_2516/ide/plugins/com.nxp.mcuxpresso.tools.win32_11.0.0.201905131304/tools/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld.exe: ./src/blinky.o: in function `main':
C:\nxp\WorkSpace\Blinky\Release/../src/blinky.c:47: undefined reference to `CLKOUT_Setup'
c:/nxp/mcuxpressoide_11.0.0_2516/ide/plugins/com.nxp.mcuxpresso.tools.win32_11.0.0.201905131304/tools/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld.exe: C:\nxp\WorkSpace\Blinky\Release/../src/blinky.c:60: undefined reference to `init_timer16'
c:/nxp/mcuxpressoide_11.0.0_2516/ide/plugins/com.nxp.mcuxpresso.tools.win32_11.0.0.201905131304/tools/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld.exe: C:\nxp\WorkSpace\Blinky\Release/../src/blinky.c:61: undefined reference to `enable_timer16'
c:/nxp/mcuxpressoide_11.0.0_2516/ide/plugins/com.nxp.mcuxpresso.tools.win32_11.0.0.201905131304/tools/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld.exe: C:\nxp\WorkSpace\Blinky\Release/../src/blinky.c:64: undefined reference to `GPIOSetDir'
c:/nxp/mcuxpressoide_11.0.0_2516/ide/plugins/com.nxp.mcuxpresso.tools.win32_11.0.0.201905131304/tools/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld.exe: C:\nxp\WorkSpace\Blinky\Release/../src/blinky.c:86: undefined reference to `GPIOSetValue'
c:/nxp/mcuxpressoide_11.0.0_2516/ide/plugins/com.nxp.mcuxpresso.tools.win32_11.0.0.201905131304/tools/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld.exe: C:\nxp\WorkSpace\Blinky\Release/../src/blinky.c:90: undefined reference to `GPIOSetValue'
c:/nxp/mcuxpressoide_11.0.0_2516/ide/plugins/com.nxp.mcuxpresso.tools.win32_11.0.0.201905131304/tools/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld.exe: C:\nxp\WorkSpace\Blinky\Release/../src/blinky.c:94: undefined reference to `timer16_0_counter'
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:32: Blinky.axf] Error 1
"make -r -j12 all" terminated with exit code 2. Build might be incomplete.

13:34:18 Build Failed. 9 errors, 0 warnings. (took 506ms)

 

Debug make file

################################################################################
# Automatically-generated file. Do not edit!
################################################################################

-include ../makefile.init

RM := rm -rf

# All of the sources participating in the build are defined here
-include sources.mk
-include src/subdir.mk
-include Common/src/subdir.mk
-include subdir.mk
-include objects.mk

ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
endif

-include ../makefile.defs

# Add inputs and outputs from these tool invocations to the build variables

# All Target
all: Blinky.axf

# Tool invocations
Blinky.axf: $(OBJS) $(USER_OBJS)
     @echo 'Building target: $@'
     @echo 'Invoking: MCU Linker'
     arm-none-eabi-gcc -nostdlib -L"C:\nxp\WorkSpace\CMSISv2p00_LPC11xx\Debug" -Xlinker -Map="Blinky.map" -Xlinker --gc-sections -mcpu=cortex-m0 -mthumb -T "Blinky_Debug.ld" -o "Blinky.axf" $(OBJS) $(USER_OBJS) $(LIBS)
     @echo 'Finished building target: $@'
     @echo ' '
     $(MAKE) --no-print-directory post-build

# Other Targets
clean:
     -$(RM) $(EXECUTABLES)$(OBJS)$(C_DEPS) Blinky.axf
     -@echo ' '

post-build:
     -@echo 'Performing post-build steps'
     -arm-none-eabi-size "Blinky.axf"; # arm-none-eabi-objcopy -O binary "Blinky.axf" "Blinky.bin" ; checksum -p LPC1114_302 -d "Blinky.bin";
     -@echo ' '

.PHONY: all clean dependents post-build

-include ../makefile.targets




Release make file

################################################################################
# Automatically-generated file. Do not edit!
################################################################################

-include ../makefile.init

RM := rm -rf

# All of the sources participating in the build are defined here
-include sources.mk
-include src/subdir.mk
-include subdir.mk
-include objects.mk

ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
endif

-include ../makefile.defs

# Add inputs and outputs from these tool invocations to the build variables

# All Target
all: Blinky.axf

# Tool invocations
Blinky.axf: $(OBJS) $(USER_OBJS)
     @echo 'Building target: $@'
     @echo 'Invoking: MCU Linker'
     arm-none-eabi-gcc -nostdlib -L"C:\nxp\WorkSpace\CMSISv2p00_LPC11xx\Release" -Xlinker -Map="Blinky.map" -Xlinker --gc-sections -mcpu=cortex-m0 -mthumb -T "Blinky_Release.ld" -o "Blinky.axf" $(OBJS) $(USER_OBJS) $(LIBS)
     @echo 'Finished building target: $@'
     @echo ' '
     $(MAKE) --no-print-directory post-build

# Other Targets
clean:
     -$(RM) $(EXECUTABLES)$(OBJS)$(C_DEPS) Blinky.axf
     -@echo ' '

post-build:
     -@echo 'Performing post-build steps'
     -arm-none-eabi-size "Blinky.axf"; # arm-none-eabi-objcopy -O binary "Blinky.axf" "Blinky.bin" ; checksum -p LPC1114_302 -d "Blinky.bin";
     -@echo ' '

.PHONY: all clean dependents post-build

-include ../makefile.targets

Outcomes