1 # script for stm32f2xxx
3 if { [info exists CHIPNAME] } {
4 set _CHIPNAME $CHIPNAME
6 set _CHIPNAME stm32f2xxx
9 if { [info exists ENDIAN] } {
15 # Work-area is a space in RAM used for flash programming
17 if { [info exists WORKAREASIZE] } {
18 set _WORKAREASIZE $WORKAREASIZE
20 set _WORKAREASIZE 0x10000
23 # JTAG speed should be <= F_CPU/6. F_CPU after reset is 8MHz, so use F_JTAG = 1MHz
30 if { [info exists CPUTAPID ] } {
31 set _CPUTAPID $CPUTAPID
33 # See STM Document RM0033
34 # Section 32.6.3 - corresponds to Cortex-M3 r2p0
35 set _CPUTAPID 0x4ba00477
37 jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
39 if { [info exists BSTAPID ] } {
42 # See STM Document RM0033
45 set _BSTAPID 0x06411041
47 jtag newtap $_CHIPNAME bs -irlen 5 -expected-id $_BSTAPID
49 set _TARGETNAME $_CHIPNAME.cpu
50 target create $_TARGETNAME cortex_m3 -endian $_ENDIAN -chain-position $_TARGETNAME
52 $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0
54 set _FLASHNAME $_CHIPNAME.flash
55 flash bank $_FLASHNAME stm32f2xxx 0 0 0 0 $_TARGETNAME