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

Subversion Repositories openmsp430

[/] [openmsp430/] [trunk/] [fpga/] [altera_de0_nano_soc/] [synthesis/] [altera/] [2_program_flash.sh] - Blame information for rev 221

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 221 olivier.gi
#!/bin/bash
2
 
3
###############################################################################
4
#                            Parameter Check                                  #
5
###############################################################################
6
EXPECTED_ARGS=1
7
if [ $# -ne $EXPECTED_ARGS ]; then
8
    echo ""
9
    echo "ERROR          : wrong number of arguments"
10
    echo "USAGE          : ./2_program_flash.sh <bitstream name>"
11
    echo "EXAMPLE        : ./2_program_flash.sh    leds"
12
    echo ""
13
    echo "AVAILABLE BITSTREAMS:"
14
    for fullfile in ./bitstreams/*.sof ; do
15
        filename=$(basename "$fullfile")
16
        filename="${filename%.*}"
17
        echo "                       - $filename"
18
    done
19
    echo ""
20
  exit 1
21
fi
22
 
23
###############################################################################
24
#                     Check if the required files exist                       #
25
###############################################################################
26
soffile=./bitstreams/$1.sof;
27
jicfile=./bitstreams/$1.jic;
28
 
29
if [ ! -e $soffile ]; then
30
    echo ""
31
    echo "ERROR: Specified SOF file doesn't exist: $soffile"
32
    echo ""
33
    exit 1
34
fi
35
 
36
###############################################################################
37
#                             Generate JIC file
38
###############################################################################
39
echo " ---------------------------------------------------------"
40
echo "|  GENERATE JIC FILE"
41
echo "|"
42
echo "|  $soffile --> $jicfile"
43
echo "|"
44
echo " ---------------------------------------------------------"
45
echo ""
46
 
47
# Copy and process COF file
48
cp scripts/sof2jic.cof ./bitstreams/.
49
sed -ie "s/BITSTREAM_NAME/$1/g"  ./bitstreams/sof2jic.cof
50
 
51
# Convert SOF file to JIC
52
quartus_cpf -c ./bitstreams/sof2jic.cof
53
 
54
# Cleanup
55
rm -rf ./bitstreams/sof2jic.cof*
56
 
57
 
58
###############################################################################
59
#                             Program FLASH                                   #
60
###############################################################################
61
echo ""
62
echo " ---------------------------------------------------------"
63
echo "|  PROGRAM FLASH: $jicfile"
64
echo " ---------------------------------------------------------"
65
echo ""
66
echo "Note: if failing:"
67
echo "                  - try killing 'jtagd', running 'jtagconfig'"
68
echo "                  - try as 'root'"
69
echo "                  - check dev usb permissions"
70
echo ""
71
 
72
# Copy and process CDF file
73
cp scripts/chain_with_flash.cdf  ./bitstreams/.
74
sed -ie "s/BITSTREAM_NAME/$1/g"  ./bitstreams/chain_with_flash.cdf
75
 
76
# Program flash
77
quartus_pgm ./bitstreams/chain_with_flash.cdf
78
 
79
# Cleanup
80
rm -rf ./bitstreams/chain_with_flash.*

powered by: WebSVN 2.1.0

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