Firmware Customization

The navX-MXP was developed/debugging using the following software tools, which (with the exception of the Debugging hardware) are open-source or freely-available. The only component you may want to purchase is the inexpensive ST-LINK/V2 JTAG programmer/debugger described below.

Install Compiler

Install the free Code sourcery G++ Lite compiler for the ARM Cortex processor used in the nav-MXP.

Download URL:

https://sourcery.mentor.com/sgpp/lite/arm/portal/[email protected]=lite

After installing, the compiler is installed into folder (32-bit Windows)

C:\Program Files\CodeSourcery\Sourcery G++ Lite

For 64-bit Windows, it is installed into:

C:\Program Files (x86)\CodeSourcery\Sourcery G++ Lite

Add the path to the “bin” director underneath the Code Sourcery G++ Lite installation directory, so that the compiler is on the path.

Install Eclipse IDE

Install the Eclipse IDE for C/C++ Developers at the following download URL:

https://www.eclipse.org/downloads/

If you already have eclipse installed w/out the C/C++ Development tools (CDT) you will need to install them, too:

CDT 8.1.2 (or later)

A URL for this software, including the CDT, is at:

https://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/junosr2

Install the Zylin embedded CDT Plugin

This is installed from within Eclipse, since it is an Eclipse Plugin. If you are unfamiliar with installingn Eclipse plugins, please visit this URL for more information on the process:

https://wiki.eclipse.org/FAQ_How_do_I_install_new_plug-ins%3F

Zylin Plugin Update URL: http://opensource.zylin.com/embeddedcdt.html

Import the project into Eclipse

Open up eclipse, and import the project which is contained in the navX-MXP stm32 directory in the Github repository.

Building

In Eclipse, select Project->Build. You might find it necessary to Project->Clean first to remove old build output files.

The output of the build will be placed in the stm32/Debug directory. The extension of the file will be .hex (Intel HEX Binary format).

You can either download this file via the ST Microelectronics DfuSe utility, or you can download it via the ST-LINK/V2 adapter (see instructions on debugging below).

In-Circuit Debugging (optional, but highly recommended)

ST-LINK/V2

ST-LINK/V2 JTAG in-circuit debugger was used, this is very inexpensive and works very well.

The ST-LINK/V2 can be purchased at www.digikey.com (among others) for approximately $40.

Additional utilities for the ST-LINK/V2 (for windows) are available on the STM website.

Connecting the ST-LINK/V2 to the navX-MXP Circuit Board

You will need to solder a 4-pin header to the navX-MXP board in order to connect debug on the navX-MXP’s STM32F411 microcontroller. Then, you will need to connect 4 wires from the connector to the corresponding location on the ST-LINK/V2 connector. Instructions on how to do this can be found at the following URL:

https://www.micromouseonline.com/2011/11/05/stlink-swd-for-stm32/

Install OpenOCD

In order to interface eclipse with the ST-LINK/V2 JTAG in-circuit debugger, the OpenOCD Server is used.

OpenOCD, version 0.9.0 (windows version available at

https://www.freddiechopin.info/en/articles/34-news/92-openocd-w-wersji-080)

OpenOCD includes A gdb server that runs with the ST-LINK/V2.

  • MPORTANT NOTE: THe 0.9.0 release of OpenOCD contains a bugfix; earlier releases of OpenOCD from cannot communicate correctly with the STM32F411 microcontroller used in the navX-MXP. If you are not able to acquire this release of OpenOCD, please contact [email protected] for information on how to proceed.

Configure Eclipse to run OpenOCD

Run->External Tools->External Tools Configuration…

Add a new configuration, name it “OpenOCD”

In the “main” tab, under Location, provide the path to the location of Open OCD. E.g., C:\OpenOCD\openocd-09.0\bin-x64\openocd-x64-0.9.0.exe

In the same “main” tab, in the Arguments window, enter the following:

-f C:\OpenOCD\openocd-0.9.0\scripts\interface\stlink-v2.cfg -f C:\OpenOCD\openocd-0.9.0\scripts\target\stm32f4x_stlink.cfg

To start the OpenOCD Server, Select Run->ExternalTools?->OpenOCD (where OpenOCD is the name provided earlier on the “main” tab)

Once the OpenOCD Server has started, the debug session can be started.

Starting a Debug Session

6b) To start a debug session, first create a debug configuration:

  • Select Run->Debug Configurations…
  • Select “Zylin Embedded Debug (Cygwin)”

Then, add a new configuration (e.g., (navX-MXP OpenOCD Debug Session”); the new configuration will be a child node of Zylin Embedded Debug (Cygwin)

On the Debugger Tab:

  • Set GDB Debugger to arm-none-eabi-gdb
  • Set GDB Command File to <navx-mxp-distribution_directory\stm32\gdb\nav10.script
  • Select “Verbose console mode”
  • NOTE: You will need to edit the nav10.script file to reference your particular directory path to the “navx-mxp-distribution-directory” you unpacked the navx mxp distribution .zip into.

Once the debug configuration is created, and the open ocd session is started, start debugging via Run->Debug