SDK for TESAIoT Dev Kit
API reference & tutorials (ModusToolbox)
Loading...
Searching...
No Matches
printf/puts on CM55

lib/edge_ai/api.txt lists 40 API functions and neither printf nor puts: this archive defines neither symbol (overridable.txt is empty). This page explains where both come from on CM55, because the answer affects your own* code.

Variant
mtb-mpy and mtb-only

printf

int printf(const char *fmt, ...); /* weak no-op in proj_cm55/bento_cm55_stdio.c */

Contract. proj_cm55/bento_cm55_stdio.c — open source you can read and change — defines printf as a weak no-op. Consequences for CM55 code:

  • A printf in your own CM55 code produces nothing by default. The call succeeds and returns 0.
  • Why the mute exists. CM55 has no console: CM33_NS owns the UART (proj_cm55/main.c:9-10) and cy_retarget_io_init() is never called on this core, so newlib stdio would take a mutex that is never initialised and abort the core — while the vendored ML middleware, TFLite-Micro and the Ethos-U driver all call printf on paths this project does not control.
  • Your options. (1) Define your own printf()/puts() anywhere in your application; yours is strong and wins the link, with no edit to that file. (2) Route CM55 diagnostics over IPC to the CM33_NS console, which is what the BENTO firmware does. (3) Build with DEFINES+=BENTO_CM55_MUTE_STDIO=0 for the real newlib printf — and then you must call cy_retarget_io_init() on CM55 and give this core a UART of its own.
  • By default, CM55 observables are therefore LED codes and the screen on both variants, plus ui._diag() on mtb-mpy (ipc_ui_platform_diag() from C on mtb-only).

puts

int puts(const char *s); /* weak no-op in proj_cm55/bento_cm55_stdio.c */

Contract. Same as printf: a weak no-op in the same file, and it has to be there too, because GCC rewrites printf("literal\n") into puts("literal") — a build that muted only printf would still reach newlib through every constant-string diagnostic. If you define your own printf, define puts as well.