Crates.io | cdefmt-parser |
lib.rs | cdefmt-parser |
version | 0.3.0 |
source | src |
created_at | 2024-04-13 09:33:09.239944 |
updated_at | 2024-08-16 12:37:15.656671 |
description | Parsing library for cdefmt log frames |
homepage | |
repository | https://github.com/risint96/cdefmt |
max_upload_size | |
id | 1207470 |
size | 26,402 |
cdefmt
cdefmt
("c de format", short for "c deferred formatting") is a highly efficient logging framework that targets resource-constrained devices, like microcontrollers.
Inspired by https://github.com/knurling-rs/defmt/
.note.gnu.build-id
section to define the necessary memory locations:
.note.gnu.build-id : {
PROVIDE(__cdefmt_build_id = .);
*(.note.gnu.build-id)
}
/DISCARD/
if it exists):
/* CDEFMT: log metadata section */
.cdefmt 0 (INFO) : {
KEEP(*(.cdefmt.init .cdefmt.init.*))
. = . + 8;
KEEP(*(.cdefmt .cdefmt.*))
}
-g
- need debugging information in order to parse log arguments.-Wl,--build-id
- link build-id into the binary to verify elf compatibility on init.cdefmt.h
to your project.cdefmt_log
in your project.CDEFMT_GENERATE_INIT()
somewhere in your main file.cdefmt_init()
after your logging backend is initialized and cdefmt_log
can be safely called.TBD
Basically cdefmt_log
should store/write log
into the log sink, then these bytes should be
provided to the parser as-is, accompanied with the elf binary.
See:
The easiest way to run the example would be to build the project using cmake:
cmake -S . -B build
cmake --build build/
Then run the stdout example and pipe it's stdout into the stdin example:
build/examples/stdout/example-stdout | build/stdin --elf build/examples/stdout/example-stdout