Line 27... |
Line 27... |
#
|
#
|
# Author(s):
|
# Author(s):
|
# - Olivier Girard, olgirard@gmail.com
|
# - Olivier Girard, olgirard@gmail.com
|
#
|
#
|
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
# $Rev: 151 $
|
# $Rev: 212 $
|
# $LastChangedBy: olivier.girard $
|
# $LastChangedBy: olivier.girard $
|
# $LastChangedDate: 2012-07-23 00:24:11 +0200 (Mon, 23 Jul 2012) $
|
# $LastChangedDate: 2015-11-17 12:05:53 +0100 (Tue, 17 Nov 2015) $
|
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
|
|
###############################################################################
|
###############################################################################
|
# Parameter Check #
|
# Parameter Check #
|
###############################################################################
|
###############################################################################
|
Line 63... |
Line 63... |
###############################################################################
|
###############################################################################
|
softdir=../../../software/$1;
|
softdir=../../../software/$1;
|
elffile=../../../software/$1/$1.elf;
|
elffile=../../../software/$1/$1.elf;
|
verfile=../src/$1.v;
|
verfile=../src/$1.v;
|
submitfile=../src/submit.f;
|
submitfile=../src/submit.f;
|
|
if [ $OMSP_SIMULATOR == "isim" ]; then
|
|
submitfile=../src/submit.prj;
|
|
fi
|
incfile=../../../rtl/verilog/openmsp430/openMSP430_defines.v;
|
incfile=../../../rtl/verilog/openmsp430/openMSP430_defines.v;
|
|
|
if [ ! -e $softdir ]; then
|
if [ ! -e $softdir ]; then
|
echo "Software directory doesn't exist: $softdir"
|
echo "Software directory doesn't exist: $softdir"
|
exit 1
|
exit 1
|
Line 98... |
Line 101... |
###############################################################################
|
###############################################################################
|
echo " ======================================================="
|
echo " ======================================================="
|
echo "| Start simulation: $1"
|
echo "| Start simulation: $1"
|
echo " ======================================================="
|
echo " ======================================================="
|
|
|
|
# Make local copy of the openMSP403 configuration file
|
|
# and prepare it for MSPGCC preprocessing
|
|
cp $incfile ./pmem.h
|
|
sed -ie 's/`ifdef/#ifdef/g' ./pmem.h
|
|
sed -ie 's/`else/#else/g' ./pmem.h
|
|
sed -ie 's/`endif/#endif/g' ./pmem.h
|
|
sed -ie 's/`define/#define/g' ./pmem.h
|
|
sed -ie 's/`include/\/\/#include/g' ./pmem.h
|
|
sed -ie 's/`//g' ./pmem.h
|
|
sed -ie "s/'//g" ./pmem.h
|
|
|
|
# Use MSPGCC preprocessor to extract the Program, Data
|
|
# and Peripheral memory sizes
|
|
if command -v msp430-elf-gcc >/dev/null; then
|
|
msp430-elf-gcc -E -P -x c ../bin/omsp_config.sh > pmem.sh
|
|
else
|
|
msp430-gcc -E -P -x c ../bin/omsp_config.sh > pmem.sh
|
|
fi
|
|
|
|
# Source the extracted configuration file
|
|
if [[ $(uname -s) == CYGWIN* ]];
|
|
then
|
|
dos2unix pmem.sh
|
|
fi
|
|
source pmem.sh
|
|
|
# Make C program
|
# Make C program
|
cd $softdir
|
cd $softdir
|
make clean
|
make clean
|
make
|
make
|
cd ../../sim/rtl_sim/run/
|
cd ../../sim/rtl_sim/run/
|
|
|
# Create links
|
# Create links
|
if [ `uname -o` = "Cygwin" ]
|
if [[ $(uname -s) == CYGWIN* ]];
|
then
|
then
|
cp $elffile pmem.elf
|
cp $elffile pmem.elf
|
cp $verfile stimulus.v
|
cp $verfile stimulus.v
|
else
|
else
|
ln -s $elffile pmem.elf
|
ln -s $elffile pmem.elf
|
ln -s $verfile stimulus.v
|
ln -s $verfile stimulus.v
|
fi
|
fi
|
|
|
# Make local copy of the openMSP403 configuration file
|
|
# and prepare it for MSPGCC preprocessing
|
|
cp $incfile ./pmem.h
|
|
sed -i 's/`ifdef/#ifdef/g' ./pmem.h
|
|
sed -i 's/`else/#else/g' ./pmem.h
|
|
sed -i 's/`endif/#endif/g' ./pmem.h
|
|
sed -i 's/`define/#define/g' ./pmem.h
|
|
sed -i 's/`//g' ./pmem.h
|
|
sed -i "s/'//g" ./pmem.h
|
|
|
|
# Use MSPGCC preprocessor to extract the Program, Data
|
|
# and Peripheral memory sizes
|
|
msp430-gcc -E -P -x c ../bin/omsp_config.sh > pmem.sh
|
|
|
|
# Source the extracted configuration file
|
|
source pmem.sh
|
|
|
|
# Create IHEX file from ELF
|
# Create IHEX file from ELF
|
echo "Convert ELF file to IHEX format..."
|
echo "Convert ELF file to IHEX format..."
|
|
if command -v msp430-elf-objcopy >/dev/null; then
|
|
msp430-elf-objcopy -O ihex pmem.elf pmem.ihex
|
|
else
|
msp430-objcopy -O ihex pmem.elf pmem.ihex
|
msp430-objcopy -O ihex pmem.elf pmem.ihex
|
|
fi
|
|
|
# Generate Program memory file
|
# Generate Program memory file
|
echo "Convert IHEX file to Verilog MEMH format..."
|
echo "Convert IHEX file to Verilog MEMH format..."
|
../bin/ihex2mem.tcl -ihex pmem.ihex -out pmem.mem -mem_size $pmemsize
|
../bin/ihex2mem.tcl -ihex pmem.ihex -out pmem.mem -mem_size $pmemsize
|
|
|