rust-ramlink
RAM-based, producer-consumer, one-way communication using a ring buffer
This no-std crate provides a way to transmit information from a producer (for example a microcontroller) to a consumer (a debbuging host) using a shared RAM memory. Usually, it is possible to read the RAM of microcontrollers using debugging interfaces (JTAG, UPDI, ..).
This way, it's possible to transmit information through the debugging interface without relying on an additional UART.
Example
Producer (AVR, PIC, microcontroller, ...)
Add this crate to your project, don't forget to enable the producer
feature
cargo add ramlink -F producer
Then create an ring buffer of size 5: In order to access it safely, we wrap it around a Mutex and a RefCell:
use ;
use ;
use RB;
static RING_BUF: = new;
you can then send data to your consumer:
;
free
Consumer (laptop with JTAG/UPDI/… interface)
Add this crate to you project, don't forget to enable the consumer
feature
cargo add ramlink -F consumer
Implement the trait for your specific device
Initialize it. In this example, the producer device is an AVR Attiny402, and the RB struct
is stored at address 0x3f0e
let mm = mk2 ;
let mut rb = new.unwrap;
and start reading:
while true
Contributing
Given that I'm a rust noob, don't hesitate to raise issues or propose merge requests to make this code better and make me improve :-). Suggestions welcome !