Console printing

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Console printing

1,466 次查看
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?

标签 (1)
标记 (1)
2 回复数

1,031 次查看
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 项奖励

1,030 次查看
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