diff --git a/flash.sh b/flash.sh index 4b04bf4..bcf6db1 100644 --- a/flash.sh +++ b/flash.sh @@ -1,6 +1,6 @@ #!/bin/bash -# flash.sh — Flash nRF52 Dongle using OpenOCD via Raspberry Pi SWD +# flash.sh — Flash nRF54 Dongle using OpenOCD via Raspberry Pi SWD set -e # Exit on error @@ -57,7 +57,7 @@ fi # Run OpenOCD flashing command sudo openocd \ -f ./raspberrypi-${INTERFACE}.cfg \ - -f target/nrf52.cfg \ + -f target/nordic/nrf54l.cfg \ -c "init" \ -c "reset halt" \ -c "flash write_image erase $HEX_FILE" \ @@ -88,7 +88,7 @@ done # Run OpenOCD flashing command sudo openocd \ -f ./raspberrypi-${INTERFACE}.cfg \ - -f target/nrf52.cfg \ + -f target/nordic/nrf54l.cfg \ -c "init" \ -c "reset halt" \ -c "flash write_image erase $HEX_FILE" \ diff --git a/flash_nrf54l.sh b/flash_nrf54l.sh new file mode 100644 index 0000000..ff2aa37 --- /dev/null +++ b/flash_nrf54l.sh @@ -0,0 +1,68 @@ +#!/bin/bash + +# flash_nrf54l.sh — Flash nRF54L device using OpenOCD via Raspberry Pi SWD + +set -e # Exit on error + +# Default values +INTERFACE="swd0" +HEX_FILE="" + +# Help message +usage() { + echo "Usage: $0 -f [-i swd0|swd1] [-h]" + echo + echo "Options:" + echo " -f Path to the HEX file to flash (required)" + echo " -i SWD interface to use: swd0 (default) or swd1" + echo " -h Show this help message and exit" + exit 1 +} + +# Parse arguments +while getopts "f:i:h" opt; do + case "$opt" in + f) + HEX_FILE="$OPTARG" + ;; + i) + if [[ "$OPTARG" == "swd0" || "$OPTARG" == "swd1" ]]; then + INTERFACE="$OPTARG" + else + echo "Invalid interface: $OPTARG" + usage + fi + ;; + h) + usage + ;; + *) + usage + ;; + esac +done + +# Verify HEX file is provided +if [[ -z "$HEX_FILE" ]]; then + echo "Error: HEX file not specified." + usage +fi + +# Check if HEX file exists +if [[ ! -f "$HEX_FILE" ]]; then + echo "Error: HEX file '$HEX_FILE' not found!" + exit 1 +fi + +# Run OpenOCD flashing command +sudo openocd \ + -f ./raspberrypi-${INTERFACE}.cfg \ + -f target/nordic/nrf54l.cfg \ + -c "init" \ + -c "reset halt" \ + -c "flash write_image erase $HEX_FILE" \ + -c "verify_image $HEX_FILE" \ + -c "reset run" \ + -c "shutdown" + +echo "✅ Flashing complete." diff --git a/linkcheck_nrf54l.sh b/linkcheck_nrf54l.sh new file mode 100644 index 0000000..d7b8256 --- /dev/null +++ b/linkcheck_nrf54l.sh @@ -0,0 +1,7 @@ +set -e # Exit on error + +sudo openocd -f ./raspberrypi-swd0.cfg -f target/nordic/nrf54l.cfg -c "init; targets; shutdown" +echo "swd0 linkcheck success." +sudo openocd -f ./raspberrypi-swd1.cfg -f target/nordic/nrf54l.cfg -c "init; targets; shutdown" +echo "swd1 linkcheck success." +echo "✅ Linkcheck complete." \ No newline at end of file diff --git a/raspberrypi-swd0.cfg b/raspberrypi-swd0.cfg index e0329e4..853f575 100644 --- a/raspberrypi-swd0.cfg +++ b/raspberrypi-swd0.cfg @@ -1,7 +1,7 @@ adapter driver bcm2835gpio transport select swd adapter gpio swclk 17 -adapter gpio swdio 18 +adapter gpio swdio 18 #adapter gpio trst 26 #reset_config trst_only