Skip to content

Commit

Permalink
boards: arduino_giga_r1: add OpenOCD support
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
pillo79 authored and fabiobaltieri committed Dec 6, 2023
1 parent b1d24e4 commit 3bdd91a
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
5 changes: 5 additions & 0 deletions boards/arm/arduino_giga_r1/board.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@

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")

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)
12 changes: 12 additions & 0 deletions boards/arm/arduino_giga_r1/support/openocd_arduino_giga_r1_m4.cfg
Original file line number Diff line number Diff line change
@@ -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
28 changes: 28 additions & 0 deletions boards/arm/arduino_giga_r1/support/openocd_arduino_giga_r1_m7.cfg
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit 3bdd91a

Please sign in to comment.