Trice Overview and Concepts
Contents
New to Trice? Follow the User Manual for your first PC log and firmware integration. This reference explains the complete options, rules and limits. Use the Guide to find a task.
1. How it works
A Trice call records an ID and binary values. The host looks up the format in til.json and formats the result. Ordinary host-decoded logging therefore keeps format strings and printf formatting out of the firmware. Local text logging is a separate configuration that performs formatting on the target.
Source calls → trice bind → sidecar headers + dictionaries → compiler
Target records → byte transport → host decoder + til.json → readable events
Bind is the normal pre-build step. It creates compiler headers and maintains their includes in the source; log calls remain ID-free. Preserve the accumulated dictionary and local location information according to IDs and dictionaries. The older Insert/Clean workflow is deprecated.
2. Direct and deferred output
| Mode | Work done by a log call | Application responsibility |
|---|---|---|
| Direct | Creates a record and passes it through the configured direct output path. | Provide an output callback with acceptable execution time. |
| Deferred | Stores a record in a ring or double buffer. | Call TriceTransfer() regularly to encode and drain pending records. |
Both modes can be enabled together; see F030_inst. Deferred mode reduces the immediate work at the call site but still needs time for transfer. Choose buffers using the performance measurements and memory reference; the fastest measured configuration is not a guarantee for every target.
3. Compact records
Without a target stamp or payload, a record needs four bytes. Stamps, payload, padding and transport framing add bytes. See binary layout and size limits for the exact representation, including the distinction between the format limit and the C buffer allowance.
4. Portability and modularity
The Go host tools run on Linux, macOS and Windows. The target C library supports different integer widths and byte orders; your project supplies hardware-specific configuration and transport functions. Compiler-dependent wrapper features have explicit Bind limits.
Use UART, RTT or a custom writer to carry the bytes. typeX0 allows application packets alongside Trice records. Host filters, structured output, context enrichment and visualization have their own reference chapters.
The project uses the MIT license; see resources and support.