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

Subversion Repositories openmsp430

[/] [openmsp430/] [trunk/] [tools/] [bin/] [openmsp430-loader.tcl] - Diff between revs 158 and 210

Show entire file | Details | Blame | View Log

Rev 158 Rev 210
Line 27... Line 27...
#
#
# Author(s):
# Author(s):
#             - Olivier Girard,    olgirard@gmail.com
#             - Olivier Girard,    olgirard@gmail.com
#
#
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# $Rev: 158 $
# $Rev: 210 $
# $LastChangedBy: olivier.girard $
# $LastChangedBy: olivier.girard $
# $LastChangedDate: 2012-10-15 23:49:09 +0200 (Mon, 15 Oct 2012) $
# $LastChangedDate: 2015-11-17 10:57:08 +0100 (Tue, 17 Nov 2015) $
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
 
 
global omsp_conf
global omsp_conf
global omsp_info
global omsp_info
 
 
 
# Detect toolchain
 
if {[catch {exec msp430-gcc --version} debug_info]} {
 
    if {[catch {exec msp430-elf-gcc --version} debug_info]} {
 
        puts "\nERROR: Could not detect MSP430 GCC toolchain"
 
        exit 1
 
    } else {
 
        set TOOLCHAIN_PFX "msp430-elf"
 
    }
 
} else {
 
    set TOOLCHAIN_PFX "msp430"
 
}
 
 
###############################################################################
###############################################################################
#                            SOURCE LIBRARIES                                 #
#                            SOURCE LIBRARIES                                 #
###############################################################################
###############################################################################
 
 
# Get library path
# Get library path
Line 168... Line 180...
if {[string eq $fileType "elf"]} {
if {[string eq $fileType "elf"]} {
    set fileType "elf32-msp430"
    set fileType "elf32-msp430"
}
}
 
 
# Generate binary file
# Generate binary file
if {[catch {exec msp430-objcopy -I $fileType -O binary $elf_file $bin_file} errMsg]} {
if {[catch {exec ${TOOLCHAIN_PFX}-objcopy -I $fileType -O binary $elf_file $bin_file} errMsg]} {
    puts $errMsg
    puts $errMsg
    exit 1
    exit 1
}
}
 
 
# Wait until bin file is present on the filesystem
# Wait until bin file is present on the filesystem
Line 182... Line 194...
    if {[file exists $bin_file]} {
    if {[file exists $bin_file]} {
        break
        break
    }
    }
}
}
if {$i>=$timeout} {
if {$i>=$timeout} {
    puts "\nTimeout: ELF to BIN file conversion problem with \"msp430-objcopy\" executable"
    puts "\nTimeout: ELF to BIN file conversion problem with \"${TOOLCHAIN_PFX}-objcopy\" executable"
    puts "$errMsg"
    puts "$errMsg"
    exit 1
    exit 1
}
}
 
 
# Read file
# Read file
Line 242... Line 254...
puts ""
puts ""
 
 
# Make sure ELF program size is the same as the available program memory
# Make sure ELF program size is the same as the available program memory
if {[lindex $sizes 0] != [expr $hex_size/2]} {
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)"
    puts "ERROR: ELF program size ($byte_size B) is different than the available program memory ([lindex $sizes 0] B)"
 
    utils::uart_close
    exit 1
    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]]
Line 260... Line 273...
flush stdout
flush stdout
if {[VerifyMem 0 $StartAddr $DataArray 1]} {
if {[VerifyMem 0 $StartAddr $DataArray 1]} {
    puts "done"
    puts "done"
} else {
} else {
    puts "ERROR"
    puts "ERROR"
 
    utils::uart_close
    exit 1
    exit 1
}
}
 
 
# Release device
# Release device
ReleaseDevice 0 0xfffe
ReleaseDevice 0 0xfffe

powered by: WebSVN 2.1.0

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