mirror of
https://git.code.sf.net/p/openocd/code
synced 2025-09-30 19:31:35 +00:00
Add support for the targets stm32mp21x, stm32mp23x and stm32mp25x. Add support for the boards stm32mp235f-dk and stm32mp257f-dk. The board stm32mp215f-dk has no configuration file as it only provides a generic JTAG/SWD connector for the stm32mp21x SoC. Change-Id: I0256bebd8a5d5600066d8ae191d83344a35d3d37 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/8985 Tested-by: jenkins Reviewed-by: zapb <dev@zapb.de>
216 lines
5.6 KiB
INI
216 lines
5.6 KiB
INI
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
# STMicroelectronics STM32MP23x
|
|
# STM32MP23x devices support both JTAG and SWD transports.
|
|
|
|
# HLA does not support multi-cores nor custom CSW nor AP other than 0
|
|
if { [using_hla] } {
|
|
echo "ERROR: HLA transport cannot work with this target."
|
|
shutdown
|
|
}
|
|
|
|
source [find target/swj-dp.tcl]
|
|
source [find mem_helper.tcl]
|
|
|
|
if { [info exists CHIPNAME] } {
|
|
set _CHIPNAME $CHIPNAME
|
|
} else {
|
|
set _CHIPNAME stm32mp23x
|
|
}
|
|
|
|
# Set to 0 to prevent CPU examine. Default examine them
|
|
if { ! [info exists EN_CA35_0] } {
|
|
set EN_CA35_0 1
|
|
}
|
|
if { ! [info exists EN_CA35_1] } {
|
|
set EN_CA35_1 1
|
|
}
|
|
if { ! [info exists EN_CM33] } {
|
|
set EN_CM33 1
|
|
}
|
|
|
|
set _ENDIAN little
|
|
|
|
# jtag scan chain
|
|
if { [info exists CPUTAPID] } {
|
|
set _CPUTAPID $CPUTAPID
|
|
} else {
|
|
if { [using_jtag] } {
|
|
set _CPUTAPID 0x6ba00477
|
|
} {
|
|
set _CPUTAPID 0x6ba02477
|
|
}
|
|
}
|
|
|
|
# Chip Level TAP Controller, only in jtag mode
|
|
if { [info exists CLCTAPID] } {
|
|
set _CLCTAPID $CLCTAPID
|
|
} else {
|
|
set _CLCTAPID 0x16505041
|
|
}
|
|
|
|
swj_newdap $_CHIPNAME tap -expected-id $_CPUTAPID -irlen 4 -ircapture 0x01 -irmask 0x0f
|
|
if { [using_jtag] } {
|
|
swj_newdap $_CHIPNAME.clc tap -expected-id $_CLCTAPID -irlen 5
|
|
}
|
|
|
|
dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.tap
|
|
|
|
# define AXI & APB Memory Access Ports
|
|
# NOTE: do not change the order of target create
|
|
target create $_CHIPNAME.ap0 mem_ap -dap $_CHIPNAME.dap -ap-num 0
|
|
target create $_CHIPNAME.axi mem_ap -dap $_CHIPNAME.dap -ap-num 4
|
|
target create $_CHIPNAME.ap8 mem_ap -dap $_CHIPNAME.dap -ap-num 8 -defer-examine
|
|
|
|
# define the first Cortex-A35
|
|
cti create $_CHIPNAME.cti.a35_0 -dap $_CHIPNAME.dap -ap-num 0 -baseaddr 0x80220000
|
|
target create $_CHIPNAME.a35_0 aarch64 -dap $_CHIPNAME.dap -ap-num 0 -dbgbase 0x80210000 \
|
|
-cti $_CHIPNAME.cti.a35_0 -defer-examine
|
|
|
|
# define the second Cortex-A35
|
|
cti create $_CHIPNAME.cti.a35_1 -dap $_CHIPNAME.dap -ap-num 0 -baseaddr 0x80320000
|
|
target create $_CHIPNAME.a35_1 aarch64 -dap $_CHIPNAME.dap -ap-num 0 -dbgbase 0x80310000 \
|
|
-cti $_CHIPNAME.cti.a35_1 -defer-examine
|
|
|
|
# define the Cortex-M33
|
|
target create $_CHIPNAME.m33 cortex_m -dap $_CHIPNAME.dap -ap-num 8 -defer-examine
|
|
cti create $_CHIPNAME.cti.m33 -dap $_CHIPNAME.dap -ap-num 8 -baseaddr 0xe0042000
|
|
|
|
# define the system CTIs
|
|
cti create $_CHIPNAME.cti.sys0 -dap $_CHIPNAME.dap -ap-num 0 -baseaddr 0x80090000
|
|
cti create $_CHIPNAME.cti.sys1 -dap $_CHIPNAME.dap -ap-num 0 -baseaddr 0x800a0000
|
|
|
|
swo create $_CHIPNAME.swo -dap $_CHIPNAME.dap -ap-num 0 -baseaddr 0x800b0000
|
|
tpiu create $_CHIPNAME.tpiu -dap $_CHIPNAME.dap -ap-num 0 -baseaddr 0x80050000
|
|
|
|
targets $_CHIPNAME.a35_0
|
|
|
|
target smp $_CHIPNAME.a35_0 $_CHIPNAME.a35_1
|
|
$_CHIPNAME.a35_0 configure -rtos hwthread
|
|
$_CHIPNAME.a35_1 configure -rtos hwthread
|
|
|
|
reset_config srst_gates_jtag srst_pulls_trst
|
|
|
|
adapter speed 5000
|
|
adapter srst pulse_width 200
|
|
# wait 1 seconds for bootrom
|
|
adapter srst delay 1000
|
|
|
|
# set CSW for AXI
|
|
$_CHIPNAME.dap apsel 4
|
|
$_CHIPNAME.dap apcsw 0x12800000
|
|
|
|
# mmw with target selection
|
|
proc target_mmw {target reg setbits clearbits} {
|
|
set val [eval $target read_memory $reg 32 1]
|
|
set val [expr {($val & ~$clearbits) | $setbits}]
|
|
eval $target mww $reg $val
|
|
}
|
|
|
|
lappend _telnet_autocomplete_skip _enable_debug
|
|
# Uses AP0 and AXI
|
|
proc _enable_debug {} {
|
|
# set debug enable bits in DBGMCU_CR to get ap8/cm33 visible
|
|
$::_CHIPNAME.ap0 mww 0x80010004 0x17
|
|
|
|
# Freeze watchdogs on CPU halt
|
|
$::_CHIPNAME.axi mww 0x4a010008 0x00000000
|
|
$::_CHIPNAME.axi mww 0x4a01003c 0x00000026
|
|
$::_CHIPNAME.axi mww 0x4a010040 0x00000038
|
|
$::_CHIPNAME.axi mww 0x4a010044 0x00000400
|
|
$::_CHIPNAME.axi mww 0x4a010048 0x00000400
|
|
$::_CHIPNAME.axi mww 0x4a01004c 0x00000600
|
|
}
|
|
|
|
lappend _telnet_autocomplete_skip _rcc_enable_traceclk
|
|
# Uses AXI
|
|
proc _rcc_enable_traceclk {} {
|
|
# set bit TRACEEN in RCC_DBGCFGR to clock TPIU
|
|
target_mmw $::_CHIPNAME.axi 0x44200520 0x200 0
|
|
}
|
|
|
|
lappend _telnet_autocomplete_skip _handshake_with_wrapper
|
|
# Uses AP0
|
|
proc _handshake_with_wrapper { halt } {
|
|
set dbgmcu_cr 0
|
|
catch {set dbgmcu_cr [eval $::_CHIPNAME.ap0 read_memory 0x80010004 32 1]}
|
|
if {[expr {($dbgmcu_cr & 0x07) == 0x00}]} {
|
|
echo "\nWARNING: FSBL wrapper not detected. Board in dev boot mode?\n"
|
|
return;
|
|
}
|
|
|
|
if { $halt } {
|
|
if { $::EN_CA35_0 || $::EN_CA35_1 } {
|
|
$::_CHIPNAME.ap0 arp_examine
|
|
$::_CHIPNAME.ap0 arp_halt
|
|
}
|
|
if { $::EN_CA35_0 } {
|
|
$::_CHIPNAME.ap0 mww 0x80210300 0
|
|
target_mmw $::_CHIPNAME.ap0 0x80210088 0x00004000 0
|
|
}
|
|
if { $::EN_CA35_1 } {
|
|
$::_CHIPNAME.ap0 mww 0x80310300 0
|
|
target_mmw $::_CHIPNAME.ap0 0x80310088 0x00004000 0
|
|
}
|
|
if { $::EN_CM33 } {
|
|
$::_CHIPNAME.ap8 arp_examine
|
|
$::_CHIPNAME.ap8 arp_halt
|
|
$::_CHIPNAME.ap8 mww 0xe000edf0 0xa05f0001
|
|
}
|
|
}
|
|
|
|
# alert wrapper that debugger is ready
|
|
$::_CHIPNAME.ap0 mww 0x80010004 0x17
|
|
}
|
|
|
|
$_CHIPNAME.m33 configure -event reset-assert { }
|
|
|
|
$_CHIPNAME.axi configure -event reset-assert-post {
|
|
adapter assert srst
|
|
}
|
|
|
|
$_CHIPNAME.axi configure -event reset-deassert-pre {
|
|
adapter deassert srst deassert trst
|
|
|
|
$::_CHIPNAME.ap0 arp_examine
|
|
_handshake_with_wrapper $halt
|
|
|
|
$::_CHIPNAME.axi arp_examine
|
|
_enable_debug
|
|
_rcc_enable_traceclk
|
|
if { $::EN_CA35_0 } {
|
|
$::_CHIPNAME.a35_0 arp_examine
|
|
if { $halt } {
|
|
$::_CHIPNAME.a35_0 arp_halt
|
|
}
|
|
}
|
|
if { $::EN_CA35_1 } {
|
|
$::_CHIPNAME.a35_1 arp_examine
|
|
if { $halt } {
|
|
$::_CHIPNAME.a35_1 arp_halt
|
|
}
|
|
}
|
|
if { $::EN_CM33 } {
|
|
$::_CHIPNAME.ap8 arp_examine
|
|
$::_CHIPNAME.m33 arp_examine
|
|
if { $halt } {
|
|
$::_CHIPNAME.m33 arp_halt
|
|
}
|
|
}
|
|
}
|
|
|
|
$_CHIPNAME.axi configure -event examine-end {
|
|
_enable_debug
|
|
_rcc_enable_traceclk
|
|
if { $::EN_CA35_0 } {
|
|
$::_CHIPNAME.a35_0 arp_examine
|
|
}
|
|
if { $::EN_CA35_1 } {
|
|
$::_CHIPNAME.a35_1 arp_examine
|
|
}
|
|
if { $::EN_CM33 } {
|
|
$::_CHIPNAME.ap8 arp_examine
|
|
$::_CHIPNAME.m33 arp_examine
|
|
}
|
|
}
|