init commit

This commit is contained in:
Robin Mueller committed 2026-06-10 20:21:07 +02:00
commit 1f805e672b
18 files changed
+1268

No files matched your search

+1
View File
@@ -0,0 +1 @@
target
+15
View File
@@ -0,0 +1,15 @@
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
# replace nRF82840_xxAA with your chip as listed in `probe-rs chip list`
runner = "probe-rs run --chip nRF52833_xxAA --allow-erase-all"
rustflags = [
"-C", "link-arg=-Tlink.x", # use the cortex-m-rt linker script
"-C", "linker=flip-link", # adds stack overflow protection
"-C", "link-arg=-Tdefmt.x", # defmt support
]
[build]
target = "thumbv7em-none-eabihf"
[env]
DEFMT_LOG = "info"
+1032
View File
File diff suppressed because it is too large. Load diff
+32
View File
@@ -0,0 +1,32 @@
[package]
edition = "2024"
name = "rust-app"
version = "0.1.0"
license = "MIT OR Apache-2.0"
publish = false
[dependencies]
embassy-executor = { version = "0.10.0", features = ["platform-cortex-m", "executor-thread", "executor-interrupt", "defmt"] }
embassy-time = { version = "0.5.1", features = ["defmt", "defmt-timestamp-uptime"] }
embassy-nrf = { version = "0.10.0", features = ["defmt", "nrf52833", "time-driver-rtc1", "unstable-pac", "time"] }
defmt = "1.0.1"
defmt-rtt = "1.0.0"
cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] }
cortex-m-rt = "0.7.0"
panic-probe = { version = "1.0.0", features = ["print-defmt"] }
embedded-hal = { version = "1.0" }
embedded-hal-async = { version = "1.0" }
embedded-hal-bus = { version = "0.3", features = ["async"] }
embedded-io = { version = "0.7.1", features = ["defmt"] }
embedded-io-async = { version = "0.7.0", features = ["defmt"] }
portable-atomic = "1"
[profile.release]
debug = 2
[package.metadata.embassy]
build = [
{ target = "thumbv7em-none-eabi", artifact-dir = "out/examples/nrf52840" }
]
+31
View File
@@ -0,0 +1,31 @@
//! This build script copies the `memory.x` file from the crate root into
//! a directory where the linker can always find it at build time.
//! For many projects this is optional, as the linker always searches the
//! project root directory -- wherever `Cargo.toml` is. However, if you
//! are using a workspace or have a more complicated build setup, this
//! build script becomes required. Additionally, by requesting that
//! Cargo re-run the build script whenever `memory.x` is changed,
//! updating `memory.x` ensures a rebuild of the application with the
//! new memory settings.
use std::env;
use std::fs::File;
use std::io::Write;
use std::path::PathBuf;
fn main() {
// Put `memory.x` in our output directory and ensure it's
// on the linker search path.
let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
File::create(out.join("memory.x"))
.unwrap()
.write_all(include_bytes!("memory.x"))
.unwrap();
println!("cargo:rustc-link-search={}", out.display());
// By default, Cargo will re-run a build script whenever
// any file in the project changes. By specifying `memory.x`
// here, we ensure the build script is only re-run when
// `memory.x` is changed.
println!("cargo:rerun-if-changed=memory.x");
}
+6
View File
@@ -0,0 +1,6 @@
MEMORY
{
/* NOTE 1 K = 1 KiBi = 1024 bytes */
FLASH : ORIGIN = 0x00000000, LENGTH = 512K
RAM : ORIGIN = 0x20000000, LENGTH = 128K
}
+32
View File
@@ -0,0 +1,32 @@
#![no_std]
#![no_main]
use embassy_executor::Spawner;
use embassy_time::Timer;
use rust_app as _;
use embassy_nrf::gpio::Output;
#[embassy_executor::main]
async fn main(_spawner: Spawner) -> ! {
let periphs = embassy_nrf::init(embassy_nrf::config::Config::default());
defmt::println!("-- microbit v2 Blinky application --");
let mut row1 = Output::new(
periphs.P0_21,
embassy_nrf::gpio::Level::Low,
embassy_nrf::gpio::OutputDrive::Standard,
);
let mut col1 = Output::new(
periphs.P0_28,
embassy_nrf::gpio::Level::Low,
embassy_nrf::gpio::OutputDrive::Standard,
);
row1.set_high();
col1.set_low();
loop {
row1.toggle();
Timer::after_millis(200).await;
}
}
+11
View File
@@ -0,0 +1,11 @@
#![no_std]
#![no_main]
use rust_app as _;
use embassy_executor::Spawner;
#[embassy_executor::main]
async fn main(_spawner: Spawner) -> ! {
defmt::info!("Hello, world!");
loop {}
}
+47
View File
@@ -0,0 +1,47 @@
#![no_std]
#![no_main]
use embassy_executor::Spawner;
use embedded_io_async::Write;
use rust_app as _;
use embassy_nrf::{
peripherals,
uarte::{self, Baudrate},
};
embassy_nrf::bind_interrupts!(
struct Irqs {
UARTE0 => uarte::InterruptHandler<peripherals::UARTE0>;
}
);
#[embassy_executor::main]
async fn main(_spawner: Spawner) -> ! {
let periphs = embassy_nrf::init(embassy_nrf::config::Config::default());
defmt::println!("-- microbit v2 UART echo application --");
let mut uarte_config = uarte::Config::default();
uarte_config.baudrate = Baudrate::BAUD115200;
let uart = uarte::Uarte::new(
periphs.UARTE0,
periphs.P1_08,
periphs.P0_06,
Irqs,
uarte_config,
);
let (mut uart_tx, mut uart_rx) =
uart.split_with_idle(periphs.TIMER0, periphs.PPI_CH0, periphs.PPI_CH1);
let mut rx_buf: [u8; 64] = [0; 64];
loop {
match uart_rx.read_until_idle(&mut rx_buf).await {
Ok(read_bytes) => match uart_tx.write_all(&rx_buf[0..read_bytes]).await {
Ok(_) => {
defmt::trace!("read {} bytes", &read_bytes);
}
Err(e) => defmt::error!("UART transmission error: {}", e),
},
Err(e) => defmt::error!("UART reception error: {}", e),
}
}
}
+5
View File
@@ -0,0 +1,5 @@
#![no_std]
use defmt_rtt as _;
use embassy_nrf as _;
use panic_probe as _;
+7
View File
@@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "host-client"
version = "0.1.0"
+20
View File
@@ -0,0 +1,20 @@
[package]
name = "host-client"
version = "0.1.0"
edition = "2024"
[dependencies]
clap = { version = "4", features = ["derive"] }
serialport = "4"
toml = "0.9"
serde = { version = "1", features = ["derive"] }
satrs-stm32f3-disco-rtic = { path = "../stm32f3-disco-rtic" }
spacepackets = { version = "0.17" }
embedded-models = { path = "../models" }
tmtc-utils = { git = "https://egit.irs.uni-stuttgart.de/rust/tmtc-utils.git", version = "0.1" }
postcard = { version = "1", features = ["alloc"] }
anyhow = "1"
cobs = "0.5"
fern = "0.7"
humantime = "2"
log = "0.4"
+17
View File
@@ -0,0 +1,17 @@
pub fn setup_logger() -> Result<(), fern::InitError> {
fern::Dispatch::new()
.format(|out, message, record| {
out.finish(format_args!(
"[{} {} {}] {}",
humantime::format_rfc3339_seconds(SystemTime::now()),
record.level(),
record.target(),
message
))
})
.level(log::LevelFilter::Info)
.chain(std::io::stdout())
.chain(fern::log_file("output.log")?)
.apply()?;
Ok(())
}
+3
View File
@@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}
+1
View File
@@ -0,0 +1 @@
book
+4
View File
@@ -0,0 +1,4 @@
[book]
title = "microbit-exercises"
authors = ["Robin Mueller"]
language = "en"
+3
View File
@@ -0,0 +1,3 @@
# Summary
- [Chapter 1](./chapter_1.md)
+1
View File
@@ -0,0 +1 @@
# Chapter 1