Skip to content

Setting up the Development Environment

David Lenfesty edited this page Feb 23, 2020 · 10 revisions

Repository setup

To download the repository:

git clone https://github.com/UofA-SPEAR/embedded
cd embedded
git submodule update --init

Dependencies

You need to have the following tools installed:

  • gcc-arm-none-eabi (GCC arm toolchain)
  • make tools
    • For windows, install MSYS
  • OpenOCD

OpenOCD Installation

(On debian-based systems)

sudo apt install make libtool pkg-config autoconf automake build-essential git libusb-1.0-0-dev
git clone git://git.code.sf.net/p/openocd/code openocd
cd openocd
./bootstrap
./configure
# After you configure, make sure ST-Link support is enabled
make -j
sudo make install

Embedded Toolchain Installation

Linux

Download the x86_64 linux version from here, and extract it somewhere.

Then you can simply add it to your path.

Documentation

Installing required Tools

Note that the supported environment is Linux preferably, I will help with Windows, but I can't make guarantees.

The supported IDE is VSCode.

VSCode

VSCode will need several extensions to work properly:

  • C/C++
  • cortex-debug

There should be a different .vscode folder for each project.

Autocomplete & Linting

Possibly more work coming this way in the future, but it's at a decent state now.

Unfortunately there aren't any VSCode tools for getting the include directories from a makefile setup. However, we can write our own target to output what we need. Essentially just follow these steps:

  • Run make vscode_scan in the project directory.
  • Delete anything inside the includePath variable in c_cpp_settings.json
  • Copy the output of make vscode_scan into the includePath variable
  • Delete the trailing comma and enter Ctrl-Shift-I to format the file
  • It should work now!

Important

These steps need to be run any time a change is made to the makefile, i.e. if you change which ChibiOS components you include.

Linux

Install the gcc-arm-none-eabi toolchain.

Download it from here.

Unpack it somewhere and make sure your $PATH points to the bin/ folder.

Windows

Install Git Bash

Install the ARM GNU toolchain from the ARM website: https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads

MAKE SURE YOU ADD THE TOOLCHAIN TO YOUR PATH.

It works to build the makefile using git Bash, or anything like linux for windows, but I haven't done full integration into windows yet. (mostly because windows development sucks)