Setting up a development environment

Dealing with microcontrollers involves several tools as we’ll be dealing with an architecturedifferent than your laptop’s and we’ll have to run and debug programs on a “remote” device.

Documentation

Tooling is not everything though. Without documentation it is pretty much impossible to work withmicrocontrollers.

We’ll be referring to all these documents throughout this book:

HEADS UP All these links point to PDF files and some of them are hundreds of pages long andseveral MBs in size.

Tools

We’ll use all the tools listed below. Where a minimum version is not specified, any recent versionshould work but we have listed the version we have tested.

  • Rust 1.31 or a newer toolchain.

  • itmdump v0.3.1

  • OpenOCD >=0.8. Tested versions: v0.9.0 and v0.10.0

  • arm-none-eabi-gdb. Version 7.12 or newer highly recommended. Tested versions: 7.10, 7.11,7.12 and 8.1

  • cargo-binutils. Version 0.1.4 or newer.

  • minicom on Linux and macOS. Tested version: 2.7. Readers report that picocom also works butwe’ll use minicom in this text.

  • PuTTY on Windows.

If your laptop has Bluetooth functionality and you have the Bluetooth module, you can additionallyinstall these tools to play with the Bluetooth module. All these are optional:

  • Linux, only if you don’t have a Bluetooth manager application like Blueman.
    • bluez
    • hcitool
    • rfcomm
    • rfkill

macOS / OSX / Windows users only need the default bluetooth manager that ships with their OS.

Next, follow OS-agnostic installation instructions for a few of the tools:

rustc & Cargo

Install rustup by following the instructions at https://rustup.rs.

If you already have rustup installed double check that you are on the stablechannel and your stable toolchain is up to date. rustc -V should return a datenewer than the one shown below:

  1. $ rustc -V
  2. rustc 1.31.0 (abe02cefd 2018-12-04)

itmdump

  1. $ cargo install itm --vers 0.3.1
  2. $ itmdump -V
  3. itmdump 0.3.1

cargo-binutils

  1. $ rustup component add llvm-tools-preview
  2. $ cargo install cargo-binutils --vers 0.1.4
  3. $ cargo size -- -version
  4. LLVM (http://llvm.org/):
  5. LLVM version 8.0.0svn
  6. Optimized build.
  7. Default target: x86_64-unknown-linux-gnu
  8. Host CPU: skylake

OS specific instructions

Now follow the instructions specific to the OS you are using: