2011-06-06 09:51:38 +00:00
|
|
|
# script for stm32f2xxx
|
|
|
|
|
|
|
|
if { [info exists CHIPNAME] } {
|
2011-10-29 21:32:17 +00:00
|
|
|
set _CHIPNAME $CHIPNAME
|
2011-06-06 09:51:38 +00:00
|
|
|
} else {
|
2011-10-29 21:32:17 +00:00
|
|
|
set _CHIPNAME stm32f2xxx
|
2011-06-06 09:51:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if { [info exists ENDIAN] } {
|
2011-10-29 21:32:17 +00:00
|
|
|
set _ENDIAN $ENDIAN
|
2011-06-06 09:51:38 +00:00
|
|
|
} else {
|
2011-10-29 21:32:17 +00:00
|
|
|
set _ENDIAN little
|
2011-06-06 09:51:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Work-area is a space in RAM used for flash programming
|
|
|
|
# By default use 64kB
|
|
|
|
if { [info exists WORKAREASIZE] } {
|
2011-10-29 21:32:17 +00:00
|
|
|
set _WORKAREASIZE $WORKAREASIZE
|
2011-06-06 09:51:38 +00:00
|
|
|
} else {
|
2011-10-29 21:32:17 +00:00
|
|
|
set _WORKAREASIZE 0x10000
|
2011-06-06 09:51:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# JTAG speed should be <= F_CPU/6. F_CPU after reset is 8MHz, so use F_JTAG = 1MHz
|
2011-07-15 10:05:37 +00:00
|
|
|
#
|
|
|
|
# Since we may be running of an RC oscilator, we crank down the speed a
|
|
|
|
# bit more to be on the safe side. Perhaps superstition, but if are
|
|
|
|
# running off a crystal, we can run closer to the limit. Note
|
|
|
|
# that there can be a pretty wide band where things are more or less stable.
|
2011-11-15 09:17:27 +00:00
|
|
|
adapter_khz 1000
|
2011-06-06 09:51:38 +00:00
|
|
|
|
|
|
|
jtag_nsrst_delay 100
|
|
|
|
jtag_ntrst_delay 100
|
|
|
|
|
|
|
|
#jtag scan chain
|
2011-10-29 21:32:17 +00:00
|
|
|
if { [info exists CPUTAPID] } {
|
2011-06-06 09:51:38 +00:00
|
|
|
set _CPUTAPID $CPUTAPID
|
|
|
|
} else {
|
|
|
|
# See STM Document RM0033
|
|
|
|
# Section 32.6.3 - corresponds to Cortex-M3 r2p0
|
|
|
|
set _CPUTAPID 0x4ba00477
|
|
|
|
}
|
|
|
|
jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
|
|
|
|
|
2011-10-29 21:32:17 +00:00
|
|
|
if { [info exists BSTAPID] } {
|
2011-06-06 09:51:38 +00:00
|
|
|
set _BSTAPID $BSTAPID
|
|
|
|
} else {
|
|
|
|
# See STM Document RM0033
|
|
|
|
# Section 32.6.2
|
|
|
|
#
|
|
|
|
set _BSTAPID 0x06411041
|
|
|
|
}
|
|
|
|
jtag newtap $_CHIPNAME bs -irlen 5 -expected-id $_BSTAPID
|
|
|
|
|
|
|
|
set _TARGETNAME $_CHIPNAME.cpu
|
|
|
|
target create $_TARGETNAME cortex_m3 -endian $_ENDIAN -chain-position $_TARGETNAME
|
|
|
|
|
|
|
|
$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0
|
|
|
|
|
|
|
|
set _FLASHNAME $_CHIPNAME.flash
|
2011-07-28 10:45:09 +00:00
|
|
|
flash bank $_FLASHNAME stm32f2x 0 0 0 0 $_TARGETNAME
|
2011-06-06 09:51:38 +00:00
|
|
|
|