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

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

2,435 Views
boris_fiedler
Contributor I

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
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
0 Kudos
5 Replies

2,064 Views
boris_fiedler
Contributor I

Ok, after some research I found a solution for my problem:

1. The IDE (MCUXpresso v11) provides CMSIS files for the LPC11xx series, they are in the folder: ...\MCUXpressoIDE_11.x.x_xxxx\ide\Examples\Legacy\CMSIS_CORE\    --> CMSIS_CORE_Latest.zip

With the above package I can compile and flash, in release and debug mode.

The support for CMSIS in the package "LPCXpresso LPC11C24 board Supports LPC1111 / 12/13/14/15 / 00XL C00 / C12 / C14 / C22 C24 / D24 "- V2.00a dated 09/13/2013 is incomplete / faulty.

2. Debugging (whether release or debug mode) with the LPC Link Probe V1.3 (on the LPCXpresso LPC1114 board) is only possible with an ISP reset at P0.1 - for LPC11xx.
--> [SOLVED] LPC-Link Debug Error 

0 Kudos

2,064 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Boris Fiedler ,

You can directly use the Debug mode to build ,debug and download.

If you want to add some optimization, you can also config on it.

pastedImage_5.png


Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

2,064 Views
boris_fiedler
Contributor I

Hi Alice,
Thank you very much for your answer...  
I knew that I can set the optimization level also in the debug mode, which makes the source code smaller / optimal.

It was more of a general question, why compiling in the release mode does not work, because the necessary files do not appear in the Makefile and where i can change it.

Many Thanks

Boris

0 Kudos

2,064 Views
bernhardfink
NXP Employee
NXP Employee

I just tried it with MCUXpresso 11.0.0 and it seems to work for me.

I downloaded the v2.00a for the LPC11C24 from here

LPCOpen Software for LPC11XX | NXP 

and imported it into my workspace.

  • I build all project in "Debug" configuration successfully
  • I set the chip library project (the one on top of the list) from "Debug" to "Release"
  • I set the periph_blinky project from "Debug" to "Release"
  • I built the periph_blinky project successfully

Flashing through the LPC3000 based LPC-Link bridge should work, but I didn't try this.

Regards,

Bernhard.

0 Kudos

2,064 Views
boris_fiedler
Contributor I

Hello Bernhard,


compiling the sample program "blinky" with the version LPCXpresso LPC11C24 board Supports LPC1111/12/13/14/15/00XL C00/C12/C14/C22/C24/D24 works fine in debug and release mode, even flashing both two versions into the LPC1114.

Unfortunately, this version does not contain CMSIS support - but I want to program bare metal. That's why i used the version from my first post - so i can program like in the small example.

The original "blinky" example program from my first posting can be compiled in the debug mode and also be flashed - but not in relase mode.

My "simple blinky" can be compiled in debug and release mode (with the version from my first posting) - but flashed only in debug mode, in relase mode flashing failed.

#include "LPC11xx.h"

int main (void)
{

 SystemCoreClockUpdate();

 LPC_SYSCON->SYSAHBCLKCTRL   |= (1<<6);
 LPC_IOCON->PIO0_7           &= ~(0x10);
 LPC_GPIO0->DIR              |= (1<<7);

 unsigned int i = 0;

 while(1)
 {

  LPC_GPIO0->DATA           |= (1<<7);
  for(i=0; i<0xFFFFF; ++i);
  LPC_GPIO0->DATA           &= ~(1<<7);
  for(i=0; i<0xFFFFF; ++i);
 }

 return 0 ;
}

Regards,

Boris

0 Kudos