Merge #255 #257 #258
255: libmctp: Initial support of MCTP support r=jrvanwhy a=alistair23
MCTP (Management Component Transport Protocol) is a transport layer that is commonly used for server management. It supports multiple underlying protocols, but in this case we are focued on SMBus.
This adds initial support for a MCTP example in libtock-rs.
257: Add ninedof example r=jrvanwhy a=l162
For unit testing.
258: stm32f3discovery support r=jrvanwhy a=l162
Adds support for stm32f3discovery.
Co-authored-by: Alistair Francis <alistair.francis@wdc.com>
Co-authored-by: l162 <l162@hey.com>
diff --git a/Makefile b/Makefile
index e32decb..81829e2 100644
--- a/Makefile
+++ b/Makefile
@@ -18,6 +18,7 @@
@echo " - nrf52"
@echo " - imxrt1050"
@echo " - apollo3"
+ @echo " - stm32f3discovery"
@echo
@echo "Run 'make setup' to setup Rust to build libtock-rs."
@echo "Run 'make <board>' to build libtock-rs for that board"
@@ -132,6 +133,14 @@
flash-nrf52840:
PLATFORM=nrf52840 cargo run $(release) --target=thumbv7em-none-eabi --example $(EXAMPLE) $(features)
+.PHONY: stm32f3discovery
+stm32f3discovery:
+ PLATFORM=stm32f3discovery cargo build $(release) --target=thumbv7em-none-eabi --examples $(features)
+
+.PHONY: flash-stm32f3discovery
+flash-stm32f3discovery:
+ PLATFORM=stm32f3discovery cargo run $(release) --target=thumbv7em-none-eabi --example $(EXAMPLE) $(features)
+
.PHONY: opentitan
opentitan:
PLATFORM=opentitan cargo build $(release) --target=riscv32imc-unknown-none-elf --examples $(features)
diff --git a/boards/layout_stm32f3discovery.ld b/boards/layout_stm32f3discovery.ld
new file mode 100644
index 0000000..9368003
--- /dev/null
+++ b/boards/layout_stm32f3discovery.ld
@@ -0,0 +1,11 @@
+/* Layout for the stm32f3discovery board, usable by the examples in this repository. */
+
+MEMORY {
+ /* The application region is 64 bytes (0x40) */
+ FLASH (rx) : ORIGIN = 0x08020040, LENGTH = 0x00020000
+ SRAM (rwx) : ORIGIN = 0x20004000, LENGTH = 48K
+}
+
+MPU_MIN_ALIGN = 8K;
+
+INCLUDE layout_generic.ld
diff --git a/examples/ninedof.rs b/examples/ninedof.rs
new file mode 100644
index 0000000..ec0724c
--- /dev/null
+++ b/examples/ninedof.rs
@@ -0,0 +1,23 @@
+#![no_std]
+
+use libtock::println;
+use libtock::result::TockResult;
+use libtock::timer::Duration;
+
+libtock_core::stack_size! {0x800}
+
+#[libtock::main]
+async fn main() -> TockResult<()> {
+ let mut drivers = libtock::retrieve_drivers()?;
+
+ let mut timer_driver = drivers.timer.create_timer_driver();
+ let timer_driver = timer_driver.activate()?;
+ drivers.console.create_console();
+
+ loop {
+ println!("Mag: {}\n", drivers.ninedof.read_magnetometer()?);
+ println!("Accel: {}\n", drivers.ninedof.read_acceleration()?);
+ println!("Gyro: {}\n", drivers.ninedof.read_gyroscope()?);
+ timer_driver.sleep(Duration::from_ms(500)).await?;
+ }
+}