boards/kakute-f7-mini-v3: simple led demo for board testing

Signed-off-by: Onur Özkan <work@onurozkan.dev>
This commit is contained in:
Onur Özkan committed 2026-07-18 14:43:59 +03:00
1 parent bd9fef26e5
commit e0065f8963
5 files changed
+56 -9

No files matched your search

Generated
+1
View File
@@ -104,6 +104,7 @@ name = "kaptan-kakute-f7-mini-v3"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"cortex-m", "cortex-m",
"cortex-m-rt",
"kaptan-spec", "kaptan-spec",
"panic-halt", "panic-halt",
"rtic", "rtic",
+2 -1
View File
@@ -11,9 +11,10 @@ firmware = []
[dependencies] [dependencies]
cortex-m = "0.7" cortex-m = "0.7"
cortex-m-rt = "0.7"
panic-halt = "1" panic-halt = "1"
rtic = { version = "2.3", default-features = false, features = ["thumbv7-backend"] } rtic = { version = "2.3", default-features = false, features = ["thumbv7-backend"] }
stm32f7 = { version = "0.16", default-features = false, features = ["rt", "stm32f745"] } stm32f7 = { version = "0.16", default-features = false, features = ["rt", "stm32f722"] }
[build-dependencies] [build-dependencies]
kaptan-spec = { path = "../../libs/kaptan-spec", features = ["std"] } kaptan-spec = { path = "../../libs/kaptan-spec", features = ["std"] }
+7
View File
@@ -1,3 +1,10 @@
fn main() { fn main() {
kaptan_spec::validate_package(); kaptan_spec::validate_package();
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=memory.x");
println!("cargo:rustc-link-arg=-Tlink.x");
println!(
"cargo:rustc-link-search={}",
std::env::var("CARGO_MANIFEST_DIR").expect("Cargo must set CARGO_MANIFEST_DIR")
);
} }
+5
View File
@@ -0,0 +1,5 @@
MEMORY
{
FLASH : ORIGIN = 0x08000000, LENGTH = 512K
RAM : ORIGIN = 0x20000000, LENGTH = 256K
}
+41 -8
View File
@@ -1,9 +1,10 @@
#![no_std] #![no_std]
#![no_main] #![no_main]
use cortex_m_rt as _;
use panic_halt as _; use panic_halt as _;
#[rtic::app(device = stm32f7::stm32f745, peripherals = true)] #[rtic::app(device = stm32f7::stm32f722, peripherals = true)]
mod app { mod app {
#[shared] #[shared]
struct Shared { struct Shared {
@@ -13,11 +14,30 @@ mod app {
#[local] #[local]
struct Local { struct Local {
// TODO // TODO
led: stm32f7::stm32f722::GPIOD,
led_output_high: bool,
} }
#[init] #[init]
fn init(_context: init::Context) -> (Shared, Local) { fn init(context: init::Context) -> (Shared, Local) {
(Shared {}, Local {}) let device = context.device;
device
.RCC
.ahb1enr()
.modify(|_, write| write.gpioden().set_bit());
device
.GPIOD
.moder()
.modify(|_, write| write.moder2().output());
(
Shared {},
Local {
led: device.GPIOD,
led_output_high: false,
},
)
} }
#[task(binds = EXTI4, priority = 15)] #[task(binds = EXTI4, priority = 15)]
@@ -25,12 +45,25 @@ mod app {
// TODO // TODO
} }
#[idle] #[idle(local = [led, led_output_high])]
fn idle(_context: idle::Context) -> ! { fn idle(context: idle::Context) -> ! {
// TODO
loop { loop {
cortex_m::asm::wfi(); if *context.local.led_output_high {
context
.local
.led
.bsrr()
.write(|write| write.br2().set_bit());
} else {
context
.local
.led
.bsrr()
.write(|write| write.bs2().set_bit());
}
*context.local.led_output_high = !*context.local.led_output_high;
cortex_m::asm::delay(8_000_000);
} }
} }
} }