diff --git a/lang/fw-clean.sh b/lang/fw-clean.sh new file mode 100644 index 00000000..a7d34072 --- /dev/null +++ b/lang/fw-clean.sh @@ -0,0 +1,61 @@ +#!/bin/sh +# +# fw-clean.sh - multi-language support script +# Remove all firmware output files from lang folder. +# + +result=0 + +rm_if_exists() +{ + if [ -e $1 ]; then + echo -n " removing '$1'..." >&2 + if rm $1; then + echo "OK" >&2 + else + echo "NG!" >&2 + result=1 + fi + fi +} + +echo "fw-clean.sh started" >&2 + +rm_if_exists text.sym +rm_if_exists progmem1.sym +rm_if_exists progmem1.lss +rm_if_exists progmem1.hex +rm_if_exists progmem1.chr +rm_if_exists progmem1.var +rm_if_exists progmem1.txt +rm_if_exists textaddr.txt +rm_if_exists firmware.bin +rm_if_exists firmware.hex +rm_if_exists firmware_cz.hex +rm_if_exists firmware_de.hex +rm_if_exists firmware_es.hex +rm_if_exists firmware_it.hex +rm_if_exists firmware_pl.hex +rm_if_exists progmem.out +rm_if_exists textaddr.out +rm_if_exists update_lang.out +rm_if_exists update_lang_cz.out +rm_if_exists update_lang_de.out +rm_if_exists update_lang_es.out +rm_if_exists update_lang_it.out +rm_if_exists update_lang_pl.out +rm_if_exists lang.bin +rm_if_exists lang.hex + +echo -n "fw-clean.sh finished" >&2 +if [ $result -eq 0 ]; then + echo " with success" >&2 +else + echo " with errors!" >&2 +fi + +case "$-" in + *i*) echo "press enter key"; read ;; +esac + +exit $result diff --git a/lang/iso639-1.txt b/lang/iso639-1.txt new file mode 100644 index 00000000..aa6f64e5 --- /dev/null +++ b/lang/iso639-1.txt @@ -0,0 +1,10 @@ +#language codes ISO639-1 +# iso english localized +#----------------------- +# en English English +# de German Deutsch +# cs Czech Cestina +# es Spanish Espanol +# fr +# it Italian Italiano +# pl Polish Polski diff --git a/lang/lang-build.sh b/lang/lang-build.sh index c98ee7b6..481929cd 100644 --- a/lang/lang-build.sh +++ b/lang/lang-build.sh @@ -90,7 +90,8 @@ generate_binary() cat lang_en_$1.txt | sed '/^$/d;/^#/d' | sed -n 'n;p' fi | sed 's/^\"\\x00\"$/\"\"/' > lang_$1.tmp #create lang_xx.dat (binary text data file) - cat lang_$1.tmp | sed 's/^\"/printf \"/;s/"$/\\x00\"/' | sh >lang_$1.dat +# cat lang_$1.tmp | sed 's/^\"/\/bin\/echo -e \"/;s/"$/\\x00\"/' > lang_$1.shx + cat lang_$1.tmp | sed 's/^\"/\/bin\/echo -e \"/;s/"$/\\x00\"/' | sh >lang_$1.dat #calculate number of strings count=$(grep -c '^"' lang_$1.tmp) echo "count="$count >&2 @@ -118,8 +119,8 @@ generate_binary() /bin/echo -n -e $(echo -n $((0x$chsum)) | awk "$awk_ui16") |\ dd of=lang_$1.bin bs=1 count=2 seek=8 conv=notrunc 2>/dev/null #remove temporary files - rm -f lang_$1.tmp - rm -f lang_$1.dat +# rm -f lang_$1.tmp +# rm -f lang_$1.dat } if [ -z "$1" ]; then set 'all'; fi diff --git a/lang/lang-clean.sh b/lang/lang-clean.sh new file mode 100644 index 00000000..95fc69b8 --- /dev/null +++ b/lang/lang-clean.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# +# clean.sh - multi-language support script +# Remove all language output files from lang folder. +# + +result=0 + +rm_if_exists() +{ + if [ -e $1 ]; then + echo -n " removing '$1'..." >&2 + if rm $1; then + echo "OK" >&2 + else + echo "NG!" >&2 + result=1 + fi + fi +} + +clean_lang() +{ + if [ "$1" = "en" ]; then + rm_if_exists lang_$1.tmp + else + rm_if_exists lang_en_$1.tmp + rm_if_exists lang_en_$1.dif + rm_if_exists lang_$1.ofs + rm_if_exists lang_$1.txt + fi + rm_if_exists lang_$1.bin + rm_if_exists lang_$1.dat +} + +echo "lang-clean.sh started" >&2 + +clean_lang en +clean_lang cz +clean_lang de +clean_lang es +clean_lang fr +clean_lang it +clean_lang pl + +echo -n "lang-clean.sh finished" >&2 +if [ $result -eq 0 ]; then + echo " with success" >&2 +else + echo " with errors!" >&2 +fi + +case "$-" in + *i*) echo "press enter key" >&2; read ;; +esac + +exit $result diff --git a/lang/postbuild.sh b/lang/postbuild.sh index c50b08ec..0d5686b6 100644 --- a/lang/postbuild.sh +++ b/lang/postbuild.sh @@ -117,6 +117,11 @@ else finish 1 fi +#convert bin to hex +echo -n " converting to hex..." >&2 +$OBJCOPY -I binary -O ihex ./firmware.bin ./firmware.hex +echo "OK" >&2 + #update _SEC_LANG in binary file if language is selected echo -n " secondary language data..." >&2 if [ ! -z "$LNG" ]; then @@ -154,9 +159,20 @@ else # echo "skipped" >&2 fi -#convert bin to hex -#echo -n " converting to hex..." >&2 -#$OBJCOPY -I binary -O ihex ./firmware.bin ./firmware.hex -#echo "OK" >&2 +#create binary file with all languages +rm -f lang.bin +if [ -e lang_cz.bin ]; then cat lang_cz.bin >> lang.bin; fi +if [ -e lang_de.bin ]; then cat lang_de.bin >> lang.bin; fi +if [ -e lang_es.bin ]; then cat lang_es.bin >> lang.bin; fi +if [ -e lang_it.bin ]; then cat lang_it.bin >> lang.bin; fi +if [ -e lang_pl.bin ]; then cat lang_pl.bin >> lang.bin; fi + +#convert lang.bin to lang.hex +echo -n " converting to hex..." >&2 +$OBJCOPY -I binary -O ihex ./lang.bin ./lang.hex +echo "OK" >&2 + +#append languages to hex file +cat ./lang.hex >> firmware.hex finish 0