Skip to content

Instantly share code, notes, and snippets.

@cocus
Created December 16, 2025 21:24
Show Gist options
  • Select an option

  • Save cocus/80a822175f1b153863e19e2cc16c5e8d to your computer and use it in GitHub Desktop.

Select an option

Save cocus/80a822175f1b153863e19e2cc16c5e8d to your computer and use it in GitHub Desktop.
phy6222 OpenOCD config file
# SPDX-License-Identifier: GPL-2.0-or-later
# script for stm32f0x family
transport select swd
#
# stm32 devices support SWD transports only.
#
source [find target/swj-dp.tcl]
source [find mem_helper.tcl]
if { [info exists CHIPNAME] } {
set _CHIPNAME $CHIPNAME
} else {
set _CHIPNAME phy622x
}
set _ENDIAN little
# Work-area is a space in RAM used for flash programming
# By default use 0x0800
if { [info exists WORKAREASIZE] } {
set _WORKAREASIZE $WORKAREASIZE
} else {
set _WORKAREASIZE 0x0800
}
# Allow overriding the Flash bank size
if { [info exists FLASH_SIZE] } {
set _FLASH_SIZE $FLASH_SIZE
} else {
# autodetect size
set _FLASH_SIZE 0
}
#jtag scan chain
if { [info exists CPUTAPID] } {
set _CPUTAPID $CPUTAPID
} else {
set _CPUTAPID 0x0ba01477
}
swj_newdap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu
set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME cortex_m -endian $_ENDIAN -dap $_CHIPNAME.dap
$_TARGETNAME configure -work-area-phys 0x1FFFC000 -work-area-size $_WORKAREASIZE -work-area-backup 0
# adapter speed should be <= F_CPU/6. F_CPU after reset is 8MHz, so use F_JTAG = 1MHz
adapter speed 1000
adapter srst delay 100
reset_config srst_nogate
if {![using_hla]} {
# if srst is not fitted use SYSRESETREQ to
# perform a soft reset
cortex_m reset_config sysresetreq
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment