From 45804f8dee06517f261627a2d99cefa12ea5da93 Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Sat, 14 Jun 2025 15:54:30 +0200 Subject: [PATCH 1/2] feat(stm32cubeprog): add address and start options Signed-off-by: Frederic Pillon --- stm32CubeProg.sh | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/stm32CubeProg.sh b/stm32CubeProg.sh index 5cba7d839..26fea2ced 100644 --- a/stm32CubeProg.sh +++ b/stm32CubeProg.sh @@ -8,9 +8,11 @@ STM32CP_CLI= INTERFACE= PORT= FILEPATH= -ADDRESS=0x8000000 OFFSET=0x0 # Optional +ADDRESS=0x8000000 +START=0x8000000 +MODE=UR ERASE= # Optional for Serial RTS= @@ -28,7 +30,10 @@ usage() { -i, --interface <'swd'/'dfu'/'serial'/'jlink'> interface identifier: 'swd', 'dfu', 'serial' or 'jlink' -f, --file file path to be downloaded: bin or hex Optional options: + -a, --address flash base address. Default: $ADDRESS -e, --erase erase all sectors before flashing + -m, --mode connection mode: UR (default), HOTPLUG, POWERDOWN or hwRstPulse + -s, --start start address after flashing. Default: $START -o, --offset offset from flash base ($ADDRESS) where flashing should start Specific options for Serial protocol: @@ -118,7 +123,7 @@ if [ -n "${GNU_GETOPT}" ]; then exit 1 fi else - if ! options=$(getopt -a -o hi:ef:o:c:r:d:v:p: --long help,interface:,erase,file:,offset:,com:,rts:,dtr:,vid:,pid: -- "$@"); then + if ! options=$(getopt -a -o a:hi:m:ef:o:c:r:s:d:v:p: --long address:,help,interface:,mode:,erase,file:,start:,offset:,com:,rts:,dtr:,vid:,pid: -- "$@"); then echo "Terminating..." >&2 exit 1 fi @@ -136,6 +141,18 @@ while true; do echo "Selected interface: $INTERFACE" shift 2 ;; + -m | --mode) + MODE=$2 + shift 2 + ;; + -a | --address) + ADDRESS=$2 + shift 2 + ;; + -s | --start) + START=$2 + shift 2 + ;; -e | --erase) ERASE="--erase all" shift 1 @@ -146,7 +163,6 @@ while true; do ;; -o | --offset) OFFSET=$2 - ADDRESS=$(printf "0x%x" $((ADDRESS + OFFSET))) shift 2 ;; -c | --com) @@ -180,6 +196,8 @@ while true; do esac done +ADDRESS=$(printf "0x%x" $((ADDRESS + OFFSET))) + # Check mandatory options if [ -z "${INTERFACE}" ]; then echo "Error missing interface!" >&2 @@ -196,14 +214,14 @@ fi case "${INTERFACE}" in swd) - ${STM32CP_CLI} --connect port=SWD mode=UR "${ERASE}" --quietMode --download "${FILEPATH}" "${ADDRESS}" --start "${ADDRESS}" + ${STM32CP_CLI} --connect port=SWD mode="${MODE}" "${ERASE}" --quietMode --download "${FILEPATH}" "${ADDRESS}" --start "${START}" ;; dfu) if [ -z "${VID}" ] || [ -z "${PID}" ]; then echo "Missing mandatory arguments for DFU mode (VID/PID)!" >&2 exit 1 fi - ${STM32CP_CLI} --connect port=usb1 VID="${VID}" PID="${PID}" "${ERASE}" --quietMode --download "${FILEPATH}" "${ADDRESS}" --start "${ADDRESS}" + ${STM32CP_CLI} --connect port=usb1 VID="${VID}" PID="${PID}" "${ERASE}" --quietMode --download "${FILEPATH}" "${ADDRESS}" --start "${START}" ;; serial) if [ -z "${PORT}" ]; then @@ -222,10 +240,10 @@ case "${INTERFACE}" in exit 1 fi fi - ${STM32CP_CLI} --connect port="${PORT}" "${RTS}" "${DTR}" "${ERASE}" --quietMode --download "${FILEPATH}" "${ADDRESS}" --start "${ADDRESS}" + ${STM32CP_CLI} --connect port="${PORT}" "${RTS}" "${DTR}" "${ERASE}" --quietMode --download "${FILEPATH}" "${ADDRESS}" --start "${START}" ;; jlink) - ${STM32CP_CLI} --connect port=JLINK ap=0 "${ERASE}" --quietMode --download "${FILEPATH}" "${ADDRESS}" --start "${ADDRESS}" + ${STM32CP_CLI} --connect port=JLINK ap=0 "${ERASE}" --quietMode --download "${FILEPATH}" "${ADDRESS}" --start "${START}" ;; *) echo "Protocol unknown!" >&2 From 6efb99d72af47a8f5938ef2a642e9f3b0f69cad1 Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Mon, 28 Jul 2025 09:41:06 +0200 Subject: [PATCH 2/2] doc: update badge version to 2.3.1 Signed-off-by: Frederic Pillon --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f9a252316..c86bbda33 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Arduino_Tools [![GitHub release](https://img.shields.io/github/release/stm32duino/Arduino_Tools.svg)](https://github.com/stm32duino/Arduino_Tools/releases/latest) -[![GitHub commits](https://img.shields.io/github/commits-since/stm32duino/Arduino_Tools/2.3.0.svg)](https://github.com/stm32duino/Arduino_Tools/compare/2.3.0...master) +[![GitHub commits](https://img.shields.io/github/commits-since/stm32duino/Arduino_Tools/2.3.1.svg)](https://github.com/stm32duino/Arduino_Tools/compare/2.3.1...main) Contains upload tools for STM32 based boards and some other usefull scripts. pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy