Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

More about Flashing:

Depending on what sort of wok you're doing, you may need to flash a dev board (or the real ZeroPilot) and debug your code in hardware to do things like observe signals with oscilloscopes or testing drivers or whatever.

There’s a few ways of doing this. The way I recommend is to use ST’s ide, but this guide will also explain the legacy way of doing it from the command line and setting up your own tools in a separate IDE.

Also, since your’e here and looking to deal with hardware, odds are your’e probably going to need ST's CubeMX tool to generate particular HAL drivers. If there’s no guide for doing that at the time your’e reading this, ask someone who knows what they’re doing to write one. But anyway, back to flashing/debugging.

Recommended way

For this, you're going to have to download ST's ID. There’s versions available for Linux, Mac and Windows, so you should be good. Now, here are the instructions:

  1. In the IDE, create a new project. You can do this by clicking File->new->STM32 project.

  2. This will open up the target selector.

    Image Added

    In the part number field, enter the part number of the relevant microcontroller (STM32F765ZG for the autopilot chip and STM32F030RC for the safety chip). Choose that part and click next.

  3. Now, give the project a name, select C++, empty, and click finish.

    Image Added

  4. Now, click on the green bug in the task bar

    Image Added

  5. This will pull up the debug configuration menu. You have to point the debugger to the elf file we built with our build system rather than the garbage that STM defaults to. So browse for the project. Our elf files are located in ZeroPilot-SW\Autopilot\build and are produced after a successful build.

    Image Added
  6. Sweet, now just make sure your debugger is plugged in, connected to the board, and everything is powered on. Hit apply then OK to begin the debug session.

  7. It is possible that upon launching the debug executable, ST has a hard time finding the source files. If that’s the case, just open the corresponding source files in the IDE (File->Open File)

  8. Awesome, your’e good to go. If your’e new to debugging in an eclipse based IDE, I’d recommend looking for some tutorials on YouTube to get familiar with doing that.

Legacy way

This stuff is from before my time. If you’d like to try, have your hand at it.

Flashing is the process by which your computer communicates to an external programmer over USB, and flashes the target MCU with the binary you generated using the toolchain. The external programmers are called STLink progammers, and are designated by several version numbers. The ones we have in the bay are either STLinkV2 or STLink V2.1 programmers, and look like this:

...

Most of the time you'll wanna select the STLINKV2 configuration, since we have very few programmers that are STLINKV2.1. Click the play button to flash the chip, or the bug button to debug it!

Install instructions for flasher/debugger (only for windows atm):

Install the st-link drivers mentioned above

Download st-link

unzip st-link and place its contents in program files (x86)

Add C:\Program Files (x86)\stlink-1.6.1-x86_64-w64-mingw32\bin to your path environment variable

To begin a debug session:

plug the programmer into the board and into your computer

power the board

execute ZeroPilot-SW/Autopilot/Tools/debug.bat

A couple windows will open, one of them runs gdb. The program is now under your control, you may use gdb as you wish (run "continue" to begin executing the program)