Hello and welcome to our community! Is this your first visit?
Register

  1. AQ32
  2. Commandline compilation and manual uploading
for advanced users

This page is a chapter in 'AQ32 Uploading the AeroQuad flight software'

If you want to customize the software to your own needs, you'll need to create and upload your own binary. How to achieve this is described in the following section.

Windows

Preparation:
  1. Download version 2011.09-69 of CodeSourcery ARM EABI Lite and install it (Download link). Newer versions of the toolchain seem to cause problems at the moment.
  2. Download MinGW MSYS and install it (Download link).
  3. This step is only needed if your Windows user name contains one or more white spaces. As MSYS doesn't support user names with white spaces, you'll need to perform a little hack.
    Navigate to "X:\MinGW\msys\1.0\" and open "msys.bat" with your favorite editor. Add the line "set USERNAME=ang" like marked in the picture below:


  4. After that navigate to "X:\MinGW\msys\1.0\" and run "msys.bat" one time to create the needed folders in the next step, close it afterwards.

Compiling and uploading:
  1. Copy (or clone using git) the AeroQuad software from GitHub to "X:\MinGW\msys\1.0\home\"User name"" (or "X:\MinGW\msys\1.0\home\ang" if you did perform step 3 ).


  2. Customize the software to fit your own needs. Make sure to edit "AeroQuad/UserConfiguration.h" and uncomment "#define AeroQuadSTM32" and comment out all other platform defines (like AeroQuad_v2 etc.).
  3. Launch 'MSYS' shell (run "X:\MinGW\msys\1.0\msys.bat").
  4. This step is only needed if you used a different folder structure than shown above: In MSYS navigate into the AeroQuad directory by using the "cd" command, e.g. "cd AeroQuad" (depending on where you put the AeroQuad software)
  5. Make Libmaple by entering the following command (without quotes): "make -C Libmaple/libmaple library"


  6. Build the AeroQuad software by entering the following command (without quotes): "make -C BuildAQ32"


  7. Now you've successfully created the flight software binary file, Grab the binary from ".../BuildAQ32/objSTM32/AeroQuad32/AeroQuadMain.bin" and copy it to the "02_FlashBinaries" folder found in the previously unzipped "All-in-one-package".
  8. Run "reset.bat". Make sure that the correct COM port is selected by editing "reset.bat" like shown below.


  9. Edit "FlashDFUSeF4.bat" and change the first line to "set filename=AeroQuadMain.bin" (or whatever filename your binary has).


  10. Run "FlashDFUSeF4.bat"
  11. Hit the reset button on the AeroQuad32 board. After reboot the upload process is completed!

Alternate route (this replaces steps 8-11): After you've created the binary and put it in the proper folder there is another way to put the board into DFU mode. On the AeroQuad32 board in the bottom right corner is a pin labeled "BOOT0". Underneath this pin is a 3V3 pin (on the bottom side of the board). If you short these two pins together before powering the AeroQuad32 board it will force it into DFU mode. At this point, you can upload the new binary using Configurator or by running "FlashDFUSeF4.bat" as described above.


AeroQuad32 v2 board

AeroQuad32 v1 board

OS X

Incomplete, currently under construction

Preparation:
Installing arm-none-eabi-gcc for code compilation (NOTE: NOT FULLY TESTED, may not work):
  1. Download and install Homebrew (link).
  2. Update by entering "brew update" into Terminal.
  3. Enter "brew install gmp mpfr libmpc libelf texinfo" into Terminal. This will take a while (~5 mins).
  4. If you do not have git installed on your Mac, either go to github.com and install the command line tools or just go to the URL in the commands below, download the repo, and unzip to wherever you want.
    1. Using git commandline:
      1. In Terminal, navigate to wherever you would like to keep the toolchain. I keep mine in folder called /compilers/ in my home folder
      2. Enter "git clone https://github.com/jsnyder/arm-eabi-toolchain". This will download the repo.
      3. cd into the folder it creates and enter "make install-cross". This will run for about an hour as it's building the entire toolchain. It's not recommended to use your computer much at this time, it will be fully loading your CPU on and off for the next hour and if using a laptop, your cooling fans will run pretty loudly for most of the time.

    2. If you just downloaded the repo from GitHub by going to the URL, then just do step (3) above (the make install-cross command)

  5. Edit your PATH variable to link to the toolchain. This is done by entering "export PATH=........./arm-cs-tools/bin:$PATH" in Terminal, where ...... is the full path to the arm-eabi-toolchain folder. For me, this command was "export PATH=/Users/imchipwood/compilers/arm-eabi-toolchain/bin:$PATH". You can move the folder wherever you want, just make sure you add it to the PATH variable (and don't forget to put :$PATH on the end or the rest of your PATH will be deleted (any previously installed tools will no longer work)
  6. Install dfu-util for uploading code (skip steps 1 and 2 if you installed Homebrew when setting up arm-none-eabi-gcc):
    1. Download and install Homebrew (link)
    2. Update by entering "brew update"
    3. Enter "brew install dfu-util" to install the dfu-util
    4. Run dfu-util by calling "dfu-util". If it comes back with some permissions error, use "sudo dfu-util". This will run it as an admin - you'll have to type your password to run as admin.

Compiling and uploading:
  1. Copy (or clone using git) the AeroQuad software from GitHub.
  2. Customize the software to fit your own needs. Make sure to edit "AeroQuad/UserConfiguration.h" and uncomment "#define AeroQuadSTM32" and comment out all other platform defines (like AeroQuad_v2 etc.).
  3. Using Terminal, navigate to the /AeroQuad/BuildAQ32/ folder. If you have previously used this folder for compiling on Windows, enter "make clean" in Terminal. If this doesn't work, delete the /.dep/ and /objSTM32/ folders and try again.

  4. To compile a new binary, enter "make" in Terminal. The new binary will be in /AeroQuad/BuildAQ32/objSTM32/AeroQuad32/ named "AeroQuadMain.bin".

  5. Navigate to /BuildAQ32/objSTM32/AeroQuad32/ and enter "dfu-util --reset --device 0483:df11 --alt 0 --dfuse-address 0x08010000 --download AeroQuadMain.bin" to upload the binary.


If you want to use the command line to upload a new bootloader, just make sure you change the --dfuse-address to 0x08000000.

Linux

Preparation:
  1. If you have a modern Linux distro (like Ubuntu 12.04 or greater), Network Manager may use a service called modem-manager to capture USB ACM devices to probe them as modems (POTS, 3G, etc). As of Ver 3.2, this causes the AQ32 trouble as it makes changes to its configuration. You will know if you have this issue as when you plug in the device and try to access /dev/ttyACM# and you get an error that the device is busy for about 30 seconds. To fix this, blacklist the AQ32 usb device from being accessed by modem-manager as follows:

    Add the following lines to this file: /lib/udev/rules.d/77-mm-usb-device-blacklist.rules


    Code:
    # STM32 (AeroQuad32)
    ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5740", ENV{ID_MM_DEVICE_IGNORE}="1"
  2. Download version 2011.09-69 of CodeSourcery ARM EABI Lite and install it (Download link). Newer versions of the toolchain seem to cause problems at the moment.
  3. Make sure you have make (and preferably git) installed. Also make sure you have dfu-util installed. Most distributions provide a package, but if not you can obtain is here: http://dfu-util.gnumonks.org/
  4. Add the codesourcery "bin" directory to your path "export PATH=$PATH:/path/to/sourcery/bin/" (you may want to make this permanent by editing .profile or whatever).

Compiling and uploading:
  1. Copy (or clone using git) the AeroQuad software from GitHub.
    You can use "git" to do this simply by using the following git command: "git clone http://github.com/AeroQuad/AeroQuad.git -b development".
  2. Customize the software to fit your own needs. Make sure to edit "AeroQuad/UserConfiguration.h" and uncomment "#define AeroQuadSTM32" and comment out all other platform defines (like AeroQuad_v2 etc.).
  3. Navigate then to the directory which includes the AeroQuad software ("AeroQuad,AeroQuad32,BuildAQ32,Libmaple,...").
  4. Make Libmaple with "make -C Libmaple/libmaple library".
  5. Make AQ with "make -C BuildAQ32".
  6. Note that the needed binary is in "BuildAQ32/objSTM32/AeroQuad32/AeroQuadMain.bin"
  7. Reset the board to DFU mode by "echo 1EAF > /dev/ttyACM0"
  8. Download the binary by "dfu-util -d 0483:df11 -a 0 -s 0x8010000 -D BuildAQ32/objSTM32/AeroQuad32/AeroQuadMain.bin". You will probably need to run it with sudo or as the root user.
  9. Hit the reset button on the AeroQuad32 board. (If you have the patched dfu-util "dfu-util -d 0483:df11 -a 0 -L" will reset the board out of DFU.)

This page has been seen 14,100 times.

    • Created by on
      Last updated by on