version 1.1, 2005/02/15 08:04:40
|
version 1.3, 2005/02/15 08:36:30
|
|
|
echo "Exports given file to <filename.ext.hex> - as a hex array" | echo "Exports given file to <filename.ext.hex> - as a hex array" |
echo "(c) Rizwan Kassim 2006" | echo "(c) Rizwan Kassim 2006" |
echo "Bugs - Appends to outputfile, doesn't check for validity" | echo "Bugs - Appends to outputfile, doesn't check for validity" |
echo "needs to remove any . from the arrayname when writing " |
#echo "needs to remove any . from the arrayname when writing " |
echo "and needs to remove final comma. " | echo "and needs to remove final comma. " |
echo "later, I realized that it would be much easier to do this " | echo "later, I realized that it would be much easier to do this " |
echo "in perl (see code for examples" | echo "in perl (see code for examples" |
echo "appending to $1.hex!" | echo "appending to $1.hex!" |
echo "DONT FORGET TO Remove . in filename and final ," |
echo "DONT FORGET TO remove final ," |
echo " ============================================ " | echo " ============================================ " |
echo "static unsigned char $1 = {" >> $1.hex |
echo "static unsigned char file_$1[] = {" >> $1.hex |
#| grep "s/cab/_/" | #| grep "s/cab/_/" |
od -h $1 | sed "s/^[0-9]\{7\}[ ]*//g" | sed "s/\([0-9a-f]\{2\}\)[ ]*/00x\U\1,/g" | sed "s/\([.]*\),$//" | sed "s/.*/&,/" | sed "s/^,$//g" | sed "/$^/d" >> $1.hex |
od -h $1 | sed "s/^[0-9]\{7\}[ ]*//g" | sed "s/\([0-9a-f]\{2\}\)[ ]*/0x\U\1,/g" | sed "s/\([.]*\),$//" | sed "s/.*/&,/" | sed "s/^,$//g" | sed "/^$/d" >> $1.hex |
#doesnt just remove end of file but end of every line - sed "s/.$[^^]//" | sed "s/.$//" | | #doesnt just remove end of file but end of every line - sed "s/.$[^^]//" | sed "s/.$//" | |
echo "};" >> $1.hex | echo "};" >> $1.hex |
|
echo "static int szfile_$1 = sizeof(file_$1);" >> $1.hex |
|
sed -i "s/\./_/g" $1.hex |
| |