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

Subversion Repositories openmsp430

[/] [openmsp430/] [trunk/] [tools/] [bin/] [openmsp430-loader.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 serial_baudrate
global serial_baudrate
global serial_device
global serial_device
 
 
Line 98... Line 98...
###############################################################################
###############################################################################
#                  CREATE AND READ BINARY EXECUTABLE FILE                     #
#                  CREATE AND READ BINARY EXECUTABLE FILE                     #
###############################################################################
###############################################################################
 
 
# Generate binary file
# Generate binary file
catch {exec msp430-objcopy -O binary $elf_file $bin_file}
if {[catch {exec msp430-objcopy -O binary $elf_file $bin_file} errMsg]} {
 
    puts $errMsg
 
    exit 1
 
}
 
 
 
# 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} {
 
    puts "Timeout: ELF to BIN file conversion problem with \"msp430-objcopy\" executable"
 
    puts "$errMsg"
 
    exit 1
 
}
 
 
# 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 144... Line 161...
puts "done"
puts "done"
set sizes [GetCPU_ID_SIZE]
set sizes [GetCPU_ID_SIZE]
puts "Connected: target device has [lindex $sizes 0]B Program Memory and [lindex $sizes 1]B Data Memory"
puts "Connected: target device has [lindex $sizes 0]B Program Memory and [lindex $sizes 1]B Data Memory"
puts ""
puts ""
 
 
 
# Make sure ELF program size is the same as the available program memory
 
if {[lindex $sizes 0] != [expr $hex_size/2]} {
 
    puts "ERROR: ELF program size ($byte_size B) is different than the available program memory ([lindex $sizes 0] B)"
 
    exit 1
 
}
 
 
# Load Program Memory
# Load Program Memory
set StartAddr [format "0x%04x" [expr 0x10000-$byte_size]]
set StartAddr [format "0x%04x" [expr 0x10000-$byte_size]]
puts -nonewline "Load Program Memory... "
puts -nonewline "Load Program Memory... "
flush stdout
flush stdout
WriteMemQuick $StartAddr $DataArray
WriteMemQuick $StartAddr $DataArray
puts "done"
puts "done"
 
 
# Check Data
# Check Data
puts -nonewline "Verify Program Memory... "
puts -nonewline "Verify Program Memory... "
flush stdout
flush stdout
if {[VerifyMem $StartAddr $DataArray]} {
if {[VerifyMem $StartAddr $DataArray 1]} {
    puts "done"
    puts "done"
} else {
} else {
    puts "ERROR"
    puts "ERROR"
}
}
 
 

powered by: WebSVN 2.1.0

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