Switch to using rtt for cargo embed, update deps
parent
2796c15208
commit
8a2c59843f
11
Cargo.toml
11
Cargo.toml
|
@ -9,9 +9,10 @@ edition = "2018"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cortex-m = "0.6.2"
|
cortex-m = "0.6.2"
|
||||||
cortex-m-rt = "0.6.12"
|
cortex-m-rt = "0.6.12"
|
||||||
panic-halt = "0.2.0"
|
|
||||||
embedded-hal = "0.2.3"
|
embedded-hal = "0.2.3"
|
||||||
nb = "0.1.2"
|
nb = "1.0.0"
|
||||||
|
panic-rtt-target = { version = "0.1.0", features = ["cortex-m"] }
|
||||||
|
rtt-target = { version = "0.2.0", features = ["cortex-m"] }
|
||||||
ssd1306 = "0.3.1"
|
ssd1306 = "0.3.1"
|
||||||
switch-hal = "0.3.2"
|
switch-hal = "0.3.2"
|
||||||
|
|
||||||
|
@ -22,12 +23,8 @@ default-features = false
|
||||||
[dependencies.embedded-graphics]
|
[dependencies.embedded-graphics]
|
||||||
version = "0.6.1"
|
version = "0.6.1"
|
||||||
|
|
||||||
[dependencies.stm32f1]
|
|
||||||
version = "0.10.0"
|
|
||||||
features = ["stm32f103", "rt"]
|
|
||||||
|
|
||||||
[dependencies.stm32f1xx-hal]
|
[dependencies.stm32f1xx-hal]
|
||||||
version = "0.5.3"
|
version = "0.6.1"
|
||||||
features = ["rt", "stm32f103", "medium"]
|
features = ["rt", "stm32f103", "medium"]
|
||||||
|
|
||||||
[dependencies.either]
|
[dependencies.either]
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
[default.probe]
|
||||||
|
# USB vendor ID
|
||||||
|
# usb_vid = "1337"
|
||||||
|
# USB product ID
|
||||||
|
# usb_pid = "1337"
|
||||||
|
# Serial number
|
||||||
|
# serial = "12345678"
|
||||||
|
# The protocol to be used for communicating with the target.
|
||||||
|
protocol = "Swd"
|
||||||
|
# The speed in kHz of the data link to the target.
|
||||||
|
# speed = 1337
|
||||||
|
|
||||||
|
[default.flashing]
|
||||||
|
# Whether or not the target should be flashed.
|
||||||
|
enabled = true
|
||||||
|
# Whether or not the target should be halted after flashing.
|
||||||
|
halt_afterwards = false
|
||||||
|
# Whether or not bytes erased but not rewritten with data from the ELF
|
||||||
|
# should be restored with their contents before erasing.
|
||||||
|
restore_unwritten_bytes = false
|
||||||
|
# The path where an SVG of the assembled flash layout should be written to.
|
||||||
|
# flash_layout_output_path = "out.svg"
|
||||||
|
|
||||||
|
[default.general]
|
||||||
|
# The chip name of the chip to be debugged.
|
||||||
|
chip = "stm32f103C8"
|
||||||
|
# A list of chip descriptions to be loaded during runtime.
|
||||||
|
chip_descriptions = []
|
||||||
|
# The default log level to be used.
|
||||||
|
log_level = "Warn"
|
||||||
|
|
||||||
|
[default.rtt]
|
||||||
|
# Whether or not an RTTUI should be opened after flashing.
|
||||||
|
# This is exclusive and cannot be used with GDB at the moment.
|
||||||
|
enabled = true
|
||||||
|
# A list of channel associations to be displayed. If left empty, all channels are displayed.
|
||||||
|
channels = [
|
||||||
|
# { up = 0, down = 0, name = "name" }
|
||||||
|
]
|
||||||
|
# The duration in ms for which the logger should retry to attach to RTT.
|
||||||
|
timeout = 3000
|
||||||
|
# Whether timestamps in the RTTUI are enabled
|
||||||
|
show_timestamps = true
|
||||||
|
|
||||||
|
[default.gdb]
|
||||||
|
# Whether or not a GDB server should be opened after flashing.
|
||||||
|
# This is exclusive and cannot be used with RTT at the moment.
|
||||||
|
enabled = false
|
||||||
|
# The connection string in host:port format wher the GDB server will open a socket.
|
||||||
|
# gdb_connection_string
|
11
src/main.rs
11
src/main.rs
|
@ -1,12 +1,14 @@
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![no_main]
|
#![cfg_attr(not(doc), no_main)]
|
||||||
|
|
||||||
use core::{
|
use core::{
|
||||||
cell::RefCell,
|
cell::RefCell,
|
||||||
fmt::Write,
|
fmt::Write,
|
||||||
};
|
};
|
||||||
|
|
||||||
use panic_halt as _;
|
use rtt_target::{rprintln, rtt_init_print};
|
||||||
|
use panic_rtt_target as _;
|
||||||
|
|
||||||
|
|
||||||
use cortex_m_rt::entry;
|
use cortex_m_rt::entry;
|
||||||
|
|
||||||
|
@ -64,6 +66,9 @@ static COUNT: Mutex<RefCell<i32>> = Mutex::new(RefCell::new(0));
|
||||||
|
|
||||||
#[entry]
|
#[entry]
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
|
// Init buffers for debug printing
|
||||||
|
rtt_init_print!();
|
||||||
|
|
||||||
// Get access to the core peripherals from the cortex-m crate
|
// Get access to the core peripherals from the cortex-m crate
|
||||||
let mut core_periph = CorePeripherals::take().unwrap();
|
let mut core_periph = CorePeripherals::take().unwrap();
|
||||||
|
|
||||||
|
@ -170,6 +175,8 @@ fn main() -> ! {
|
||||||
// Turn the LED on via the OutputPin trait
|
// Turn the LED on via the OutputPin trait
|
||||||
led.on().unwrap();
|
led.on().unwrap();
|
||||||
|
|
||||||
|
rprintln!("Finished init, starting main loop");
|
||||||
|
|
||||||
let mut button_last = false;
|
let mut button_last = false;
|
||||||
// Microcontroller programs never exit main, so we must loop!
|
// Microcontroller programs never exit main, so we must loop!
|
||||||
loop {
|
loop {
|
||||||
|
|
Loading…
Reference in New Issue