Created
December 16, 2025 21:24
-
-
Save cocus/5994be77748fcf53669daa70ef291e0d to your computer and use it in GitHub Desktop.
py32f002.cfg OpenOCD wip config file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # SPDX-License-Identifier: GPL-2.0-or-later | |
| # script for py32f02 family | |
| # | |
| # 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 py32f02 | |
| } | |
| set _ENDIAN little | |
| # Work-area is a space in RAM used for flash programming | |
| if { [info exists WORKAREASIZE] } { | |
| set _WORKAREASIZE $WORKAREASIZE | |
| } else { | |
| set _WORKAREASIZE 0xC00 | |
| } | |
| # Allow overriding the Flash bank size | |
| if { [info exists FLASH_SIZE] } { | |
| set _FLASH_SIZE $FLASH_SIZE | |
| } else { | |
| # autodetect size | |
| set _FLASH_SIZE 0x5000 | |
| } | |
| #jtag scan chain | |
| if { [info exists CPUTAPID] } { | |
| set _CPUTAPID $CPUTAPID | |
| } else { | |
| set _CPUTAPID 0x0bb11477 | |
| } | |
| 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 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0 | |
| # flash size will be probed | |
| set _FLASHNAME $_CHIPNAME.flash | |
| #######flash bank $_FLASHNAME stm32f1x 0x08000000 $_FLASH_SIZE 0 0 $_TARGETNAME | |
| # 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 | |
| } | |
| # Default hooks | |
| #######$_TARGETNAME configure -event examine-end { stm32f0x_default_examine_end } | |
| #######$_TARGETNAME configure -event reset-start { stm32f0x_default_reset_start } | |
| #######$_TARGETNAME configure -event reset-init { stm32f0x_default_reset_init } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment