aboutsummaryrefslogtreecommitdiff
path: root/tcl
diff options
context:
space:
mode:
authorAke Rehnman <ake.rehnman@gmail.com>2017-11-06 19:56:28 +0100
committerPaul Fertser <fercerpav@gmail.com>2017-12-07 07:53:13 +0000
commit020cb12077cb15be1700bf7733178acfb2b26428 (patch)
tree3d40047dad41518d264264862bd1f3a193933577 /tcl
parent6090a5b158ad212a54510f061226ca58155b51fe (diff)
downloadriscv-openocd-020cb12077cb15be1700bf7733178acfb2b26428.zip
riscv-openocd-020cb12077cb15be1700bf7733178acfb2b26428.tar.gz
riscv-openocd-020cb12077cb15be1700bf7733178acfb2b26428.tar.bz2
stm8 : new target
New STM8 target based mostly on mips4k. Target communication through STLINK/SWIM. No flash driver yet but it is still possible to program flash through load_image command. The usual target debug methods are implemented. Change-Id: I7216f231d3ac7c70cae20f1cd8463c2ed864a329 Signed-off-by: Ake Rehnman <ake.rehnman@gmail.com> Reviewed-on: http://openocd.zylin.com/3953 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Diffstat (limited to 'tcl')
-rw-r--r--tcl/target/stm8l.cfg87
-rw-r--r--tcl/target/stm8s.cfg84
2 files changed, 171 insertions, 0 deletions
diff --git a/tcl/target/stm8l.cfg b/tcl/target/stm8l.cfg
new file mode 100644
index 0000000..5cc99e1
--- /dev/null
+++ b/tcl/target/stm8l.cfg
@@ -0,0 +1,87 @@
+# script for stm8l family
+
+#
+# stm8 devices support SWIM transports only.
+#
+
+transport select stlink_swim
+
+if { [info exists CHIPNAME] } {
+ set _CHIPNAME $CHIPNAME
+} else {
+ set _CHIPNAME stm8l
+}
+
+# Work-area is a space in RAM used for flash programming
+# By default use 1kB
+if { [info exists WORKAREASIZE] } {
+ set _WORKAREASIZE $WORKAREASIZE
+} else {
+ set _WORKAREASIZE 0x400
+}
+
+if { [info exists FLASHSTART] } {
+ set _FLASHSTART $FLASHSTART
+} else {
+ set _FLASHSTART 0x8000
+}
+
+if { [info exists FLASHEND] } {
+ set _FLASHEND $FLASHEND
+} else {
+ set _FLASHEND 0xffff
+}
+
+if { [info exists EEPROMSTART] } {
+ set _EEPROMSTART $EEPROMSTART
+} else {
+ set _EEPROMSTART 0x4000
+}
+
+if { [info exists EEPROMEND] } {
+ set _EEPROMEND $EEPROMEND
+} else {
+ set _EEPROMEND 0x43ff
+}
+
+if { [info exists OPTIONSTART] } {
+ set _OPTIONSTART $OPTIONSTART
+} else {
+ set _OPTIONSTART 0x4800
+}
+
+if { [info exists OPTIONEND] } {
+ set _OPTIONEND $OPTIONEND
+} else {
+ set _OPTIONEND 0x487f
+}
+
+if { [info exists BLOCKSIZE] } {
+ set _BLOCKSIZE $BLOCKSIZE
+} else {
+ set _BLOCKSIZE 0x80
+}
+
+hla newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id 0
+
+set _TARGETNAME $_CHIPNAME.cpu
+
+target create $_TARGETNAME stm8 -chain-position $_CHIPNAME.cpu
+
+$_TARGETNAME configure -work-area-phys 0x0 -work-area-size $_WORKAREASIZE -work-area-backup 1
+$_TARGETNAME configure -flashstart $_FLASHSTART -flashend $_FLASHEND -eepromstart $_EEPROMSTART -eepromend $_EEPROMEND
+$_TARGETNAME configure -optionstart $_OPTIONSTART -optionend $_OPTIONEND -blocksize $_BLOCKSIZE
+
+# Uncomment this line to enable interrupts while instruction step
+#$_TARGETNAME configure -enable_step_irq
+
+# Set stm8l type
+$_TARGETNAME configure -enable_stm8l
+
+# The khz rate does not apply here, only slow <0> and fast <1>
+adapter_khz 1
+
+reset_config srst_only
+
+#uncomment this line to connect under reset
+#reset_config srst_nogate connect_assert_srst
diff --git a/tcl/target/stm8s.cfg b/tcl/target/stm8s.cfg
new file mode 100644
index 0000000..d55e61b
--- /dev/null
+++ b/tcl/target/stm8s.cfg
@@ -0,0 +1,84 @@
+# script for stm8s family
+
+#
+# stm8 devices support SWIM transports only.
+#
+
+transport select stlink_swim
+
+if { [info exists CHIPNAME] } {
+ set _CHIPNAME $CHIPNAME
+} else {
+ set _CHIPNAME stm8s
+}
+
+# Work-area is a space in RAM used for flash programming
+# By default use 1kB
+if { [info exists WORKAREASIZE] } {
+ set _WORKAREASIZE $WORKAREASIZE
+} else {
+ set _WORKAREASIZE 0x400
+}
+
+if { [info exists FLASHSTART] } {
+ set _FLASHSTART $FLASHSTART
+} else {
+ set _FLASHSTART 0x8000
+}
+
+if { [info exists FLASHEND] } {
+ set _FLASHEND $FLASHEND
+} else {
+ set _FLASHEND 0xffff
+}
+
+if { [info exists EEPROMSTART] } {
+ set _EEPROMSTART $EEPROMSTART
+} else {
+ set _EEPROMSTART 0x4000
+}
+
+if { [info exists EEPROMEND] } {
+ set _EEPROMEND $EEPROMEND
+} else {
+ set _EEPROMEND 0x43ff
+}
+
+if { [info exists OPTIONSTART] } {
+ set _OPTIONSTART $OPTIONSTART
+} else {
+ set _OPTIONSTART 0x4800
+}
+
+if { [info exists OPTIONEND] } {
+ set _OPTIONEND $OPTIONEND
+} else {
+ set _OPTIONEND 0x487f
+}
+
+if { [info exists BLOCKSIZE] } {
+ set _BLOCKSIZE $BLOCKSIZE
+} else {
+ set _BLOCKSIZE 0x80
+}
+
+hla newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id 0
+
+set _TARGETNAME $_CHIPNAME.cpu
+
+target create $_TARGETNAME stm8 -chain-position $_CHIPNAME.cpu
+
+$_TARGETNAME configure -work-area-phys 0x0 -work-area-size $_WORKAREASIZE -work-area-backup 1
+$_TARGETNAME configure -flashstart $_FLASHSTART -flashend $_FLASHEND -eepromstart $_EEPROMSTART -eepromend $_EEPROMEND
+$_TARGETNAME configure -optionstart $_OPTIONSTART -optionend $_OPTIONEND -blocksize $_BLOCKSIZE
+
+# Uncomment this line to enable interrupts while instruction step
+#$_TARGETNAME configure -enable_step_irq
+
+# The khz rate does not apply here, only slow <0> and fast <1>
+adapter_khz 1
+
+reset_config srst_only
+
+# uncomment this line to connect under reset
+#reset_config srst_nogate connect_assert_srst