lpcware

couldn't compile with libraries projects

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 18, 2016 by lpcware
Content originally posted in LPCWare by miccio on Fri Apr 15 07:57:17 MST 2016
Hello fellow LPC-users,

I have a workspace composed of the following projects:
- a hardware abstraction layer project (C++ static library project) -> HAL
- a modules/middleware project (C++ static library project) -> MOD
- a final application (C++ project) -> MAIN
- the LPCOpen chip layer (lpc_chip_15xx) -> LPCOPEN

The following graph expresses the relation between these projects:

      MAIN_______
     /    \      \
    MOD   HAL  LPCOPEN
     |     |
    HAL LPCOPEN
     |
  LPCOPEN


Compilation of both HAL and MOD occurs successfully, however when I try to compile the MAIN project, I get these linker errors:

Building target: lpc1549_main.axf
Invoking: MCU C++ Linker
arm-none-eabi-c++ -nostdlib -L"WORKSPACEPATH/lpc_chip_15xx/Debug" -L"WORKSPACEPATH/CMSIS_DSPLIB_CM3/lib" -L"WORKSPACEPATH/lpc1549_modules/Debug" -L"WORKSPACEPATH/lpc1549_hal/Debug" -Xlinker -Map="lpc1549_main.map" -Xlinker --gc-sections -Xlinker -print-memory-usage -mcpu=cortex-m3 -mthumb -T "lpc1549_main_Debug.ld" -o "lpc1549_main.axf"  ./src/sys/cr_cpp_config.o ./src/sys/cr_startup_lpc15xx.o ./src/sys/crp.o ./src/sys/sysinit.o  ./src/main.o   -llpc_chip_15xx -lCMSIS_DSPLIB_CM3 -llpc1549_modules -llpc1549_hal
WORKSPACEPATH/lpc1549_hal/Debug/liblpc1549_hal.a(spi.o): In function `Chip_SWM_MovablePortPinAssign':
WORKSPACEPATH/lpc_chip_15xx/inc/swm_15xx.h:234: undefined reference to `Chip_SWM_MovablePinAssign'
WORKSPACEPATH/lpc1549_hal/Debug/liblpc1549_hal.a(spi.o): In function `SPI::init(PortPin, PortPin, PortPin, PortPin, LPC_SPI_T*)':
WORKSPACEPATH/lpc1549_hal/Debug/../src/spi.cpp:63: undefined reference to `Chip_SPI_Init'
WORKSPACEPATH/lpc1549_hal/Debug/liblpc1549_hal.a(spi.o): In function `SPI::initSettings()':
WORKSPACEPATH/lpc1549_hal/Debug/../src/spi.cpp:114: undefined reference to `Chip_SPI_CalClkRateDivider'
WORKSPACEPATH/lpc1549_hal/Debug/../src/spi.cpp:131: undefined reference to `Chip_SPI_SetConfig'
WORKSPACEPATH/lpc1549_hal/Debug/../src/spi.cpp:132: undefined reference to `Chip_SPI_DelayConfig'
collect2: error: ld returned 1 exit status
make: *** [lpc1549_main.axf] Error 1


It is basically complaining about any non-inlined LPCOpen function used inside those HAL project functions used in the MAIN project (hope it's not too convoluted).
It would also complain about any non-inlined LPCOpen function used inside those HAL project functions used in the MOD project functions used in the MAIN project (ok, that sure is a little convoluted, but should be easy to get from the graph above).

The projects have been created using the LPCXpresso wizard, and the libraries have been included using this guideline: https://www.lpcware.com/content/faq/lpcxpresso/creating-linking-library-projects

Any idea about what could be causing the issue?
Thanks in advance and have a nice weekend! :)

Outcomes