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

Subversion Repositories openmsp430

[/] [openmsp430/] [trunk/] [tools/] [bin/] [openmsp430-minidebug.tcl] - Diff between revs 169 and 210

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

Rev 169 Rev 210
Line 27... Line 27...
# 
# 
# Author(s):
# Author(s):
#             - Olivier Girard,    olgirard@gmail.com
#             - Olivier Girard,    olgirard@gmail.com
#
#
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# $Rev: 169 $
# $Rev: 210 $
# $LastChangedBy: olivier.girard $
# $LastChangedBy: olivier.girard $
# $LastChangedDate: 2012-12-06 22:11:29 +0100 (Thu, 06 Dec 2012) $
# $LastChangedDate: 2015-11-17 10:57:08 +0100 (Tue, 17 Nov 2015) $
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
 
 
###############################################################################
###############################################################################
#                                                                             #
#                                                                             #
#                            SOURCE LIBRARIES                                 #
#                            SOURCE LIBRARIES                                 #
Line 80... Line 80...
global binFileName
global binFileName
global pmemIHEX
global pmemIHEX
global isPmemRead
global isPmemRead
global brkpt
global brkpt
global color
global color
 
global TOOLCHAIN_PFX
 
 
# Initialize to default values
# Initialize to default values
set CpuNr                 0
set CpuNr                 0
set omsp_nr               1
set omsp_nr               1
set omsp_conf(interface)  uart_generic
set omsp_conf(interface)  uart_generic
Line 126... Line 127...
}
}
for {set i 0} {$i<3} {incr i} {
for {set i 0} {$i<3} {incr i} {
    set backup($i,current_file_name) ""
    set backup($i,current_file_name) ""
}
}
 
 
 
# Detect toolchain
 
set TOOLCHAIN_PFX "msp430"
 
if {[catch {exec msp430-gcc --version} debug_info]} {
 
    if {[catch {exec msp430-elf-gcc --version} debug_info]} {
 
    } else {
 
        set TOOLCHAIN_PFX "msp430-elf"
 
    }
 
}
 
 
 
 
###############################################################################
###############################################################################
#                                                                             #
#                                                                             #
#                                    FUNCTIONS                                #
#                                    FUNCTIONS                                #
#                                                                             #
#                                                                             #
Line 454... Line 464...
    global binFileType
    global binFileType
    global binFileName
    global binFileName
    global pmemIHEX
    global pmemIHEX
    global brkpt
    global brkpt
    global isPmemRead
    global isPmemRead
 
    global TOOLCHAIN_PFX
 
 
    if {($binFileName!="") | ($isPmemRead==1)} {
    if {($binFileName!="") | ($isPmemRead==1)} {
 
 
        if {$isPmemRead==1} {
        if {$isPmemRead==1} {
 
 
Line 477... Line 488...
            set currentFileName $binFileName
            set currentFileName $binFileName
        }
        }
 
 
        set temp_elf_file  "[clock clicks].elf"
        set temp_elf_file  "[clock clicks].elf"
        set temp_ihex_file "[clock clicks].ihex"
        set temp_ihex_file "[clock clicks].ihex"
        if {[catch {exec msp430-objcopy -I $currentFileType -O elf32-msp430 $currentFileName $temp_elf_file} debug_info]} {
        if {[catch {exec ${TOOLCHAIN_PFX}-objcopy -I $currentFileType -O elf32-msp430 $currentFileName $temp_elf_file} debug_info]} {
            .ctrl.load.info.l configure -text "$debug_info" -fg red
            .ctrl.load.info.l configure -text "$debug_info" -fg red
            return 0
            return 0
        }
        }
        if {![waitForFile $temp_elf_file]} {
        if {![waitForFile $temp_elf_file]} {
            .ctrl.load.info.l configure -text "Timeout: ELF file conversion problem with \"msp430-objcopy\" executable" -fg red
            .ctrl.load.info.l configure -text "Timeout: ELF file conversion problem with \"${TOOLCHAIN_PFX}-objcopy\" executable" -fg red
            return 0
            return 0
        }
        }
        if {[string eq $currentFileType "ihex"]} {
        if {[string eq $currentFileType "ihex"]} {
            set dumpOpt "-D"
            set dumpOpt "-D"
        } else {
        } else {
Line 499... Line 510...
            for {set i 0} {$i<3} {incr i} {
            for {set i 0} {$i<3} {incr i} {
                set brkpt(en_$i) 0
                set brkpt(en_$i) 0
                .ctrl.cpu.brkpt.chk$i  configure -state disable
                .ctrl.cpu.brkpt.chk$i  configure -state disable
                updateBreakpoint $i
                updateBreakpoint $i
            }
            }
            if {[catch {exec msp430-objcopy -I $currentFileType -O ihex $temp_elf_file $temp_ihex_file} debug_info]} {
            if {[catch {exec ${TOOLCHAIN_PFX}-objcopy -I $currentFileType -O ihex $temp_elf_file $temp_ihex_file} debug_info]} {
                .ctrl.load.info.l configure -text "$debug_info" -fg red
                .ctrl.load.info.l configure -text "$debug_info" -fg red
                return 0
                return 0
            }
            }
            if {![waitForFile  $temp_ihex_file]} {
            if {![waitForFile  $temp_ihex_file]} {
                .ctrl.load.info.l configure -text "Timeout: IHEX file conversion problem with \"msp430-objcopy\" executable" -fg red
                .ctrl.load.info.l configure -text "Timeout: IHEX file conversion problem with \"${TOOLCHAIN_PFX}-objcopy\" executable" -fg red
                return 0
                return 0
            }
            }
            set fp [open $temp_ihex_file r]
            set fp [open $temp_ihex_file r]
            set debug_info [read $fp]
            set debug_info [read $fp]
            close $fp
            close $fp
Line 517... Line 528...
 
 
        } elseif {$codeSelect==2} {
        } elseif {$codeSelect==2} {
            for {set i 0} {$i<3} {incr i} {
            for {set i 0} {$i<3} {incr i} {
                .ctrl.cpu.brkpt.chk$i  configure -state normal
                .ctrl.cpu.brkpt.chk$i  configure -state normal
            }
            }
            if {[catch {exec msp430-objdump $dumpOpt $temp_elf_file} debug_info]} {
            if {[catch {exec ${TOOLCHAIN_PFX}-objdump $dumpOpt $temp_elf_file} debug_info]} {
                .ctrl.load.info.l configure -text "$debug_info" -fg red
                .ctrl.load.info.l configure -text "$debug_info" -fg red
                return 0
                return 0
            }
            }
        } elseif {$codeSelect==3} {
        } elseif {$codeSelect==3} {
            for {set i 0} {$i<3} {incr i} {
            for {set i 0} {$i<3} {incr i} {
                .ctrl.cpu.brkpt.chk$i  configure -state normal
                .ctrl.cpu.brkpt.chk$i  configure -state normal
            }
            }
            if {[catch {exec msp430-objdump $dumpOpt\S $temp_elf_file} debug_info]} {
            if {[catch {exec ${TOOLCHAIN_PFX}-objdump $dumpOpt\S $temp_elf_file} debug_info]} {
                .ctrl.load.info.l configure -text "$debug_info" -fg red
                .ctrl.load.info.l configure -text "$debug_info" -fg red
                return 0
                return 0
            }
            }
        }
        }
        file delete $temp_elf_file
        file delete $temp_elf_file
Line 624... Line 635...
    global brkpt
    global brkpt
    global CpuNr
    global CpuNr
    global isPmemRead
    global isPmemRead
    global pmemIHEX
    global pmemIHEX
    global backup
    global backup
 
    global TOOLCHAIN_PFX
 
 
    # Check if the file exists
    # Check if the file exists
    #----------------------------------------
    #----------------------------------------
    if {![file exists $current_file_name]} {
    if {![file exists $current_file_name]} {
        .ctrl.load.info.l configure -text "Specified file doesn't exists: \"$current_file_name\"" -fg red
        .ctrl.load.info.l configure -text "Specified file doesn't exists: \"$current_file_name\"" -fg red
Line 680... Line 692...
    # Create and read binary executable file
    # Create and read binary executable file
    #----------------------------------------
    #----------------------------------------
 
 
    # Generate binary file
    # Generate binary file
    set bin_file "[clock clicks].bin"
    set bin_file "[clock clicks].bin"
    if {[catch {exec msp430-objcopy -I $binFileType -O binary $binFileName $bin_file} errMsg]} {
    if {[catch {exec ${TOOLCHAIN_PFX}-objcopy -I $binFileType -O binary $binFileName $bin_file} errMsg]} {
        .ctrl.load.info.l configure -text "$errMsg" -fg red
        .ctrl.load.info.l configure -text "$errMsg" -fg red
        return 0
        return 0
    }
    }
 
 
    # Wait until bin file is present on the filesystem
    # Wait until bin file is present on the filesystem
    if {![waitForFile $bin_file]} {
    if {![waitForFile $bin_file]} {
        .ctrl.load.info.l configure -text "Timeout: ELF to BIN file conversion problem with \"msp430-objcopy\" executable" -fg red
        .ctrl.load.info.l configure -text "Timeout: ELF to BIN file conversion problem with \"${TOOLCHAIN_PFX}-objcopy\" executable" -fg red
        return 0
        return 0
    }
    }
 
 
    # Read file
    # Read file
    set fp [open $bin_file r]
    set fp [open $bin_file r]
Line 1423... Line 1435...
####################################
####################################
#  CREATE THE CPU CONTROL SECTION  #
#  CREATE THE CPU CONTROL SECTION  #
####################################
####################################
 
 
# Exit button
# Exit button
button .menu.exit      -text "Exit" -command {clearBreakpoints; exit 0}
button .menu.exit      -text "Exit" -command {clearBreakpoints; utils::uart_close; exit 0}
pack   .menu.exit      -side left
pack   .menu.exit      -side left
 
 
# CPU selection buttons
# CPU selection buttons
label  .menu.cpusel    -text "oMSP core Selection:" -anchor w -state disabled
label  .menu.cpusel    -text "oMSP core Selection:" -anchor w -state disabled
pack   .menu.cpusel    -side left -padx "100 0"
pack   .menu.cpusel    -side left -padx "100 0"

powered by: WebSVN 2.1.0

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