__attribute__ ((format (printf, 1, 2)))
void ei_printf(const char *format, ...);

Brief: User-defined function for printing debugging information to a console, over serial, etc.

Location: edge-impulse-sdk/porting/ei_classifier_porting.h

Blocking: Depends on user implementation

ei_printf() is declared internally to the Edge Impulse SDK library so that debugging information (e.g. during inference) can be printed out. However, the function must be defined by the user, as printing methods can change depending on the platform and use case. For example, you may want to print debugging information to stdout in Linux or over a UART serial port on a microcontroller.

You can find ei_printf() being used in edge-impulse-sdk/classifier/ei_run_classifier.h.

Please see the Porting Guide for more information about other functions that must be implemented by the user.


  • format - [input] Pointer to a character array or string that should be printed.
  • ... - Other optional arguments may be passed as necessary (e.g. handle to a UART object). Note that any calls to ei_printf() from within the edge-impulse-sdk library do not pass anything other than the format argument.

The following examples demonstrate possible implementations of ei_printf() for various platforms. Note the __attribute__((weak)) in most of the definitions, which means that a user could override the implementation elsewhere in the program (e.g. to send debugging information to a different UART port):