Author Topic: Low-footprint printf replacement for embedded dev  (Read 5636 times)

0 Members and 1 Guest are viewing this topic.

Offline martinribelotta

  • Regular Contributor
  • *
  • Posts: 66
  • Country: ar
  • A camel is a horse designed by a committee
    • Martin Ribelotta design services
Re: Low-footprint printf replacement for embedded dev
« Reply #50 on: December 17, 2024, 01:18:28 pm »
A few years ago I develop a little deferred printf library for log system on flying embedded devices:

https://github.com/martinribelotta/elog

Is pretty simple and straight forward but work well in hard environments with low footprint requeriments.

The log packet may be better and the decoder may be more smart, but for the requeriments of these project was sufficient.
 
The following users thanked this post: pardo-bsso, mikerj

Offline tellurium

  • Frequent Contributor
  • **
  • Posts: 287
  • Country: ua
Re: Low-footprint printf replacement for embedded dev
« Reply #51 on: December 29, 2024, 09:09:58 am »
Quote
Presumably IPV4 (uint32_t)
Yep.  Also "%e" for ethernet addresses.
Compared the C++ way, I find printf formats to be a nice compromise in being able to visualize what the output will actually look like, not quite so explicit as fortran FORMAT or COBOL PICTUREs (?), but much better than individual function calls.

This implementation https://github.com/cesanta/str expands the idea of non-standard specifiers (%I, %e) to one single non-standard specifier %m/%M which requires a "printer" function. This way, you can custom-print anything: internet addresses, ethernet addresses, structures, automatically base64-encode strings, etc etc.
Open source embedded network library https://github.com/cesanta/mongoose
TCP/IP stack + TLS1.3 + HTTP/WebSocket/MQTT in a single file
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf