All Projects → rust-embedded → Cortex M Quickstart

rust-embedded / Cortex M Quickstart

Template to develop bare metal applications for Cortex-M microcontrollers

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Cortex M Quickstart

Cortex M Rtic
Real-Time Interrupt-driven Concurrency (RTIC) framework for ARM Cortex-M microcontrollers
Stars: ✭ 623 (+67.47%)
Mutual labels:  bare-metal, arm, microcontroller, cortex-m, no-std
stm32f103xx
DEPRECATED
Stars: ✭ 31 (-91.67%)
Mutual labels:  arm, microcontroller, cortex-m, no-std
alloc-cortex-m
A heap allocator for Cortex-M processors
Stars: ✭ 139 (-62.63%)
Mutual labels:  arm, microcontroller, cortex-m, no-std
mdepx
MDEPX — A BSD-style RTOS
Stars: ✭ 17 (-95.43%)
Mutual labels:  arm, microcontroller, cortex-m, bare-metal
Cortex M
Low level access to Cortex-M processors
Stars: ✭ 379 (+1.88%)
Mutual labels:  arm, microcontroller, cortex-m, no-std
Xpcc
DEPRECATED, use our successor library https://modm.io instead
Stars: ✭ 177 (-52.42%)
Mutual labels:  arm, microcontroller, cortex-m
Ferret
Ferret is a free software lisp implementation for real time embedded control systems.
Stars: ✭ 878 (+136.02%)
Mutual labels:  bare-metal, arm, microcontroller
rnk
rnk is a RTOS targeting ARM architecture.
Stars: ✭ 22 (-94.09%)
Mutual labels:  arm, microcontroller, cortex-m
Pyocd
Open source Python library for programming and debugging Arm Cortex-M microcontrollers
Stars: ✭ 550 (+47.85%)
Mutual labels:  arm, microcontroller, cortex-m
drone-stm32-map
STM32 peripheral mappings for Drone, an Embedded Operating System.
Stars: ✭ 16 (-95.7%)
Mutual labels:  arm, bare-metal, no-std
drone-cortexm
ARM® Cortex®-M platform crate for Drone, an Embedded Operating System.
Stars: ✭ 31 (-91.67%)
Mutual labels:  arm, bare-metal, no-std
betafpv-f3
Board Support Crate for the BetaFPV F3 Drone Flight Controller
Stars: ✭ 37 (-90.05%)
Mutual labels:  arm, cortex-m, no-std
DemOS
Free, simple, extremely lightweight, stackless, cooperative, co-routine system (OS) for microcontrollers
Stars: ✭ 18 (-95.16%)
Mutual labels:  arm, microcontroller, cortex-m
Cortex M Rt
Minimal startup / runtime for Cortex-M microcontrollers
Stars: ✭ 286 (-23.12%)
Mutual labels:  arm, cortex-m, no-std
async-stm32f1xx
Abstractions for asynchronous programming on the STM32F1xx family of microcontrollers.
Stars: ✭ 24 (-93.55%)
Mutual labels:  arm, cortex-m, no-std
Daplink
Stars: ✭ 1,162 (+212.37%)
Mutual labels:  arm, microcontroller, cortex-m
Distortos
object-oriented C++ RTOS for microcontrollers
Stars: ✭ 354 (-4.84%)
Mutual labels:  arm, microcontroller, cortex-m
m4vga-rs
VGA-style video output for STM32F4 processors, in Rust
Stars: ✭ 122 (-67.2%)
Mutual labels:  microcontroller, cortex-m, no-std
Tock
A secure embedded operating system for microcontrollers
Stars: ✭ 3,258 (+775.81%)
Mutual labels:  arm, microcontroller, cortex-m
Svd2rust
Generate Rust register maps (`struct`s) from SVD files
Stars: ✭ 347 (-6.72%)
Mutual labels:  arm, microcontroller, cortex-m

cortex-m-quickstart

A template for building applications for ARM Cortex-M microcontrollers

This project is developed and maintained by the Cortex-M team.

Dependencies

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-compiled core crate) for the ARM Cortex-M targets. Run:

$ rustup target add thumbv6m-none-eabi thumbv7m-none-eabi thumbv7em-none-eabi thumbv7em-none-eabihf

Using this template

NOTE: This is the very short version that only covers building programs. For the long version, which additionally covers flashing, running and debugging programs, check the embedded Rust book.

  1. Before we begin you need to identify some characteristics of the target device as these will be used to configure the project:
  • The ARM core. e.g. Cortex-M3.

  • Does the ARM core include an FPU? Cortex-M4F and Cortex-M7F cores do.

  • How much Flash memory and RAM does the target device has? e.g. 256 KiB of Flash and 32 KiB of RAM.

  • Where are Flash memory and RAM mapped in the address space? e.g. RAM is commonly located at address 0x2000_0000.

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).

  1. Instantiate the template.
$ cargo generate --git https://github.com/rust-embedded/cortex-m-quickstart
 Project Name: app
 Creating project called `app`...
 Done! New project created /tmp/app

$ cd app
  1. Set a default compilation target. There are four options as mentioned at the bottom of .cargo/config. For the STM32F303VCT6, which has a Cortex-M4F core, we'll pick the thumbv7em-none-eabihf target.
$ tail -n6 .cargo/config
[build]
# Pick ONE of these compilation targets
# target = "thumbv6m-none-eabi"    # Cortex-M0 and Cortex-M0+
# target = "thumbv7m-none-eabi"    # Cortex-M3
# target = "thumbv7em-none-eabi"   # Cortex-M4 and Cortex-M7 (no FPU)
target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU)
  1. Enter the memory region information into the memory.x file.
$ cat memory.x
/* Linker script for the STM32F303VCT6 */
MEMORY
{
  /* NOTE 1 K = 1 KiBi = 1024 bytes */
  FLASH : ORIGIN = 0x08000000, LENGTH = 256K
  RAM : ORIGIN = 0x20000000, LENGTH = 40K
}
  1. Build the template application or one of the examples.
$ cargo build

VS Code

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.

License

This template is licensed under either of

at your option.

Contribution

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.

Code of Conduct

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].