Line 27... |
Line 27... |
#
|
#
|
# Author(s):
|
# Author(s):
|
# - Olivier Girard, olgirard@gmail.com
|
# - Olivier Girard, olgirard@gmail.com
|
#
|
#
|
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
# $Rev: 141 $
|
# $Rev: 151 $
|
# $LastChangedBy: olivier.girard $
|
# $LastChangedBy: olivier.girard $
|
# $LastChangedDate: 2012-05-05 23:22:06 +0200 (Sat, 05 May 2012) $
|
# $LastChangedDate: 2012-07-23 00:24:11 +0200 (Mon, 23 Jul 2012) $
|
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
|
|
###############################################################################
|
###############################################################################
|
# Parameter Check #
|
# Parameter Check #
|
###############################################################################
|
###############################################################################
|
Line 120... |
Line 120... |
else
|
else
|
ln -s $asmfile pmem.s43
|
ln -s $asmfile pmem.s43
|
ln -s $verfile stimulus.v
|
ln -s $verfile stimulus.v
|
fi
|
fi
|
|
|
# Make local copy of the openMSP403 configuration file and remove comments
|
# Make local copy of the openMSP403 configuration file
|
cp $incfile ./pmem.inc
|
# and prepare it for MSPGCC preprocessing
|
sed -i "/^\/\// s,.*,," pmem.inc
|
cp $incfile ./pmem.h
|
|
sed -i 's/`ifdef/#ifdef/g' ./pmem.h
|
# Get Program Memory size
|
sed -i 's/`else/#else/g' ./pmem.h
|
pmemunit=`grep PMEM_SIZE_ pmem.inc | grep -v ifdef | grep -v "//" | cut -d'_' -f4`
|
sed -i 's/`endif/#endif/g' ./pmem.h
|
pmemsize=`grep PMEM_SIZE_ pmem.inc | grep -v ifdef | grep -v "//" | cut -d'_' -f3`
|
sed -i 's/`define/#define/g' ./pmem.h
|
pmemsize=${pmemsize/p/.}
|
sed -i 's/`//g' ./pmem.h
|
if [ $pmemunit == "KB" ]
|
sed -i "s/'//g" ./pmem.h
|
then
|
|
pmemsize=`echo "pmemsize=$pmemsize * 1024; pmemsize /= 1; pmemsize" | bc`
|
# Use MSPGCC preprocessor to extract the Program, Data
|
fi
|
# and Peripheral memory sizes
|
|
msp430-gcc -E -P -x c ../bin/omsp_config.sh > pmem.sh
|
|
|
# Get Data Memory size
|
# Source the extracted configuration file
|
dmemunit=`grep DMEM_SIZE_ pmem.inc | grep -v ifdef | grep -v "//" | cut -d'_' -f4`
|
source pmem.sh
|
dmemsize=`grep DMEM_SIZE_ pmem.inc | grep -v ifdef | grep -v "//" | cut -d'_' -f3`
|
|
dmemsize=${dmemsize/p/.}
|
|
if [ $dmemunit == "KB" ]
|
|
then
|
|
dmemsize=`echo "dmemsize=$dmemsize * 1024; dmemsize /= 1; dmemsize" | bc`
|
|
fi
|
|
|
|
# Get Peripheral Address space size
|
|
perunit=`grep PER_SIZE_ pmem.inc | grep -v ifdef | grep -v "//" | cut -d'_' -f4`
|
|
persize=`grep PER_SIZE_ pmem.inc | grep -v ifdef | grep -v "//" | cut -d'_' -f3`
|
|
persize=${persize/p/.}
|
|
if [ $perunit == "KB" ]
|
|
then
|
|
persize=`echo "persize=$persize * 1024; persize /= 1; persize" | bc`
|
|
fi
|
|
|
|
# Compile assembler code
|
# Compile assembler code
|
echo "Compile, link & generate IHEX file (Program Memory: $pmemsize B, Data Memory: $dmemsize B, Peripheral Space: $persize B)..."
|
echo "Compile, link & generate IHEX file (Program Memory: $pmemsize B, Data Memory: $dmemsize B, Peripheral Space: $persize B)..."
|
../bin/asm2ihex.sh pmem pmem.s43 $linkfile $headfile $pmemsize $dmemsize $persize
|
../bin/asm2ihex.sh pmem pmem.s43 $linkfile $headfile $pmemsize $dmemsize $persize
|
|
|