Skip to content

Commit

Permalink
Update TraceWithTrice.md
Browse files Browse the repository at this point in the history
  • Loading branch information
rokath authored Sep 4, 2024
1 parent edc4415 commit 2df5339
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/TraceWithTrice.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Learning that *Trice* is also a [baby girl name](https://www.babynamespedia.com

*Trice* performs **no** [costly](./TriceVsPrintfSimilaritiesAndDifferences.md#printf-like-functions) printf-like functions on the target at all. The `trice` macro, instead, just copies an ID together with the optional values to a buffer and is done. In the minimum case this can happen in [6-8](./TriceSpeed.md) processor clocks even with target timestamps included. When running on a 64 MHz clock, **light can travel about 30 meters in that time**.

To achieve that, an automatable pre-compile step is needed, executing a `trice insert` command on the PC. The **trice** tool parses then the source tree for macros like `trice( "msg: %d Kelvin\n", k );` and patches them to `trice( iD(12345), "msg: %d Kelvin\n", k );`, where `12345` is a generated 14-bit identifier copied into a [**T**rice **I**D **L**ist](../til.json). During compilation than, the `trice` macro is translated to the `12345` ID only, and the optional parameter values. The format string is ignored by the compiler.
To achieve that, an automatable pre-compile step is needed, executing a `trice insert` command on the PC. This is fast enough not to disturb the build process. The **trice** tool parses then the source tree for macros like `trice( "msg: %d Kelvin\n", k );` and patches them to `trice( iD(12345), "msg: %d Kelvin\n", k );`, where `12345` is a generated 14-bit identifier copied into a [**T**rice **I**D **L**ist](../til.json). During compilation than, the `trice` macro is translated to the `12345` ID only, and the optional parameter values. The format string is ignored by the compiler.

The target code is [project specific](../test/F030R8/Core/Inc/triceConfig.h) configurable. In **immediate mode** the the stack is used as *Trice* buffer and the TRICE macro execution includes the quick [COBS](https://en.wikipedia.org/wiki/Consistent_Overhead_Byte_Stuffing) encoding and the data transfer. This more straightforward and slower architecture can be interesting for many cases because it is anyway much faster than printf-like functions calls. In **deferred mode** a service swaps the *Trice* double buffer periodically, the COBS encoding takes part and with the filled buffer the background transfer is triggered. Out buffer and half *Trice* buffer share the same memory for efficiency.

Expand Down

0 comments on commit 2df5339

Please sign in to comment.