From 82b0f412374bb02400a6e1b0c990304020ad02e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Onur=20=C3=96zkan?= Date: Sat, 1 Aug 2026 20:54:41 +0300 Subject: [PATCH] boards/geprc-f722-v2: add F722 V2 declaration --- boards/geprc-f722-v2/Cargo.toml | 26 ++++++++++++++++++++++ boards/geprc-f722-v2/README.md | 7 ++++++ boards/geprc-f722-v2/build.rs | 9 ++++++++ boards/geprc-f722-v2/memory.x | 19 ++++++++++++++++ boards/geprc-f722-v2/src/board.rs | 37 +++++++++++++++++++++++++++++++ boards/geprc-f722-v2/src/main.rs | 11 +++++++++ 6 files changed, 109 insertions(+) create mode 100644 boards/geprc-f722-v2/Cargo.toml create mode 100644 boards/geprc-f722-v2/README.md create mode 100644 boards/geprc-f722-v2/build.rs create mode 100644 boards/geprc-f722-v2/memory.x create mode 100644 boards/geprc-f722-v2/src/board.rs create mode 100644 boards/geprc-f722-v2/src/main.rs diff --git a/boards/geprc-f722-v2/Cargo.toml b/boards/geprc-f722-v2/Cargo.toml new file mode 100644 index 0000000..41b1064 --- /dev/null +++ b/boards/geprc-f722-v2/Cargo.toml @@ -0,0 +1,26 @@ +[package] +name = "kaptan-geprc-f722-v2" +edition.workspace = true +license.workspace = true +repository.workspace = true +rust-version.workspace = true +version.workspace = true +build = "build.rs" + +[lints] +workspace = true + +[features] +firmware = [] +uart2-wire-test = ["firmware"] + +[dependencies] +kaptan-board = { path = "../../libs/kaptan-board" } +platform-stm32f7 = { path = "../../platforms/stm32f7" } + +[[bin]] +name = "kaptan-geprc-f722-v2" +path = "src/main.rs" +required-features = ["firmware"] +test = false +bench = false diff --git a/boards/geprc-f722-v2/README.md b/boards/geprc-f722-v2/README.md new file mode 100644 index 0000000..2a9c79f --- /dev/null +++ b/boards/geprc-f722-v2/README.md @@ -0,0 +1,7 @@ +# GEPRC GEP-F722-HD V2 + +Build from the workspace root: + +```sh +cargo build --release -p kaptan-geprc-f722-v2 --features firmware --target thumbv7em-none-eabihf +``` diff --git a/boards/geprc-f722-v2/build.rs b/boards/geprc-f722-v2/build.rs new file mode 100644 index 0000000..51a6630 --- /dev/null +++ b/boards/geprc-f722-v2/build.rs @@ -0,0 +1,9 @@ +fn main() { + 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") + ); +} diff --git a/boards/geprc-f722-v2/memory.x b/boards/geprc-f722-v2/memory.x new file mode 100644 index 0000000..39d4362 --- /dev/null +++ b/boards/geprc-f722-v2/memory.x @@ -0,0 +1,19 @@ +MEMORY +{ + FLASH : ORIGIN = 0x08000000, LENGTH = 512K + /* + * STM32F722 RAM totals 256 KiB: + * - DTCM: 64 KiB at 0x2000_0000 + * - SRAM1: 176 KiB at 0x2001_0000 + * - SRAM2: 16 KiB at 0x2003_C000 + * + * SRAM1 and SRAM2 are contiguous and are both accessible by DMA1 and DMA2. + * They form one 192 KiB default RAM region from 0x2001_0000 through + * 0x2003_FFFF. DTCM is intentionally kept separate for a future explicit + * placement policy rather than mixing CPU-critical and general allocations. + * + * TODO: Utilize DTCM. + * + */ + RAM : ORIGIN = 0x20010000, LENGTH = 192K +} diff --git a/boards/geprc-f722-v2/src/board.rs b/boards/geprc-f722-v2/src/board.rs new file mode 100644 index 0000000..f338ee3 --- /dev/null +++ b/boards/geprc-f722-v2/src/board.rs @@ -0,0 +1,37 @@ +//! Declarative support for the GEPRC TAKER F722 BLS 60A V2 stack. + +use kaptan_board::{BoardConfig, DataChannelRates, MavlinkEndpoint, VerticalSensingKind}; +use platform_stm32f7::{ + BoardError, F7Board, F7BoardBuilder, F722BoardRoutes, Icm42688, Mavlink, MotorOutputs, Pc3, + VerticalSensor, +}; + +/// ICM-42688-P-based GEP-F722-HD V2 paired with the 60 A stack. +pub struct GeprcF722V2; + +impl F7Board for GeprcF722V2 { + const CONFIG: BoardConfig = BoardConfig { + name: "GEPRC TAKER F722 BLS 60A V2 (ICM-42688-P)", + mavlink: MavlinkEndpoint { + system_id: 1, + component_id: 1, + }, + vertical_sensing: VerticalSensingKind::None, + data_channel: DataChannelRates { + service_hz: 100, + raw_imu_hz: 20, + range_hz: None, + optical_flow_hz: None, + heartbeat_hz: 2, + }, + }; + + fn build(platform: F7BoardBuilder) -> Result { + platform + .imu(Icm42688::on_spi3().with_drdy(Pc3)) + .motors(MotorOutputs::geprc_tim3_tim5().dshot600()) + .mavlink(Mavlink::on_usart2()) + .vertical_sensor(VerticalSensor::none()) + .build() + } +} diff --git a/boards/geprc-f722-v2/src/main.rs b/boards/geprc-f722-v2/src/main.rs new file mode 100644 index 0000000..3f45f58 --- /dev/null +++ b/boards/geprc-f722-v2/src/main.rs @@ -0,0 +1,11 @@ +#![no_std] +#![no_main] + +#[cfg(not(feature = "uart2-wire-test"))] +mod board; + +#[cfg(feature = "uart2-wire-test")] +platform_stm32f7::geprc_uart2_wire_test!(); + +#[cfg(not(feature = "uart2-wire-test"))] +platform_stm32f7::flight_firmware!(board::GeprcF722V2);