cu-sdlogger
Utilities for writing Copper unified logs to an SD/eMMC partition from embedded targets. It builds on embedded_sdmmc::BlockDevice and speaks the Cu29 on-disk format used by the runtime log reader.
What it provides
find_copper_partition: scan the GPT and return the start/length of the Cu29 partition.EMMCLogger:UnifiedLogWrite<EMMCSectionStorage<_>>implementation that lays out the main header and log sections on a block device.EMMCSectionStorage: section writer that encodes entries with bincode.ForceSyncSend: wrapper for sharing block devices with serialized access.
Usage
use ;
use *;
use SdCard;
// 1) Wrap your block device if it is not Sync and access is serialized.
let sd = new;
// 2) Locate the Copper partition (GUID 29A2E0C9-0000-4C75-9229-000000000029).
let Some = find_copper_partition? else ;
// 3) Create the logger and allocate a section for your stream.
let mut logger: = new?;
let mut telem = logger.add_section?; // bytes of payload
// 4) Append log entries and flush before shutdown.
telem.append?;
logger.flush_section;
Notes:
- Blocks are assumed to be 512 bytes; the logger errors if it would run out of space.
appendandflush_sectionuse bincode encoding and update the section header to keep usage counters accurate.ForceSyncSenddoes not provide locking; use it only with single-threaded or externally synchronized access.- See
examples/cu_rp2350_skeletonandexamples/cu_elrs_bdshot_demofor full RP2350 setups that hand the logger to aCuApplication.