This is the bootloader for the AM32 project
To install the required build tools please run the script for your operating system found in the env_setup_scripts directory. This will download the required tools from https://firmware.ardupilot.org/Tools/AM32-tools/ and unpack them in tools. It will also setup your vscode settings for your OS.
When you run vscode it will recommend you install some key extensions:
- C/C++ tools
- Cortex-Debug
- Makefile Tools
You will need to install these before doing a build.
To build with the command line use the command "make". If your environment is setup correctly you should be able to tab complete the available targets. Otherwise you can run "make targets" to see the available build targets.
The G051_32K and G051_64K targets share the G071 startup, CMSIS and driver files. Both use 18 KB RAM and reserve the final 2 KB erase page for EEPROM:
| Target | Flash | EEPROM offset | deviceInfo layout identifier |
|---|---|---|---|
| G051_32K | 32 KB | 0x7800 | 0x51 |
| G051_64K | 64 KB | 0xF800 | 0x35 (same as G071_64K) |
Configurators must recognize 0x51 as the G051 32 KB layout. The 64 KB
variant shares the existing 0x35 layout identifier with G071_64K. Both use
unshifted addresses; protocol v3 deviceInfo also reports the EEPROM address directly.
The bootloader retains its 4 KB reservation and the application starts at
0x08001000. For example, build the PA2 variant with
make AM32_G051_BOOTLOADER_PA2_32K, or its updater with
make AM32_G051_BL_UPDATER_PA2_32K. Use the _64K suffix for the 64 KB
variant. Updater metadata uses MCU name G051 and the selected flash size.
A bootloader updater is a small firmware that carries a bootloader image inside it. It is flashed as if it were the main application, and on boot it writes the bootloader it carries into place and resets. This lets a bootloader be replaced without a SWD debugger. Run "make updater_targets" to see the available updaters, or "make updaters" to build them all.
An updater named AM32_BL_UPDATER_CAN_FROM4K_V is a transition updater. Use it to move an ESC that shipped with a 4k non-CAN bootloader onto a 16k DroneCAN bootloader, which the normal CAN updater cannot do as it needs the 16k bootloader to already be installed. The transition updater has its entry point at 0x08001000 where the 4k bootloader starts the application, while its code and the bootloader image it carries sit above 0x08004000, out of the way of the region it erases. A CAN bootloader keeps its settings at the 128k layout address rather than where the 4k bootloader kept them, and the transition updater leaves that page blank.
The main firmware is erased in the process, so flash a matching CAN main firmware once the new bootloader is in place, then configure the ESC from scratch with the configurator or the DroneCAN GUI tool. Until it is configured the new bootloader will not boot the application.
All of the bootloaders are automatically built in CI using github actions. See the Actions tab on https://github.com/am32-firmware/AM32-bootloader for the latest builds.
The latest release is available here:
https://github.com/am32-firmware/AM32-bootloader/releases
If you need help with bootloader development please ask on the AM32 discord server in the development channel https://discord.com/invite/h7ddYMmEVV