forked from ARMmbed/mbed-os
-
Notifications
You must be signed in to change notification settings - Fork 22
Implement AMBIQ_SVL upload method for Ambiq Apollo3 #472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,2 @@ | ||
# Mbed OS upload method configuration file for target SFE_ARTEMIS. | ||
# To change any of these parameters from their default values, set them in your build script between where you | ||
# include mbed_toolchain_setup and where you add mbed-os as a subdirectory. | ||
|
||
# Notes: | ||
# 1. This board does not have an onboard debugger. You must use an external debugger, e.g. a PicoProbe | ||
# or J-Link, if you wish to debug code. | ||
# 2. Support for this device exists in PyOCD main branch but has not been released yet (as of Jun 2025). | ||
# This version will be used automatically by Mbed if the python venv is enabled. If not, you need to install it via: | ||
# pip install git+https://github.com/pyocd/pyOCD.git | ||
|
||
set(UPLOAD_METHOD_DEFAULT NONE) | ||
|
||
# Config options for PYOCD | ||
# ------------------------------------------------------------- | ||
set(PYOCD_UPLOAD_ENABLED TRUE) | ||
set(PYOCD_TARGET_NAME ama3b1kk_kbr) | ||
set(PYOCD_CLOCK_SPEED 4000k) | ||
|
||
# Config options for JLINK | ||
# ------------------------------------------------------------- | ||
set(JLINK_UPLOAD_ENABLED TRUE) | ||
set(JLINK_CPU_NAME AMA3B1KK-KBR) | ||
set(JLINK_CLOCK_SPEED 4000) | ||
set(JLINK_UPLOAD_INTERFACE SWD) | ||
# Upload method configuration is the same as other SparkFun Artemis boards | ||
include(${CMAKE_CURRENT_LIST_DIR}/common/sparkfun_artemis.cmake) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Upload method configuration is the same as other SparkFun Artemis boards | ||
include(${CMAKE_CURRENT_SOURCE_DIR}/common/sparkfun_artemis.cmake) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Upload method configuration is the same as other SparkFun Artemis boards | ||
include(${CMAKE_CURRENT_SOURCE_DIR}/common/sparkfun_artemis.cmake) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Upload method configuration is the same as other SparkFun Artemis boards | ||
include(${CMAKE_CURRENT_SOURCE_DIR}/common/sparkfun_artemis.cmake) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Mbed OS upload method configuration file for SparkFun Artemis DK | ||
# To change any of these parameters from their default values, set them in your build script between where you | ||
# include mbed_toolchain_setup and where you add mbed-os as a subdirectory. | ||
|
||
# Notes: | ||
# 1. Support for this device exists in PyOCD main branch but has not been released yet (as of Jun 2025). | ||
# This version will be used automatically by Mbed if the python venv is enabled. If not, you need to install it via: | ||
# pip install git+https://github.com/pyocd/pyOCD.git | ||
# 2. Unlike all other SparkFun Artemis boards, this board has a CMSIS-DAP interface MCU on it, so it | ||
# should be debuggable & flashable out of the box via PyOCD. | ||
|
||
set(UPLOAD_METHOD_DEFAULT MBED) | ||
|
||
# Config options for PYOCD | ||
# ------------------------------------------------------------- | ||
set(PYOCD_UPLOAD_ENABLED TRUE) | ||
set(PYOCD_TARGET_NAME ama3b1kk_kbr) | ||
set(PYOCD_CLOCK_SPEED 4000k) | ||
|
||
# Config options for MBED | ||
# ------------------------------------------------------------- | ||
set(MBED_UPLOAD_ENABLED TRUE) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Mbed OS upload method configuration file for most SparkFun Artemis devices | ||
# To change any of these parameters from their default values, set them in your build script between where you | ||
# include mbed_toolchain_setup and where you add mbed-os as a subdirectory. | ||
|
||
# Notes: | ||
# 1. This board does not have an onboard debugger. You must use an external debugger, e.g. a PicoProbe | ||
# or J-Link, if you wish to debug code. | ||
# 2. Support for this device exists in PyOCD main branch but has not been released yet (as of Jun 2025). | ||
# This version will be used automatically by Mbed if the python venv is enabled. If not, you need to install it via: | ||
# pip install git+https://github.com/pyocd/pyOCD.git | ||
|
||
set(UPLOAD_METHOD_DEFAULT AMBIQ_SVL) | ||
|
||
# Config options for PYOCD | ||
# ------------------------------------------------------------- | ||
set(PYOCD_UPLOAD_ENABLED TRUE) | ||
set(PYOCD_TARGET_NAME ama3b1kk_kbr) | ||
set(PYOCD_CLOCK_SPEED 4000k) | ||
|
||
# Config options for JLINK | ||
# ------------------------------------------------------------- | ||
set(JLINK_UPLOAD_ENABLED TRUE) | ||
set(JLINK_CPU_NAME AMA3B1KK-KBR) | ||
set(JLINK_CLOCK_SPEED 4000) | ||
set(JLINK_UPLOAD_INTERFACE SWD) | ||
|
||
# Config options for AMBIQ_SVL | ||
# ------------------------------------------------------------- | ||
set(AMBIQ_SVL_UPLOAD_ENABLED TRUE) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Copyright (c) 2025 Jamie Smith | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
### Ambiq SVL upload method | ||
### This upload method allows flashing code over the UART port to SparkFun boards using | ||
### the Ambiq Apollo3 SoC and SVL bootloader. | ||
### Unlike some other bootloader-based upload methods, the SparkFun setup is able to reset the | ||
### MCU into bootloader without needing any buttons to be pressed on the board! | ||
# This method creates the following options: | ||
# AMBIQ_SVL_SERIAL_PORT - Serial port to connect to the SVL bootloader over, e.g. 'COM20' or '/dev/ttyUSB0' | ||
# This method creates the following parameters: | ||
# AMBIQ_SVL_UPLOAD_BAUD - Baudrate to upload at. Defaults to 115200 baud. | ||
|
||
set(UPLOAD_SUPPORTS_DEBUG FALSE) | ||
|
||
set(AMBIQ_SVL_SERIAL_PORT "" CACHE STRING "Serial port to connect to the SVL bootloader over, e.g. 'COM20' or '/dev/ttyACM0'") | ||
|
||
# note: the ambiq_svl script is included under tools/python/ambiq_svl and is already | ||
# found by mbed_python_interpreter.cmake | ||
set(UPLOAD_AMBIQ_SVL_FOUND TRUE) | ||
|
||
### Function to generate upload target | ||
function(gen_upload_target TARGET_NAME BINARY_FILE) | ||
|
||
if("${AMBIQ_SVL_SERIAL_PORT}" STREQUAL "") | ||
message(FATAL_ERROR "Must specify AMBIQ_SVL_SERIAL_PORT to use the AMBIQ_SVL upload method!") | ||
endif() | ||
|
||
if("${AMBIQ_SVL_UPLOAD_BAUD}" STREQUAL "") | ||
set(AMBIQ_SVL_UPLOAD_BAUD 115200) | ||
endif() | ||
|
||
add_custom_target(flash-${TARGET_NAME} | ||
COMMAND ${ambiq_svl} | ||
-f ${BINARY_FILE} | ||
-b ${AMBIQ_SVL_UPLOAD_BAUD} | ||
${AMBIQ_SVL_SERIAL_PORT} | ||
VERBATIM | ||
USES_TERMINAL) | ||
|
||
endfunction(gen_upload_target) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# SVL for Ambiq Apollo3 | ||
|
||
This folder contains the script to flash Ambiq Apollo3 MCUs using the SparkFun Variable Loader (SVL) UART bootloader. This script appears to be under the MIT license, and was copied from its development repository here: | ||
|
||
https://github.com/sparkfun/Apollo3_Uploader_SVL/blob/main/svl.py | ||
|
||
Slight modifications were made to add an entry point function compatible with Hatchling. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
""" | ||
SparkFun Variable Loader | ||
Variable baud rate bootloader for Artemis Apollo3 modules | ||
SPDX-License-Identifier: MIT | ||
""" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.