ODrive Documentation

High performance motor control

View the Project on GitHub madcowswe/ODrive

Help improve these docs: submit edits using the link in the top right.

If you need help, please search or ask the ODrive Community.

Configuring Visual Studio Code

VSCode is the recommended IDE for working with the ODrive codebase. It is a light-weight text editor with Git integration and GDB debugging functionality.

Before doing the VSCode setup, make sure you’ve installed all of your prerequisites

Setup Procedure

  1. Clone the ODrive repository
  2. Download VSCode
  3. Open VSCode
  4. Install extensions. This can be done directly from VSCode (Ctrl+Shift+X)
    • Required extensions:
      • C/C++
      • Cortex-Debug
    • Recommended Extensions:
      • Include Autocomplete
      • Path Autocomplete
      • Auto Comment Blocks
  5. Create an environment variable named ARM_GCC_ROOT whose value is the location of the GNU Arm Embedded Toolchain (.e.g C:\Program Files (x86)\GNU Tools Arm Embedded\7 2018-q2-update) that you installed in the prerequisites section of the developer’s guide.
  6. Restart VSCode
  7. Open the VSCode Workspace file, which is located in the root of the ODrive repository. It is called ODrive_Workspace.code-workspace. The first time you open it, VSCode will install some dependencies. If it fails, you may need to change your proxy settings.

You should now be ready to compile and test the ODrive project.

Building the Firmware

A terminal window will open with your native shell. VSCode is configured to run the command make -j4 in this terminal.

Flashing the Firmware

A terminal window will open with your native shell. VSCode is configured to run the command make flash in this terminal.

If the flashing worked, you can connect to the board using the odrivetool.

Debugging

An extension called Cortex-Debug has recently been released which is designed specifically for debugging ARM Cortex projects. You can read more on Cortex-Debug here: https://github.com/Marus/cortex-debug

Note: If developing on Windows, you should have arm-none-eabi-gdb and openOCD on your PATH.

Cleaning the Build

This sometimes needs to be done if you change branches.