Author
Topic: Support for Arduino Boards (Read 65 Times)
Role
Posts: 3
Points: 0

Do you have an Arduino board? You can use Iron Coder to develop Rust programs and flash them onto your board! The following tutorial includes the following three sections:

  • Installation steps to add support for Arduino Boards.

  • Flashing a Program onto Arduino Uno through the Alarm Clock Example

  • Exploring more Arduino Rust example programs

Support for Arduino Boards

Installation

macOS

Run the following in your terminal to install dependencies: avr-gcc and avrdude.

brew tap osx-cross/avr    

brew install avr-gcc     

brew install avrdude           

Windows

Install GCC compiler via MinGW-w64. If you have run any C or C++ program on your computer, you most likely already have this installed!

Helpful Article for installing GCC compiler: https://www.linkedin.com/pulse/installing-gcc-compiler-windows-run-c-program-gitbash-david-michael/

 

To get AVRDUDE for Windows, install the latest version from their Releases page.

 

Flashing an Arduino Uno - Alarm Clock Example Code

Open the Alarm Clock example from the example menu.

 

Press Start Development to navigate to the code editor. View the File Explorer.

 

The .cargo folder contains the config.toml file which contains the configuration for telling cargo to use ravedude for uploading code to board and for specifying the target for cargo build. Note that our example is for the Arduino Uno.

The avr-specs folder contains the avr-atmega328p.json file. This will tell cargo to build for the given architecture.

 

The source folder contains the main.rs file which is our Rust code!

 

To create your own example, you need your source files, cargo configuration file, and AVR specification file in the provided structure.

 

More Arduino Examples

Check out https://github.com/Rahix/avr-hal/tree/af47f08c315dfacd7d1f8437f8bcefc34cec0959 for more embedded Rust examples for a number of Arduino Boards.

The examples are located in the examples folder.

More AVR specification json files can be found in the avr-specs folder. 

 

Remember to include your cargo configuration file and AVR specification file in your project to flash the program onto your board.

 


You need to login to comment or reply!