Skip to content

Commit

Permalink
add st-nucleo-wb55 support
Browse files Browse the repository at this point in the history
  • Loading branch information
kaspar030 committed Apr 25, 2024
1 parent 2299651 commit baa67bd
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 4 deletions.
10 changes: 10 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions laze-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,16 @@ contexts:
RUSTFLAGS:
- --cfg context=\"stm32f401retx\"

- name: stm32wb55rgvx
parent: stm32
selects:
- thumbv7em-none-eabi # actually eabihf, but riot-rs doesn't support hard float yet
env:
PROBE_RS_CHIP: STM32WB55RGVx
PROBE_RS_PROTOCOL: swd
RUSTFLAGS:
- --cfg context=\"stm32wb55rgvx\"

- name: stm32h755zitx
parent: stm32
selects:
Expand Down Expand Up @@ -699,6 +709,14 @@ builders:
selects:
- probe-rs-run

- name: st-nucleo-wb55
parent: stm32wb55rgvx
#FLASH : ORIGIN = 0x08000000, LENGTH = 512K
#RAM : ORIGIN = 0x20000000, LENGTH = 96K
# rcc.cfgr.use_hse(8.mhz()).freeze();
selects:
- probe-rs-run

apps:
# define a dummy host application so the host tasks work
- name: host
Expand Down
1 change: 1 addition & 0 deletions src/riot-rs-boards/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ nrf52840dk = { optional = true, path = "nrf52840dk" }
nrf52dk = { optional = true, path = "nrf52dk" }
nrf5340dk = { optional = true, path = "nrf5340dk" }
st-nucleo-f401re = { optional = true, path = "st-nucleo-f401re" }
st-nucleo-wb55 = { optional = true, path = "st-nucleo-wb55" }
rpi-pico = { optional = true, path = "rpi-pico" }
particle-xenon = { optional = true, path = "particle-xenon" }
st-nucleo-h755zi-q = { optional = true, path = "st-nucleo-h755zi-q" }
Expand Down
2 changes: 2 additions & 0 deletions src/riot-rs-boards/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ cfg_if! {
pub use rpi_pico as board;
} else if #[cfg(feature = "st-nucleo-f401re")] {
pub use st_nucleo_f401re as board;
} else if #[cfg(feature = "st-nucleo-wb55")] {
pub use st_nucleo_wb55 as board;
} else if #[cfg(feature = "st-nucleo-h755zi-q")] {
pub use st_nucleo_h755zi_q as board;
} else if #[cfg(feature = "nintendo-game-and-watch-mario")] {
Expand Down
11 changes: 11 additions & 0 deletions src/riot-rs-boards/st-nucleo-wb55/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
name = "st-nucleo-wb55"
version = "0.1.0"
authors = ["Kaspar Schleiser <kaspar@schleiser.de>"]
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
embassy-stm32 = { workspace = true, features = ["stm32wb55rg"] }
riot-rs-debug = { workspace = true, features = ["rtt-target"] }
riot-rs-rt.workspace = true
15 changes: 15 additions & 0 deletions src/riot-rs-boards/st-nucleo-wb55/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use std::env;
use std::fs::copy;
use std::path::PathBuf;

fn main() {
// Put the linker script somewhere the linker can find it
let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());

copy("memory.x", out.join("memory.x")).unwrap();

println!("cargo:rustc-link-search={}", out.display());

println!("cargo:rerun-if-changed=memory.x");
println!("cargo:rerun-if-changed=build.rs");
}
5 changes: 5 additions & 0 deletions src/riot-rs-boards/st-nucleo-wb55/memory.x
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
MEMORY
{
FLASH : ORIGIN = 0x08000000, LENGTH = 1024K /* BANK_1 */
RAM : ORIGIN = 0x20000000, LENGTH = 192K
}
5 changes: 5 additions & 0 deletions src/riot-rs-boards/st-nucleo-wb55/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#![no_std]

pub fn init() {
riot_rs_debug::println!("boards::st-nucleo-wb55::init()");
}
6 changes: 2 additions & 4 deletions src/riot-rs-embassy/src/arch/stm32/mod.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
pub(crate) use embassy_executor::InterruptExecutor as Executor;
pub use embassy_stm32::interrupt;
pub use embassy_stm32::interrupt::USART2 as SWI;
pub use embassy_stm32::interrupt::LPUART1 as SWI;
pub use embassy_stm32::{peripherals, Config, OptionalPeripherals, Peripherals};

use embassy_stm32::interrupt::{InterruptExt, Priority};

#[interrupt]
unsafe fn USART2() {
unsafe fn LPUART1() {
// SAFETY:
// - called from ISR
// - not called before `start()`, as the interrupt is enabled by `start()`
Expand Down Expand Up @@ -42,8 +42,6 @@ pub fn init(_config: Config) -> OptionalPeripherals {
// config.rcc.mux.usbsel = mux::Usbsel::HSI48;
}
println!("{}{}", file!(), line!());
interrupt::USART2.set_priority(Priority::P7);
println!("{}{}", file!(), line!());
let peripherals = embassy_stm32::init(config);
println!("{}{}", file!(), line!());
OptionalPeripherals::from(peripherals)
Expand Down

0 comments on commit baa67bd

Please sign in to comment.