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

Subversion Repositories openmsp430

[/] [openmsp430/] [trunk/] [tools/] [openmsp430-gdbproxy/] [server.tcl] - Diff between revs 124 and 158

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 124 Rev 158
Line 27... Line 27...
# 
# 
# Author(s):
# Author(s):
#             - Olivier Girard,    olgirard@gmail.com
#             - Olivier Girard,    olgirard@gmail.com
#
#
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# $Rev: 124 $
# $Rev: 158 $
# $LastChangedBy: olivier.girard $
# $LastChangedBy: olivier.girard $
# $LastChangedDate: 2011-10-27 09:38:36 +0200 (Thu, 27 Oct 2011) $
# $LastChangedDate: 2012-10-15 23:49:09 +0200 (Mon, 15 Oct 2012) $
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
 
 
global clients
global clients
global server
global server
 
 
Line 62... Line 62...
    }
    }
    return 1
    return 1
}
}
 
 
proc stopServer { } {
proc stopServer { } {
    global serial_status
    global omsp_info
    global server
    global server
 
    global CpuNr
 
 
    if {[info exists server(socket)]} {
    if {[info exists server(socket)]} {
        set port [lindex [fconfigure $server(socket) -sockname] 2]
        set port [lindex [fconfigure $server(socket) -sockname] 2]
        putsLog "Stop server (port $port)"
        putsLog "Stop server (port $port)"
        close $server(socket)
        close $server(socket)
        unset server(socket)
        unset server(socket)
    }
    }
    if {$serial_status} {
    if {$omsp_info($CpuNr,connected)} {
        ReleaseDevice 0xfffe
        ReleaseDevice $CpuNr 0xfffe
    }
    }
}
}
 
 
proc clientAccept {sock addr port} {
proc clientAccept {sock addr port} {
    global clients
    global clients
 
    global CpuNr
 
 
    putsLog "Accept client: $addr ($port)\n"
    putsLog "Accept client: $addr ($port)\n"
 
 
    set clients(addr,$sock) [list $addr $port]
    set clients(addr,$sock) [list $addr $port]
    fconfigure $sock -buffering none
    fconfigure $sock -buffering none
    fileevent  $sock readable [list receiveRSPpacket $sock]
    fileevent  $sock readable [list receiveRSPpacket $sock]
 
 
    InitBreakUnits
    InitBreakUnits $CpuNr
}
}
 
 
proc startServerGUI { } {
proc startServerGUI { } {
    global serial_device
    global omsp_conf
    global hw_break
 
    global omsp_info
    global omsp_info
 
    global CpuNr
 
 
    # Connect to device
    # Connect to device
    if {![GetDevice]} {
    if {![GetDevice $CpuNr]} {
        .info.cpu.con   configure -text "Connection problem" -fg red
        .info.cpu.con   configure -text "Connection problem" -fg red
        putsLog "ERROR: Could not open \"$serial_device\""
        putsLog "ERROR: Could not open \"$omsp_conf(device)\""
    putsLog ""
    putsLog ""
    putsLog "         -------------------------------------------------------------"
    putsLog "         -------------------------------------------------------------"
    putsLog "       !!!! Please consider the following options:                  !!!!"
    putsLog "       !!!! Please consider the following options:                  !!!!"
        putsLog "       !!!!                                                         !!!!"
        putsLog "       !!!!                                                         !!!!"
        putsLog "       !!!!      - check the physical connection to the board.      !!!!"
        putsLog "       !!!!      - check the physical connection to the board.      !!!!"
Line 110... Line 112...
    putsLog "         -------------------------------------------------------------"
    putsLog "         -------------------------------------------------------------"
    putsLog ""
    putsLog ""
        return 0
        return 0
    }
    }
 
 
    if {$omsp_info(alias)==""} {
    if {$omsp_info($CpuNr,alias)==""} {
        .info.cpu.con   configure -text "Connected" -fg "\#00ae00"
        .info.cpu.con   configure -text "Connected" -fg "\#00ae00"
    } else {
    } else {
        .info.cpu.con   configure -text "Connected to $omsp_info(alias)" -fg "\#00ae00"
        .info.cpu.con   configure -text "Connected to $omsp_info($CpuNr,alias)" -fg "\#00ae00"
    }
    }
 
 
    # Display info
    # Display info
    putsLog "INFO: Sucessfully connected with the openMSP430 target."
    putsLog "INFO: Sucessfully connected with the openMSP430 target."
    set sizes [GetCPU_ID_SIZE]
    set sizes [GetCPU_ID_SIZE $CpuNr]
    if {$omsp_info(asic)} {
    if {$omsp_info($CpuNr,asic)} {
        putsLog "INFO: CPU Version              - $omsp_info(cpu_ver) / ASIC"
        putsLog "INFO: CPU Version              - $omsp_info($CpuNr,cpu_ver) / ASIC"
    } else {
    } else {
        putsLog "INFO: CPU Version              - $omsp_info(cpu_ver) / FPGA"
        putsLog "INFO: CPU Version              - $omsp_info($CpuNr,cpu_ver) / FPGA"
    }
    }
    putsLog "INFO: User Version             - $omsp_info(user_ver)"
    putsLog "INFO: User Version             - $omsp_info($CpuNr,user_ver)"
    if {$omsp_info(cpu_ver)==1} {
    if {$omsp_info($CpuNr,cpu_ver)==1} {
        putsLog "INFO: Hardware Multiplier      - --"
        putsLog "INFO: Hardware Multiplier      - --"
    } elseif {$omsp_info(mpy)} {
    } elseif {$omsp_info($CpuNr,mpy)} {
        putsLog "INFO: Hardware Multiplier      - Yes"
        putsLog "INFO: Hardware Multiplier      - Yes"
    } else {
    } else {
        putsLog "INFO: Hardware Multiplier      - No"
        putsLog "INFO: Hardware Multiplier      - No"
    }
    }
    putsLog "INFO: Program Memory Size      - $omsp_info(pmem_size) B"
    putsLog "INFO: Program Memory Size      - $omsp_info($CpuNr,pmem_size) B"
    putsLog "INFO: Data Memory Size         - $omsp_info(dmem_size) B"
    putsLog "INFO: Data Memory Size         - $omsp_info($CpuNr,dmem_size) B"
    putsLog "INFO: Peripheral Address Space - $omsp_info(per_size) B"
    putsLog "INFO: Peripheral Address Space - $omsp_info($CpuNr,per_size) B"
    putsLog "INFO: $hw_break(num) Hardware Break/Watch-point unit(s) detected"
    putsLog "INFO: $omsp_info($CpuNr,hw_break) Hardware Break/Watch-point unit(s) detected"
    putsLog ""
    putsLog ""
 
 
    # Activate Load TCL script section
    # Activate Load TCL script section
    .tclscript.ft.l          configure -state normal
    .tclscript.ft.l          configure -state normal
    .tclscript.ft.file       configure -state normal
    .tclscript.ft.file       configure -state normal
Line 148... Line 150...
 
 
    # Activate extra cpu info button
    # Activate extra cpu info button
    .info.cpu.more           configure -state normal
    .info.cpu.more           configure -state normal
 
 
    # Reset & Stop CPU
    # Reset & Stop CPU
    ExecutePOR_Halt
    ExecutePOR_Halt $CpuNr
 
 
    # Start server for GDB
    # Start server for GDB
    if {![startServer]} {
    if {![startServer]} {
        .info.server.con configure -text "Connection problem" -fg red
        .info.server.con configure -text "Connection problem" -fg red
        return 0
        return 0
    }
    }
    .info.server.con     configure -text "Running" -fg "\#00ae00"
    .info.server.con     configure -text "Running" -fg "\#00ae00"
 
 
    # Disable gui entries
    # Disable gui entries
    .connect.config.serial_port.p1      configure -state disabled
    .connect.cfg.if.config1.adapter.p1       configure -state disabled
    .connect.config.serial_baudrate.p2  configure -state disabled
    .connect.cfg.if.config2.adapter.p2       configure -state disabled
    .connect.config.server_port.p       configure -state disabled
    .connect.cfg.if.config1.serial_port.p1   configure -state disabled
    .connect.start.but                  configure -state disabled
    .connect.cfg.if.config2.serial_port.p2   configure -state disabled
 
    .connect.cfg.ad.server_port.p0           configure -state disabled
 
    .connect.cfg.ad.server_port.p1           configure -state disabled
 
    .connect.cfg.ad.server_port.p2           configure -state disabled
 
    .connect.cfg.ad.server_port.p3           configure -state disabled
 
    .connect.cfg.ad.i2c_addr.s0              configure -state disabled
 
    .connect.cfg.ad.i2c_addr.s1              configure -state disabled
 
    .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
}
}
 
 
###############################################################################
###############################################################################
#                                                                             #
#                                                                             #
#                        RECEIVE / SEND RSP PACKETS                           #
#                        RECEIVE / SEND RSP PACKETS                           #
#                                                                             #
#                                                                             #
###############################################################################
###############################################################################
 
 
proc receiveRSPpacket {sock} {
proc receiveRSPpacket {sock} {
 
 
 
    global CpuNr
 
 
    # Get client info
    # Get client info
    set ip   [lindex [fconfigure $sock -peername] 0]
    set ip   [lindex [fconfigure $sock -peername] 0]
    set port [lindex [fconfigure $sock -peername] 2]
    set port [lindex [fconfigure $sock -peername] 2]
 
 
    # Check if a new packet arrives
    # Check if a new packet arrives
Line 187... Line 200...
        set rsp_cmd ""
        set rsp_cmd ""
    } else {
    } else {
        binary scan $rsp_cmd H* rsp_cmd
        binary scan $rsp_cmd H* rsp_cmd
        if {$rsp_cmd=="03"} {
        if {$rsp_cmd=="03"} {
            putsVerbose "--> BREAK"
            putsVerbose "--> BREAK"
            HaltCPU
            HaltCPU $CpuNr
        }
        }
    }
    }
    # Receive packet
    # Receive packet
    while {$rx_packet} {
    while {$rx_packet} {
        set char [getDebugChar $sock]
        set char [getDebugChar $sock]
Line 347... Line 360...
    wm geometry .omsp_extra_info +380+200
    wm geometry .omsp_extra_info +380+200
    wm resizable .omsp_extra_info 0 0
    wm resizable .omsp_extra_info 0 0
 
 
    # Title
    # Title
    set title "openMSP430"
    set title "openMSP430"
    if {$omsp_info(alias)!=""} {
    if {$omsp_info($CpuNr,alias)!=""} {
        set title $omsp_info(alias)
        set title $omsp_info($CpuNr,alias)
    }
    }
    label  .omsp_extra_info.title  -text "$title"   -anchor center -fg "\#00ae00" -font {-weight bold -size 16}
    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}
    pack   .omsp_extra_info.title  -side top -padx {20 20} -pady {20 10}
 
 
    # Add extra info
    # Add extra info
Line 369... Line 382...
 
 
 
 
    # Fill the text widget will configuration info
    # 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 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         "Configuration\n\n" bold
    .omsp_extra_info.extra.text insert end [format "CPU Version                : %5s\n" $omsp_info(cpu_ver)]
    .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(user_ver)]
    .omsp_extra_info.extra.text insert end [format "User Version               : %5s\n" $omsp_info($CpuNr,user_ver)]
    if {$omsp_info(cpu_ver)==1} {
    if {$omsp_info($CpuNr,cpu_ver)==1} {
    .omsp_extra_info.extra.text insert end [format "Implementation             : %5s\n" --]
    .omsp_extra_info.extra.text insert end [format "Implementation             : %5s\n" --]
    } elseif {$omsp_info(asic)==0} {
    } elseif {$omsp_info($CpuNr,asic)==0} {
    .omsp_extra_info.extra.text insert end [format "Implementation             : %5s\n" FPGA]
    .omsp_extra_info.extra.text insert end [format "Implementation             : %5s\n" FPGA]
    } elseif {$omsp_info(asic)==1} {
    } elseif {$omsp_info($CpuNr,asic)==1} {
    .omsp_extra_info.extra.text insert end [format "Implementation             : %5s\n" ASIC]
    .omsp_extra_info.extra.text insert end [format "Implementation             : %5s\n" ASIC]
    }
    }
    if {$omsp_info(mpy)==1} {
    if {$omsp_info($CpuNr,mpy)==1} {
    .omsp_extra_info.extra.text insert end [format "Hardware Multiplier support: %5s\n" Yes]
    .omsp_extra_info.extra.text insert end [format "Hardware Multiplier support: %5s\n" Yes]
    } elseif {$omsp_info(mpy)==0} {
    } elseif {$omsp_info($CpuNr,mpy)==0} {
    .omsp_extra_info.extra.text insert end [format "Hardware Multiplier support: %5s\n" No]
    .omsp_extra_info.extra.text insert end [format "Hardware Multiplier support: %5s\n" No]
    } else {
    } else {
    .omsp_extra_info.extra.text insert end [format "Hardware Multiplier support: %5s\n" --]
    .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(pmem_size)]
    .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(dmem_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(per_size)]
    .omsp_extra_info.extra.text insert end [format "Peripheral address space   : %5s B\n" $omsp_info($CpuNr,per_size)]
    if {$omsp_info(alias)==""} {
    if {$omsp_info($CpuNr,alias)==""} {
    .omsp_extra_info.extra.text insert end [format "Alias                      : %5s\n\n\n" None]
    .omsp_extra_info.extra.text insert end [format "Alias                      : %5s\n\n\n" None]
    } else {
    } else {
    .omsp_extra_info.extra.text insert end [format "Alias                      : %5s\n\n\n" $omsp_info(alias)]
    .omsp_extra_info.extra.text insert end [format "Alias                      : %5s\n\n\n" $omsp_info($CpuNr,alias)]
    }
    }
 
 
    .omsp_extra_info.extra.text insert end         "Extra Info\n\n" bold
    .omsp_extra_info.extra.text insert end         "Extra Info\n\n" bold
 
 
    if {$omsp_info(alias)!=""} {
    if {$omsp_info($CpuNr,alias)!=""} {
 
 
        set aliasEXTRA  [lsort -increasing [array names omsp_info -glob "extra,*"]]
        set aliasEXTRA  [lsort -increasing [array names omsp_info -glob "extra,*"]]
        if {[llength $aliasEXTRA]} {
        if {[llength $aliasEXTRA]} {
 
 
            foreach currentEXTRA $aliasEXTRA {
            foreach currentEXTRA $aliasEXTRA {
                regexp {^.+,.+,(.+)$} $currentEXTRA whole_match extraATTR
                regexp {^.+,.+,(.+)$} $currentEXTRA whole_match extraATTR
                .omsp_extra_info.extra.text insert end     [format "%-15s: %s\n" $extraATTR  $omsp_info($currentEXTRA)]
                .omsp_extra_info.extra.text insert end     [format "%-15s: %s\n" $extraATTR  $omsp_info($CpuNr,$currentEXTRA)]
            }
            }
            .omsp_extra_info.extra.text insert end         "\n\n"
            .omsp_extra_info.extra.text insert end         "\n\n"
        }
        }
    } else {
    } else {
        .omsp_extra_info.extra.text insert end  "No alias found in 'omsp_alias.xml' file"
        .omsp_extra_info.extra.text insert end  "No alias found in 'omsp_alias.xml' file"

powered by: WebSVN 2.1.0

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