aboutsummaryrefslogtreecommitdiff
path: root/tcl/target/stm8l.cfg
blob: 583a2a4834341672e4b7e9edd5c52aa4395c671a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# SPDX-License-Identifier: GPL-2.0-or-later

# script for stm8l family

#
# stm8 devices support SWIM transports only.
#

transport select 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
}

swim newtap $_CHIPNAME cpu

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

# Set high speed
adapter speed 800
# Set low speed
#adapter speed 363

reset_config srst_only

#uncomment this line to connect under reset
#reset_config srst_nogate connect_assert_srst