if i do connect to a STM32H7 target, i get
Error executing event examine-end on target stm32h7x.cpu0:
/usr/bin/../share/openocd/scripts/target/stm32h7x.cfg:202: Error: wrong # args: should be "expr expression"
in procedure 'stm32h7x_dbgmcu_mmw' called at file "/usr/bin/../share/openocd/scripts/target/stm32h7x.cfg", line 166
in procedure 'stm32h7x_get_chipname' called at file "/usr/bin/../share/openocd/scripts/target/stm32h7x.cfg", line 243
at file "/usr/bin/../share/openocd/scripts/target/stm32h7x.cfg", line 202
something seems to be wrong in line 202 (return statement):
# get _CHIPNAME from current target
proc stm32h7x_get_chipname {} {
set t [target current]
set sep [string last "." $t]
if {$sep == -1} {
return $t
}
return [string range $t 0 [expr $sep - 1]]
}
unfort i dont speak tcl …
You seem to be using an old OpenOCD.
Line 202 of that script is different now.
https://github.com/openocd-org/openocd/blob/1998b1e5a89e57b2d1109bc36d6af916106103ff/tcl/target/stm32h7x.cfg#L202
You should try the latest 0.12.0 release or even a build from the head of the source repository.
so it seems within
expr
, curly brackets are required:return [string range $t 0 [expr $sep - 1]]
-->
return [string range $t 0 [expr {$sep - 1}]]
that's a simple fix. cheers.
Seems to be fixed now?
https://github.com/openocd-org/openocd/blob/b6b4f9d46a48aadc1de6bb5152ff4913661c9059/tcl/target/stm32h7x.cfg#L213
although I haven't been able to identify the specific commit/patch that effected this change...