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

Subversion Repositories openmsp430

[/] [openmsp430/] [trunk/] [fpga/] [altera_de0_nano_soc/] [synthesis/] [altera/] [0_create_bitstream.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
# Cleanup
4
rm -rf ./WORK
5
mkdir WORK
6
 
7
###############################################################################
8
#                            Parameter Check                                  #
9
###############################################################################
10
EXPECTED_ARGS=1
11
if [ $# -ne $EXPECTED_ARGS ]; then
12
    echo ""
13
    echo "ERROR          : wrong number of arguments"
14
    echo "USAGE          : ./0_create_bitstream.sh <test name>"
15
    echo "EXAMPLE        : ./0_create_bitstream.sh    leds"
16
    echo ""
17
    echo "AVAILABLE TESTS:"
18
    for fullfile in ../../software/apps/* ; do
19
        filename=$(basename "$fullfile")
20
        filename="${filename%.*}"
21
        echo "                  - $filename"
22
    done
23
    echo ""
24
  exit 1
25
fi
26
 
27
###############################################################################
28
#                     Check if the required files exist                       #
29
###############################################################################
30
softdir=../../software/apps/$1;
31
elffile=../../software/apps/$1/$1.elf;
32
 
33
if [ ! -e $softdir ]; then
34
    echo "Software directory doesn't exist: $softdir"
35
    exit 1
36
fi
37
 
38
###############################################################################
39
#                           Compile program                                   #
40
###############################################################################
41
echo " -----------------------------------------------"
42
echo "|  COMPILE PROGRAM: $1"
43
echo " -----------------------------------------------"
44
echo ""
45
 
46
cd $softdir
47
make clean
48
make
49
cd ../../../synthesis/altera
50
 
51
###############################################################################
52
#                           Generate MIF file                                 #
53
###############################################################################
54
echo ""
55
echo " -----------------------------------------------"
56
echo "|  GENERATE MIF FILE: $1"
57
echo " -----------------------------------------------"
58
echo ""
59
 
60
cd ./WORK
61
 
62
# Generate memory MIF file
63
if command -v msp430-elf-gcc >/dev/null; then
64
    msp430-elf-objcopy -O ihex ../$elffile ./$1.ihex
65
else
66
    msp430-objcopy     -O ihex ../$elffile ./$1.ihex
67
fi
68
../scripts/ihex2mif.tcl -ihex $1.ihex -out pmem.mif -mem_size 32768
69
 
70
echo "New MIF file generated:"
71
echo "                          ./WORK/pmem.mif"
72
echo ""
73
 
74
###############################################################################
75
#                           Generate bitstream                                #
76
###############################################################################
77
echo ""
78
echo " -----------------------------------------------"
79
echo "|  GENERATE NEW BITSTREAM (SOF FILE)"
80
echo " -----------------------------------------------"
81
echo ""
82
 
83
# FPGA flow (i.e. generate SOF file)
84
quartus_sh  -t ../scripts/synthesis.tcl | tee ../log/quartus_synthesis.log
85
 
86
cd ..
87
cp -f ./WORK/output_files/openMSP430_fpga.sof ./bitstreams/$1.sof
88
 
89
echo ""
90
echo "New SOF file generated:"
91
echo "                        ./bitstreams/$1.sof"
92
echo ""

powered by: WebSVN 2.1.0

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