User Guide: Updating The Bootloader

Michael Corcoran edited this page Oct 31, 2015 · 6 revisions
Clone this wiki locally

The bootloader is what allows you to upgrade your firmware at any time. From time to time the bootloader may need to be updated to allow more flash space for firmware etc.

Updating The Bootloader Using GCS

incomplete The basic process is:

  • Flash bu_<target>.tlfw using GCS,
  • boot the board,
  • wait for LED to stop pulsing on board,
  • wait some more,
  • unplug, hit rescue, replug,
  • flash fw_<target>.tlfw.

Rescuing Bricked Boards

Sometimes bad things happen and the bootloader gets damaged, e.g. you don't wait for the bootloader updater to finish, or the board becomes disconnected while the bootloader updater is running. You can repair the bootloader using the USB or serial interface as described in this section, or using a debugger as described in the OpenOCD section.

F1 Boards

CopterControl/CC3D, PipXtreme/TauLink.

incomplete

F3/F4 Boards

You will need dfu-util (cross-platform) or ST DfuSe (Windows only) to flash a new bootloader.

DFU-Util

You can either install dfu-util using the Tau Labs toolchain using the command make dfuutil_install, or using your package manager (e.g. apt-get install dfu-util on Ubuntu or with homebrew installed, brew install dfu-util on Mac). Addtionally you will need a bootloader bin for your flight controller. This will be named bl_<target>.bin and should be included in Tau Labs official releases.

The command to flash the bootloader is:

[tools/dfu-util/bin/]dfu-util -d 0483:df11 -R -a 0 -s 0x08000000 -D bl_<target>.bin

DfuSe

http://www.st.com/web/en/catalog/tools/FM147/CL1794/SC961/SS1533/PF257916 needs instructions

Using OpenOCD

Note: the below documentation is old and may need updating.

These steps assume you have already gotten a compiled firmware and GCS for your target board. If you have not, please go to www.taulabs.org and request help, as these wiki instructions will need to be updated.

Windows

  • Install the ST-Link Utility from here STM32 ST-LINK utility
  • Connect the STM32F3Discovery board using the mini-usb connector marked USB ST-LINK
  • Start STM32 ST-LINK Utility
  • Select Target->Connect from the menu
  • Select Target-> Erase Chip from the menu
  • Select File -> Open File... from the menu
  • Choose the appropriate bootloader. Tau Labs bootloaders are prefaced by bl_. For instance, if you are flashing the FlyingF3, this will be in builds/bl_flyingf3/bl_flyingf3.bin
  • Confirm the dialog box which asks to write the data to the target
  • Close the software

Linux and Mac OS X

cd into <TauLabs> directory and run

make openocd_install

That will create a local copy of openocd in your <TauLabs>/tools/ directory.

Make sure udev rules are correctly setup (see Installing udev rules)

You can then flash the bootloader using the following command:

make bl_flyingf3_program

and you're done :)

You can check that the bootloader was successfully written by unplugging and replugging the USB cable. The blue LED should begin slowly pulsing. This means that the bootloader is running, but that there is no valid autopilot firmware. Advance to the next step to rescue the firmware.