boards: arduino_giga_r1: add OpenOCD support

Add support for OpenOCD runner to the Arduino Giga R1 board. This shares
the same CPU as the STM32H747i Discovery, so that implementation can be
reused.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
This commit is contained in:
Luca Burelli 2023-08-30 14:42:51 +02:00 committed by Fabio Baltieri
parent b1d24e425c
commit 3bdd91a575
3 changed files with 45 additions and 0 deletions

View file

@ -2,8 +2,12 @@
if(CONFIG_BOARD_ARDUINO_GIGA_R1_M7)
board_runner_args(jlink "--device=STM32H747XI_M7" "--speed=4000")
board_runner_args(openocd "--config=${BOARD_DIR}/support/openocd_arduino_giga_r1_m7.cfg")
board_runner_args(openocd --target-handle=_CHIPNAME.cpu0)
elseif(CONFIG_BOARD_ARDUINO_GIGA_R1_M4)
board_runner_args(jlink "--device=STM32H747XI_M4" "--speed=4000")
board_runner_args(openocd "--config=${BOARD_DIR}/support/openocd_arduino_giga_r1_m4.cfg")
board_runner_args(openocd --target-handle=_CHIPNAME.cpu1)
endif()
board_runner_args(dfu-util "--pid=2341:0366" "--alt=0" "--dfuse")
board_runner_args(blackmagicprobe "--connect-rst")
@ -11,3 +15,4 @@ board_runner_args(blackmagicprobe "--connect-rst")
include(${ZEPHYR_BASE}/boards/common/dfu-util.board.cmake)
include(${ZEPHYR_BASE}/boards/common/blackmagicprobe.board.cmake)
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)

View file

@ -0,0 +1,12 @@
source [find interface/stlink.cfg]
transport select hla_swd
set DUAL_BANK 1
set DUAL_CORE 1
source [find target/stm32h7x.cfg]
reset_config srst_only srst_nogate connect_assert_srst

View file

@ -0,0 +1,28 @@
source [find interface/stlink.cfg]
transport select hla_swd
source [find target/stm32h7x.cfg]
# Use connect_assert_srst here to be able to program
# even when core is in sleep mode
reset_config srst_only srst_nogate connect_assert_srst
$_CHIPNAME.cpu0 configure -event gdb-attach {
echo "Debugger attaching: halting execution"
gdb_breakpoint_override hard
}
$_CHIPNAME.cpu0 configure -event gdb-detach {
echo "Debugger detaching: resuming execution"
resume
}
# Due to the use of connect_assert_srst, running gdb requires
# to reset halt just after openocd init.
rename init old_init
proc init {} {
old_init
reset halt
}