---------------------------
Semihosting C Project
• Creates a simple “Hello World” project, with the main() routine containing a printf() call, which will cause the text to be displayed within the Console View of the LPCXpresso IDE. This is implemented using “semihosting” functionality. For more details, please see the FAQ at
http://www.lpcware.com/content/faq/lpcxpresso/using-printf
---------------------------
For example, I tried as below:
---
#include<stdio.h>
--------------
*******
12:43:23 **** Incremental Build of configuration Debug for project app_demo_dp_blinky ****
make -r all
Building file: ../src/mainblinky.c
Invoking: MCU C Compiler
arm-none-eabi-gcc -std=c99 -DDEBUG -D__CODE_RED -DCORE_M0PLUS -D__REDLIB__ -I"C:\Users\Bitse\Documents\LPCXpresso_8.1.4_606\workspace\lib_chip_nss" -I"C:\Users\Bitse\Documents\LPCXpresso_8.1.4_606\workspace\lib_board_dp" -I"C:\Users\Bitse\Documents\LPCXpresso_8.1.4_606\workspace\app_demo_dp_blinky\inc" -I"C:\Users\Bitse\Documents\LPCXpresso_8.1.4_606\workspace\lib_board_dp\inc" -I"C:\Users\Bitse\Documents\LPCXpresso_8.1.4_606\workspace\lib_chip_nss\inc" -I"C:\Users\Bitse\Documents\LPCXpresso_8.1.4_606\workspace\mods" -I"C:\Users\Bitse\Documents\LPCXpresso_8.1.4_606\workspace\app_demo_dp_blinky\mods" -I"C:\Users\Bitse\Documents\LPCXpresso_8.1.4_606\workspace\lib_board_dp\mods" -I"C:\Users\Bitse\Documents\LPCXpresso_8.1.4_606\workspace\lib_chip_nss\mods" -include"C:\Users\Bitse\Documents\LPCXpresso_8.1.4_606\workspace\lib_chip_nss\mods\chip_sel.h" -include"C:\Users\Bitse\Documents\LPCXpresso_8.1.4_606\workspace\lib_board_dp\mods\board_sel.h" -include"C:\Users\Bitse\Documents\LPCXpresso_8.1.4_606\workspace\app_demo_dp_blinky\mods\app_sel.h" -O0 -g3 -pedantic -Wall -Wextra -Wconversion -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=cortex-m0plus -mthumb -D__REDLIB__ -specs=redlib.specs -MMD -MP -MF"src/mainblinky.d" -MT"src/mainblinky.o" -MT"src/mainblinky.d" -o "src/mainblinky.o" "../src/mainblinky.c"
Finished building: ../src/mainblinky.c
Building target: app_demo_dp_blinky.axf
Invoking: MCU Linker
arm-none-eabi-gcc -nostdlib -L"C:\Users\Bitse\Documents\LPCXpresso_8.1.4_606\workspace\lib_board_dp\Debug" -L"C:\Users\Bitse\Documents\LPCXpresso_8.1.4_606\workspace\lib_chip_nss\Debug" -Xlinker -Map="app_demo_dp_blinky.map" -Xlinker --gc-sections -mcpu=cortex-m0plus -mthumb -T "app_demo_dp_blinky_Debug.ld" -o "app_demo_dp_blinky.axf" ./src/crp.o ./src/mainblinky.o -llib_board_dp -llib_chip_nss
c:/nxp/lpcxpresso_8.1.4_606/lpcxpresso/tools/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/lib/armv6-m\libcr_c.a(fpprintf.o): In function `printf':
fpprintf.c:(.text.printf+0x38): undefined reference to `__sys_write'
c:/nxp/lpcxpresso_8.1.4_606/lpcxpresso/tools/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/lib/armv6-m\libcr_c.a(_deferredlazyseek.o): In function `__flsbuf':
_deferredlazyseek.c:(.text.__flsbuf+0x88): undefined reference to `__sys_istty'
c:/nxp/lpcxpresso_8.1.4_606/lpcxpresso/tools/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/lib/armv6-m\libcr_c.a(_writebuf.o): In function `_Cwritebuf':
_writebuf.c:(.text._Cwritebuf+0x16): undefined reference to `__sys_flen'
_writebuf.c:(.text._Cwritebuf+0x26): undefined reference to `__sys_seek'
_writebuf.c:(.text._Cwritebuf+0x3c): undefined reference to `__sys_write'
c:/nxp/lpcxpresso_8.1.4_606/lpcxpresso/tools/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/lib/armv6-m\libcr_c.a(alloc.o): In function `_Csys_alloc':
alloc.c:(.text._Csys_alloc+0xe): undefined reference to `__sys_write'
alloc.c:(.text._Csys_alloc+0x12): undefined reference to `__sys_appexit'
c:/nxp/lpcxpresso_8.1.4_606/lpcxpresso/tools/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/lib/armv6-m\libcr_c.a(fseek.o): In function `fseek':
fseek.c:(.text.fseek+0x18): undefined reference to `__sys_istty'
fseek.c:(.text.fseek+0x3c): undefined reference to `__sys_flen'
collect2.exe: error: ld returned 1 exit status
make: *** [app_demo_dp_blinky.axf] Error 1
12:43:24 Build Finished (took 856ms)
***************
Look forward to your guide.
Many thanks,
Arna
Hi,
It looks like you forgot to change the library setting. Under the LPCXpresso IDE, check:
Project > Properties > C/C++ Build > Settings > Tool Settings > MCU Linker > Managed Linker script > Library
That should be set to Redlib (semihost). Take care to change it for the correct (and all) build configurations (listed on top).
Also take into account that using semihost carries some disadvantages:
We recommend using the uarttx module to insert traces in a more unobtrusive way. That said, using semihosting still remains an easy way to try out the different functionalities the chip can offer.
Kind regards,
Dries.