Apm - Installation Guide

by Visual Micro 2. May 2013 15:21

new August 2016. There appears to be a more up to date solution for ArduPilot developers here https://github.com/JeffyW/ardupilot/tree/development

Tip: ArduPilot wiki notes about atmel studio also apply to visual studio.

The following notes might be out of date. Please see the ArduPilot link above or the ArduPilot wiki for currnt information.

APM Developer Wikihttp://dev.ardupilot.com/wiki/building-ardupilot-apm-with-visual-studio-visual-micro/

Installation for APM versions 2.9x is quite simple. You will already have installed the APM firmware.

1) Install either Arduino 1.0.x or 1.5.x Ide or the modified diydrones Arduino ide

2) Install Visual Micro and open Visual Studio

3) If you are a first time user of Visual Micro then you might be prompted to enter your arduino ide installation location. Otherwise set via "Tools>Options>Applications & Locations". Please read the next step before closing the locations configuration window.

4) If you have not set the arduino ide sketchbook folder as instructed in the diyd instructions then set it now in Visual Studio or Atmel Studio. If you have not just completed step 3) above then click the list of applications to the left of the list of boards on the tool bar and then click "Configure" (or use tools>options>visual micro>application locations). Enter the sketchbook location against the arduino ide entry that you are using. 

5) Unzip this file into the sketchbook folder (normally the sketchbook folder is 'mydocuments\arduino'), it should create a "hardware" folder with sub folder called apm, in the apm folder should exist one boards.txt file. This zip should result in additional APM boards appearing at the bottom of the boards list in visual Micro

6) If Visual Studio was already open when you unzipped the file then click "Tools>Arduino>Reload Tool Chain"

7) Confirm that you see APM boards in the boards list

8) Enjoy and please use our forum if you encounter any difficulties

notes

For advanced users, it is not important (optional) to install the modified Arduino IDE from diydrones. The standard Arduino ide should work well. For newer users you should install the modified Arduino ide from diydrones so that you can verify that any compile failiures are due to the APM project code and not a fault of the plugin. If the compile works in the modified arduino ide but not with Visual Micro then please report the problem to the forum.

The APM SITL board willl only compile if you have installed cygwin and set visual studio "Tools>Options>Visual Micro>Applications & Locations>Cygwin" with the location of the Cygwin install. Normally c:\cygwin. You can follow these instructions to ensure cygwin installs correctly. If you have a problem then remove the install and start again.

Visual micro will work with boards found in a file called boards.txt or vmboards.txt. Boards.txt is the standard Arduino name for the file, vmboards.txt is unique to Visual micro and will be invisible to the arduino ide. It might be a good idea to place boards for cores that the arduino ide does not understand in vmboards.txt. This will avoid the potential confusion of attempting to build a board in the arduino ide with properties that are unrecognized and might not produce the desired results.

 

Arduino Advanced Build Examples

by Visual Micro 2. May 2013 12:26

Note: In releases after in 1305.01 arduino 1.5 build {variables} can optionally be used

This document is draft and subject to change. Currently using diydrones apm example

##############################################################

apm_1280.name=APM Arduino Mega 1280

apm_1280.upload.protocol=arduino

apm_1280.upload.maximum_size=126976

apm_1280.upload.speed=57600

apm_1280.bootloader.low_fuses=0xFF

apm_1280.bootloader.high_fuses=0xDA

apm_1280.bootloader.extended_fuses=0xF5

apm_1280.bootloader.path=atmega

apm_1280.bootloader.file=ATmegaBOOT_168_atmega1280.hex

apm_1280.bootloader.unlock_bits=0x3F

apm_1280.bootloader.lock_bits=0x0F

apm_1280.build.mcu=atmega1280

apm_1280.build.f_cpu=16000000L

apm_1280.build.core=arduino

apm_1280.build.variant=mega

apm_1280.build.option1=-mcall-prologues

apm_1280.build.linkoption1=-mcall-prologues

##############################################################

mytest1.name=APM Arduino Mega 2560 

mytest1.upload.protocol=wiring

mytest1.upload.maximum_size=258048

mytest1.upload.speed=115200

mytest1.bootloader.low_fuses=0xFF

mytest1.bootloader.high_fuses=0xD8

mytest1.bootloader.extended_fuses=0xFD

mytest1.bootloader.path=stk500v2

mytest1.bootloader.file=stk500boot_v2_mega2560.hex

mytest1.bootloader.unlock_bits=0x3F

mytest1.bootloader.lock_bits=0x0F

mytest1.build.mcu=atmega2560

mytest1.build.f_cpu=16000000L

mytest1.build.core=arduino

mytest1.build.variant=mega

mytest1.build.option1=-mcall-prologues

mytest1.build.linkoption1=-mcall-prologues

##############################################################

apm1_1280HAL.name=Arduino Mega 1280 HAL (Apm 1)

apm1_1280HAL.upload.protocol=arduino

apm1_1280HAL.upload.maximum_size=126976

apm1_1280HAL.upload.speed=57600

apm1_1280HAL.bootloader.low_fuses=0xFF

apm1_1280HAL.bootloader.high_fuses=0xDA

apm1_1280HAL.bootloader.extended_fuses=0xF5

apm1_1280HAL.bootloader.path=atmega

apm1_1280HAL.bootloader.file=ATmegaBOOT_168_atmega1280.hex

apm1_1280HAL.bootloader.unlock_bits=0x3F

apm1_1280HAL.bootloader.lock_bits=0x0F

apm1_1280HAL.build.mcu=atmega1280

apm1_1280HAL.build.f_cpu=16000000L

apm_SITL.build.nocore=true

apm_SITL.build.noarchive=true

apm1_1280HAL.build.option1=-mcall-prologues

apm1_1280HAL.build.option2=-DCONFIG_HAL_BOARD=HAL_BOARD_APM1

apm1_1280HAL.build.option3=-DEXCLUDECORE

apm1_1280HAL.build.linkoption1=-mcall-prologues

apm1_1280HAL.build.noarchive=true

##############################################################

apm1_2560HAL.name=Arduino Mega 2560 HAL (Apm 1)

apm1_2560HAL.upload.protocol=wiring

apm1_2560HAL.upload.maximum_size=258048

apm1_2560HAL.upload.speed=115200

apm1_2560HAL.bootloader.low_fuses=0xFF

apm1_2560HAL.bootloader.high_fuses=0xD8

apm1_2560HAL.bootloader.extended_fuses=0xFD

apm1_2560HAL.bootloader.path=stk500v2

apm1_2560HAL.bootloader.file=stk500boot_v2_mega2560.hex

apm1_2560HAL.bootloader.unlock_bits=0x3F

apm1_2560HAL.bootloader.lock_bits=0x0F

apm1_2560HAL.build.mcu=atmega2560

apm1_2560HAL.build.f_cpu=16000000L

apm1_2560HAL.build.nocore=true

apm1_2560HAL.build.noarchive=true

apm1_2560HAL.build.option1=-mcall-prologues

apm1_2560HAL.build.option2=-DCONFIG_HAL_BOARD=HAL_BOARD_APM1

apm1_2560HAL.build.option3=-DEXCLUDECORE

apm1_2560HAL.build.linkoption1=-mcall-prologues

apm1_2560HAL.build.noarchive=true

##############################################################

apm2_2560HAL.name=Arduino Mega 2560 HAL (Apm 2)

apm2_2560HAL.upload.protocol=wiring

apm2_2560HAL.upload.maximum_size=258048

apm2_2560HAL.upload.speed=115200

apm2_2560HAL.bootloader.low_fuses=0xFF

apm2_2560HAL.bootloader.high_fuses=0xD8

apm2_2560HAL.bootloader.extended_fuses=0xFD

apm2_2560HAL.bootloader.path=stk500v2

apm2_2560HAL.bootloader.file=stk500boot_v2_mega2560.hex

apm2_2560HAL.bootloader.unlock_bits=0x3F

apm2_2560HAL.bootloader.lock_bits=0x0F

apm2_2560HAL.build.mcu=atmega2560

apm2_2560HAL.build.f_cpu=16000000L

apm2_2560HAL.build.nocore=true

apm2_2560HAL.build.noarchive=true

apm2_2560HAL.build.option1=-mcall-prologues

apm2_2560HAL.build.option2=-DCONFIG_HAL_BOARD=HAL_BOARD_APM2

apm2_2560HAL.build.option3=-DEXCLUDECORE

apm2_2560HAL.build.linkoption1=-mcall-prologues

apm2_2560HAL.build.noarchive=true

##############################################################

apm_SITL.name=Apm SITL

apm_SITL.upload.protocol=wiring

apm_SITL.upload.maximum_size=258048

apm_SITL.upload.speed=115200

apm_SITL.bootloader.low_fuses=0xFF

apm_SITL.bootloader.high_fuses=0xD8

apm_SITL.bootloader.extended_fuses=0xFD

apm_SITL.bootloader.path=stk500v2

apm_SITL.bootloader.file=stk500boot_v2_mega2560.hex

apm_SITL.bootloader.unlock_bits=0x3F

apm_SITL.bootloader.lock_bits=0x0F

apm_SITL.build.mcu=atmega2560

apm_SITL.build.f_cpu=

apm_SITL.build.core=

apm_SITL.build.nocore=true

apm_SITL.build.noarchive=true

apm_SITL.build.noeep=true

apm_SITL.build.nohex=true

apm_SITL.build.nosize=true

apm_SITL.build.toolset=cygwin

apm_SITL.build.architecture=

apm_SITL.build.toolchain.path=

apm_SITL.build.command.gcc=gcc-?

apm_SITL.build.command.g++=g++-?

apm_SITL.build.command.link=g++-?

apm_SITL.build.command.run="%SKETCH_BUILD_PATH%\%SKETCH%.exe"

apm_SITL.build.default.cpp.options=-g -DF_CPU=   -Wa,-adhlns="%SOURCE_BUILD_PATH%\%SOURCE_FILE%.lst" -O0 -g -Wformat -Wall -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wformat=2 -Wno-reorder -MD -MT "%SOURCE_BUILD_PATH%\%SOURCE_FILE_W_EXT%.o" -ffunction-sections -fdata-sections -fno-exceptions -fsigned-char -c -I"%SKETCH_PATH%" 

apm_SITL.build.default.c.options=-g  -DF_CPU= -Wa,-adhlns="%SOURCE_BUILD_PATH%\%SOURCE_FILE%.lst" -O0 -g -Wformat -Wall -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wformat=2 -Wno-reorder -MD -MT "%SOURCE_BUILD_PATH%\%SOURCE_FILE_W_EXT%.o" -ffunction-sections -fdata-sections -fsigned-char -c -I"%SKETCH_PATH%" 

apm_SITL.build.default.s.options=-g  -assembler-with-cpp -DF_CPU= -Wa,-adhlns="%SOURCE_BUILD_PATH%\%SOURCE_FILE%.lst" -O0 -g  -MD -MT "%SOURCE_BUILD_PATH%\%SOURCE_FILE_W_EXT%.o" -c -I"%SKETCH_PATH%" 

apm_SITL.build.option1=-DCONFIG_HAL_BOARD=HAL_BOARD_AVR_SITL

apm_SITL.build.option2=-DSKETCH="\"%SKETCH%\""

apm_SITL.build.option3=-D_GNU_SOURCE

apm_SITL.build.default.link.options=-g -D_GNU_SOURCE -O0 -g -Wformat -Wall -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wformat=2 -Wl,--gc-sections -Wl,-Map -Wl,"%SOURCE_BUILD_PATH%\%SKETCH%.map" -o "%SOURCE_BUILD_PATH%\%SKETCH%.exe"