Switch to using rtt for cargo embed, update deps

master
Levi Pearson 2020-07-10 01:29:18 -06:00
parent 2796c15208
commit 8a2c59843f
3 changed files with 63 additions and 9 deletions

View File

@ -9,9 +9,10 @@ edition = "2018"
[dependencies]
cortex-m = "0.6.2"
cortex-m-rt = "0.6.12"
panic-halt = "0.2.0"
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"
switch-hal = "0.3.2"
@ -22,12 +23,8 @@ default-features = false
[dependencies.embedded-graphics]
version = "0.6.1"
[dependencies.stm32f1]
version = "0.10.0"
features = ["stm32f103", "rt"]
[dependencies.stm32f1xx-hal]
version = "0.5.3"
version = "0.6.1"
features = ["rt", "stm32f103", "medium"]
[dependencies.either]

50
Embed.toml Normal file
View File

@ -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

View File

@ -1,12 +1,14 @@
#![no_std]
#![no_main]
#![cfg_attr(not(doc), no_main)]
use core::{
cell::RefCell,
fmt::Write,
};
use panic_halt as _;
use rtt_target::{rprintln, rtt_init_print};
use panic_rtt_target as _;
use cortex_m_rt::entry;
@ -64,6 +66,9 @@ static COUNT: Mutex<RefCell<i32>> = Mutex::new(RefCell::new(0));
#[entry]
fn main() -> ! {
// Init buffers for debug printing
rtt_init_print!();
// Get access to the core peripherals from the cortex-m crate
let mut core_periph = CorePeripherals::take().unwrap();
@ -170,6 +175,8 @@ fn main() -> ! {
// Turn the LED on via the OutputPin trait
led.on().unwrap();
rprintln!("Finished init, starting main loop");
let mut button_last = false;
// Microcontroller programs never exit main, so we must loop!
loop {