Skip to content

Commit a7b911e

Browse files
committed
Add RTT support to serial_echo_rtic example
1 parent 3bfec9c commit a7b911e

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

Cargo.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,14 @@ usbd-serial = "0.1.0"
7070
heapless = "0.5"
7171
cortex-m-rtic = "0.5.5"
7272

73+
[dev-dependencies.panic-rtt-target]
74+
version = "0.1.1"
75+
features = ["cortex-m"]
76+
77+
[dev-dependencies.rtt-target]
78+
version = "0.2.2"
79+
features = ["cortex-m"]
80+
7381
[profile.dev]
7482
incremental = false
7583
codegen-units = 1

examples/serial_echo_rtic.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
#![no_main]
22
#![no_std]
33

4-
extern crate panic_halt;
4+
extern crate panic_rtt_target;
55

66
use nb::block;
7+
use rtt_target::{
8+
rprint,
9+
rprintln,
10+
};
711
use stm32l4xx_hal::{
812
prelude::*,
913
pac::{
@@ -26,6 +30,9 @@ const APP: () = {
2630

2731
#[init]
2832
fn init(_: init::Context) -> init::LateResources {
33+
rtt_target::rtt_init_print!();
34+
rprint!("Initializing... ");
35+
2936
let p = pac::Peripherals::take().unwrap();
3037

3138
let mut rcc = p.RCC.constrain();
@@ -49,6 +56,8 @@ const APP: () = {
4956
);
5057
let (tx, rx) = serial.split();
5158

59+
rprintln!("done.");
60+
5261
init::LateResources {
5362
rx,
5463
tx,

0 commit comments

Comments
 (0)