Failed to compile the blinky example

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

Failed to compile the blinky example

3,255 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by xultz on Mon Apr 14 05:22:13 MST 2014
Hello.

I'm new to LPCxpresso, I have some experience working with LPC2106 using GCC as a compiler.
I downloaded the LPCxpresso for Windows, and downloaded the examples. I would like to compile the blinky example and try to run it on a mBed LPC2168 board, just to test it.
I didn't change anything in the code. What am I doing wrong?
Thanx for any help!

The compilation failed, with the error messages:

Building target: periph_blinky.axf
Invoking: MCU Linker

arm-none-eabi-gcc -nostdlib -Xlinker -Map="periph_blinky.map" -Xlinker --gc-sections -mcpu=cortex-m3 -mthumb -T "periph_blinky_Release.ld" -o "periph_blinky.axf"  ./example/src/cr_startup_lpc175x_6x.o ./example/src/sysinit.o ./example/src/systick.o   -llpc_board_nxp_lpcxpresso_1769 -llpc_chip_175x_6x

c:/nxp/lpcxpresso_7.1.1_125/lpcxpresso/tools/bin/../lib/gcc/arm-none-eabi/4.8.3/../../../../arm-none-eabi/bin/ld.exe: cannot find -llpc_board_nxp_lpcxpresso_1769

c:/nxp/lpcxpresso_7.1.1_125/lpcxpresso/tools/bin/../lib/gcc/arm-none-eabi/4.8.3/../../../../arm-none-eabi/bin/ld.exe: cannot find -llpc_chip_175x_6x

collect2.exe: error: ld returned 1 exit status

make: *** [periph_blinky.axf] Error 1
0 Kudos
Reply
11 Replies

2,588 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by xultz on Tue Apr 15 04:45:37 MST 2014
Thank you very much, R2D2, I'll test it (tomorrow)!
0 Kudos
Reply

2,589 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Mon Apr 14 12:18:03 MST 2014

Quote: xultz
Another question I have, the compiler generates a .axf file. If I click on it I have the option to create a binary file with .bin extension. Is that the file I must copy to mBed so it can run the firmware?



Unfortunately this bin-file  isn't checksummed.

You should use post-processing to generate a bin with checksum.

See: http://www.lpcware.com/content/faq/lpcxpresso/post-processing-linked-application

Your 'Post-build steps' should look like:

arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ;[color=#f00] # [/color]checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin";  


Just remove the '[color=#f00]#[/color]' and the correct bin file is created...
0 Kudos
Reply

2,589 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by xultz on Mon Apr 14 11:32:53 MST 2014
You got it! I don't know how and when, I compiled the blinke in Release mode, and the libraries where set to Debug mode. I did a make clean in all the three projects, switched all to Release mode, and recompiled them, and now it worked.

Thank you so much for your help!!!

Another question I have, the compiler generates a .axf file. If I click on it I have the option to create a binary file with .bin extension. Is that the file I must copy to mBed so it can run the firmware?
0 Kudos
Reply

2,589 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Mon Apr 14 10:12:16 MST 2014
You're building your project in Release mode, did you build your libraries in Release mode also?

If so, check your Libraries->Settings again...
0 Kudos
Reply

2,589 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Mon Apr 14 09:58:37 MST 2014
It all worked for me. Suggest you read the section on manually creating links to library projects in the FAQ:
http://www.lpcware.com/content/faq/lpcxpresso/creating-linking-library-projects
0 Kudos
Reply

2,589 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by xultz on Mon Apr 14 09:50:16 MST 2014
Thanx for the reply

TheFallGuy, yes, I did read the documentation and I followed the steps there, and I am stuck in the step "Building an Example" when I try to build the Blinky example. It is not my intention to waste anyone time, I'm seraching for help here because I followed the tutorial and it didn't work, and I don't know what to do.
R2D2, yes, I imported both libraries, and built them, without errors. But when I try to build the example code, it fails.

On the link below it is possible to see an screenshot of the LPCxpreso with the error, and it is possible to see that I imported all libraries from LPCOpen.

http://postimg.org/image/68lfgoswv/

Thanx for any help!
0 Kudos
Reply

2,589 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Mon Apr 14 07:35:09 MST 2014
Did you read the documentation?
http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quicks...

If you follow that, you won't waste your time, our ours.
0 Kudos
Reply

2,589 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Mon Apr 14 07:34:26 MST 2014

Quote: xultz

arm-none-eabi-gcc -nostdlib -Xlinker -Map="periph_blinky.map" -Xlinker --gc-sections -mcpu=cortex-m3 -mthumb -T "periph_blinky_Release.ld" -o "periph_blinky.axf"  ./example/src/cr_startup_lpc175x_6x.o ./example/src/sysinit.o ./example/src/systick.o   -llpc_board_nxp_lpcxpresso_1769 -llpc_chip_175x_6x
c:/nxp/lpcxpresso_7.1.1_125/lpcxpresso/tools/bin/../lib/gcc/arm-none-eabi/4.8.3/../../../../arm-none-eabi/bin/ld.exe: [color=#f00]cannot find -llpc_board_nxp_lpcxpresso_1769[/color]
c:/nxp/lpcxpresso_7.1.1_125/lpcxpresso/tools/bin/../lib/gcc/arm-none-eabi/4.8.3/../../../../arm-none-eabi/bin/ld.exe:[color=#f00] cannot find -llpc_chip_175x_6x[/color]
collect2.exe: error: ld returned 1 exit status
make: *** [periph_blinky.axf] Error 1

Any clues?



What's not clear there  :quest:

Your linker isn't finding this 2 linked libraries.

Did you import and build them?
0 Kudos
Reply

2,589 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by xultz on Mon Apr 14 07:01:04 MST 2014
Thank you very much for the reply.

Maybe I'm drinking too much coffee, I though LPC1768 as the mBed processor, and type LPC2168, and I have no idea where that code come from :)
I understand that probably (I didn't check it yet) I'll need to modify the code to change the port for a led in the mBed board. My first duty was trying to compile the example code as it is, and is successful, modify it to work on the mBed, but it failed on the first step.
So, I downloaded all the LPCOpen examples.
I built the lpc_board_nxp_lpcxpresso_1769 code, and here is the result:

Building file: ../src/board.c
Invoking: MCU C Compiler
arm-none-eabi-gcc -D__REDLIB__ -DDEBUG -D__CODE_RED -D__USE_LPCOPEN -DCORE_M3 -I"C:\Users\christian\Documents\LPCXpresso_7.1.1_125\workspace\lpc_chip_175x_6x\inc" -I"C:\Users\christian\Documents\LPCXpresso_7.1.1_125\workspace\lpc_board_nxp_lpcxpresso_1769\inc" -Og -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=cortex-m3 -mthumb -specs=redlib.specs -MMD -MP -MF"src/board.d" -MT"src/board.d" -o "src/board.o" "../src/board.c"
../src/board.c: In function 'Board_I2C_Init':
../src/board.c:267:2: warning: enumeration value 'I2C_NUM_INTERFACE' not handled in switch [-Wswitch]
  switch (id) {
  ^
Finished building: ../src/board.c

Building file: ../src/board_sysinit.c
Invoking: MCU C Compiler
arm-none-eabi-gcc -D__REDLIB__ -DDEBUG -D__CODE_RED -D__USE_LPCOPEN -DCORE_M3 -I"C:\Users\christian\Documents\LPCXpresso_7.1.1_125\workspace\lpc_chip_175x_6x\inc" -I"C:\Users\christian\Documents\LPCXpresso_7.1.1_125\workspace\lpc_board_nxp_lpcxpresso_1769\inc" -Og -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=cortex-m3 -mthumb -specs=redlib.specs -MMD -MP -MF"src/board_sysinit.d" -MT"src/board_sysinit.d" -o "src/board_sysinit.o" "../src/board_sysinit.c"
Finished building: ../src/board_sysinit.c

Building file: ../src/lpc_phy_smsc87x0.c
Invoking: MCU C Compiler
arm-none-eabi-gcc -D__REDLIB__ -DDEBUG -D__CODE_RED -D__USE_LPCOPEN -DCORE_M3 -I"C:\Users\christian\Documents\LPCXpresso_7.1.1_125\workspace\lpc_chip_175x_6x\inc" -I"C:\Users\christian\Documents\LPCXpresso_7.1.1_125\workspace\lpc_board_nxp_lpcxpresso_1769\inc" -Og -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=cortex-m3 -mthumb -specs=redlib.specs -MMD -MP -MF"src/lpc_phy_smsc87x0.d" -MT"src/lpc_phy_smsc87x0.d" -o "src/lpc_phy_smsc87x0.o" "../src/lpc_phy_smsc87x0.c"
Finished building: ../src/lpc_phy_smsc87x0.c

Building target: liblpc_board_nxp_lpcxpresso_1769.a
Invoking: MCU Archiver
arm-none-eabi-ar -r  "liblpc_board_nxp_lpcxpresso_1769.a"  ./src/board.o ./src/board_sysinit.o ./src/lpc_phy_smsc87x0.o  
c:\nxp\LPCXpresso_7.1.1_125\lpcxpresso\tools\bin\arm-none-eabi-ar.exe: creating liblpc_board_nxp_lpcxpresso_1769.a
Finished building target: liblpc_board_nxp_lpcxpresso_1769.a

make --no-print-directory post-build
Performing post-build steps
arm-none-eabi-size "liblpc_board_nxp_lpcxpresso_1769.a" ; # arm-none-eabi-objdump -h -S "liblpc_board_nxp_lpcxpresso_1769.a" >"liblpc_board_nxp_lpcxpresso_1769.lss"
   text   data    bss    dec    hexfilename
   1072      0      0   1072    430board.o (ex liblpc_board_nxp_lpcxpresso_1769.a)
    156      0      0    156     9cboard_sysinit.o (ex liblpc_board_nxp_lpcxpresso_1769.a)
    576      0     18    594    252lpc_phy_smsc87x0.o (ex liblpc_board_nxp_lpcxpresso_1769.a)

I built the lpc_chip_175x_6x code, and here is the result: (just the last lines)

make --no-print-directory post-build
Performing post-build steps
arm-none-eabi-size "liblpc_chip_175x_6x.a" ; # arm-none-eabi-objdump -h -S "liblpc_chip_175x_6x.a" >"liblpc_chip_175x_6x.lss"
   text   data    bss    dec    hexfilename
    404      0      0    404    194adc_17xx_40xx.o (ex liblpc_chip_175x_6x.a)
   4792      0      0   4792   12b8can_17xx_40xx.o (ex liblpc_chip_175x_6x.a)
     80      0      0     80     50chip_17xx_40xx.o (ex liblpc_chip_175x_6x.a)
    760      0      0    760    2f8clock_17xx_40xx.o (ex liblpc_chip_175x_6x.a)
      0      0      0      0      0cmp_17xx_40xx.o (ex liblpc_chip_175x_6x.a)
      0      0      0      0      0crc_17xx_40xx.o (ex liblpc_chip_175x_6x.a)
     56      0      0     56     38dac_17xx_40xx.o (ex liblpc_chip_175x_6x.a)
      0      0      0      0      0eeprom_17xx_40xx.o (ex liblpc_chip_175x_6x.a)
      0      0      0      0      0emc_17xx_40xx.o (ex liblpc_chip_175x_6x.a)
    528      0      4    532    214enet_17xx_40xx.o (ex liblpc_chip_175x_6x.a)
   1348     96      8   1452    5acgpdma_17xx_40xx.o (ex liblpc_chip_175x_6x.a)
      0      0      0      0      0gpio_17xx_40xx.o (ex liblpc_chip_175x_6x.a)
      0      0      0      0      0gpioint_17xx_40xx.o (ex liblpc_chip_175x_6x.a)
   1620     84    120   1824    720i2c_17xx_40xx.o (ex liblpc_chip_175x_6x.a)
    720      0      0    720    2d0i2s_17xx_40xx.o (ex liblpc_chip_175x_6x.a)
    408      0      0    408    198iap.o (ex liblpc_chip_175x_6x.a)
    128      0      0    128     80iocon_17xx_40xx.o (ex liblpc_chip_175x_6x.a)
      0      0      0      0      0lcd_17xx_40xx.o (ex liblpc_chip_175x_6x.a)
    156      0      0    156     9cpmu_17xx_40xx.o (ex liblpc_chip_175x_6x.a)
    360      0      0    360    168ring_buffer.o (ex liblpc_chip_175x_6x.a)
     92      0      0     92     5critimer_17xx_40xx.o (ex liblpc_chip_175x_6x.a)
    388      0      0    388    184rtc_17xx_40xx.o (ex liblpc_chip_175x_6x.a)
      0      0      0      0      0sdc_17xx_40xx.o (ex liblpc_chip_175x_6x.a)
      0      0      0      0      0sdmmc_17xx_40xx.o (ex liblpc_chip_175x_6x.a)
    468      0      0    468    1d4spi_17xx_40xx.o (ex liblpc_chip_175x_6x.a)
   1084      0      0   1084    43cssp_17xx_40xx.o (ex liblpc_chip_175x_6x.a)
    172      0     12    184     b8stopwatch_17xx_40xx.o (ex liblpc_chip_175x_6x.a)
     20      0      0     20     14sysctl_17xx_40xx.o (ex liblpc_chip_175x_6x.a)
    260      0      0    260    104sysinit_17xx_40xx.o (ex liblpc_chip_175x_6x.a)
    128      0      0    128     80timer_17xx_40xx.o (ex liblpc_chip_175x_6x.a)
   1036      0      1   1037    40duart_17xx_40xx.o (ex liblpc_chip_175x_6x.a)
     44      0      0     44     2cwwdt_17xx_40xx.o (ex liblpc_chip_175x_6x.a)

And when I try to built the  periph_blinky  code, I still get the error:
Building target: periph_blinky.axf
Invoking: MCU Linker
arm-none-eabi-gcc -nostdlib -Xlinker -Map="periph_blinky.map" -Xlinker --gc-sections -mcpu=cortex-m3 -mthumb -T "periph_blinky_Release.ld" -o "periph_blinky.axf"  ./example/src/cr_startup_lpc175x_6x.o ./example/src/sysinit.o ./example/src/systick.o   -llpc_board_nxp_lpcxpresso_1769 -llpc_chip_175x_6x
c:/nxp/lpcxpresso_7.1.1_125/lpcxpresso/tools/bin/../lib/gcc/arm-none-eabi/4.8.3/../../../../arm-none-eabi/bin/ld.exe: cannot find -llpc_board_nxp_lpcxpresso_1769
c:/nxp/lpcxpresso_7.1.1_125/lpcxpresso/tools/bin/../lib/gcc/arm-none-eabi/4.8.3/../../../../arm-none-eabi/bin/ld.exe: cannot find -llpc_chip_175x_6x
collect2.exe: error: ld returned 1 exit status
make: *** [periph_blinky.axf] Error 1

Any clues?
0 Kudos
Reply

2,589 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Mon Apr 14 06:32:10 MST 2014
There is not an mbed "2168" board. I assume you mean and mbed LPC1768 board.

It looks like you have tried to import the LPCOpen "periph_blinky" application. A few things to note:

[list]
  [*] When using LPCOpen, you must also import the "chip" and "board" library projects from the zip file: lpc_chip_175x_6x and lpc_board_nxp_lpcxpresso_1769. This is described in the documentation.
  [*] LPCOpen does not explicitly support the mbed board. Basically this means that the pinouts used by the examples may not actually match your board - in other words, the blinky will probably not blink the LED on your board. You will need to modify the "board" library to define what the pinouts are. The "lpc_board_nxp_lpcxpresso_1769" project is setup for the LPCXpresso 1769 board (OM13000).
[/list]
0 Kudos
Reply

2,589 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by serge on Mon Apr 14 05:35:44 MST 2014
Your target MCU is a LPC2168 and you are compiling for a LPC175x or LPC176x.

You used a wrong sample.

Anyway it should compile so check if include path's are correct within LPCXpresso.
0 Kudos
Reply