Using printf/DEBUTOUT() with DEBUG_UART not SemiHosting

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

Using printf/DEBUTOUT() with DEBUG_UART not SemiHosting

1,245 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by gwlindberg on Thu Feb 04 12:06:46 MST 2016
I'm trying to use uart0 in our LPC1517 for debug output.

I've enabled the defines for DEBUG_ENABLE AND DEBUG_UART in board.h and if I use the DEBUGOUT() macro everything compiles correctly. If I try to use the DEBUGOUT() macro or printf() I get the following errors:

c:/nxp/lpcxpresso_8.0.0_526/lpcxpresso/tools/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7-m\libcr_c.a(alloc.o): In function `_Csys_alloc':
alloc.c:(.text._Csys_alloc+0x12): undefined reference to `__sys_appexit'
c:/nxp/lpcxpresso_8.0.0_526/lpcxpresso/tools/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7-m\libcr_c.a(_deferredlazyseek.o): In function `__flsbuf':
_deferredlazyseek.c:(.text.__flsbuf+0x84): undefined reference to `__sys_istty'
c:/nxp/lpcxpresso_8.0.0_526/lpcxpresso/tools/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7-m\libcr_c.a(_writebuf.o): In function `_Cwritebuf':
_writebuf.c:(.text._Cwritebuf+0x14): undefined reference to `__sys_flen'
_writebuf.c:(.text._Cwritebuf+0x28): undefined reference to `__sys_seek'
c:/nxp/lpcxpresso_8.0.0_526/lpcxpresso/tools/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7-m\libcr_c.a(fseek.o): In function `fseek':
fseek.c:(.text.fseek+0x1a): undefined reference to `__sys_istty'
fseek.c:(.text.fseek+0x44): undefined reference to `__sys_flen'
collect2.exe: error: ld returned 1 exit status


Where are these symbols defined? board_api.h redefines the DEBUGOUT() macro to printf for non-SemiHosting debugging, so I would assume that it is expected to work. Am I expected to provide stubs for these functions, I've searched and I can't find any sample code for these functions, what is supposed to be in them?
Labels (1)
0 Kudos
3 Replies

910 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Thu Feb 04 12:36:22 MST 2016
Switch from the "None" to the "Nohost" C library variant. For more details see:

https://www.lpcware.com/content/faq/lpcxpresso/linker-undefined-reference
https://www.lpcware.com/content/faq/lpcxpresso/using-printf

Regards,
LPCXpresso Support
0 Kudos

441 Views
pentleman
Contributor I

The links shown in the post are no longer valid.     I'm using an lpc11e13 and the lpcopen chip library for lpc11c24.    I do not have a board library hence no board.h.

Is it possible to use lpcopen in this fashion?   Do I need to create a board library or is there an lpcopen document that describes what to do in the case of a customer custom board.

Thanks

0 Kudos

910 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by gwlindberg on Thu Feb 04 12:34:39 MST 2016
Apparently when we first built the project we ended up with the none libraries.  I had searched for where to find the library selection to no avail in the past, but I went looking again and found it this time.  We are using LPCXpresso 8.0.0, the selection is buried on the Properties/C/C++ Build/settings/ToolSettings tab, MCU Linker/Managed Linker Script page.

I changed to the nohost library and now my project is linking correctly with a printf() call.

So I guess that I've answered my own question.
0 Kudos