mirror of
https://github.com/ferrous-systems/embedded-trainings-2020.git
synced 2024-09-27 14:00:04 +00:00
move uarte solution to its own folder
This commit is contained in:
parent
b8f34e47ad
commit
13b90e15a5
5 changed files with 84 additions and 1 deletions
19
down-the-stack/solutions/.cargo/config.toml
Normal file
19
down-the-stack/solutions/.cargo/config.toml
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
|
||||||
|
# (..)
|
||||||
|
rustflags = [
|
||||||
|
"-C", "linker=flip-link", # adds stack overflow protection
|
||||||
|
"-C", "link-arg=-Tdefmt.x", # defmt support
|
||||||
|
# (..)
|
||||||
|
]
|
||||||
|
|
||||||
|
[target.thumbv7em-none-eabihf]
|
||||||
|
# set custom cargo runner to flash & run on embedded target when we call `cargo run`
|
||||||
|
# for more information, check out https://github.com/knurling-rs/probe-run
|
||||||
|
runner = "probe-run --chip nRF52840_xxAA"
|
||||||
|
rustflags = [
|
||||||
|
"-C", "link-arg=-Tlink.x",
|
||||||
|
]
|
||||||
|
|
||||||
|
[build]
|
||||||
|
# cross-compile to this target
|
||||||
|
target = "thumbv7em-none-eabihf" # = ARM Cortex-M4
|
50
down-the-stack/solutions/Cargo.toml
Normal file
50
down-the-stack/solutions/Cargo.toml
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
[package]
|
||||||
|
authors = ["Tanks Transfeld <tanks.transfeld@ferrous-systems.com>"]
|
||||||
|
edition = "2018"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
name = "uarte_enable_solution"
|
||||||
|
version = "0.0.0"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
cortex-m = {version = "0.7.6", features = ["critical-section-single-core"]}
|
||||||
|
cortex-m-rt = "0.7.2"
|
||||||
|
dk_bsc = { path = "../dk_bsc" }
|
||||||
|
dk_pac = { path = "../dk_pac", features = ["critical-section"]}
|
||||||
|
heapless = "0.7.16"
|
||||||
|
panic-probe = { version = "0.3.0", features = ["print-defmt"] }
|
||||||
|
defmt = "0.3.2"
|
||||||
|
defmt-rtt = "0.3.2"
|
||||||
|
|
||||||
|
# optimize code in both profiles
|
||||||
|
[profile.dev]
|
||||||
|
codegen-units = 1
|
||||||
|
debug = 2
|
||||||
|
debug-assertions = true # !
|
||||||
|
incremental = false
|
||||||
|
lto = "fat"
|
||||||
|
opt-level = 'z' # !
|
||||||
|
overflow-checks = false
|
||||||
|
|
||||||
|
[profile.release]
|
||||||
|
codegen-units = 1
|
||||||
|
debug = 1
|
||||||
|
debug-assertions = false
|
||||||
|
incremental = false
|
||||||
|
lto = "fat"
|
||||||
|
opt-level = 3
|
||||||
|
overflow-checks = false
|
||||||
|
|
||||||
|
[features]
|
||||||
|
|
||||||
|
|
||||||
|
default = [
|
||||||
|
"other-feature"
|
||||||
|
]
|
||||||
|
other-feature = []
|
||||||
|
# do NOT modify these features
|
||||||
|
defmt-default = []
|
||||||
|
defmt-trace = []
|
||||||
|
defmt-debug = []
|
||||||
|
defmt-info = []
|
||||||
|
defmt-warn = []
|
||||||
|
defmt-error = []
|
4
down-the-stack/solutions/README.md
Normal file
4
down-the-stack/solutions/README.md
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# Solutions
|
||||||
|
|
||||||
|
This program does not build if the pac is not generated!
|
||||||
|
The file is only for reference.
|
|
@ -6,7 +6,7 @@ use cortex_m_rt::entry;
|
||||||
use dk_pac::UARTE0;
|
use dk_pac::UARTE0;
|
||||||
|
|
||||||
// this imports `down-the-stack/apps/lib.rs` to retrieve our global logger + panicking-behavior
|
// this imports `down-the-stack/apps/lib.rs` to retrieve our global logger + panicking-behavior
|
||||||
use apps as _;
|
use uarte_enable_solution as _;
|
||||||
use defmt;
|
use defmt;
|
||||||
use defmt_rtt as _; // global logger
|
use defmt_rtt as _; // global logger
|
||||||
|
|
10
down-the-stack/solutions/src/lib.rs
Normal file
10
down-the-stack/solutions/src/lib.rs
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#![no_std]
|
||||||
|
|
||||||
|
use panic_probe as _;
|
||||||
|
|
||||||
|
// same panicking *behavior* as `panic-probe` but doesn't print a panic message
|
||||||
|
// this prevents the panic message being printed *twice* when `defmt::panic` is invoked
|
||||||
|
#[defmt::panic_handler]
|
||||||
|
fn panic() -> ! {
|
||||||
|
cortex_m::asm::udf()
|
||||||
|
}
|
Loading…
Reference in a new issue