OpenCores
URL https://opencores.org/ocsvn/openmsp430/openmsp430/trunk

Subversion Repositories openmsp430

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /openmsp430/trunk/tools/openmsp430-gdbproxy
    from Rev 158 to Rev 172
    Reverse comparison

Rev 158 → Rev 172

/commands.tcl
35,6 → 35,8
#------------------------------------------------------------------------------
 
global mem_breakpoint
global mem_mapping
global breakSelect
 
###############################################################################
# #
42,7 → 44,7
# #
###############################################################################
 
proc rspParse {sock rsp_cmd} {
proc rspParse {CpuNr sock rsp_cmd} {
 
set rsp_answer ""
set cmd_tail [string range $rsp_cmd 1 [string length $rsp_cmd]]
49,34 → 51,34
 
switch -exact -- [string index $rsp_cmd 0] {
"!" {set rsp_answer "OK"}
"?" {set rsp_answer [rsp_stop_reply $sock "?"]}
"?" {set rsp_answer [rsp_stop_reply $CpuNr $sock "?"]}
"A" {}
"b" {}
"c" {set rsp_answer [rsp_c $sock $cmd_tail]}
"C" {set rsp_answer [rsp_c $sock $cmd_tail]}
"c" {set rsp_answer [rsp_c $CpuNr $sock $cmd_tail]}
"C" {set rsp_answer [rsp_c $CpuNr $sock $cmd_tail]}
"D" {}
"F" {}
"g" {set rsp_answer [rsp_g]}
"G" {set rsp_answer [rsp_G $cmd_tail]}
"g" {set rsp_answer [rsp_g $CpuNr]}
"G" {set rsp_answer [rsp_G $CpuNr $cmd_tail]}
"H" {set rsp_answer ""}
"i" {}
"I" {}
"k" {set rsp_answer [rsp_k $cmd_tail]}
"m" {set rsp_answer [rsp_m $cmd_tail]}
"M" {set rsp_answer [rsp_M $cmd_tail]}
"k" {set rsp_answer [rsp_k $CpuNr $cmd_tail]}
"m" {set rsp_answer [rsp_m $CpuNr $cmd_tail]}
"M" {set rsp_answer [rsp_M $CpuNr $cmd_tail]}
"p" {}
"P" {}
"q" {set rsp_answer [rsp_q $sock $cmd_tail]}
"q" {set rsp_answer [rsp_q $CpuNr $sock $cmd_tail]}
"Q" {}
"R" {}
"s" {set rsp_answer [rsp_s $sock $cmd_tail]}
"S" {set rsp_answer [rsp_s $sock $cmd_tail]}
"s" {set rsp_answer [rsp_s $CpuNr $sock $cmd_tail]}
"S" {set rsp_answer [rsp_s $CpuNr $sock $cmd_tail]}
"t" {}
"T" {}
"v" {}
"X" {}
"z" {set rsp_answer [rsp_z $sock $cmd_tail]}
"Z" {set rsp_answer [rsp_Z $sock $cmd_tail]}
"z" {set rsp_answer [rsp_z $CpuNr $sock $cmd_tail]}
"Z" {set rsp_answer [rsp_Z $CpuNr $sock $cmd_tail]}
default {}
}
 
94,10 → 96,8
#-----------------------------------------------------------------------------#
# Read CPU registers #
#-----------------------------------------------------------------------------#
proc rsp_g {} {
proc rsp_g {CpuNr} {
global CpuNr
 
# Read register value
set reg_val [ReadRegAll $CpuNr]
 
115,10 → 115,8
#-----------------------------------------------------------------------------#
# Write CPU registers #
#-----------------------------------------------------------------------------#
proc rsp_G {cmd} {
proc rsp_G {CpuNr cmd} {
global CpuNr
 
# Format register value
set num_reg [expr [string length $cmd]/4]
 
139,10 → 137,8
#-----------------------------------------------------------------------------#
# Kill request. #
#-----------------------------------------------------------------------------#
proc rsp_k {cmd} {
proc rsp_k {CpuNr cmd} {
global CpuNr
 
# Reset & Stop CPU
ExecutePOR_Halt $CpuNr
152,10 → 148,11
#-----------------------------------------------------------------------------#
# Write length bytes of memory. #
#-----------------------------------------------------------------------------#
proc rsp_M {cmd} {
proc rsp_M {CpuNr cmd} {
global mem_breakpoint
global CpuNr
global mem_mapping
global breakSelect
# Parse command
regexp {(.*),(.*):(.*)} $cmd match addr length data
177,14 → 174,19
}
 
# Eventually re-set the software breakpoints in case they have been overwritten
set addr_start [format %d "0x$addr"]
foreach {brk_addr brk_val} [array get mem_breakpoint] {
set brk_addr_dec [format %d "0x$brk_addr"]
set brk_addr_offset [expr $brk_addr_dec-$addr_start]
if {(0<=$brk_addr_offset) && ($brk_addr_offset<=$length)} {
set mem_breakpoint($brk_addr) [lindex $mem_val $brk_addr_offset]
WriteMem $CpuNr 0 "0x$brk_addr" 0x4343
}
if {$breakSelect==0} {
set addr_start [format %d "0x$addr"]
foreach {brk_addr brk_val} [array get mem_breakpoint] {
regsub {,} $brk_addr { } brk_addr_lst
if {[lindex $brk_addr_lst 0]==$mem_mapping($CpuNr)} {
set brk_addr_dec [format %d "0x[lindex $brk_addr_lst 1]"]
set brk_addr_offset [expr $brk_addr_dec-$addr_start]
if {(0<=$brk_addr_offset) && ($brk_addr_offset<=$length)} {
set mem_breakpoint($brk_addr) [lindex $mem_val $brk_addr_offset]
WriteMem $CpuNr 0 "0x[lindex $brk_addr 1]" 0x4343
}
}
}
}
 
return "OK"
194,10 → 196,11
#-----------------------------------------------------------------------------#
# Read length bytes from memory. #
#-----------------------------------------------------------------------------#
proc rsp_m {cmd} {
proc rsp_m {CpuNr cmd} {
global mem_breakpoint
global CpuNr
global mem_mapping
global breakSelect
 
# Parse command
regexp {(.*),(.*)} $cmd match addr length
209,13 → 212,18
 
# Eventually replace read data by the original software breakpoint value
set addr_start [format %d "0x$addr"]
foreach {brk_addr brk_val} [array get mem_breakpoint] {
set brk_addr_dec [format %d "0x$brk_addr"]
set brk_addr_offset [expr $brk_addr_dec-$addr_start]
if {(0<=$brk_addr_offset) && ($brk_addr_offset<=$length)} {
set data [lreplace $data $brk_addr_offset $brk_addr_offset "0x$mem_breakpoint($brk_addr)"]
}
if {$breakSelect==0} {
set addr_start [format %d "0x$addr"]
foreach {brk_addr brk_val} [array get mem_breakpoint] {
regsub {,} $brk_addr { } brk_addr_lst
if {[lindex $brk_addr_lst 0]==$mem_mapping($CpuNr)} {
set brk_addr_dec [format %d "0x[lindex $brk_addr_lst 1]"]
set brk_addr_offset [expr $brk_addr_dec-$addr_start]
if {(0<=$brk_addr_offset) && ($brk_addr_offset<=$length)} {
set data [lreplace $data $brk_addr_offset $brk_addr_offset "0x$mem_breakpoint($brk_addr)"]
}
}
}
}
 
# Format data
229,10 → 237,11
#-----------------------------------------------------------------------------#
# Insert breakpoint. #
#-----------------------------------------------------------------------------#
proc rsp_Z {sock cmd} {
proc rsp_Z {CpuNr sock cmd} {
 
global mem_breakpoint
global CpuNr
global mem_mapping
global breakSelect
 
# Parse command
regexp {(.),(.*),(.*)} $cmd match type addr length
239,10 → 248,23
set addr [format %04x "0x$addr"]
 
switch -exact -- $type {
"0" {# Memory breakpoint
set mem_breakpoint($addr) [ReadMem $CpuNr 0 "0x$addr"]
WriteMem $CpuNr 0 "0x$addr" 0x4343
return "OK"
"0" {# Soft Memory breakpoint
if {$breakSelect==0} {
if {![info exists mem_breakpoint($mem_mapping($CpuNr),$addr)]} {
set mem_breakpoint($mem_mapping($CpuNr),$addr) [ReadMem $CpuNr 0 "0x$addr"]
WriteMem $CpuNr 0 "0x$addr" 0x4343
}
return "OK"
 
# Hard Memory breakpoint
} else {
if {[SetHWBreak $CpuNr 1 [format "0x%04x" 0x$addr] 1 0]} {
#putsLog "CORE $CpuNr: --- INFO --- SET HARDWARE MEMORY BREAKPOINT. "
return "OK"
}
putsLog "CORE $CpuNr: --- ERROR --- NO MORE HARDWARE MEMORY BREAKPOINT AVAILABLE. "
return ""
}
}
 
"1" {# Hardware breakpoint
249,6 → 271,7
if {[SetHWBreak $CpuNr 1 [format "0x%04x" 0x$addr] 1 0]} {
return "OK"
}
putsLog "CORE $CpuNr: --- ERROR --- NO MORE HARDWARE BREAKPOINT AVAILABLE. "
return ""
}
 
256,6 → 279,7
if {[SetHWBreak $CpuNr 0 [format "0x%04x" 0x$addr] 0 1]} {
return "OK"
}
putsLog "CORE $CpuNr: --- ERROR --- NO MORE WRITE WATCHPOINT AVAILABLE. "
return ""
}
 
263,6 → 287,7
if {[SetHWBreak $CpuNr 0 [format "0x%04x" 0x$addr] 1 0]} {
return "OK"
}
putsLog "CORE $CpuNr: --- ERROR --- NO MORE READ WATCHPOINT AVAILABLE. "
return ""
}
 
270,6 → 295,7
if {[SetHWBreak $CpuNr 0 [format "0x%04x" 0x$addr] 1 1]} {
return "OK"
}
putsLog "CORE $CpuNr: --- ERROR --- NO MORE ACCESS WATCHPOINT AVAILABLE. "
return ""
}
 
280,10 → 306,11
#-----------------------------------------------------------------------------#
# Remove breakpoint. #
#-----------------------------------------------------------------------------#
proc rsp_z {sock cmd} {
proc rsp_z {CpuNr sock cmd} {
 
global mem_breakpoint
global CpuNr
global mem_mapping
global breakSelect
 
# Parse command
regexp {(.),(.*),(.*)} $cmd match type addr length
290,10 → 317,23
set addr [format %04x "0x$addr"]
 
switch -exact -- $type {
"0" {# Memory breakpoint
WriteMem $CpuNr 0 "0x$addr" $mem_breakpoint($addr)
unset mem_breakpoint($addr)
return "OK"
"0" {# Soft Memory breakpoint
if {$breakSelect==0} {
if {[info exists mem_breakpoint($mem_mapping($CpuNr),$addr)]} {
WriteMem $CpuNr 0 "0x$addr" $mem_breakpoint($mem_mapping($CpuNr),$addr)
unset mem_breakpoint($mem_mapping($CpuNr),$addr)
}
return "OK"
 
# Hard Memory breakpoint
} else {
if {[ClearHWBreak $CpuNr 1 [format "0x%04x" 0x$addr]]} {
#putsLog "CORE $CpuNr: --- INFO --- RELEASE HARDWARE MEMORY BREAKPOINT. "
return "OK"
}
putsLog "CORE $CpuNr: --- ERROR --- COULD NOT REMOVE HARDWARE MEMORY BREAKPOINT. "
return ""
}
}
 
"1" {# Hardware breakpoint
331,10 → 371,8
#-----------------------------------------------------------------------------#
# Continue. #
#-----------------------------------------------------------------------------#
proc rsp_c {sock cmd} {
proc rsp_c {CpuNr sock cmd} {
global CpuNr
 
# Set address if required
if {$cmd!=""} {
set cmd [format %04x "0x$cmd"]
348,16 → 386,14
ReleaseCPU $CpuNr
 
 
return [rsp_stop_reply $sock "c"]
return [rsp_stop_reply $CpuNr $sock "c"]
}
 
#-----------------------------------------------------------------------------#
# Step. #
#-----------------------------------------------------------------------------#
proc rsp_s {sock cmd} {
proc rsp_s {CpuNr sock cmd} {
global CpuNr
 
# Set address if required
if {$cmd!=""} {
set cmd [format %04x "0x$cmd"]
373,7 → 409,7
# Incremental step
StepCPU $CpuNr
 
return [rsp_stop_reply $sock "s" $pc]
return [rsp_stop_reply $CpuNr $sock "s" $pc]
}
 
 
382,10 → 418,8
# packets can receive any of the below as a reply. Except for `?' and #
# `vStopped', that reply is only returned when the target halts. #
#-----------------------------------------------------------------------------#
proc rsp_stop_reply {sock cmd {opt_val "0"}} {
proc rsp_stop_reply {CpuNr sock cmd {opt_val "0"}} {
 
global CpuNr
 
# Wait until halted
while {![IsHalted $CpuNr]} {
 
426,13 → 460,13
#-----------------------------------------------------------------------------#
# #
#-----------------------------------------------------------------------------#
proc rsp_q {sock cmd} {
proc rsp_q {CpuNr sock cmd} {
switch -regexp -- $cmd {
 
"C" {set rsp_answer ""}
"Offsets" {set rsp_answer "Text=0;Data=0;Bss=0"}
"Rcmd,.+" {set rsp_answer [rsp_qRcmd $sock $cmd]}
"Rcmd,.+" {set rsp_answer [rsp_qRcmd $CpuNr $sock $cmd]}
default {set rsp_answer ""}
}
return $rsp_answer
447,10 → 481,8
# that providing access to a stubs's interpreter may have security #
# implications. #
#-----------------------------------------------------------------------------#
proc rsp_qRcmd {sock cmd} {
proc rsp_qRcmd {CpuNr sock cmd} {
 
global CpuNr
 
regsub {^Rcmd,} $cmd {} cmd
set cmd [binary format H* $cmd]; # Convert hex to ascii
 
/server.tcl
37,7 → 37,10
global clients
global server
 
global CpuNr
set CpuNr 0
 
 
###############################################################################
# #
# START/STOP LOCAL SERVER #
44,50 → 47,52
# #
###############################################################################
 
proc startServer { } {
proc startServer { CpuNr } {
global server
 
global server
if {![info exists server(socket)]} {
putsLog "Open socket on port $server(port) ... " 1
if {[catch {socket -server clientAccept $server(port)} server(socket)]} {
if {![info exists server($CpuNr,socket)]} {
putsLog "CORE $CpuNr: Open socket on port $server($CpuNr,port)... " 1
if {[catch {socket -server "clientAccept $CpuNr" $server($CpuNr,port)} server($CpuNr,socket)]} {
putsLog "failed"
putsLog "ERROR: $server(socket)."
unset server(socket)
putsLog "CORE $CpuNr: ERROR: $server($CpuNr,socket)."
unset server($CpuNr,socket)
return 0
}
putsLog "done"
putsLog "INFO: Waiting on TCP port $server(port)"
putsLog "CORE $CpuNr: INFO: Waiting on TCP port $server($CpuNr,port)"
} else {
putsLog "Server is already up."
putsLog "CORE $CpuNr: Server is already up and running."
}
return 1
}
 
proc stopServer { } {
proc stopAllServers { } {
global omsp_info
global server
global CpuNr
global omsp_nr
 
if {[info exists server(socket)]} {
set port [lindex [fconfigure $server(socket) -sockname] 2]
putsLog "Stop server (port $port)"
close $server(socket)
unset server(socket)
for { set CpuNr 0 } { $CpuNr < $omsp_nr } { incr CpuNr } {
 
if {[info exists server($CpuNr,socket)]} {
set port [lindex [fconfigure $server($CpuNr,socket) -sockname] 2]
putsLog "CORE $CpuNr: Stop server (port $port)"
close $server($CpuNr,socket)
unset server($CpuNr,socket)
}
if {$omsp_info($CpuNr,connected)} {
ReleaseDevice $CpuNr 0xfffe
}
}
if {$omsp_info($CpuNr,connected)} {
ReleaseDevice $CpuNr 0xfffe
}
}
 
proc clientAccept {sock addr port} {
proc clientAccept {CpuNr sock addr port} {
global clients
global CpuNr
 
putsLog "Accept client: $addr ($port)\n"
putsLog "CORE $CpuNr: Accept client: $addr ($port)\n"
 
set clients(addr,$sock) [list $addr $port]
set clients($CpuNr,addr,$sock) [list $addr $port]
fconfigure $sock -buffering none
fileevent $sock readable [list receiveRSPpacket $sock]
fileevent $sock readable [list receiveRSPpacket $CpuNr $sock]
 
InitBreakUnits $CpuNr
}
95,51 → 100,79
proc startServerGUI { } {
global omsp_conf
global omsp_info
global CpuNr
global omsp_nr
global breakSelect
 
# Connect to device
if {![GetDevice $CpuNr]} {
.info.cpu.con configure -text "Connection problem" -fg red
putsLog "ERROR: Could not open \"$omsp_conf(device)\""
putsLog ""
putsLog " -------------------------------------------------------------"
putsLog " !!!! Please consider the following options: !!!!"
putsLog " !!!! !!!!"
putsLog " !!!! - check the physical connection to the board. !!!!"
putsLog " !!!! - adjust the serial connection baudrate. !!!!"
putsLog " !!!! - don't forget to reset the serial debug interface !!!!"
putsLog " !!!! between each attempt. !!!!"
putsLog " -------------------------------------------------------------"
putsLog ""
return 0
# Connect to all devices
set connection_status 0
set connection_sum 0
for { set CpuNr 0 } { $CpuNr < $omsp_nr } { incr CpuNr } {
set connection_ok [GetDevice $CpuNr]
set connection_sum [expr $connection_sum + $connection_ok]
if {$connection_ok==0} {
set error_nr "$CpuNr"
}
}
if {$connection_sum==$omsp_nr} {
set connection_status 1
}
 
if {$omsp_info($CpuNr,alias)==""} {
if {!$connection_status} {
.info.cpu.con configure -text "Connection problem" -fg red
putsLog ""
putsLog "ERROR: Could not connect to Core $error_nr"
putsLog ""
putsLog " -----------------------------------------------------------------------"
putsLog " !!!! Please consider the following options: !!!!"
putsLog " !!!! !!!!"
putsLog " !!!! - make sure \"$omsp_conf(device)\" is the right device."
putsLog " !!!! - check the physical connection to the board. !!!!"
putsLog " !!!! - adjust the serial connection baudrate. !!!!"
putsLog " !!!! - for UART, don't forget to reset the serial debug interface !!!!"
putsLog " !!!! between each attempt. !!!!"
putsLog " !!!! - for I2C, make sure $omsp_conf($error_nr,cpuaddr) the is the right address. !!!!"
putsLog " -----------------------------------------------------------------------"
putsLog ""
return 0
}
 
if {$breakSelect==1} {
if {$omsp_info(0,hw_break)==0} {
.info.cpu.con configure -text "No Hardware breakpoint unit detected" -fg red
putsLog ""
putsLog "ERROR: Could not detect any Hardware Breakpoint Unit"
putsLog " Consider switching to the Software Breakpoint configuration"
putsLog ""
return 0
}
}
 
if {$omsp_info(0,alias)==""} {
.info.cpu.con configure -text "Connected" -fg "\#00ae00"
} else {
.info.cpu.con configure -text "Connected to $omsp_info($CpuNr,alias)" -fg "\#00ae00"
.info.cpu.con configure -text "Connected to $omsp_info(0,alias)" -fg "\#00ae00"
}
 
# Display info
putsLog "INFO: Sucessfully connected with the openMSP430 target."
set sizes [GetCPU_ID_SIZE $CpuNr]
if {$omsp_info($CpuNr,asic)} {
putsLog "INFO: CPU Version - $omsp_info($CpuNr,cpu_ver) / ASIC"
set sizes [GetCPU_ID_SIZE 0]
if {$omsp_info(0,asic)} {
putsLog "INFO: CPU Version - $omsp_info(0,cpu_ver) / ASIC"
} else {
putsLog "INFO: CPU Version - $omsp_info($CpuNr,cpu_ver) / FPGA"
putsLog "INFO: CPU Version - $omsp_info(0,cpu_ver) / FPGA"
}
putsLog "INFO: User Version - $omsp_info($CpuNr,user_ver)"
if {$omsp_info($CpuNr,cpu_ver)==1} {
putsLog "INFO: User Version - $omsp_info(0,user_ver)"
if {$omsp_info(0,cpu_ver)==1} {
putsLog "INFO: Hardware Multiplier - --"
} elseif {$omsp_info($CpuNr,mpy)} {
} elseif {$omsp_info(0,mpy)} {
putsLog "INFO: Hardware Multiplier - Yes"
} else {
putsLog "INFO: Hardware Multiplier - No"
}
putsLog "INFO: Program Memory Size - $omsp_info($CpuNr,pmem_size) B"
putsLog "INFO: Data Memory Size - $omsp_info($CpuNr,dmem_size) B"
putsLog "INFO: Peripheral Address Space - $omsp_info($CpuNr,per_size) B"
putsLog "INFO: $omsp_info($CpuNr,hw_break) Hardware Break/Watch-point unit(s) detected"
putsLog "INFO: Program Memory Size - $omsp_info(0,pmem_size) B"
putsLog "INFO: Data Memory Size - $omsp_info(0,dmem_size) B"
putsLog "INFO: Peripheral Address Space - $omsp_info(0,per_size) B"
putsLog "INFO: $omsp_info(0,hw_break) Hardware Break/Watch-point unit(s) detected"
putsLog ""
 
# Activate Load TCL script section
151,14 → 184,18
# Activate extra cpu info button
.info.cpu.more configure -state normal
 
# Reset & Stop CPU
ExecutePOR_Halt $CpuNr
for { set CpuNr 0 } { $CpuNr < $omsp_nr } { incr CpuNr } {
 
# Start server for GDB
if {![startServer]} {
.info.server.con configure -text "Connection problem" -fg red
return 0
# Reset & Stop CPU
ExecutePOR_Halt $CpuNr
 
# Start server for GDB
if {![startServer $CpuNr]} {
.info.server.con configure -text "Connection problem" -fg red
return 0
}
}
 
.info.server.con configure -text "Running" -fg "\#00ae00"
 
# Disable gui entries
175,6 → 212,28
.connect.cfg.ad.i2c_addr.s2 configure -state disabled
.connect.cfg.ad.i2c_addr.s3 configure -state disabled
.connect.cfg.ad.i2c_nr.s configure -state disabled
 
.connect.cfg.ad.i2c_nr.f.soft.b configure -state disabled
.connect.cfg.ad.i2c_nr.f.soft.r configure -state disabled
.connect.cfg.ad.i2c_nr.f.hard.r configure -state disabled
if {[winfo exists .omsp_sft_brk]} {
.omsp_sft_brk.map.b.share configure -state disabled
.omsp_sft_brk.map.b.dedic configure -state disabled
.omsp_sft_brk.map.r.core_nr.l0 configure -state disabled
.omsp_sft_brk.map.r.pmem0.p0 configure -state disabled
.omsp_sft_brk.map.r.core_nr.l1 configure -state disabled
.omsp_sft_brk.map.r.pmem0.p1 configure -state disabled
.omsp_sft_brk.map.r.pmem1.p1 configure -state disabled
.omsp_sft_brk.map.r.core_nr.l2 configure -state disabled
.omsp_sft_brk.map.r.pmem0.p2 configure -state disabled
.omsp_sft_brk.map.r.pmem1.p2 configure -state disabled
.omsp_sft_brk.map.r.pmem2.p2 configure -state disabled
.omsp_sft_brk.map.r.core_nr.l3 configure -state disabled
.omsp_sft_brk.map.r.pmem0.p3 configure -state disabled
.omsp_sft_brk.map.r.pmem1.p3 configure -state disabled
.omsp_sft_brk.map.r.pmem2.p3 configure -state disabled
.omsp_sft_brk.map.r.pmem3.p3 configure -state disabled
}
}
 
###############################################################################
183,10 → 242,8
# #
###############################################################################
 
proc receiveRSPpacket {sock} {
proc receiveRSPpacket {CpuNr sock} {
 
global CpuNr
 
# Get client info
set ip [lindex [fconfigure $sock -peername] 0]
set port [lindex [fconfigure $sock -peername] 2]
193,7 → 250,7
 
# Check if a new packet arrives
set rx_packet 0
set rsp_cmd [getDebugChar $sock]
set rsp_cmd [getDebugChar $CpuNr $sock]
set rsp_sum ""
if {[string eq $rsp_cmd "\$"]} {
set rx_packet 1
207,13 → 264,13
}
# Receive packet
while {$rx_packet} {
set char [getDebugChar $sock]
set char [getDebugChar $CpuNr $sock]
if {$char==-1} {
set rx_packet 0
} elseif {[string eq $char "\#"]} {
set rx_packet 0
set rsp_sum [getDebugChar $sock]
append rsp_sum [getDebugChar $sock]
set rsp_sum [getDebugChar $CpuNr $sock]
append rsp_sum [getDebugChar $CpuNr $sock]
# Re-calculate the checksum
set tmp_sum [RSPcheckSum $rsp_cmd]
224,12 → 281,12
 
# Remove escape characters
set rsp_cmd [removeEscapeChar $rsp_cmd]
putsVerbose "+ w $rsp_cmd"
putsVerbose "CORE $CpuNr: + w $rsp_cmd"
 
# Parse packet and send back the answer
set rsp_answer [rspParse $sock $rsp_cmd]
set rsp_answer [rspParse $CpuNr $sock $rsp_cmd]
if {$rsp_answer != "-1"} {
sendRSPpacket $sock $rsp_answer
sendRSPpacket $CpuNr $sock $rsp_answer
}
} else {
putDebugChar $sock "-"
241,7 → 298,7
}
 
 
proc sendRSPpacket {sock rsp_cmd} {
proc sendRSPpacket {CpuNr sock rsp_cmd} {
 
# Set escape characters
set rsp_cmd [setEscapeChar $rsp_cmd]
256,9 → 313,9
set send_ok 0
while {!$send_ok} {
putDebugChar $sock "$rsp_packet"
set char [getDebugChar $sock]
set char [getDebugChar $CpuNr $sock]
 
putsVerbose "$char r $rsp_cmd"
putsVerbose "CORE $CpuNr: $char r $rsp_cmd"
 
if {$char==-1} {
set send_ok 1
316,7 → 373,7
}
 
 
proc getDebugChar {sock} {
proc getDebugChar {CpuNr sock} {
global clients
 
# Get client info
326,8 → 383,8
if {[eof $sock] || [catch {set char [read $sock 1]}]} {
# end of file or abnormal connection drop
close $sock
putsLog "Connection closed: $ip ($port)\n"
unset clients(addr,$sock)
putsLog "CORE $CpuNr: Connection closed: $ip ($port)\n"
unset clients($CpuNr,addr,$sock)
return -1
} else {
return $char
362,8 → 419,8
 
# Title
set title "openMSP430"
if {$omsp_info($CpuNr,alias)!=""} {
set title $omsp_info($CpuNr,alias)
if {$omsp_info(0,alias)!=""} {
set title $omsp_info(0,alias)
}
label .omsp_extra_info.title -text "$title" -anchor center -fg "\#00ae00" -font {-weight bold -size 16}
pack .omsp_extra_info.title -side top -padx {20 20} -pady {20 10}
384,34 → 441,34
# Fill the text widget will configuration info
.omsp_extra_info.extra.text tag configure bold -font {-family TkFixedFont -weight bold}
.omsp_extra_info.extra.text insert end "Configuration\n\n" bold
.omsp_extra_info.extra.text insert end [format "CPU Version : %5s\n" $omsp_info($CpuNr,cpu_ver)]
.omsp_extra_info.extra.text insert end [format "User Version : %5s\n" $omsp_info($CpuNr,user_ver)]
if {$omsp_info($CpuNr,cpu_ver)==1} {
.omsp_extra_info.extra.text insert end [format "CPU Version : %5s\n" $omsp_info(0,cpu_ver)]
.omsp_extra_info.extra.text insert end [format "User Version : %5s\n" $omsp_info(0,user_ver)]
if {$omsp_info(0,cpu_ver)==1} {
.omsp_extra_info.extra.text insert end [format "Implementation : %5s\n" --]
} elseif {$omsp_info($CpuNr,asic)==0} {
} elseif {$omsp_info(0,asic)==0} {
.omsp_extra_info.extra.text insert end [format "Implementation : %5s\n" FPGA]
} elseif {$omsp_info($CpuNr,asic)==1} {
} elseif {$omsp_info(0,asic)==1} {
.omsp_extra_info.extra.text insert end [format "Implementation : %5s\n" ASIC]
}
if {$omsp_info($CpuNr,mpy)==1} {
if {$omsp_info(0,mpy)==1} {
.omsp_extra_info.extra.text insert end [format "Hardware Multiplier support: %5s\n" Yes]
} elseif {$omsp_info($CpuNr,mpy)==0} {
} elseif {$omsp_info(0,mpy)==0} {
.omsp_extra_info.extra.text insert end [format "Hardware Multiplier support: %5s\n" No]
} else {
.omsp_extra_info.extra.text insert end [format "Hardware Multiplier support: %5s\n" --]
}
.omsp_extra_info.extra.text insert end [format "Program memory size : %5s B\n" $omsp_info($CpuNr,pmem_size)]
.omsp_extra_info.extra.text insert end [format "Data memory size : %5s B\n" $omsp_info($CpuNr,dmem_size)]
.omsp_extra_info.extra.text insert end [format "Peripheral address space : %5s B\n" $omsp_info($CpuNr,per_size)]
if {$omsp_info($CpuNr,alias)==""} {
.omsp_extra_info.extra.text insert end [format "Program memory size : %5s B\n" $omsp_info(0,pmem_size)]
.omsp_extra_info.extra.text insert end [format "Data memory size : %5s B\n" $omsp_info(0,dmem_size)]
.omsp_extra_info.extra.text insert end [format "Peripheral address space : %5s B\n" $omsp_info(0,per_size)]
if {$omsp_info(0,alias)==""} {
.omsp_extra_info.extra.text insert end [format "Alias : %5s\n\n\n" None]
} else {
.omsp_extra_info.extra.text insert end [format "Alias : %5s\n\n\n" $omsp_info($CpuNr,alias)]
.omsp_extra_info.extra.text insert end [format "Alias : %5s\n\n\n" $omsp_info(0,alias)]
}
 
.omsp_extra_info.extra.text insert end "Extra Info\n\n" bold
 
if {$omsp_info($CpuNr,alias)!=""} {
if {$omsp_info(0,alias)!=""} {
 
set aliasEXTRA [lsort -increasing [array names omsp_info -glob "extra,*"]]
if {[llength $aliasEXTRA]} {
418,7 → 475,7
 
foreach currentEXTRA $aliasEXTRA {
regexp {^.+,.+,(.+)$} $currentEXTRA whole_match extraATTR
.omsp_extra_info.extra.text insert end [format "%-15s: %s\n" $extraATTR $omsp_info($CpuNr,$currentEXTRA)]
.omsp_extra_info.extra.text insert end [format "%-15s: %s\n" $extraATTR $omsp_info(0,$currentEXTRA)]
}
.omsp_extra_info.extra.text insert end "\n\n"
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.