Keep standard 30MHzDF and adds the lite configuration
[debian6500.git] / simple-cdd / additional_scripts / flash_fe306.sh
CommitLineData
b3f3562f
OL
1#!/bin/bash
2
3# parameters
4#
5# ============================================================================
6#
7# Copyright (C) THALES. All rights reserved
8# Author: Laurent Mazet
9#
10# 2014-10-06 V1.0 : Creation
11#
12# ============================================================================
13
14DRY=
15FIRMWARE=/opt/trc6500/config/code_metier/libHwCtrl/Bitstream
16LIST="application.out production.bin ts12_fp_pano.bin ts22_fp_pano.bin firmware.out"
17HOST=
18#TRC6500_SCRIPT_DIR=/opt/trc6500/script
19TRC6500_SCRIPT_DIR=$(dirname $0)
20
21# help function
22
23function usage () {
24 echo "usage: $PROGNAME [-d] [-f dir] [-h] [-i host] [-l list]"
25 echo " -d: dry mode"
26 echo " -f: firmware directory ($FIRMWARE)"
27 echo " -h: help message"
28 echo " -i: board hostname (or ip)"
29 echo " -l: list of firmware ($LIST)"
30 exit $@
31 }
32
33# formating functions
34
35function title () { echo -e "\033[0;1m$*\033[0;0m"; }
36function pass () { echo -e "\033[1;32m$*\033[0;0m"; }
37function warn () { echo -e "\033[1;33m$*\033[0;0m"; }
38function fail () { echo -e "\033[1;31m$*\033[0;0m"; }
39
40# argument processing
41
42while [ $# -gt 0 ]; do
43 case "$1" in
44 -d) DRY=yes;;
45 -f) shift; FIRMWARE=$1;;
46 -h) usage 0;;
47 -i) shift; HOST=$1;;
48 -l) shift; LIST=$1;;
49 *) usage 1;;
50 esac
51 shift
52done
53
54# check host
55
56[ "$HOST" ] || ping -c 1 $HOST >&/dev/null || \
57 { fail "Can't connect '$HOST'"; exit 1; }
58
59# check firmware
60
61for f in $LIST; do
62 [ -f $FIRMWARE/$f ] || { fail "Can't find '$FIRMWARE/$f'"; exit 1; }
63done
64
65# check mode
66
67protect=""
68[ "$DRY" = yes ] && protect="!echo"
69
70# flash firmware
71
72title "flash fe306 '$HOST'"
73
74ftp -n <<EOF
75open $HOST
76quote USER none
77quote PASS none
78binary
79cd flash
80$(for f in $LIST; do echo "$protect send $FIRMWARE/$f"; done)
81bye
82EOF
83
84# vim:set tabstop=4 shiftwidth=4 softtabstop=4: