-
Notifications
You must be signed in to change notification settings - Fork 7
Flashing a target device with the IAR C‐SPY Command Line Utility
The IAR C-SPY Command Line Utility (CSpyBat) is commonly used for non-interactive execution of an application from the command line or headless environments such as in continuous integration. Alternatively, CSpyBat can also be used for flashing the target MCU without initiating a debug session.
The IAR C-SPY Command Line utility offers an special option that can be used for flashing the target device without entering a debug session:
| Option | Description |
|---|---|
--download_only |
Downloads a code image without starting a debug session afterwards. |
This example applies to the IAR Build Tools for Arm (CX) with a simplified workflow as follows:
-
A
build-jobruns in the cloud, inside a container, produces an executable for the an an ST STM32F407VG MCU, and uploads the artifact using a GitHub Action. -
A
flash-jobruns on a self-hosted with the IAR Build Tools for Arm and utilizesCSpyBatfor flashing a target MCU via an IAR I-jet debug probe.
jobs:
# Things happen...
build-job:
runs-on: ubuntu-latest
container: ghcr.io/iarsystems/arm:9.60.4-st
steps:
# Build the application with "iarbuild" or "cmake" and then...
- name: Upload the executable as an artifact
uses: action/upload-artifact@v4
with:
name: project
# Needs to be updated with the proper location of the project.out...
path: path/to/project.out
# Other things might be happening in between and then...
flash-job:
needs: [ build-job ]
runs-on: [ self-hosted, linux ]
steps:
- name: Download the artifact
uses: actions/download-artifact@v4
with:
name: project
path: ./
- name: Flash the target MCU
run: |
/opt/iar/cxarm/common/bin/CSpyBat \
/opt/iar/cxarm/arm/bin/libarmPROC.so \
/opt/iar/cxarm/arm/bin/libarmJET.so \
--plugin=/opt/iar/cxarm/arm/bin/libarmLibsupportUniversal.so \
--flash_loader=/opt/iar/cxarm/arm/config/flashloader/ST/FlashSTM32F4xxx.board \
--debug_file=project.out \
--download_only \
--backend \
--cpu=cortex-m4 \
--fpu=vfpv4_sp \
--device=STM32F407VG \
--jet_power_from_probe=switch_off \
--drv_interface=SWD
# There could be additional jobs described after...This is the github-actions-ci-example wiki. Back to Home.