Luftboot

From PaparazziUAV
Revision as of 12:17, 23 May 2013 by Openuas (talk | contribs)
Jump to navigation Jump to search

= Introduction

Luftboot is the name for a small piece of software called a bootloader and is used for Lisa/M v2.0 to be able to simply upload new airframe an flightplans to the autopilotboard.

Sourcecode

The sourcecode is available in the paparazzi/luftboot repository on github. It is also integrated into the master branch of paparazzi as a submodule.

Uploading the Luftboot USB Bootloader

If you bought your Lisa/M v2.0 (e.g. from Transition Robotics Inc.) it should already come with the bootloader installed.

Only if you have a strong reason to (re)upload or update the bootloader, read on...

otherwise better visit this page Lisa/M v2.0#Uploading new software

Required components

So now you decided; Yes, because I have good reasons I want to re-upload the luftboot bootloader you need some equipment.

  • Floss-JTAG debugger or Blacksphere mini JTAG
  • Lisa/M board
  • PC

Procedure

The easiest way is to checkout the master branch and use the integrated luftboot git submodule:

  1. Check out the paparazzi master branch
    git checkout master
    
  2. If you were already using the master branch luftboot should already be built, otherwise:
    make ext
    
  3. Change directory into the luftboot/src folder, in paparazzi:
    cd sw/ext/luftboot/src
    
  4. Flash the Lisa/M v2.0 Attach the floss-jtag unit to the PC and connect it to the Lisa/M via the black connector. Power the Lisa/M (easiest way is to connect to the PC via a micro-USB cable).
    make flash DEV_SERIAL="LM2-ser"
    

    where "ser" stands for the serial number of your Lisa/M. So for example if you have lisa/m with the serial number 020 this would be:

    make flash DEV_SERIAL="LM2-020"
    

    To use the BlackMagicProbe instead of OpenOCD and FlossJTAG on linux:

    make flash DEV_SERIAL="LM2-020" BMP_PORT=/dev/ttyACM0
    

    or on OSX:

    make flash DEV_SERIAL="LM2-020" BMP_PORT=/dev/cu.usbmodem<serial>
    


As an alternative, you can also clone the Luftboot repository directly:

git clone https://github.com/paparazzi/luftboot.git

But then you manually have to install a recent version of libopencm3 (for example into /opt/libopencm3) in order to build luftboot. The libopencm3 from the paparazzi-arm-multilib package is not new enough to build luftboot.

Entering Bootloader Mode

Currently Luftboot cannot switch into bootloader mode using software only by USB.
However if you have a recent Luftboot version (since December 2012)

If you are in bootloader mode, the leds will cycle up and down:

Luftboot.gif

The boot sequence is:

  • Luftboot
    • Check if ADC2 is configured as output pull down indicating software bootloader request
      • If ADC2 output pull down: initialize usb and stay in bootloader mode
    • Setting the ADC2 pin to input pull up
    • Checking if the ADC2 pin is low
      • If ADC2 low: initialize USB and stay in bootloader mode
      • If ADC2 high: check if there is a payload at 0x8002000
        • If payload detected: set vector table pointer to be at 0x8002000 and jump to the reset handler of the payload
        • If payload not detected: initialize USB and stay in bootloader mode

Force bootloader on old versions

To enter the bootloader mode of old luftboot versions (before December 2012), you need a small cable to force the bootloader to run. This cable should bridge pin GND and ADC2 on your Lisa/M v2.0. Make sure you do not shortcircuit your board. Once your "Boot mode connector" is inserted, connect the Lisa/M to the PC via a micro-usb cable and it should start in bootloader mode. You should disconnect the "Boot mode connector" after enforcing the bootloader.

Luftboot USB permissions

Copy the udev-rules file is needed for the upload software to get permission to use this hardware in your PC for uploading. For short: the Python program "stm32_mem.py" needs permission to write to the the Luftboot USB device. If you do not have set this rules already you get an error message, which explanation what is wrong is quite obscure due to the way python-libusb accesses the device.