Console printing

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

Console printing

1,344 Views
muis
Contributor II

Using LPCExpresso I was able to use this code to print directly to the console:

#define LIBSTUB_SYS_WRITE __write

But using MCUExpresso it cannot compile because __write seems undefined?

Normally this is caused when you disable semihosting, but its enabled now, so how to upgrade my code?

Labels (1)
Tags (1)
2 Replies

909 Views
muis
Contributor II

The alias was still present in the latest release of LPCXpresso (v8.2.2), but I changed it to __sys_* and it compiles again, so thanks for your help.

0 Kudos

908 Views
lpcxpresso_supp
NXP Employee
NXP Employee

You need to use the symbol __sys_write (as described in section 11.5.6, "Retargeting printf/scanf", of the MCUXpresso IDE v10.0.2 User Guide).

IIRC __write was renamed to __sys_write back in the days of Red Suite 3 or 4 when the whole semihosting layer was reworked. It is possible the symbol was still there as an alias in later LPCXpresso IDE versions until some more recent tidy up work.

Regards,

MCUXpresso IDE Support