trice

module
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2026 License: MIT

README

🅃🅁ace 🄸d's 🄲 🄴mbedded

TriceGirlS.png Hi, I am Trice.

Trice User Manual

GitHub issues GitHub All Releases GitHub code size in bytes GitHub watchers GitHub release (latest by date) GitHub commits since latest release Go Report Card PRs Welcome Coverage Status CodeQL

Log in (a) trice (S>G)

even inside ↯ interrupts in less than 1 µs❗

What is Trice?

Trice replaces printf or log in C code and gives you three main benefits:

Main Idea

Instead of storing log strings on your embedded device, Trice keeps them on your PC. This makes logging faster and uses less memory on your device.

- No version mismatch problems❗
+ The Trice ID List stores all log strings, so the
+ newest version can read logs from all older versions❗
Two Parts of Trice
  1. C code macros - Works like printf but creates very fast trace and log code for your embedded device
  2. Trice tool - Manages and displays the logs
    • Written in Go - works on all platforms that Go supports
    • You can also build your own tool to receive Trice packages, replace IDs with text, and display the output

When to Use Trice

Logging and Debugging

You can use Trice for printf debugging and as a logging system. The advantage is very short messages (no strings) for data transfer. Remember that the file til.json is needed to read all output from devices in the field for 10+ years.

  • Optional: Add til.json as a compressed resource to your target image. You can use SRecord or provide a download link.
Data Compression

Trice looks like data compression (IDs instead of strings), which is useful for IoT devices, especially NB-IoT with very low data rates.

FLASH Memory Storage

Store Trice messages in FLASH memory for later analysis. A typical trice uses only 4 bytes, no matter how long the format string is.

Encryption

You can encrypt Trice transfer packets for security.

  • Deliver firmware images with encrypted Trice output that only works with the right key and til.json
  • XTEA encryption is available
Translation

Translate the til.json file into different languages. Change the language by changing the til.json file without changing the target binary.

Timing Analysis

Trice makes timing analysis easy on distributed embedded systems. It supports both host and target timestamps.

How Trice Works (UART Example)

This simplified diagram shows how Trice works. Read the detailed explanation here.

trice

Data Transfer Options

Implemented Transfer Methods
Other Transfer Options

Display Server

  • Start trice ds in a console on your local PC or a remote PC. Then connect several trice tool instances using commands like trice log -p COM15 -ds
  • This allows to see the Trice logs of several devices line-by-line intermixed in one terminal.

Documentation

Debugging with VS-Code and Clang

Debug a Trice project in Direct-Out Mode over SEGGER-RTT. (See Development Environment Setup for details.)

Trice Cache

You can use the -cache CLI switch with trice insert and trice clean commands. This only works when you create the .trice/cache folder in your home directory. (Trice Cache Details)

When to Use Cache

Use cache when you:

  • Use trice i ... before compiling
  • Use trice c ... after compiling
  • Want to keep IDs out of your source code when working
  • Want faster compilation
How Cache Works

The Trice cache saves copies of all files after processing them with trice i or trice c. This avoids inserting and removing IDs repeatedly. The copies are used to get the same results for files that have not been edited. Edited files are processed normally and the cache updates afterwards. File modification times do not change, so the build system does not reprocess unchanged files even when IDs are temporarily removed.

Important Note

Be careful when your build system also modifies source files!

For example, run an auto-formatter before the trice insert command.

Which Mode Should You Use?

  • For development: Direct mode with SEGGER_RTT is recommended
  • For most use cases: Deferred mode with TRICE_BUFFER == TRICE_RING_BUFFER (uses less RAM) in TRICE_MULTI_PACK_MODE (transfers less data)

Project Status

Trice is fully usable. There are no known bugs (see issues).

+ Please use v1.0, v1.1, or the main branch if you want to build from source.
- Do not use the "dev" branch right now (December 2025) - it may not work properly.

Future Plans

The documentation could be improved. We could add features like remote procedure calls. Or create a separate tlog tool written in C or Python (with AI help). This would allow logging on any platform, not just platforms supported by Go.

Structured Logging

Trice will soon support structured logging. Based on feedback from #531, there is now a specification draft. Please provide feedback before implementation starts.

Support the Project

  • Trice takes a lot of my free time. I want to keep it MIT licensed in the future.
  • If you make profit using Trice in your products, donations help convince my family to continue improving Trice.
  • ⭐ Star this project! ☺

Become a Sponsor with your Github Account

OR

Buy Me A Coffee

OR

paypal

Clone the Repository

git clone https://github.com/rokath/trice.git

Similar Projects

Trice Compare (generated 2025-05-26)

Logging & Tracing Solutions for Embedded Systems (generated 2026-02-16)

(back to top)

Directories

Path Synopsis
_test
_dblB_de_single_xtea_cobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
_dblB_de_single_xtea_tcobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
_ringB_de_multi_nopf_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
_userprint_dblB_de_tcobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
alias_dblB_de_tcobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
aliasassert_dblB_de_tcobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
be_dblB_de_tcobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
be_staticB_di_xtea_cobs_rtt32
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
dblB_de_multi_cobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
dblB_de_multi_nopf_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
dblB_de_multi_tcobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
dblB_de_multi_xtea_cobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
dblB_de_multi_xtea_tcobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
dblB_de_protect_tcobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
dblB_de_single_cobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
dblB_de_single_nopf_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
dblB_de_single_tcobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
dblB_di_cobs_rtt32__de_xtea_cobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
dblB_di_nopf_rtt32__de_cobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
dblB_di_nopf_rtt32__de_multi_cobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
dblB_di_nopf_rtt32__de_multi_tcobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
dblB_di_nopf_rtt32__de_tcobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
dblB_di_nopf_rtt32__de_xtea_cobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
dblB_di_nopf_rtt8__de_cobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
dblB_di_nopf_rtt8__de_multi_cobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
dblB_di_nopf_rtt8__de_multi_tcobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
dblB_di_nopf_rtt8__de_tcobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
modify_for_debug
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
ringB_de_multi_cobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
ringB_de_multi_tcobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
ringB_de_multi_xtea_cobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
ringB_de_multi_xtea_tcobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
ringB_de_protect_tcobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
ringB_de_single_cobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
ringB_de_single_nopf_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
ringB_de_single_tcobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
ringB_de_single_xtea_cobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
ringB_de_single_xtea_tcobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
ringB_di_cobs_rtt32__de_tcobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
ringB_di_cobs_rtt32__de_xtea_cobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
ringB_di_cobs_rtt8__de_tcobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
ringB_di_nopf_rtt32__de_tcobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
ringB_di_nopf_rtt32__de_xtea_cobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
ringB_di_nopf_rtt8__de_tcobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
ringB_di_tcobs_rtt32__de_tcobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
ringB_di_xtea_cobs_rtt32__de_cobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
ringB_di_xtea_cobs_rtt32__de_tcobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
ringB_di_xtea_cobs_rtt32__de_xtea_cobs_ua
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
stackB_di_nopf_aux32
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
stackB_di_nopf_aux32_specific
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
stackB_di_nopf_aux8
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
stackB_di_nopf_rtt32
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
stackB_di_nopf_rtt8
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
stackB_di_xtea_cobs_rtt8
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
staticB_di_nopf_aux32
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
staticB_di_nopf_aux8
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
staticB_di_nopf_rtt32
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
staticB_di_nopf_rtt8
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
staticB_di_tcobs_rtt32
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
staticB_di_tcobs_rtt8
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
staticB_di_xtea_cobs_rtt32
Package cgot is a helper for testing the target C-code.
Package cgot is a helper for testing the target C-code.
cmd
_cui command
_stim command
clang-filter command
trice command
internal
args
Package args defines the Trice command-line interface.
Package args defines the Trice command-line interface.
charDecoder
Package charDecoder provides a pass-through decoder for character streams.
Package charDecoder provides a pass-through decoder for character streams.
com
Package com provides serial COM-port helpers for opening, reading, and writing.
Package com provides serial COM-port helpers for opening, reading, and writing.
decoder
Package decoder provides several decoders for differently encoded trice streams.
Package decoder provides several decoders for differently encoded trice streams.
do
Package do wires parsed command arguments into cooperating runtime packages.
Package do wires parsed command arguments into cooperating runtime packages.
dumpDecoder
Package dumpDecoder provides a decoder that hex-dumps an encoded trice stream.
Package dumpDecoder provides a decoder that hex-dumps an encoded trice stream.
emitter
Package emitter formats decoded trice text lines and writes them either to a local display or to a remote RPC display server.
Package emitter formats decoded trice text lines and writes them either to a local display or to a remote RPC display server.
id
Package id List is responsible for id List managing
Package id List is responsible for id List managing
keybcmd
Package keybcmd is responsible for interpreting user commandline and executing commands
Package keybcmd is responsible for interpreting user commandline and executing commands
link
Package link reads from SeggerRTT with the SEGGER app JLinkRTTLogger or with the open source app stRttLogger.exe.
Package link reads from SeggerRTT with the SEGGER app JLinkRTTLogger or with the open source app stRttLogger.exe.
trexDecoder
Package trexDecoder decodes framed TREX trice byte streams.
Package trexDecoder decodes framed TREX trice byte streams.
pkg
ant
Package ant walks source trees and applies an action function to matching files.
Package ant walks source trees and applies an action function to matching files.
cipher
Package cipher provides XTEA-based helper functions for encrypting and decrypting Trice binary payload blocks.
Package cipher provides XTEA-based helper functions for encrypting and decrypting Trice binary payload blocks.
msg
Package msg contains small logging and diagnostic helpers used across Trice.
Package msg contains small logging and diagnostic helpers used across Trice.
tst
Package tst provides helper utilities used by tests in this repository.
Package tst provides helper utilities used by tests in this repository.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL