skrom 1.18 KB
#!/bin/sh

###### Code in rom file #######
_codeSegmentRomStart=`nm -n d_pad | grep _codeSegmentRomStart | sed -e s/" A.*$"//`
_codeSegmentRomEnd=`nm -n d_pad | grep _codeSegmentRomEnd | sed -e s/" A.*$"//`

##### Code read to memory #######
_codeSegmentTextStart=`nm -n d_pad | grep  _codeSegmentTextStart | sed -e s/" A.*$"//`
_codeSegmentTextEnd=`nm -n d_pad | grep _codeSegmentTextEnd | sed -e s/" A.*$"//`

###### BSS in memory which need to init to zero #####
_codeSegmentBssStart=`nm -n d_pad | grep _codeSegmentBssStart | sed -e s/" A.*$"//`
_codeSegmentBssEnd=`nm -n d_pad | grep _codeSegmentBssEnd | sed -e s/" A.*$"//`

###### DATA in memory which need to be invalidate #####
_codeSegmentDataStart=`nm -n d_pad | grep _codeSegmentDataStart | sed -e s/" A.*$"//`
_codeSegmentDataEnd=`nm -n d_pad | grep _codeSegmentDataEnd | sed -e s/" A.*$"//`

echo "$_codeSegmentRomStart" > tmp.$$
echo "$_codeSegmentRomEnd" >> tmp.$$
echo "$_codeSegmentTextStart" >> tmp.$$
echo "$_codeSegmentTextEnd" >> tmp.$$
echo "$_codeSegmentBssStart" >> tmp.$$
echo "$_codeSegmentBssEnd" >> tmp.$$
echo "$_codeSegmentDataStart" >> tmp.$$
echo "$_codeSegmentDataEnd" >> tmp.$$

./hex2dat tmp.$$ $2
cat $1 >> $2
rm -rf tmp.$$