2 # STM32f4x stlink pseudo target
5 if { [info exists CHIPNAME] == 0 } {
9 if { [info exists CPUTAPID] == 0 } {
10 set CPUTAPID 0x2ba01477
13 if { [info exists WORKAREASIZE] == 0 } {
14 set WORKAREASIZE 0x10000
18 # stm32 stlink pseudo target
21 if { [info exists CHIPNAME] } {
22 set _CHIPNAME $CHIPNAME
24 set _CHIPNAME stm32f1x
27 # Work-area is a space in RAM used for flash programming
29 if { [info exists WORKAREASIZE] } {
30 set _WORKAREASIZE $WORKAREASIZE
32 set _WORKAREASIZE 0x4000
35 if { [info exists CPUTAPID] } {
36 set _CPUTAPID $CPUTAPID
38 # this is the SW-DP tap id not the jtag tap id
39 set _CPUTAPID 0x1ba01477
42 if { [info exists TRANSPORT] } {
43 set _TRANSPORT $TRANSPORT
44 if { $TRANSPORT == "stlink_jtag" } {
45 if { [info exists CPUTAPID] == 0 } {
46 # jtag requires us to use the jtag tap id
47 set _CPUTAPID 0x3ba00477
51 set _TRANSPORT stlink_swd
55 # possibles value are stlink_swd or stlink_jtag
57 transport select $_TRANSPORT
59 stlink newtap $_CHIPNAME cpu -expected-id $_CPUTAPID
61 set _TARGETNAME $_CHIPNAME.cpu
62 target create $_TARGETNAME stm32_stlink -chain-position $_TARGETNAME -rtos auto
64 $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0
66 # stm32f4x family uses stm32f2x driver
67 set _FLASHNAME $_CHIPNAME.flash
68 flash bank $_FLASHNAME stm32f2x 0 0 0 0 $_TARGETNAME