All About the Artemis SVL Bootloader

There has been a lot to learn regarding the Artemis “SparkFun Variable Loader” bootloader and it could be overwhelming when faced with the dreaded ‘upload failed’ omen.

Follow along here and we’ll lay out the whole story in a (hopefully) enlightening journey – and we’ll make it clear what to do to get your code uploading.

Contents

========

  1. How to Upgrade / Use Your Bootloader [Read Me First!]

  2. Resources / Links

  3. Ambiq Secure Bootloader

  4. SparkFun Variable Loader

TLDR: How to Get Programming

===========================

The problem:

  • Apollo3 Arduino core version 1.0.4 comes with the tools to upload to a board running the latest Artemis SprkFun Variable Loader (SVL) – but your board has older versions of SVL or only the Ambiq Secure Bootloader. You hit ‘Upload’ but it fails every time.

The solution:

  • You should upload the latest version of the SVL to your board.

  • The exact steps required to upload the latest version vary by what board you have (e.g. Edge vs. Artemis Blackboard etc…)

Common Steps:

  1. Install the latest version of the Apollo3 Arduino core using the Arduino boards manager (v1.0.4 at time of writing). See link below for instructions on how to do this.

  2. Select your board from the boards menu

  1. Select ‘Ambiq Secure Bootloader’ as your programmer

  1. Select the correct Serial Port under “Tools–>Port”

  2. Burn the bootloader with “Tools–>Burn Bootloader”

  1. You should see a result like this:

If you have an “Edge” board then you may need to change the baud rate that the Ambiq Secure Bootloader operates on. Boards received at the TensorFlow conference should use 115200 baud while boards ordered from SparkFun should use the default 921600.

Resources / Links

===============

[How to Install / Update Apollo3 Arduino Core

[Artemis SVL (Embedded Side) Source Code:

[Artemis SVL (Computer Side Python) Source Code

Original Edge Upload Issues (Linux + 921600) ( viewtopic.php?f=153&t=49585 )

Ambiq Secure Bootloader

======================

App Offset: 0xC000

Baud rate: fixed

Entry: strapping pin

The Ambiq Secure Bootloader (ASB) is a very good tool developed by Ambiq to program the Apollo microcontrollers. It has all the features you would expect for producing and maintaining a commercial product like memory protection and robust over-the-air handling. The AmbiqSuite SDK comes with Python scripts for the three-step process of creating an OTA app blob, converting an OTA blob into a wired (UART) blob, and finally transmitting that blob via a USB-serial converter.

This process is great for a final product but the ASB has a couple drawbacks when it comes to use for rapid prototyping. Namely that the baud rate is fixed - it can only be adjusted by using a Cortex programmer/debugger, - that you need to actuate a ‘boot’ strapping pin, and that the bootload process tells us little about what product is on the other end of the USB cable. We’ll get more into why those features were needed later – for now we are going to take a quick visit back to March 2019 and the frantic preparation of the original SparkFun Edge board for the TensorFlow dev summit.

The Apollo3 comes in a very tight 81-ball (9x9) BGA package which required a 4-layer PCB, high quality surface finish, and a huge effort from the production team to work out. On top of all that a sneaky routing problem was causing enormous current draw and board heating, and we still had to produce documentation to walk users through the process of using the AmbiqSuite SDK on their computers. Needless to say that we were happy to use the default ASB at 115200 baud - after all “If it 'aint broke don’t fix it”

Well once that all calmed down we grew weary of waiting for the full ‘Micro Speech’ example binary to transfer over 115200 UART connections so for the next batch of Edge boards we bumped the baud rate up to a blazing fast 921600! Unfortunately this change brought its own set of problems – some Linux drivers could not reliably run at 921600 and so users were forced to embark on a low-level search and destroy mission to eliminate the faulty drivers. At the same time Pete Warden from Google started asking about board identification through the bootloader. The code uploading process was now the loudest squeaker on this machine and bound to be oiled soon. Enter the SVL loader.

SparkFun Variable Loader (AKA Saturn V Loader)

=========================================

App Offset: 0xC000 + 0x4000

Baud rate: variable

Entry: UART handshake

The SparkFun Variable Loader (SVL) makes rapid prototyping easy and reliable across operating systems. The “variable”

part of the SVL gives users the option to use a fast baud rate (good for seeing changes in code quickly), a slow baud rate (good for reliability), and everything in between. A custom bootloader also affords the opportunity to customize data going across which we could use in the future to identify boards programmatically.

The SVL lives “on top” of the ASB – so effectively the SVL appears as an “application” to the ASB which allows it to run at startup. This provides yet another benefit of the SVL – it can use the ASB as a failsafe or advanced use case. (When doing this the SVL is overwritten and needs to be re-uploaded before being used again)

The SVL also presented some learning opportunities in regards to PySerial cross-platform differences. These differences were enough to cause upload failure on Mac and Linux. The effort to smooth out the differences produced the latest version (v3) of the SVL, which is what the instructions at the top of this post show you how to use.](https://github.com/sparkfun/Arduino_Apollo3/blob/master/tools/artemis/artemis_svl.py)](https://github.com/sparkfun/Arduino_Apollo3/tree/master/bootloaders/artemis/!artemis_svl/src)](Arduino_Boards/README.md at master · sparkfun/Arduino_Boards · GitHub)