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

Subversion Repositories openmsp430

[/] [openmsp430/] [trunk/] [tools/] [bin/] [openmsp430-minidebug.tcl] - Diff between revs 35 and 77

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

Rev 35 Rev 77
Line 27... Line 27...
# 
# 
# Author(s):
# Author(s):
#             - Olivier Girard,    olgirard@gmail.com
#             - Olivier Girard,    olgirard@gmail.com
#
#
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# $Rev: 35 $
# $Rev: 77 $
# $LastChangedBy: olivier.girard $
# $LastChangedBy: olivier.girard $
# $LastChangedDate: 2009-12-29 21:12:19 +0100 (Tue, 29 Dec 2009) $
# $LastChangedDate: 2010-11-21 20:50:55 +0100 (Sun, 21 Nov 2010) $
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
 
 
###############################################################################
###############################################################################
#                                                                             #
#                                                                             #
#                            GLOBAL VARIABLES                                 #
#                            GLOBAL VARIABLES                                 #
Line 134... Line 134...
    # 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"
    catch {exec msp430-objcopy -O binary $elf_file_name $bin_file}
    if {[catch {exec msp430-objcopy -O binary $elf_file_name $bin_file} errMsg]} {
 
        .load.fb.l configure -text "$errMsg" -fg red
 
        return 0
 
    }
 
 
 
    # Wait until bin file is present on the filesystem
 
    set timeout 100
 
    for {set i 0} {$i <= $timeout} {incr i} {
 
        after 500
 
        if {[file exists $bin_file]} {
 
            break
 
        }
 
    }
 
    if {$i>=$timeout} {
 
        .load.fb.l configure -text "Timeout: ELF to BIN file conversion problem with \"msp430-objcopy\" executable" -fg red
 
        return 0
 
    }
 
 
    # Read file
    # Read file
    set fp [open $bin_file r]
    set fp [open $bin_file r]
    fconfigure $fp -translation binary
    fconfigure $fp -translation binary
    binary scan [read $fp] H* hex_data yop
    binary scan [read $fp] H* hex_data yop
Line 150... Line 166...
    # Get program size
    # Get program size
    set hex_size  [string length $hex_data]
    set hex_size  [string length $hex_data]
    set byte_size [expr $hex_size/2]
    set byte_size [expr $hex_size/2]
    set word_size [expr $byte_size/2]
    set word_size [expr $byte_size/2]
 
 
 
    # Make sure ELF program size is the same as the available program memory
 
    set sizes [GetCPU_ID_SIZE]
 
    if {[lindex $sizes 0] != [expr $hex_size/2]} {
 
        .load.fb.l configure -text "ERROR: ELF program size ([expr $hex_size/2] B) is different than the available program memory ([lindex $sizes 0] B)" -fg red
 
        return 0
 
    }
 
 
    # Format data
    # Format data
    for {set i 0} {$i < $hex_size} {set i [expr $i+4]} {
    for {set i 0} {$i < $hex_size} {set i [expr $i+4]} {
        set hex_msb "[string index $hex_data [expr $i+2]][string index $hex_data [expr $i+3]]"
        set hex_msb "[string index $hex_data [expr $i+2]][string index $hex_data [expr $i+3]]"
        set hex_lsb "[string index $hex_data [expr $i+0]][string index $hex_data [expr $i+1]]"
        set hex_lsb "[string index $hex_data [expr $i+0]][string index $hex_data [expr $i+1]]"
        lappend DataArray "0x$hex_msb$hex_lsb"
        lappend DataArray "0x$hex_msb$hex_lsb"
Line 172... Line 195...
    WriteMemQuick $StartAddr $DataArray
    WriteMemQuick $StartAddr $DataArray
 
 
    # Check Data
    # Check Data
    .load.fb.l configure -text "Verify..." -fg yellow
    .load.fb.l configure -text "Verify..." -fg yellow
    update
    update
    if {[VerifyMem $StartAddr $DataArray]} {
    if {[VerifyMem $StartAddr $DataArray 1]} {
        .load.fb.l configure -text "Done" -fg green
        .load.fb.l configure -text "Done" -fg green
    } else {
    } else {
        .load.fb.l configure -text "ERROR" -fg red
        .load.fb.l configure -text "ERROR" -fg red
    }
    }
    update
    update

powered by: WebSVN 2.1.0

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