Log in (a) trice (S>G)
even inside β― interrupts in less than 1 Β΅sβ
- Replace
printf
orlog
in C-code for getting: - 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, similar usable likeprintf
, 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 User Manual
- Trice Status: Trice is ready to be used!
- Using Trice not only for printf 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.
- 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 4 bytes independently of the format string length plus optional values. - Also, it is possible to encrypt the Trice transfer packets to get a reasonable protection for many cases.
- 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.
This slightly simplified view is explained here
- Implemented:
- UART connectable to virtual UART over USB
- RTT over J-Link and RTT over ST-Link
- 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.
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.
- https://interrupt.memfault.com/blog/trice (a bit outdated)
- Trice User Manual (covers also the interrupt blog actualized information)
- Check issues and discussions including the closed items.
- Read the target source code, especially triceDefaultConfig.h
- View the CLI options by executing
trice help -all
in a terminal or reading tricehelpall_test.go - Look into and optionally modify ./internal/emitter/lineTransformerANSI.go (Needs
go install ./cmd/trice/...
afterwards.)
Debugging using VS-Code and Clang for a Trice-instrumented Project in Direct-Out Mode over SEGGER-RTT
(See chapter Development Environment Setup for more details.)
Starting with Trice version 0.70.0 it is possible to use additionally the Trice -cache
CLI switch for the commands trice insert
and trice clean
. This switch will have only effect when the user creates in his home directory the .trice/cache
folder. (Trice Cache Spec)
When you use trice i
as a pre-compile step and trice c
as a post-compile step to have the IDs not in the project source code when you work on it, therefore only during compilation time, and wish to speed-up the whole thing.
The Trice cache keeps copies of all to trice i
or trice c
passed files after processing them, to avoid repeatedly ID inserting and cleaning. The copies are used to get the same results as with trice i
or trice c
for all files not edited inbetween. Edited files are processed normally and the cache is updated afterwards. Because the file copies are done without changing the file modification time, a build system does not process unchanged files again even the IDs have been temporarily removed from the files.
Special care is needed, when the build system modifies source files as well!
For example an auto-formatter should get active before the tice insert
command.
- For the development direct mode with SEGGER_RTT is recommended.
- Most use cases are coverable in deferred mode with TRICE_BUFFER == TRICE_RING_BUFFER (less RAM needs) in TRICE_MULTI_PACK_MODE (less transfer data).
Trice is full usable and there are no known bugs (see issues).
The documentation could get improved, for example by adding a quick start help. Additional features like remote procedure calls could be described and a separate tlog, maybe written in C, would allow logging on any platforms - not only Go supported ones.
Yes please - or simply β it. βΊ
Become a Sponsor with your Github Account
OR
OR
Cloning the repo:
git clone https://github.com/rokath/trice.git
- 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)
- Diagnostic Log and Trace (AUTOSAR)
- elog (Embedded logger with minimal footprint and memory usage)
- J-Link System View (SEGGER)
- Logging with symbols - The Embedonomicon
- MCUViewer
- Memfault Compact Log Library
- Metal Serial Library
- Minimal Structured Logging for Autonomous Vehikles (C++, closed source talk)
- NanoLog (Linux C++)
- Percepio Tracealyzer (Visual Trace Diagnostics)
- Pigweed Trace Tokenized
- Postform (Postponed formatting experiments with string interning in C++. Inspired by the defmt Rust crate )
- qpspy (C/C++)
- Real-time binary data logging/tracing toolkit
- Serial-Studio (Data visualisation)
- Traces (API tracing framework for Linux C/C++ applications
- Zepyr Dictionary Based Logging