A template for building applications for the stm32f3-Discovery board
This project was started from the cortex-m-quickstart project from Cortex-M team. Included is a project to demonstrate RTIC (Real-Time Interrupt-driven Concurrency) an RTOS-like framework.
There are two ways to run under gdb:
-
In the root directory run openocd, In a different terminal run cargo run
or
-
In the root directory run cargo embed. In a different terminal run gdb-multiarch -x gdb.run target/thumbv7em-none-eabihf/debug/stm32f3disc-quickstart
examples/rtic is a project to demonstrate RTIC, it includes a task to rotate the LEDs and tasks to transmit "Hello World" and echo characters. To run, change to examples/rtic and run cargo enbed.
To build embedded programs using this template you'll need:
-
Rust 1.31, 1.30-beta, nightly-2018-09-13 or a newer toolchain. e.g.
rustup default beta
-
The
cargo generate
subcommand. Installation instructions. -
rust-std
components (pre-compiledcore
crate) for the ARM Cortex-M targets. Run:
$ rustup target add thumbv6m-none-eabi thumbv7m-none-eabi thumbv7em-none-eabi thumbv7em-none-eabihf
You can find this information in the data sheet or the reference manual of your device.
In this example we'll be using the STM32F3DISCOVERY. This board contains an STM32F303VCT6 microcontroller. This microcontroller has:
-
A Cortex-M4F core that includes a single precision FPU
-
256 KiB of Flash located at address 0x0800_0000.
-
40 KiB of RAM located at address 0x2000_0000. (There's another RAM region but for simplicity we'll ignore it).
- Instantiate the template.
$ cargo generate --git https://github.com/rust-embedded/cortex-m-stm32f3disc-quickstart
Project Name: app
Creating project called `app`...
Done! New project created /tmp/app
$ cd app
$ cargo build
This template includes launch configurations for debugging CortexM programs with Visual Studio Code located in the .vscode/
directory.
See .vscode/README.md for more information.
If you're not using VS Code, you can safely delete the directory from the generated project.
This template is licensed under either of
-
Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
-
MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Contribution to this crate is organized under the terms of the Rust Code of Conduct, the maintainer of this crate, the Cortex-M team, promises to intervene to uphold that code of conduct.