trice
trice copied to clipboard
š¢ super fast š and tiny š„ embedded device š¾ printf-like trace ā code, works also inside ā” interrupts ā” and real-time PC š» logging (trace ID visualization š)
Trice <- TR~~ace~~ I~~ds~~ C E~~mbedded~~
"log in (a) trice" (S>G)
About
- Replace
printf
orlog
in C-code for getting:- SPEED, to be usable also inside interrupts,
- SPACE, to reduce needed FLASH memory size,
- and various FEATURES delighting the developers heart.
- Main idea: Logging strings not into an embedded device to display them later on a PC but keep usage comfortable and simple.
-
Trice consists of 2 parts:
-
C code
TRICE
macros generating tiny & super-fast embedded device real-time trace/log code - Tool trice for managing and visualization.
- Written in Go and therefore usable on all platforms Go supports.
- You can also use your own environment to receive the Trice packages, exchange the carried IDs with the format string and print out.
-
C code
- Trice Usage guide
Possible Use Cases
- Using Trice not only for dynamic debugging but also as logging technique is possible and gives the advantage to have very short messages (no strings) for transmission, but keep in mind that the file til.json is the key to read all output if your devices in the field for 10 or more years.
- Optionally add til.json as a (compressed) resource to your target image. One possibility is using SRecord. Or simply provide a download link.
- You can see Trice also as a kind of data compression what could be interesting for IoT things, especially NB-IoT, where you have very low data rates.
- Storing Trice messages in FLASH memory for later log analysis saves memory because a typical
TRICE
occupies only about 8 bytes independently of the format string length. - Also, it is possible to encrypt the Trice transfer packets to get a reasonable protection for many cases.
- This way you can deliver firmware images with encrypted Trice output, only readable with the appropriate key and til.json.
- XTEA is implemented as one option.
- You can even translate the til.json file in different languages, so changing a language is just changing the til.json file without touching the target binary.
- With Trice it is easy to do timing analysis on distributed embedded systems. Host and target timestamps are supported.
How it approximately works (UART example)
This slightly simplified view is explained here
Data Transfer
- Implemented:
- A small separate microcontroller is always usable as interfaces bridge to GPIO, IĀ²C, SPI, CAN, LIN, ...
- With a Chip from FTDI, check for example Adafruit FT232H Breakout, GPIO, I2C and SPI are easy accessable.
Display server option
Start trice ds
inside a console, option: third_party/alacritty, locally or on a remote PC and connect with several trice tool instances like with trice log -p COM15 -ds
for example.
Documentation
- https://interrupt.memfault.com/blog/trice
- Trice User Guide
- Check the docs folder. No need to read all this stuff - it is just for help and reference.
Support?
Yes please - or simply :star: it. āŗ
Cloning the repo:
git clone https://github.com/rokath/trice.git
Similar projects
- baical.net (C)
- call stack logger function instrumentation (a way to trace programs flow of execution)
- Debugging with Dynamic Printf Breakpoints (Eclipse IDE option)
- defmt (Rust)
- J-Link System View (SEGGER)
- Minimal Structured Logging for Autonomous Vehikles (C++, closed source talk)
- NanoLog (Linux C++)
- Percepio Tracealyzer (Visual Trace Diagnostics)
- Pigweed Trace Tokenized
- qpspy (C/C++)
- Serial-Studio (Data visualisation)