lpcware

sprintf works with LPC1343 but cause compile failure with LPC1345

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by CC58 on Wed Jan 23 16:52:37 MST 2013
Below sprintf works in LPCexpresso project for LPC1343, but gets below compile error in LPC1345 project.
I assume it related to the differing libs each processor uses.
(I'm using  LPCXpresso v4.2.0, but just tried v5.0.12 and it fails too)
Is there a fix for this?

#include <stdio.h>

sprintf((char *)(test)," %d \r\n", len);


compile error:

Invoking: MCU Linker
arm-none-eabi-gcc -nostdlib -L"C:\Users\cc\LPC_tempster1345\CMSISv2p10_LPC13Uxx\Debug" -L"C:\Users\cc\LPC_tempster1345\LPC13Uxx_DriverLib\Debug" -Xlinker -Map="ROM_USB_msc.map" -Xlinker --gc-sections -mcpu=cortex-m3 -mthumb -T "ROM_USB_msc_Debug.ld" -o"ROM_USB_msc.axf"  ./src/DiskImg.o ./src/cr_startup_lpc13u.o ./src/lpc13uxx_usbd_msc_mem.o ./src/main.o ./src/mem_lpc13uxx_usbdesc.o   -lCMSISv2p10_LPC13Uxx -lLPC13Uxx_DriverLib
c:/nxp/lpcxpresso_4.2.0_264/lpcxpresso/tools/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/lib/thumb2\libcr_c.a(_deferredlazyseek.o): In function `__flsbuf':
_deferredlazyseek.c:(.text.(float, long, short, bool, float __restrict)+0x96): undefined reference to `__sys_istty'
c:/nxp/lpcxpresso_4.2.0_264/lpcxpresso/tools/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/lib/thumb2\libcr_c.a(_writebuf.o): In function `_Cwritebuf':
_writebuf.c:(.text._Cwritebuf+0x18): undefined reference to `__sys_flen'
_writebuf.c:(.text._Cwritebuf+0x2e): undefined reference to `__sys_seek'
_writebuf.c:(.text._Cwritebuf+0x56): undefined reference to `__sys_write'
c:/nxp/lpcxpresso_4.2.0_264/lpcxpresso/tools/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/lib/thumb2\libcr_c.a(alloc.o): In function `malloc':
alloc.c:(.text.malloc+0x78): undefined reference to `_sbrk'
alloc.c:(.text.malloc+0x9c): undefined reference to `_sbrk'
c:/nxp/lpcxpresso_4.2.0_264/lpcxpresso/tools/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/lib/thumb2\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_4.2.0_264/lpcxpresso/tools/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/lib/thumb2\libcr_c.a(fseek.o): In function `fseek':
fseek.c:(.text.fseek+0x1c): undefined reference to `__sys_istty'
fseek.c:(.text.fseek+0x3e): undefined reference to `__sys_flen'
collect2: ld returned 1 exit status
make: *** [ROM_USB_msc.axf] Error 1

Outcomes