I have a "linker" problem in a project that use the LPCOpen board configuration (board.c and board.h) on a LPC11U6X.
The physical setup:
- Custom PCB with a LPC11U6X chip, and a design very close to the OM13058 LPC Xpresso v2 (Rev C) board (based on LPC11U68).
- I am using MCUXpresso IDE v10.0.0 [Build 344] [2017-03-21],
- I already tested with success different project examples from LPCOpen (v3.01), and different custom tests, (all using the "LPC board library" included with #include "board.h")
- I started the development of a firmware with a copy/paste from the blinky example:
- As for LPCOpen projects, the "custom_firmware" project includes and is linked to "lpc_board_nxp_lpcxpresso_11u68" and "lpc_chip_11u6x" projects (in the same workspace),
- I included "board.h" in my main file to use the base configuration (pin muxing, clock, IO) of the LPCXpresso11U68,
Everything works fine until I start working with extern variables defined for the board or chip (e.g. IRQ handler). For no apparent reason, the linker raise two errors:
liblpc_chip_11u6x.a(clock_11u6x.o): In function `Chip_Clock_GetMainOscRate':
clock_11u6x.h:518: undefined reference to `OscRateIn'
liblpc_chip_11u6x.a(clock_11u6x.o): In function `Chip_Clock_GetRTCOscRate':
clock_11u6x.h:536: undefined reference to `RTCOscRateIn'
The two variables "OscRateIn" and "RTCOscRateIn" are extern in "chip.h" , and defined in "board.c":
const uint32_t OscRateIn = 12000000;
const uint32_t RTCOscRateIn = 32768;
Since I include "board.h", I see no reason that these variables are considered as not defined. For the moment (as a quick fix) I added the definition of the two variables in my main file, but I am afraid that there is a larger problem, and I am not sure if the board configuration is really taken into account or if the default chip configuration is used instead.
Thanks for your help,