# Copyright (C) 2014 Free Software Foundation, Inc.
#
# This file is part of DejaGnu.
#
# DejaGnu is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# DejaGnu is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with DejaGnu; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.

# This initializes the path to the Foundation Model
proc ${board}_init { hostname } {
    global model

    # Get the full path to the Foundation Model
    if {[board_info $hostname exists model]} {
        set model "[board_info $hostname model]"
    }
}

proc ${board}_download { dest file args } {
    global model timeout

    # Extract the endianess of the executable
    set status [catch "exec od -An -v -j5 -N1 -t x1 $file" bigendian]
    set args "--quiet"
    if { $bigendian == "02"} {
     	set args "$args --bigendian"
    }
    
    return [local_exec "$model --image $file $args" "" "" $timeout]
}


proc ${board}_exec { dest file args } {
    # This is a stub, since we can't execute remote commands on bare metal
    return 0
}
