1 |
2 |
olivier.gi |
#!/usr/bin/tclsh
|
2 |
|
|
#------------------------------------------------------------------------------
|
3 |
|
|
# Copyright (C) 2001 Authors
|
4 |
|
|
#
|
5 |
|
|
# This source file may be used and distributed without restriction provided
|
6 |
|
|
# that this copyright statement is not removed from the file and that any
|
7 |
|
|
# derivative work contains the original copyright notice and the associated
|
8 |
|
|
# disclaimer.
|
9 |
|
|
#
|
10 |
|
|
# This source file is free software; you can redistribute it and/or modify
|
11 |
|
|
# it under the terms of the GNU Lesser General Public License as published
|
12 |
|
|
# by the Free Software Foundation; either version 2.1 of the License, or
|
13 |
|
|
# (at your option) any later version.
|
14 |
|
|
#
|
15 |
|
|
# This source is distributed in the hope that it will be useful, but WITHOUT
|
16 |
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
17 |
|
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
18 |
|
|
# License for more details.
|
19 |
|
|
#
|
20 |
|
|
# You should have received a copy of the GNU Lesser General Public License
|
21 |
|
|
# along with this source; if not, write to the Free Software Foundation,
|
22 |
|
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
23 |
|
|
#
|
24 |
|
|
#------------------------------------------------------------------------------
|
25 |
|
|
#
|
26 |
|
|
# File Name: openmsp430-gdbproxy.tcl
|
27 |
|
|
#
|
28 |
14 |
olivier.gi |
# Author(s):
|
29 |
|
|
# - Olivier Girard, olgirard@gmail.com
|
30 |
|
|
#
|
31 |
2 |
olivier.gi |
#------------------------------------------------------------------------------
|
32 |
14 |
olivier.gi |
# $Rev: 158 $
|
33 |
|
|
# $LastChangedBy: olivier.girard $
|
34 |
|
|
# $LastChangedDate: 2012-10-15 23:49:09 +0200 (Mon, 15 Oct 2012) $
|
35 |
|
|
#------------------------------------------------------------------------------
|
36 |
2 |
olivier.gi |
|
37 |
|
|
###############################################################################
|
38 |
|
|
# #
|
39 |
|
|
# SOURCE LIBRARIES #
|
40 |
|
|
# #
|
41 |
|
|
###############################################################################
|
42 |
|
|
|
43 |
|
|
# Get library path
|
44 |
|
|
set current_file [info script]
|
45 |
|
|
if {[file type $current_file]=="link"} {
|
46 |
|
|
set current_file [file readlink $current_file]
|
47 |
|
|
}
|
48 |
|
|
set lib_path [file dirname $current_file]/../lib/tcl-lib
|
49 |
|
|
|
50 |
|
|
# Source library
|
51 |
|
|
source $lib_path/dbg_functions.tcl
|
52 |
158 |
olivier.gi |
source $lib_path/dbg_utils.tcl
|
53 |
2 |
olivier.gi |
|
54 |
|
|
# Source remaining files
|
55 |
|
|
source [file dirname $current_file]/../openmsp430-gdbproxy/server.tcl
|
56 |
|
|
source [file dirname $current_file]/../openmsp430-gdbproxy/commands.tcl
|
57 |
|
|
|
58 |
|
|
|
59 |
|
|
###############################################################################
|
60 |
|
|
# #
|
61 |
158 |
olivier.gi |
# GLOBAL VARIABLES #
|
62 |
|
|
# #
|
63 |
|
|
###############################################################################
|
64 |
|
|
|
65 |
|
|
global CpuNr
|
66 |
|
|
|
67 |
|
|
global omsp_conf
|
68 |
|
|
global omsp_info
|
69 |
|
|
|
70 |
|
|
global omsp_nr
|
71 |
|
|
|
72 |
|
|
global gui_dbg_if
|
73 |
|
|
global gui_adapter
|
74 |
|
|
global clients
|
75 |
|
|
global server
|
76 |
|
|
global verbose
|
77 |
|
|
global shell
|
78 |
|
|
|
79 |
|
|
# Initialize to default values
|
80 |
|
|
set CpuNr 0
|
81 |
|
|
set omsp_nr 1
|
82 |
|
|
set omsp_conf(interface) uart_generic
|
83 |
|
|
#set omsp_nr 4
|
84 |
|
|
#set omsp_conf(interface) i2c_usb-iss
|
85 |
|
|
set omsp_conf(device) [lindex [utils::uart_port_list] end]
|
86 |
|
|
set omsp_conf(baudrate) [lindex [GetAllowedSpeeds] 1]
|
87 |
|
|
set omsp_conf(0,cpuaddr) 50
|
88 |
|
|
set omsp_conf(1,cpuaddr) 51
|
89 |
|
|
set omsp_conf(2,cpuaddr) 52
|
90 |
|
|
set omsp_conf(3,cpuaddr) 53
|
91 |
|
|
|
92 |
|
|
set server(port) 2000
|
93 |
|
|
|
94 |
|
|
set shell 0
|
95 |
|
|
set verbose 0
|
96 |
|
|
|
97 |
|
|
###############################################################################
|
98 |
|
|
# #
|
99 |
2 |
olivier.gi |
# PARAMETER CHECK #
|
100 |
|
|
# #
|
101 |
|
|
###############################################################################
|
102 |
|
|
|
103 |
|
|
proc help {} {
|
104 |
|
|
puts ""
|
105 |
158 |
olivier.gi |
puts "USAGE : openmsp430-gdbproxy.tcl \[-device <communication port>\]"
|
106 |
|
|
puts " \[-adaptor <adaptor type>\]"
|
107 |
|
|
puts " \[-speed <communication speed>\]"
|
108 |
|
|
puts " \[-i2c_addr <cpu address>\]"
|
109 |
2 |
olivier.gi |
puts " \[-port <server port>\]"
|
110 |
|
|
puts " \[-shell]"
|
111 |
|
|
puts " \[-verbose\]"
|
112 |
|
|
puts " \[-help\]"
|
113 |
|
|
puts ""
|
114 |
158 |
olivier.gi |
puts "Examples: openmsp430-gdbproxy.tcl -device /dev/ttyUSB0 -adaptor uart_generic -speed 115200 -port 2000"
|
115 |
|
|
puts " openmsp430-gdbproxy.tcl -device COM2: -adaptor i2c_usb-iss -speed I2C_S_100KHZ -i2c_addr 75 -port 2000"
|
116 |
2 |
olivier.gi |
puts ""
|
117 |
|
|
}
|
118 |
|
|
|
119 |
|
|
# Parse arguments
|
120 |
|
|
for {set i 0} {$i < $argc} {incr i} {
|
121 |
|
|
switch -exact -- [lindex $argv $i] {
|
122 |
158 |
olivier.gi |
-device {set omsp_conf(device) [lindex $argv [expr $i+1]]; incr i}
|
123 |
|
|
-adaptor {set omsp_conf(interface) [lindex $argv [expr $i+1]]; incr i}
|
124 |
|
|
-speed {set omsp_conf(baudrate) [lindex $argv [expr $i+1]]; incr i}
|
125 |
|
|
-i2c_addr {set omsp_conf(0,cpuaddr) [lindex $argv [expr $i+1]]; incr i}
|
126 |
|
|
-port {set server(port) [lindex $argv [expr $i+1]]; incr i}
|
127 |
|
|
-shell {set shell 1}
|
128 |
|
|
-verbose {set verbose 1}
|
129 |
|
|
-h {help; exit 0}
|
130 |
|
|
-help {help; exit 0}
|
131 |
|
|
default {}
|
132 |
2 |
olivier.gi |
}
|
133 |
|
|
}
|
134 |
|
|
|
135 |
158 |
olivier.gi |
# Make sure the selected adptor is valid
|
136 |
|
|
if {![string eq $omsp_conf(interface) "uart_generic"] &
|
137 |
|
|
![string eq $omsp_conf(interface) "i2c_usb-iss"]} {
|
138 |
|
|
puts "\nERROR: Specified adaptor is not valid (should be \"uart_generic\" or \"i2c_usb-iss\")"
|
139 |
|
|
help
|
140 |
|
|
exit 1
|
141 |
|
|
}
|
142 |
|
|
|
143 |
|
|
# Make sure the I2C address is an integer
|
144 |
|
|
if {![string is integer $omsp_conf(0,cpuaddr)]} {
|
145 |
|
|
puts "\nERROR: Specified I2C address is not an integer"
|
146 |
|
|
help
|
147 |
|
|
exit 1
|
148 |
|
|
}
|
149 |
|
|
|
150 |
|
|
# Make sure the I2C address is valid
|
151 |
|
|
if {($omsp_conf(0,cpuaddr)<8) | ($omsp_conf(0,cpuaddr)>119)} {
|
152 |
|
|
puts "\nERROR: Specified I2C address should lay between 7 and 120"
|
153 |
|
|
help
|
154 |
|
|
exit 1
|
155 |
|
|
}
|
156 |
|
|
|
157 |
|
|
# If the selected interface is a UART, make sure the selected speed is an integer
|
158 |
|
|
if {[string eq $omsp_conf(interface) "uart_generic"]} {
|
159 |
|
|
if {![string is integer $omsp_conf(baudrate)]} {
|
160 |
|
|
puts "\nERROR: Specified UART communication speed is not an integer"
|
161 |
|
|
help
|
162 |
|
|
exit 1
|
163 |
|
|
}
|
164 |
|
|
} elseif {[string eq $omsp_conf(interface) "i2c_usb-iss"]} {
|
165 |
|
|
if {[lsearch [lindex [GetAllowedSpeeds] 2] $omsp_conf(baudrate)]==-1} {
|
166 |
|
|
puts "\nERROR: Specified I2C communication speed is not valid."
|
167 |
|
|
puts " Allowed values are:"
|
168 |
|
|
foreach allowedVal [lindex [GetAllowedSpeeds] 2] {
|
169 |
|
|
puts " - $allowedVal"
|
170 |
|
|
}
|
171 |
|
|
puts ""
|
172 |
|
|
exit 1
|
173 |
|
|
}
|
174 |
|
|
}
|
175 |
|
|
|
176 |
2 |
olivier.gi |
# Source additional library for graphical interface
|
177 |
|
|
if {!$shell} {
|
178 |
|
|
source $lib_path/combobox.tcl
|
179 |
|
|
package require combobox 2.3
|
180 |
|
|
catch {namespace import combobox::*}
|
181 |
|
|
}
|
182 |
|
|
|
183 |
|
|
# Small functions to display messages
|
184 |
|
|
proc putsLog {string {nonewline 0}} {
|
185 |
|
|
global server
|
186 |
|
|
global shell
|
187 |
|
|
if {$shell} {
|
188 |
158 |
olivier.gi |
if {$nonewline} {
|
189 |
|
|
puts -nonewline $string
|
190 |
|
|
} else {
|
191 |
|
|
puts $string
|
192 |
|
|
}
|
193 |
2 |
olivier.gi |
} else {
|
194 |
158 |
olivier.gi |
if {$nonewline} {
|
195 |
|
|
$server(log) insert end "$string"
|
196 |
|
|
} else {
|
197 |
|
|
$server(log) insert end "$string\n"
|
198 |
|
|
}
|
199 |
|
|
$server(log) see end
|
200 |
2 |
olivier.gi |
}
|
201 |
|
|
}
|
202 |
|
|
proc putsVerbose {string} {
|
203 |
|
|
global verbose
|
204 |
|
|
if {$verbose} {
|
205 |
158 |
olivier.gi |
putsLog "$string"
|
206 |
2 |
olivier.gi |
}
|
207 |
|
|
}
|
208 |
|
|
|
209 |
|
|
###############################################################################
|
210 |
|
|
# SHELL MODE #
|
211 |
|
|
###############################################################################
|
212 |
|
|
if {$shell} {
|
213 |
|
|
|
214 |
|
|
# Connect to device
|
215 |
158 |
olivier.gi |
if {![GetDevice $CpuNr]} {
|
216 |
|
|
puts "ERROR: Could not open $omsp_conf(device)
|
217 |
|
|
puts "INFO: Available serial ports are:"
|
218 |
|
|
foreach port [utils::uart_port_list] {
|
219 |
|
|
puts "INFO: - $port"
|
220 |
|
|
}
|
221 |
|
|
if {[string eq $omsp_conf(interface) "i2c_usb-iss"]} {
|
222 |
|
|
puts "\nMake sure the specified I2C device address is correct: $omsp_conf(0,cpuaddr)\n"
|
223 |
|
|
}
|
224 |
|
|
exit 1
|
225 |
2 |
olivier.gi |
}
|
226 |
|
|
|
227 |
|
|
# Display info
|
228 |
158 |
olivier.gi |
if {$omsp_info($CpuNr,alias)==""} {
|
229 |
|
|
puts "INFO: Sucessfully connected with the openMSP430 target."
|
230 |
110 |
olivier.gi |
} else {
|
231 |
158 |
olivier.gi |
puts "INFO: Sucessfully connected with the openMSP430 target ($omsp_info($CpuNr,alias))."
|
232 |
110 |
olivier.gi |
}
|
233 |
158 |
olivier.gi |
set sizes [GetCPU_ID_SIZE $CpuNr]
|
234 |
|
|
if {$omsp_info($CpuNr,asic)} {
|
235 |
|
|
puts "INFO: CPU Version - $omsp_info($CpuNr,cpu_ver) / ASIC"
|
236 |
110 |
olivier.gi |
} else {
|
237 |
158 |
olivier.gi |
puts "INFO: CPU Version - $omsp_info($CpuNr,cpu_ver) / FPGA"
|
238 |
110 |
olivier.gi |
}
|
239 |
158 |
olivier.gi |
puts "INFO: User Version - $omsp_info($CpuNr,user_ver)"
|
240 |
|
|
if {$omsp_info($CpuNr,cpu_ver)==1} {
|
241 |
|
|
puts "INFO: Hardware Multiplier - --"
|
242 |
|
|
} elseif {$omsp_info($CpuNr,mpy)} {
|
243 |
|
|
puts "INFO: Hardware Multiplier - Yes"
|
244 |
110 |
olivier.gi |
} else {
|
245 |
158 |
olivier.gi |
puts "INFO: Hardware Multiplier - No"
|
246 |
110 |
olivier.gi |
}
|
247 |
158 |
olivier.gi |
puts "INFO: Program Memory Size - $omsp_info($CpuNr,pmem_size) B"
|
248 |
|
|
puts "INFO: Data Memory Size - $omsp_info($CpuNr,dmem_size) B"
|
249 |
|
|
puts "INFO: Peripheral Address Space - $omsp_info($CpuNr,per_size) B"
|
250 |
|
|
puts "INFO: $omsp_info($CpuNr,hw_break) Hardware Brea/Watch-point unit(s) detected"
|
251 |
2 |
olivier.gi |
puts ""
|
252 |
|
|
|
253 |
|
|
# Reset & Stop CPU
|
254 |
158 |
olivier.gi |
ExecutePOR_Halt $CpuNr
|
255 |
2 |
olivier.gi |
|
256 |
|
|
# Start server for GDB
|
257 |
|
|
if {![startServer]} {
|
258 |
158 |
olivier.gi |
exit 1
|
259 |
2 |
olivier.gi |
}
|
260 |
|
|
|
261 |
|
|
vwait forever
|
262 |
|
|
}
|
263 |
|
|
|
264 |
158 |
olivier.gi |
proc getConfiguration {} {
|
265 |
2 |
olivier.gi |
|
266 |
158 |
olivier.gi |
global gui_dbg_if
|
267 |
|
|
global gui_adapter
|
268 |
|
|
global omsp_conf
|
269 |
|
|
|
270 |
|
|
regexp {(.+)_(.+)} $omsp_conf(interface) whole_match tmp_if tmp_adapter
|
271 |
|
|
|
272 |
|
|
set gui_dbg_if [string toupper $tmp_if]
|
273 |
|
|
set gui_adapter [string toupper $tmp_adapter]
|
274 |
|
|
|
275 |
|
|
return 1
|
276 |
|
|
}
|
277 |
|
|
|
278 |
|
|
proc updateConfiguration {{w ""} {sel ""}} {
|
279 |
|
|
|
280 |
|
|
global gui_dbg_if
|
281 |
|
|
global gui_adapter
|
282 |
|
|
global omsp_conf
|
283 |
|
|
global omsp_nr
|
284 |
|
|
|
285 |
|
|
if {$sel=="UART"} {
|
286 |
|
|
eval .connect.cfg.if.config2.adapter.p2 list delete 0 end
|
287 |
|
|
eval .connect.cfg.if.config2.adapter.p2 list insert end [list "GENERIC"]
|
288 |
|
|
set gui_adapter "GENERIC"
|
289 |
|
|
set omsp_conf(interface) uart_generic
|
290 |
|
|
|
291 |
|
|
} elseif {$sel=="I2C"} {
|
292 |
|
|
|
293 |
|
|
eval .connect.cfg.if.config2.adapter.p2 list delete 0 end
|
294 |
|
|
eval .connect.cfg.if.config2.adapter.p2 list insert end [list "USB-ISS"]
|
295 |
|
|
set gui_adapter "USB-ISS"
|
296 |
|
|
set omsp_conf(interface) i2c_usb-iss
|
297 |
|
|
}
|
298 |
|
|
|
299 |
|
|
if {$gui_dbg_if=="UART"} {
|
300 |
|
|
set omsp_nr 1
|
301 |
|
|
.connect.cfg.ad.i2c_nr.l configure -state disabled
|
302 |
|
|
.connect.cfg.ad.i2c_nr.s configure -state disabled
|
303 |
|
|
.connect.cfg.ad.i2c_addr.l configure -state disabled
|
304 |
|
|
.connect.cfg.ad.i2c_addr.s0 configure -state disabled
|
305 |
|
|
.connect.cfg.ad.i2c_addr.s1 configure -state disabled
|
306 |
|
|
.connect.cfg.ad.i2c_addr.s2 configure -state disabled
|
307 |
|
|
.connect.cfg.ad.i2c_addr.s3 configure -state disabled
|
308 |
|
|
.connect.cfg.ad.arrow.l0 configure -state disabled
|
309 |
|
|
.connect.cfg.ad.arrow.l1 configure -state disabled
|
310 |
|
|
.connect.cfg.ad.arrow.l2 configure -state disabled
|
311 |
|
|
.connect.cfg.ad.arrow.l3 configure -state disabled
|
312 |
|
|
.connect.cfg.ad.server_port.p0 configure -state normal
|
313 |
|
|
.connect.cfg.ad.server_port.p1 configure -state disabled
|
314 |
|
|
.connect.cfg.ad.server_port.p2 configure -state disabled
|
315 |
|
|
.connect.cfg.ad.server_port.p3 configure -state disabled
|
316 |
|
|
.connect.cfg.ad.core_nr.l0 configure -state disabled
|
317 |
|
|
.connect.cfg.ad.core_nr.l1 configure -state disabled
|
318 |
|
|
.connect.cfg.ad.core_nr.l2 configure -state disabled
|
319 |
|
|
.connect.cfg.ad.core_nr.l3 configure -state disabled
|
320 |
|
|
} elseif {$gui_dbg_if=="I2C"} {
|
321 |
|
|
# .connect.cfg.ad.core_nr.l0 configure -state normal
|
322 |
|
|
# .connect.cfg.ad.i2c_nr.l configure -state normal
|
323 |
|
|
# .connect.cfg.ad.i2c_nr.s configure -state normal
|
324 |
|
|
.connect.cfg.ad.i2c_addr.l configure -state normal
|
325 |
|
|
.connect.cfg.ad.i2c_addr.s0 configure -state normal
|
326 |
|
|
.connect.cfg.ad.arrow.l0 configure -state normal
|
327 |
|
|
.connect.cfg.ad.server_port.p0 configure -state normal
|
328 |
|
|
# .connect.cfg.ad.core_nr.l0 configure -state normal
|
329 |
|
|
|
330 |
|
|
|
331 |
|
|
if {$omsp_nr < 2} {
|
332 |
|
|
.connect.cfg.ad.core_nr.l1 configure -state disabled
|
333 |
|
|
.connect.cfg.ad.server_port.p1 configure -state disabled
|
334 |
|
|
.connect.cfg.ad.arrow.l1 configure -state disabled
|
335 |
|
|
.connect.cfg.ad.i2c_addr.s1 configure -state disabled
|
336 |
|
|
} else {
|
337 |
|
|
.connect.cfg.ad.core_nr.l1 configure -state normal
|
338 |
|
|
.connect.cfg.ad.server_port.p1 configure -state normal
|
339 |
|
|
.connect.cfg.ad.arrow.l1 configure -state normal
|
340 |
|
|
.connect.cfg.ad.i2c_addr.s1 configure -state normal
|
341 |
|
|
}
|
342 |
|
|
|
343 |
|
|
if {$omsp_nr < 3} {
|
344 |
|
|
.connect.cfg.ad.core_nr.l2 configure -state disabled
|
345 |
|
|
.connect.cfg.ad.server_port.p2 configure -state disabled
|
346 |
|
|
.connect.cfg.ad.arrow.l2 configure -state disabled
|
347 |
|
|
.connect.cfg.ad.i2c_addr.s2 configure -state disabled
|
348 |
|
|
} else {
|
349 |
|
|
.connect.cfg.ad.core_nr.l2 configure -state normal
|
350 |
|
|
.connect.cfg.ad.server_port.p2 configure -state normal
|
351 |
|
|
.connect.cfg.ad.arrow.l2 configure -state normal
|
352 |
|
|
.connect.cfg.ad.i2c_addr.s2 configure -state normal
|
353 |
|
|
}
|
354 |
|
|
|
355 |
|
|
if {$omsp_nr < 4} {
|
356 |
|
|
.connect.cfg.ad.core_nr.l3 configure -state disabled
|
357 |
|
|
.connect.cfg.ad.server_port.p3 configure -state disabled
|
358 |
|
|
.connect.cfg.ad.arrow.l3 configure -state disabled
|
359 |
|
|
.connect.cfg.ad.i2c_addr.s3 configure -state disabled
|
360 |
|
|
} else {
|
361 |
|
|
.connect.cfg.ad.core_nr.l3 configure -state normal
|
362 |
|
|
.connect.cfg.ad.server_port.p3 configure -state normal
|
363 |
|
|
.connect.cfg.ad.arrow.l3 configure -state normal
|
364 |
|
|
.connect.cfg.ad.i2c_addr.s3 configure -state normal
|
365 |
|
|
}
|
366 |
|
|
}
|
367 |
|
|
|
368 |
|
|
.connect.cfg.if.config2.serial_port.p2 configure -editable 1
|
369 |
|
|
eval .connect.cfg.if.config2.serial_port.p2 list delete 0 end
|
370 |
|
|
eval .connect.cfg.if.config2.serial_port.p2 list insert end [lindex [GetAllowedSpeeds] 2]
|
371 |
|
|
set omsp_conf(baudrate) [lindex [GetAllowedSpeeds] 1];
|
372 |
|
|
.connect.cfg.if.config2.serial_port.p2 configure -editable [lindex [GetAllowedSpeeds] 0];
|
373 |
|
|
|
374 |
|
|
}
|
375 |
|
|
|
376 |
2 |
olivier.gi |
###############################################################################
|
377 |
|
|
# GUI MODE #
|
378 |
|
|
###############################################################################
|
379 |
|
|
|
380 |
|
|
####################################
|
381 |
|
|
# CREATE & PLACE MAIN WIDGETS #
|
382 |
|
|
####################################
|
383 |
|
|
|
384 |
|
|
wm title . "openMSP430 GDB Proxy"
|
385 |
|
|
wm iconname . "openMSP430 GDB Proxy"
|
386 |
|
|
|
387 |
110 |
olivier.gi |
# Create the Main Menu frame
|
388 |
2 |
olivier.gi |
frame .menu
|
389 |
|
|
pack .menu -side top -padx 10 -pady 10 -fill x
|
390 |
|
|
|
391 |
110 |
olivier.gi |
# Create the Connection frame
|
392 |
|
|
frame .connect -bd 2 -relief ridge ;# solid
|
393 |
|
|
pack .connect -side top -padx 10 -pady {5 0} -fill x
|
394 |
2 |
olivier.gi |
|
395 |
110 |
olivier.gi |
# Create the Info frame
|
396 |
|
|
frame .info -bd 2 -relief ridge ;# solid
|
397 |
|
|
pack .info -side top -padx 10 -pady {10 0} -fill x
|
398 |
2 |
olivier.gi |
|
399 |
110 |
olivier.gi |
# Create the Server frame
|
400 |
|
|
frame .server -bd 2 -relief ridge ;# solid
|
401 |
|
|
pack .server -side top -padx 10 -pady {10 0} -fill x
|
402 |
|
|
|
403 |
87 |
olivier.gi |
# Create the TCL script field
|
404 |
110 |
olivier.gi |
frame .tclscript -bd 2 -relief ridge ;# solid
|
405 |
87 |
olivier.gi |
pack .tclscript -side top -padx 10 -pady 10 -fill x
|
406 |
2 |
olivier.gi |
|
407 |
87 |
olivier.gi |
|
408 |
2 |
olivier.gi |
####################################
|
409 |
|
|
# CREATE THE REST #
|
410 |
|
|
####################################
|
411 |
|
|
|
412 |
|
|
# Exit button
|
413 |
|
|
button .menu.exit -text "Exit" -command {stopServer; exit 0}
|
414 |
|
|
pack .menu.exit -side left
|
415 |
|
|
|
416 |
110 |
olivier.gi |
# openMSP430 label
|
417 |
|
|
label .menu.omsp -text "openMSP430 GDB proxy" -anchor center -fg "\#6a5acd" -font {-weight bold -size 14}
|
418 |
|
|
pack .menu.omsp -side right -padx 20
|
419 |
2 |
olivier.gi |
|
420 |
110 |
olivier.gi |
# Create the Configuration, Start & Info frames
|
421 |
158 |
olivier.gi |
getConfiguration
|
422 |
|
|
frame .connect.cfg
|
423 |
|
|
pack .connect.cfg -side left -padx 0 -pady 0 -fill x -expand true
|
424 |
|
|
frame .connect.cfg.if -bd 2 -relief ridge
|
425 |
|
|
pack .connect.cfg.if -side top -padx 10 -pady {10 0} -fill x -expand true
|
426 |
|
|
frame .connect.cfg.ad -bd 2 -relief ridge
|
427 |
|
|
pack .connect.cfg.ad -side top -padx 10 -pady 10 -fill both -expand true
|
428 |
110 |
olivier.gi |
frame .connect.start
|
429 |
|
|
pack .connect.start -side right -padx 10 -pady 0 -fill x -expand true
|
430 |
|
|
|
431 |
158 |
olivier.gi |
frame .connect.cfg.if.config1
|
432 |
|
|
pack .connect.cfg.if.config1 -side left -padx 0 -pady 0 -fill x -expand true
|
433 |
|
|
frame .connect.cfg.if.config2
|
434 |
|
|
pack .connect.cfg.if.config2 -side left -padx 0 -pady 0 -fill x -expand true
|
435 |
110 |
olivier.gi |
|
436 |
158 |
olivier.gi |
# Interface & Adapter selection
|
437 |
|
|
frame .connect.cfg.if.config1.adapter
|
438 |
|
|
pack .connect.cfg.if.config1.adapter -side top -padx 5 -pady {10 0} -fill x
|
439 |
|
|
label .connect.cfg.if.config1.adapter.l1 -text "Serial Debug Interface:" -anchor w
|
440 |
|
|
pack .connect.cfg.if.config1.adapter.l1 -side left -padx 5
|
441 |
|
|
combobox .connect.cfg.if.config1.adapter.p1 -textvariable gui_dbg_if -editable false -width 15 -command {updateConfiguration}
|
442 |
|
|
eval .connect.cfg.if.config1.adapter.p1 list insert end [list "UART" "I2C"]
|
443 |
|
|
pack .connect.cfg.if.config1.adapter.p1 -side right -padx 10
|
444 |
2 |
olivier.gi |
|
445 |
158 |
olivier.gi |
frame .connect.cfg.if.config2.adapter
|
446 |
|
|
pack .connect.cfg.if.config2.adapter -side top -padx 5 -pady {10 0} -fill x
|
447 |
|
|
label .connect.cfg.if.config2.adapter.l2 -text "Adapter selection:" -anchor w
|
448 |
|
|
pack .connect.cfg.if.config2.adapter.l2 -side left -padx 5
|
449 |
|
|
combobox .connect.cfg.if.config2.adapter.p2 -textvariable gui_adapter -editable false -width 15
|
450 |
|
|
eval .connect.cfg.if.config2.adapter.p2 list insert end [list "GENERIC"]
|
451 |
|
|
pack .connect.cfg.if.config2.adapter.p2 -side right -padx 5
|
452 |
2 |
olivier.gi |
|
453 |
158 |
olivier.gi |
# Device port & Speed selection
|
454 |
|
|
frame .connect.cfg.if.config1.serial_port
|
455 |
|
|
pack .connect.cfg.if.config1.serial_port -side top -padx 5 -pady {10 10} -fill x
|
456 |
|
|
label .connect.cfg.if.config1.serial_port.l1 -text "Device Port:" -anchor w
|
457 |
|
|
pack .connect.cfg.if.config1.serial_port.l1 -side left -padx 5
|
458 |
|
|
combobox .connect.cfg.if.config1.serial_port.p1 -textvariable omsp_conf(device) -editable true -width 15
|
459 |
|
|
eval .connect.cfg.if.config1.serial_port.p1 list insert end [utils::uart_port_list]
|
460 |
|
|
pack .connect.cfg.if.config1.serial_port.p1 -side right -padx 10
|
461 |
2 |
olivier.gi |
|
462 |
158 |
olivier.gi |
frame .connect.cfg.if.config2.serial_port
|
463 |
|
|
pack .connect.cfg.if.config2.serial_port -side top -padx 5 -pady {10 10} -fill x
|
464 |
|
|
label .connect.cfg.if.config2.serial_port.l2 -text "Speed:" -anchor w
|
465 |
|
|
pack .connect.cfg.if.config2.serial_port.l2 -side left -padx 5
|
466 |
|
|
combobox .connect.cfg.if.config2.serial_port.p2 -textvariable omsp_conf(baudrate) -editable [lindex [GetAllowedSpeeds] 0] -width 15
|
467 |
|
|
eval .connect.cfg.if.config2.serial_port.p2 list insert end [lindex [GetAllowedSpeeds] 2]
|
468 |
|
|
pack .connect.cfg.if.config2.serial_port.p2 -side right -padx 5
|
469 |
|
|
|
470 |
|
|
# Server Port field & I2C address selection
|
471 |
|
|
frame .connect.cfg.ad.core_nr
|
472 |
|
|
pack .connect.cfg.ad.core_nr -side left -padx 5 -fill y
|
473 |
|
|
label .connect.cfg.ad.core_nr.l3 -text "Core 3:" -anchor w
|
474 |
|
|
pack .connect.cfg.ad.core_nr.l3 -side bottom -padx {25 0} -pady {10 10}
|
475 |
|
|
label .connect.cfg.ad.core_nr.l2 -text "Core 2:" -anchor w
|
476 |
|
|
pack .connect.cfg.ad.core_nr.l2 -side bottom -padx {25 0} -pady {10 2}
|
477 |
|
|
label .connect.cfg.ad.core_nr.l1 -text "Core 1:" -anchor w
|
478 |
|
|
pack .connect.cfg.ad.core_nr.l1 -side bottom -padx {25 0} -pady {10 2}
|
479 |
|
|
label .connect.cfg.ad.core_nr.l0 -text "Core 0:" -anchor w
|
480 |
|
|
pack .connect.cfg.ad.core_nr.l0 -side bottom -padx {25 0} -pady {10 2}
|
481 |
|
|
|
482 |
|
|
frame .connect.cfg.ad.server_port
|
483 |
|
|
pack .connect.cfg.ad.server_port -side left -padx 5 -fill y
|
484 |
|
|
entry .connect.cfg.ad.server_port.p3 -textvariable server(port) -relief sunken -width 10
|
485 |
|
|
pack .connect.cfg.ad.server_port.p3 -side bottom -padx 5 -pady {10 10}
|
486 |
|
|
entry .connect.cfg.ad.server_port.p2 -textvariable server(port) -relief sunken -width 10
|
487 |
|
|
pack .connect.cfg.ad.server_port.p2 -side bottom -padx 5 -pady {10 0}
|
488 |
|
|
entry .connect.cfg.ad.server_port.p1 -textvariable server(port) -relief sunken -width 10
|
489 |
|
|
pack .connect.cfg.ad.server_port.p1 -side bottom -padx 5 -pady {10 0}
|
490 |
|
|
entry .connect.cfg.ad.server_port.p0 -textvariable server(port) -relief sunken -width 10
|
491 |
|
|
pack .connect.cfg.ad.server_port.p0 -side bottom -padx 5 -pady {10 0}
|
492 |
|
|
label .connect.cfg.ad.server_port.l -text "Proxy Server Port" -anchor w
|
493 |
|
|
pack .connect.cfg.ad.server_port.l -side bottom -padx 5 -pady {10 0}
|
494 |
|
|
|
495 |
|
|
frame .connect.cfg.ad.arrow
|
496 |
|
|
pack .connect.cfg.ad.arrow -side left -padx 5 -fill y
|
497 |
|
|
label .connect.cfg.ad.arrow.l3 -text "==>" -anchor w
|
498 |
|
|
pack .connect.cfg.ad.arrow.l3 -side bottom -padx 5 -pady {10 10}
|
499 |
|
|
label .connect.cfg.ad.arrow.l2 -text "==>" -anchor w
|
500 |
|
|
pack .connect.cfg.ad.arrow.l2 -side bottom -padx 5 -pady {10 2}
|
501 |
|
|
label .connect.cfg.ad.arrow.l1 -text "==>" -anchor w
|
502 |
|
|
pack .connect.cfg.ad.arrow.l1 -side bottom -padx 5 -pady {10 2}
|
503 |
|
|
label .connect.cfg.ad.arrow.l0 -text "==>" -anchor w
|
504 |
|
|
pack .connect.cfg.ad.arrow.l0 -side bottom -padx 5 -pady {10 2}
|
505 |
|
|
|
506 |
|
|
frame .connect.cfg.ad.i2c_addr
|
507 |
|
|
pack .connect.cfg.ad.i2c_addr -side left -padx 5 -fill y
|
508 |
|
|
spinbox .connect.cfg.ad.i2c_addr.s3 -from 8 -to 119 -textvariable omsp_conf(3,cpuaddr) -width 4
|
509 |
|
|
pack .connect.cfg.ad.i2c_addr.s3 -side bottom -padx 5 -pady {10 10}
|
510 |
|
|
spinbox .connect.cfg.ad.i2c_addr.s2 -from 8 -to 119 -textvariable omsp_conf(2,cpuaddr) -width 4
|
511 |
|
|
pack .connect.cfg.ad.i2c_addr.s2 -side bottom -padx 5 -pady {10 0}
|
512 |
|
|
spinbox .connect.cfg.ad.i2c_addr.s1 -from 8 -to 119 -textvariable omsp_conf(1,cpuaddr) -width 4
|
513 |
|
|
pack .connect.cfg.ad.i2c_addr.s1 -side bottom -padx 5 -pady {10 0}
|
514 |
|
|
spinbox .connect.cfg.ad.i2c_addr.s0 -from 8 -to 119 -textvariable omsp_conf(0,cpuaddr) -width 4
|
515 |
|
|
pack .connect.cfg.ad.i2c_addr.s0 -side bottom -padx 5 -pady {10 0}
|
516 |
|
|
label .connect.cfg.ad.i2c_addr.l -text "I2C Address" -anchor w
|
517 |
|
|
pack .connect.cfg.ad.i2c_addr.l -side bottom -padx 5 -pady {10 0}
|
518 |
|
|
|
519 |
|
|
frame .connect.cfg.ad.i2c_nr
|
520 |
|
|
pack .connect.cfg.ad.i2c_nr -side right -padx 5 -fill y
|
521 |
|
|
label .connect.cfg.ad.i2c_nr.l -text "Number of cores" -anchor w
|
522 |
|
|
pack .connect.cfg.ad.i2c_nr.l -side top -padx 50 -pady {10 0}
|
523 |
|
|
spinbox .connect.cfg.ad.i2c_nr.s -from 1 -to 4 -textvariable omsp_nr -state readonly -width 4 -command {updateConfiguration}
|
524 |
|
|
pack .connect.cfg.ad.i2c_nr.s -side top -padx 50 -pady {10 10}
|
525 |
|
|
|
526 |
|
|
# Update according to default values
|
527 |
|
|
updateConfiguration
|
528 |
|
|
|
529 |
110 |
olivier.gi |
# Connect to CPU & start proxy server
|
530 |
158 |
olivier.gi |
button .connect.start.but -text "Connect to CPU(s)\n and \nStart Proxy Server(s)" -command {startServerGUI}
|
531 |
110 |
olivier.gi |
pack .connect.start.but -side right -padx 30
|
532 |
|
|
|
533 |
|
|
|
534 |
|
|
# CPU Info
|
535 |
|
|
frame .info.cpu
|
536 |
|
|
pack .info.cpu -side top -padx 10 -pady {5 0} -fill x
|
537 |
|
|
label .info.cpu.l -text "CPU Info:" -anchor w
|
538 |
|
|
pack .info.cpu.l -side left -padx {10 10}
|
539 |
|
|
label .info.cpu.con -text "Disconnected" -anchor w -fg Red
|
540 |
|
|
pack .info.cpu.con -side left
|
541 |
|
|
button .info.cpu.more -text "More..." -width 9 -command {displayMore} -state disabled
|
542 |
|
|
pack .info.cpu.more -side right -padx {0 30}
|
543 |
|
|
|
544 |
|
|
|
545 |
|
|
# Server Info
|
546 |
|
|
frame .info.server
|
547 |
|
|
pack .info.server -side top -padx 10 -pady {0 10} -fill x
|
548 |
|
|
label .info.server.l -text "Server Info:" -anchor w
|
549 |
|
|
pack .info.server.l -side left -padx {10 10}
|
550 |
|
|
label .info.server.con -text "Not running" -anchor w -fg Red
|
551 |
|
|
pack .info.server.con -side left
|
552 |
|
|
|
553 |
|
|
|
554 |
2 |
olivier.gi |
# Create the text widget to log received messages
|
555 |
|
|
frame .server.t
|
556 |
|
|
pack .server.t -side top -padx 10 -pady 10 -fill x
|
557 |
110 |
olivier.gi |
set server(log) [text .server.t.log -width 80 -height 15 -borderwidth 2 \
|
558 |
2 |
olivier.gi |
-setgrid true -yscrollcommand {.server.t.scroll set}]
|
559 |
|
|
pack .server.t.log -side left -fill both -expand true
|
560 |
|
|
scrollbar .server.t.scroll -command {.server.t.log yview}
|
561 |
87 |
olivier.gi |
pack .server.t.scroll -side right -fill both
|
562 |
2 |
olivier.gi |
|
563 |
|
|
|
564 |
|
|
# Log commands
|
565 |
|
|
frame .server.cmd
|
566 |
110 |
olivier.gi |
pack .server.cmd -side top -pady {0 10} -fill x
|
567 |
2 |
olivier.gi |
button .server.cmd.clear -text "Clear log" -command {$server(log) delete 1.0 end}
|
568 |
|
|
pack .server.cmd.clear -side left -padx 10
|
569 |
|
|
checkbutton .server.cmd.verbose -text "Verbose" -variable verbose
|
570 |
|
|
pack .server.cmd.verbose -side right -padx 10
|
571 |
87 |
olivier.gi |
|
572 |
|
|
|
573 |
|
|
# Load TCL script fields
|
574 |
|
|
frame .tclscript.ft
|
575 |
110 |
olivier.gi |
pack .tclscript.ft -side top -padx 10 -pady 10 -fill x
|
576 |
87 |
olivier.gi |
label .tclscript.ft.l -text "TCL script:" -state disabled
|
577 |
|
|
pack .tclscript.ft.l -side left -padx "0 10"
|
578 |
|
|
entry .tclscript.ft.file -width 58 -relief sunken -textvariable tcl_file_name -state disabled
|
579 |
|
|
pack .tclscript.ft.file -side left -padx 10
|
580 |
|
|
button .tclscript.ft.browse -text "Browse" -state disabled -command {set tcl_file_name [tk_getOpenFile -filetypes {{{TCL Files} {.tcl}} {{All Files} *}}]}
|
581 |
|
|
pack .tclscript.ft.browse -side left -padx 5
|
582 |
|
|
frame .tclscript.fb
|
583 |
|
|
pack .tclscript.fb -side top -fill x
|
584 |
|
|
button .tclscript.fb.read -text "Source TCL script !" -state disabled -command {if {[file exists $tcl_file_name]} {source $tcl_file_name}}
|
585 |
110 |
olivier.gi |
pack .tclscript.fb.read -side left -padx 20 -pady {0 10} -fill x
|
586 |
87 |
olivier.gi |
|
587 |
110 |
olivier.gi |
wm resizable . 0 0
|