Skip to content

p-kraszewski/stm32-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Programming STM32 microcontrollers in Rust

Strongly influenced by this article by @japaric (Jorge Aparicio). Thank you!

Prerequisites

Everything is based on Ubuntu 16.10 platform. Not tested on other.

What you will need:

  • Rust-nigtly, preferably installed via rustup.
  • rust-src, installed via rustup component add rust-src
  • xargo, installed via cargo install xargo, also by @japaric.

Plans

As of now - this is strongly work in progress. I plan to make it as complete as possible for the following processors (with roughly that order of importance):

If time gives, I'll try the STM32F746NG behemoth, as found in 32F746GDISCOVERY.

Purpose

To have maximally elastic macro- and object-based system to program 32-bit ARM processors, with some light std:: library focused on memory-constrained systems.

Each peripheral device will be implemented as a class with respective configuration and query methods (and of course a direct registry access).

Device memory map

// ...
iomap!{
    GPIO @ 0x40020000 -> GPIOA;
    GPIO @ 0x40020400 -> GPIOB;
    GPIO @ 0x40020800 -> GPIOC;
    GPIO @ 0x40020C00 -> GPIOD;
    GPIO @ 0x40021000 -> GPIOE
}
// ...

Device usage

with class-like syntax:

// ...
let n = io!{GPIOE.SPEED};
io!{GPIOE.SPEED = n+5};
// ...
io!{GPIOE.setmode(GPIO_PIN::PIN03, GPIO_MODE::Output)};
io!{GPIOE.bset(0b0000000000001000)};
// ...

or with descriptive syntax:

// ...
let n = io!{get SPEED from GPIOE};
io!{set SPEED in GPIOE to n+5};
// ...
io!{with GPIOE do setmode(GPIO_PIN::PIN03, GPIO_MODE::Output)};
io!{with GPIOE do bset(0b0000000000001000)};
// ...

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages