upstream/MK3 merge
This commit is contained in:
commit
01529f18d2
@ -141,7 +141,6 @@ void dcode_3()
|
||||
}
|
||||
#endif //DEBUG_DCODE3
|
||||
|
||||
#ifdef DEBUG_DCODES
|
||||
|
||||
#include "ConfigurationStore.h"
|
||||
#include "cmdqueue.h"
|
||||
@ -149,8 +148,9 @@ void dcode_3()
|
||||
#include "adc.h"
|
||||
#include "temperature.h"
|
||||
#include <avr/wdt.h>
|
||||
#include "bootapp.h"
|
||||
|
||||
|
||||
/*
|
||||
#define FLASHSIZE 0x40000
|
||||
|
||||
#define RAMSIZE 0x2000
|
||||
@ -171,6 +171,8 @@ extern float axis_steps_per_unit[NUM_AXIS];
|
||||
|
||||
//#define LOG(args...) printf(args)
|
||||
#define LOG(args...)
|
||||
*/
|
||||
#ifdef DEBUG_DCODES
|
||||
|
||||
void dcode__1()
|
||||
{
|
||||
@ -278,10 +280,13 @@ void dcode_4()
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
#endif //DEBUG_DCODES
|
||||
|
||||
#ifdef DEBUG_DCODE5
|
||||
|
||||
void dcode_5()
|
||||
{
|
||||
LOG("D5 - Read/Write FLASH\n");
|
||||
printf_P(PSTR("D5 - Read/Write FLASH\n"));
|
||||
uint32_t address = 0x0000; //default 0x0000
|
||||
uint16_t count = 0x0400; //default 0x0400 (1kb block)
|
||||
if (code_seen('A')) // Address (0x00000-0x3ffff)
|
||||
@ -305,17 +310,11 @@ void dcode_5()
|
||||
{
|
||||
if (bErase)
|
||||
{
|
||||
LOG(count, DEC);
|
||||
LOG(" bytes of FLASH at address ");
|
||||
print_hex_word(address);
|
||||
putchar(" will be erased\n");
|
||||
printf_P(PSTR("%d bytes of FLASH at address %05x will be erased\n"), count, address);
|
||||
}
|
||||
if (bCopy)
|
||||
{
|
||||
LOG(count, DEC);
|
||||
LOG(" bytes will be written to FLASH at address ");
|
||||
print_hex_word(address);
|
||||
putchar('\n');
|
||||
printf_P(PSTR("%d bytes will be written to FLASH at address %05x\n"), count, address);
|
||||
}
|
||||
cli();
|
||||
boot_app_magic = 0x55aa55aa;
|
||||
@ -323,6 +322,7 @@ void dcode_5()
|
||||
boot_copy_size = (uint16_t)count;
|
||||
boot_dst_addr = (uint32_t)address;
|
||||
boot_src_addr = (uint32_t)(&data);
|
||||
bootapp_print_vars();
|
||||
wdt_enable(WDTO_15MS);
|
||||
while(1);
|
||||
}
|
||||
@ -343,7 +343,9 @@ void dcode_5()
|
||||
putchar('\n');
|
||||
}
|
||||
}
|
||||
*/
|
||||
#endif //DEBUG_DCODE5
|
||||
|
||||
#ifdef DEBUG_DCODES
|
||||
|
||||
void dcode_6()
|
||||
{
|
||||
|
@ -64,7 +64,10 @@
|
||||
|
||||
#include "lcd.h"
|
||||
|
||||
extern "C" {
|
||||
extern FILE _uartout;
|
||||
}
|
||||
|
||||
#define uartout (&_uartout)
|
||||
|
||||
#define SERIAL_PROTOCOL(x) (MYSERIAL.print(x))
|
||||
|
@ -763,8 +763,9 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
||||
|
||||
}
|
||||
|
||||
|
||||
extern "C" {
|
||||
FILE _uartout; //= {0}; Global variable is always zero initialized. No need to explicitly state this.
|
||||
}
|
||||
|
||||
int uart_putchar(char c, FILE *)
|
||||
{
|
||||
@ -1413,7 +1414,7 @@ void setup()
|
||||
uint16_t ui = _SEC_LANG_TABLE; //table pointer
|
||||
printf_P(_n("lang_selected=%d\nlang_table=0x%04x\nSEC_LANG_CODE=0x%04x (%c%c)\n"), lang_selected, ui, sec_lang_code, sec_lang_code >> 8, sec_lang_code & 0xff);
|
||||
|
||||
// lang_print_sec_lang(uartout);
|
||||
lang_print_sec_lang(uartout);
|
||||
#endif //DEBUG_SEC_LANG
|
||||
|
||||
#endif //(LANG_MODE != 0)
|
||||
@ -6941,10 +6942,14 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
||||
#ifdef DEBUG_DCODES
|
||||
case 4: //! D4 - Read/Write PIN
|
||||
dcode_4(); break;
|
||||
case 5: //! D5 - Read/Write FLASH
|
||||
// dcode_5(); break;
|
||||
#endif //DEBUG_DCODES
|
||||
#ifdef DEBUG_DCODE5
|
||||
case 5: // D5 - Read/Write FLASH
|
||||
dcode_5(); break;
|
||||
break;
|
||||
case 6: //! D6 - Read/Write external FLASH
|
||||
#endif //DEBUG_DCODE5
|
||||
#ifdef DEBUG_DCODES
|
||||
case 6: // D6 - Read/Write external FLASH
|
||||
dcode_6(); break;
|
||||
case 7: //! D7 - Read/Write Bootloader
|
||||
dcode_7(); break;
|
||||
|
@ -5,17 +5,20 @@
|
||||
#include <avr/interrupt.h>
|
||||
|
||||
|
||||
/*
|
||||
void bootapp_print_vars()
|
||||
#include <stdio.h>
|
||||
extern FILE _uartout;
|
||||
#define uartout (&_uartout)
|
||||
|
||||
void bootapp_print_vars(void)
|
||||
{
|
||||
printf_P(_n("boot_src_addr =0x%08lx\n"), boot_src_addr);
|
||||
printf_P(_n("boot_dst_addr =0x%08lx\n"), boot_dst_addr);
|
||||
printf_P(_n("boot_copy_size =0x%04x\n"), boot_copy_size);
|
||||
printf_P(_n("boot_reserved =0x%02x\n"), boot_reserved);
|
||||
printf_P(_n("boot_app_flags =0x%02x\n"), boot_app_flags);
|
||||
printf_P(_n("boot_app_magic =0x%08lx\n"), boot_app_magic);
|
||||
fprintf_P(uartout, PSTR("boot_src_addr =0x%08lx\n"), boot_src_addr);
|
||||
fprintf_P(uartout, PSTR("boot_dst_addr =0x%08lx\n"), boot_dst_addr);
|
||||
fprintf_P(uartout, PSTR("boot_copy_size =0x%04x\n"), boot_copy_size);
|
||||
fprintf_P(uartout, PSTR("boot_reserved =0x%02x\n"), boot_reserved);
|
||||
fprintf_P(uartout, PSTR("boot_app_flags =0x%02x\n"), boot_app_flags);
|
||||
fprintf_P(uartout, PSTR("boot_app_magic =0x%08lx\n"), boot_app_magic);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
void bootapp_ram2flash(uint16_t rptr, uint16_t fptr, uint16_t size)
|
||||
{
|
||||
@ -35,6 +38,7 @@ void bootapp_ram2flash(uint16_t rptr, uint16_t fptr, uint16_t size)
|
||||
boot_copy_size = (uint16_t)size;
|
||||
boot_src_addr = (uint32_t)rptr;
|
||||
boot_dst_addr = (uint32_t)fptr;
|
||||
bootapp_print_vars();
|
||||
wdt_enable(WDTO_15MS);
|
||||
while(1);
|
||||
}
|
||||
@ -45,6 +49,7 @@ void bootapp_reboot_user0(uint8_t reserved)
|
||||
boot_app_magic = BOOT_APP_MAGIC;
|
||||
boot_app_flags = BOOT_APP_FLG_USER0;
|
||||
boot_reserved = reserved;
|
||||
bootapp_print_vars();
|
||||
wdt_enable(WDTO_15MS);
|
||||
while(1);
|
||||
}
|
||||
|
@ -28,6 +28,7 @@
|
||||
extern "C" {
|
||||
#endif //defined(__cplusplus)
|
||||
|
||||
extern void bootapp_print_vars(void);
|
||||
|
||||
extern void bootapp_ram2flash(uint16_t rptr, uint16_t fptr, uint16_t size);
|
||||
|
||||
|
@ -43,9 +43,9 @@
|
||||
#define W25X20CL_SPSR SPI_SPSR(W25X20CL_SPI_RATE)
|
||||
|
||||
//LANG - Multi-language support
|
||||
//#define LANG_MODE 0 // primary language only
|
||||
#define LANG_MODE 1 // sec. language support
|
||||
#define LANG_SIZE_RESERVED 0x2a00 // reserved space for secondary language (~10kb)
|
||||
#define LANG_MODE 0 // primary language only
|
||||
//#define LANG_MODE 1 // sec. language support
|
||||
#define LANG_SIZE_RESERVED 0x2a00 // reserved space for secondary language (~10kb)
|
||||
|
||||
|
||||
#endif //_CONFIG_H
|
||||
|
@ -227,6 +227,7 @@ uint8_t lang_is_selected(void)
|
||||
}
|
||||
|
||||
#ifdef DEBUG_SEC_LANG
|
||||
#include <stdio.h>
|
||||
const char* lang_get_sec_lang_str_by_id(uint16_t id)
|
||||
{
|
||||
uint16_t ui = _SEC_LANG_TABLE; //table pointer
|
||||
|
@ -23,22 +23,21 @@
|
||||
#define STRINGIFY_(n) #n
|
||||
#define STRINGIFY(n) STRINGIFY_(n)
|
||||
|
||||
/** @def PROGMEM_I2
|
||||
* @brief section progmem0 will be used for localized translated strings */
|
||||
#define PROGMEM_I2 __attribute__((section(".progmem0")))
|
||||
/** @def PROGMEM_I1
|
||||
* @brief section progmem1 will be used for localized strings in english */
|
||||
#define PROGMEM_I1 __attribute__((section(".progmem1")))
|
||||
/** @def PROGMEM_N1
|
||||
* @brief section progmem2 will be used for not localized strings in english */
|
||||
#define PROGMEM_N1 __attribute__((section(".progmem2")))
|
||||
|
||||
#if (LANG_MODE == 0) //primary language only
|
||||
#define PROGMEM_I2 __attribute__((section(".progmem0")))
|
||||
#define PROGMEM_I1 __attribute__((section(".progmem1")))
|
||||
#define PROGMEM_N1 __attribute__((section(".progmem2")))
|
||||
#define _I(s) (__extension__({static const char __c[] PROGMEM_I1 = s; &__c[0];}))
|
||||
#define ISTR(s) s
|
||||
#define _i(s) _I(s)
|
||||
#define _T(s) s
|
||||
#else //(LANG_MODE == 0)
|
||||
// section .loc_sec (originaly .progmem0) will be used for localized translated strings
|
||||
#define PROGMEM_I2 __attribute__((section(".loc_sec")))
|
||||
// section .loc_pri (originaly .progmem1) will be used for localized strings in english
|
||||
#define PROGMEM_I1 __attribute__((section(".loc_pri")))
|
||||
// section .noloc (originaly progmem2) will be used for not localized strings in english
|
||||
#define PROGMEM_N1 __attribute__((section(".noloc")))
|
||||
#define _I(s) (__extension__({static const char __c[] PROGMEM_I1 = "\xff\xff" s; &__c[0];}))
|
||||
#define ISTR(s) "\xff\xff" s
|
||||
#define _i(s) lang_get_translation(_I(s))
|
||||
|
@ -3,6 +3,10 @@
|
||||
// Common serial messages
|
||||
#define MSG_MARLIN "Marlin"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif //defined(__cplusplus)
|
||||
|
||||
// LCD Menu Messages
|
||||
//internationalized messages
|
||||
extern const char MSG_AUTO_HOME[];
|
||||
@ -119,3 +123,7 @@ extern const char MSG_Z_MIN[];
|
||||
extern const char MSG_ZPROBE_OUT[];
|
||||
extern const char MSG_ZPROBE_ZOFFSET[];
|
||||
extern const char MSG_TMC_OVERTEMP[];
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif //defined(__cplusplus)
|
||||
|
@ -5,7 +5,7 @@
|
||||
# This file is 'included' in all scripts.
|
||||
#
|
||||
# Arduino main folder:
|
||||
export ARDUINO=C:/arduino-1.6.8
|
||||
export ARDUINO=C:/arduino-1.8.5
|
||||
#
|
||||
# Arduino builder:
|
||||
export BUILDER=$ARDUINO/arduino_debug.exe
|
||||
|
@ -169,6 +169,7 @@ 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_fr.bin ]; then cat lang_fr.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
|
||||
|
@ -43,6 +43,7 @@ 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_fr.out
|
||||
rm_if_exists update_lang_it.out
|
||||
rm_if_exists update_lang_pl.out
|
||||
rm_if_exists lang.bin
|
||||
|
@ -130,6 +130,7 @@ if [ "$1" = "all" ]; then
|
||||
generate_binary 'cz'
|
||||
generate_binary 'de'
|
||||
generate_binary 'es'
|
||||
generate_binary 'fr'
|
||||
generate_binary 'it'
|
||||
generate_binary 'pl'
|
||||
else
|
||||
|
@ -21,16 +21,20 @@ rm_if_exists()
|
||||
|
||||
clean_lang()
|
||||
{
|
||||
if [ "$1" = "en" ]; then
|
||||
if [ "$1" == "en" ]; then
|
||||
rm_if_exists lang_$1.tmp
|
||||
else
|
||||
rm_if_exists lang_$1.tmp
|
||||
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_check.dif
|
||||
rm_if_exists lang_$1.bin
|
||||
rm_if_exists lang_$1.dat
|
||||
rm_if_exists lang_$1_1.tmp
|
||||
rm_if_exists lang_$1_2.tmp
|
||||
}
|
||||
|
||||
echo "lang-clean.sh started" >&2
|
||||
|
@ -1,173 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# makelang.sh - multi-language support script
|
||||
# for generating lang_xx.bin (secondary language binary file)
|
||||
#
|
||||
# Input files:
|
||||
# lang_en.txt
|
||||
# lang_en_xx.txt
|
||||
#
|
||||
# Output files:
|
||||
# lang_en.tmp (temporary, will be removed when finished)
|
||||
# lang_en_xx.tmp ==||==
|
||||
# lang_en_xx.dif ==||==
|
||||
# lang_xx.txt
|
||||
#
|
||||
#
|
||||
# Selected language:
|
||||
LNG=$1
|
||||
if [ -z "$LNG" ]; then LNG='all'; fi
|
||||
#
|
||||
#
|
||||
|
||||
finish()
|
||||
{
|
||||
if [ $1 -eq 0 ]; then
|
||||
if [ -e lang_en.tmp ]; then rm lang_en.tmp; fi
|
||||
if [ -e lang_en_$LNG.tmp ]; then rm lang_en_$LNG.tmp; fi
|
||||
if [ -e lang_en_$LNG.dif ]; then rm lang_en_$LNG.dif; fi
|
||||
fi
|
||||
# echo >&2
|
||||
if [ $1 -eq 0 ]; then
|
||||
echo "make_lang.sh finished with success" >&2
|
||||
else
|
||||
echo "make_lang.sh finished with errors!" >&2
|
||||
fi
|
||||
exit $1
|
||||
}
|
||||
|
||||
make_lang()
|
||||
{
|
||||
LNG=$1
|
||||
|
||||
echo "make_lang.sh started" >&2
|
||||
echo "selected language=$LNG" >&2
|
||||
|
||||
#check if input files exists
|
||||
echo -n " checking input files..." >&2
|
||||
if [ ! -e lang_en.txt ]; then echo "NG! file lang_en.txt not found!" >&2; exit 1; fi
|
||||
if [ ! -e lang_en_$LNG.txt ]; then echo "NG! file lang_en_$LNG.txt not found!" >&2; exit 1; fi
|
||||
echo "OK" >&2
|
||||
|
||||
#filter comment and empty lines from key and dictionary files, create temporary files
|
||||
echo -n " creating tmp files..." >&2
|
||||
cat lang_en.txt | sed "/^$/d;/^#/d" > lang_en.tmp
|
||||
cat lang_en_$LNG.txt | sed "/^$/d;/^#/d" > lang_en_$LNG.tmp
|
||||
echo "OK" >&2
|
||||
#cat lang_en_$LNG.tmp | sed 'n;d' >test1.txt
|
||||
|
||||
#compare files using diff and check for differences
|
||||
echo -n " comparing tmp files..." >&2
|
||||
if ! cat lang_en_$LNG.tmp | sed 'n;d' | diff lang_en.tmp - > lang_en_$LNG.dif; then
|
||||
echo "NG!" >&2
|
||||
echo "Entries in lang_en_$LNG.txt are different from lang_en.txt!" >&2
|
||||
echo "please check lang_en_$LNG.dif" >&2
|
||||
finish 1
|
||||
fi
|
||||
echo "OK" >&2
|
||||
|
||||
#generate lang_xx.txt (secondary language text data sorted by ids)
|
||||
echo -n " generating lang_$LNG.txt..." >&2
|
||||
cat lang_en_$LNG.tmp | sed '1~2d' | sed "s/^\"\\\\x00/\"/" > lang_$LNG.txt
|
||||
echo "OK" >&2
|
||||
|
||||
#generate lang_xx.dat (secondary language text data in binary form)
|
||||
echo -n " generating lang_$LNG.dat..." >&2
|
||||
cat lang_$LNG.txt | sed "s/\\\\/\\\\\\\\/g" | while read s; do
|
||||
s=${s#\"}
|
||||
s=${s%\"}
|
||||
/bin/echo -e -n "$s\x00"
|
||||
done >lang_$LNG.dat
|
||||
echo "OK" >&2
|
||||
|
||||
#calculate variables
|
||||
lt_magic='\xa5\x5a\xb4\x4b'
|
||||
lt_count=$(grep -c '^' lang_$LNG.txt)
|
||||
lt_data_size=$(wc -c lang_$LNG.dat | cut -f1 -d' ')
|
||||
lt_offs_size=$((2 * $lt_count))
|
||||
lt_size=$((16 + $lt_offs_size + $lt_data_size))
|
||||
lt_chsum=0
|
||||
lt_code='\xff\xff'
|
||||
lt_resv1='\xff\xff\xff\xff'
|
||||
|
||||
case "$LNG" in
|
||||
*en*) lt_code='\x6e\x65' ;;
|
||||
*cz*) lt_code='\x73\x63' ;;
|
||||
*de*) lt_code='\x65\x64' ;;
|
||||
*es*) lt_code='\x73\x65' ;;
|
||||
*fr*) lt_code='\x71\x66' ;;
|
||||
*it*) lt_code='\x74\x69' ;;
|
||||
*pl*) lt_code='\x6c\x70' ;;
|
||||
esac
|
||||
|
||||
#generate lang_xx.ofs (secondary language text data offset table)
|
||||
echo -n " generating lang_$LNG.ofs..." >&2
|
||||
cat lang_$LNG.txt | sed "s/\\\\x[0-9a-f][0-9a-f]/\./g;s/\\\\[0-7][0-7][0-7]/\./g" |\
|
||||
awk 'BEGIN { o='$((16 + $lt_offs_size))';} { printf("%d\n",o); o+=(length($0)-1); }' > lang_$LNG.ofs
|
||||
echo "OK" >&2
|
||||
|
||||
#generate lang_xx.bin (secondary language result binary file)
|
||||
echo " generating lang_$LNG.bin:" >&2
|
||||
#create empty file
|
||||
dd if=/dev/zero of=lang_$LNG.bin bs=1 count=$lt_size 2>/dev/null
|
||||
#awk code to format ui16 variables for dd
|
||||
awk_ui16='{ h=int($1/256); printf("\\x%02x\\x%02x\n", int($1-256*h), h); }'
|
||||
|
||||
#write data to binary file with dd
|
||||
|
||||
echo -n " writing header (16 bytes)..." >&2
|
||||
/bin/echo -n -e "$lt_magic" |\
|
||||
dd of=lang_$LNG.bin bs=1 count=4 seek=0 conv=notrunc 2>/dev/null
|
||||
/bin/echo -n -e $(echo -n "$lt_size" | awk "$awk_ui16") |\
|
||||
dd of=lang_$LNG.bin bs=1 count=2 seek=4 conv=notrunc 2>/dev/null
|
||||
/bin/echo -n -e $(echo -n "$lt_count" | awk "$awk_ui16") |\
|
||||
dd of=lang_$LNG.bin bs=1 count=2 seek=6 conv=notrunc 2>/dev/null
|
||||
/bin/echo -n -e $(echo -n "$lt_chsum" | awk "$awk_ui16") |\
|
||||
dd of=lang_$LNG.bin bs=1 count=2 seek=8 conv=notrunc 2>/dev/null
|
||||
/bin/echo -n -e "$lt_code" |\
|
||||
dd of=lang_$LNG.bin bs=1 count=2 seek=10 conv=notrunc 2>/dev/null
|
||||
/bin/echo -n -e "$lt_resv1" |\
|
||||
dd of=lang_$LNG.bin bs=1 count=4 seek=12 conv=notrunc 2>/dev/null
|
||||
echo "OK" >&2
|
||||
|
||||
echo -n " writing offset table ($lt_offs_size bytes)..." >&2
|
||||
/bin/echo -n -e $(cat lang_$LNG.ofs | awk "$awk_ui16" | tr -d '\n'; echo) |\
|
||||
dd of=./lang_$LNG.bin bs=1 count=$lt_offs_size seek=16 conv=notrunc 2>/dev/null
|
||||
echo "OK" >&2
|
||||
|
||||
echo -n " writing text data ($lt_data_size bytes)..." >&2
|
||||
dd if=./lang_$LNG.dat of=./lang_$LNG.bin bs=1 count=$lt_data_size seek=$((16 + $lt_offs_size)) conv=notrunc 2>/dev/null
|
||||
echo "OK" >&2
|
||||
|
||||
#update signature
|
||||
echo -n " updating signature..." >&2
|
||||
dd if=lang_en.bin of=lang_$LNG.bin bs=1 count=4 skip=6 seek=12 conv=notrunc 2>/dev/null
|
||||
echo "OK" >&2
|
||||
|
||||
#calculate and update checksum
|
||||
lt_chsum=$(cat lang_$LNG.bin | xxd | cut -c11-49 | tr ' ' "\n" | sed '/^$/d' | awk 'BEGIN { sum = 0; } { sum += strtonum("0x"$1); if (sum > 0xffff) sum -= 0x10000; } END { printf("%x\n", sum); }')
|
||||
/bin/echo -n -e $(echo -n $((0x$lt_chsum)) | awk "$awk_ui16") |\
|
||||
dd of=lang_$LNG.bin bs=1 count=2 seek=8 conv=notrunc 2>/dev/null
|
||||
|
||||
echo " lang_table details:" >&2
|
||||
echo " lt_count = $lt_count" >&2
|
||||
echo " lt_size = $lt_size" >&2
|
||||
echo " lt_chsum = $lt_chsum" >&2
|
||||
}
|
||||
|
||||
echo $LNG
|
||||
|
||||
if [ "$LNG" = "all" ]; then
|
||||
./lang-build.sh en
|
||||
make_lang cz
|
||||
make_lang de
|
||||
make_lang es
|
||||
make_lang fr
|
||||
make_lang it
|
||||
make_lang pl
|
||||
exit 0
|
||||
else
|
||||
make_lang $LNG
|
||||
fi
|
||||
|
||||
finish 0
|
1717
lang/po/lang.pot
1717
lang/po/lang.pot
File diff suppressed because it is too large
Load Diff
1722
lang/po/lang_cz.po
1722
lang/po/lang_cz.po
File diff suppressed because it is too large
Load Diff
1788
lang/po/lang_de.po
1788
lang/po/lang_de.po
File diff suppressed because it is too large
Load Diff
1796
lang/po/lang_es.po
1796
lang/po/lang_es.po
File diff suppressed because it is too large
Load Diff
1791
lang/po/lang_it.po
1791
lang/po/lang_it.po
File diff suppressed because it is too large
Load Diff
1788
lang/po/lang_pl.po
1788
lang/po/lang_pl.po
File diff suppressed because it is too large
Load Diff
@ -1,114 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# make_po.sh - multi-language support script
|
||||
# for generating lang_xx.po
|
||||
#
|
||||
SRCDIR="../../Firmware"
|
||||
#
|
||||
LNG=$1
|
||||
if [ -z "$LNG" ]; then LNG=cz; fi
|
||||
#
|
||||
|
||||
if [ "$LNG" == "all" ]; then
|
||||
./make_po.sh cz
|
||||
./make_po.sh de
|
||||
./make_po.sh es
|
||||
./make_po.sh it
|
||||
./make_po.sh pl
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "make_po.sh started" >&2
|
||||
echo " selected language=$LNG" >&2
|
||||
|
||||
#remove output file if exists
|
||||
if [ -e lang_$LNG.po ]; then rm lang_$LNG.po; fi
|
||||
|
||||
lang_name=$(\
|
||||
case "$LNG" in
|
||||
*en*) echo "English" ;;
|
||||
*cz*) echo "Czech" ;;
|
||||
*de*) echo "German" ;;
|
||||
*es*) echo "Spanish" ;;
|
||||
*it*) echo "Italian" ;;
|
||||
*pl*) echo "Polish" ;;
|
||||
esac)
|
||||
|
||||
lang_short=$(\
|
||||
case "$LNG" in
|
||||
*en*) echo "en" ;;
|
||||
*cz*) echo "cs" ;;
|
||||
*de*) echo "de" ;;
|
||||
*it*) echo "it" ;;
|
||||
*es*) echo "es" ;;
|
||||
*pl*) echo "pl" ;;
|
||||
esac)
|
||||
|
||||
po_date=$(date)
|
||||
|
||||
#write po header
|
||||
echo "# Translation of Prusa-Firmware into $lang_name." > lang_$LNG.po
|
||||
echo "#" >> lang_$LNG.po
|
||||
echo 'msgid ""' >> lang_$LNG.po
|
||||
echo 'msgstr ""' >> lang_$LNG.po
|
||||
echo '"MIME-Version: 1.0\n"' >> lang_$LNG.po
|
||||
echo '"Content-Type: text/plain; charset=UTF-8\n"' >> lang_$LNG.po
|
||||
echo '"Content-Transfer-Encoding: 8bit\n"' >> lang_$LNG.po
|
||||
echo '"Language: '$lang_short'\n"' >> lang_$LNG.po
|
||||
echo '"Project-Id-Version: Prusa-Firmware\n"' >> lang_$LNG.po
|
||||
echo '"POT-Creation-Date: '$po_date'\n"' >> lang_$LNG.po
|
||||
echo '"PO-Revision-Date: '$po_date'\n"' >> lang_$LNG.po
|
||||
echo '"Language-Team: \n"' >> lang_$LNG.po
|
||||
echo '"X-Generator: Poedit 2.0.7\n"' >> lang_$LNG.po
|
||||
echo '"X-Poedit-SourceCharset: UTF-8\n"' >> lang_$LNG.po
|
||||
echo '"Last-Translator: \n"' >> lang_$LNG.po
|
||||
echo '"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"' >> lang_$LNG.po
|
||||
echo >> lang_$LNG.po
|
||||
|
||||
#list .cpp, .c and .h files
|
||||
files=$(ls "$SRCDIR"/*.cpp "$SRCDIR"/*.c "$SRCDIR"/*.h)
|
||||
|
||||
num_texts=$(grep '^#' -c ../lang_en_$LNG.txt)
|
||||
num_texts_nt=$(grep '^\"\\x00\"' -c ../lang_en_$LNG.txt)
|
||||
echo " $num_texts texts, $num_texts_nt not translated" >&2
|
||||
|
||||
#loop over all messages
|
||||
s0=''
|
||||
s1=''
|
||||
s2=''
|
||||
num=1
|
||||
cat ../lang_en_$LNG.txt | sed "s/\\\\/\\\\\\\\/g" | while read -r s; do
|
||||
if [ "$s" == "" ]; then
|
||||
echo " processing $num of $num_texts" >&2
|
||||
if [ "$s0" == "\"\\\\x00\"" ]; then
|
||||
search=$(/bin/echo -e "$s1")
|
||||
found=$(grep -m1 -n -F "$search" $files | head -n1 | cut -f1-2 -d':' | sed "s/^.*\///")
|
||||
echo "$s2" | sed 's/ c=0//;s/ r=0//;s/^#/# /'
|
||||
echo "#: $found"
|
||||
echo "#, fuzzy"
|
||||
/bin/echo -e "msgid $s1"
|
||||
echo 'msgstr ""'
|
||||
echo
|
||||
else
|
||||
search=$(/bin/echo -e "$s1")
|
||||
found=$(grep -m1 -n -F "$search" $files | head -n1 | cut -f1-2 -d':' | sed "s/^.*\///")
|
||||
echo "$s2" | sed 's/ c=0//;s/ r=0//;s/^#/# /'
|
||||
echo "#: $found"
|
||||
/bin/echo -e "msgid $s1"
|
||||
/bin/echo -e "msgstr $s0"
|
||||
echo
|
||||
fi
|
||||
num=$((num+1))
|
||||
fi
|
||||
s2=$s1
|
||||
s1=$s0
|
||||
s0=$s
|
||||
done >> lang_$LNG.po
|
||||
|
||||
#replace LF with CRLF
|
||||
sync
|
||||
sed -i 's/$/\r/' lang_$LNG.po
|
||||
|
||||
echo "make_po.sh finished" >&2
|
||||
#read
|
||||
exit 0
|
@ -1,86 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# make_pot.sh - multi-language support script
|
||||
# Generate lang.pot
|
||||
#
|
||||
SRCDIR="../../Firmware"
|
||||
#
|
||||
#
|
||||
|
||||
|
||||
echo "make_pot.sh started" >&2
|
||||
|
||||
#remove output file if exists
|
||||
if [ -e lang.pot ]; then rm lang.pot; fi
|
||||
|
||||
lang_name="English"
|
||||
lang_short="en"
|
||||
|
||||
po_date=$(date)
|
||||
|
||||
#cat ../lang_en_cz.txt | sed "/^$/d;/^#/d" | sed '{N;s/\n/ /}' | sed -n '/\"\\x00\"$/p' | sed 's/ \"\\x00\"$//' > lang_pot_cz.tmp
|
||||
#cat ../lang_en_de.txt | sed "/^$/d;/^#/d" | sed '{N;s/\n/ /}' | sed -n '/\"\\x00\"$/p' | sed 's/ \"\\x00\"$//' > lang_pot_de.tmp
|
||||
#cat ../lang_en_es.txt | sed "/^$/d;/^#/d" | sed '{N;s/\n/ /}' | sed -n '/\"\\x00\"$/p' | sed 's/ \"\\x00\"$//' > lang_pot_es.tmp
|
||||
#cat ../lang_en_it.txt | sed "/^$/d;/^#/d" | sed '{N;s/\n/ /}' | sed -n '/\"\\x00\"$/p' | sed 's/ \"\\x00\"$//' > lang_pot_it.tmp
|
||||
#cat ../lang_en_pl.txt | sed "/^$/d;/^#/d" | sed '{N;s/\n/ /}' | sed -n '/\"\\x00\"$/p' | sed 's/ \"\\x00\"$//' > lang_pot_pl.tmp
|
||||
|
||||
#cat lang_pot_cz.tmp lang_pot_de.tmp lang_pot_es.tmp lang_pot_it.tmp lang_pot_pl.tmp | sort -u > lang_pot.tmp
|
||||
|
||||
#cat ../lang_en.txt | sed "/^$/d;/^#/d" > lang_pot.tmp
|
||||
|
||||
|
||||
#write po header
|
||||
echo "# Translation of Prusa-Firmware into $lang_name." > lang.pot
|
||||
echo "#" >> lang.pot
|
||||
echo 'msgid ""' >> lang.pot
|
||||
echo 'msgstr ""' >> lang.pot
|
||||
echo '"MIME-Version: 1.0\n"' >> lang.pot
|
||||
echo '"Content-Type: text/plain; charset=UTF-8\n"' >> lang.pot
|
||||
echo '"Content-Transfer-Encoding: 8bit\n"' >> lang.pot
|
||||
echo '"Language: '$lang_short'\n"' >> lang.pot
|
||||
echo '"Project-Id-Version: Prusa-Firmware\n"' >> lang.pot
|
||||
echo '"POT-Creation-Date: '$po_date'\n"' >> lang.pot
|
||||
echo '"PO-Revision-Date: '$po_date'\n"' >> lang.pot
|
||||
echo '"Language-Team: \n"' >> lang.pot
|
||||
echo '"X-Generator: Poedit 2.0.7\n"' >> lang.pot
|
||||
echo '"X-Poedit-SourceCharset: UTF-8\n"' >> lang.pot
|
||||
echo '"Last-Translator: \n"' >> lang.pot
|
||||
echo '"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"' >> lang.pot
|
||||
echo >> lang.pot
|
||||
|
||||
#list .cpp, .c and .h files
|
||||
files=$(ls "$SRCDIR"/*.cpp "$SRCDIR"/*.c "$SRCDIR"/*.h)
|
||||
|
||||
num_texts=$(grep '^#' -c ../lang_en.txt)
|
||||
#num_texts_nt=$(grep '^"' -c lang_en.txt)
|
||||
#echo " $num_texts texts, $num_texts_nt not translated" >&2
|
||||
echo " $num_texts texts" >&2
|
||||
|
||||
#loop over all messages
|
||||
s0=''
|
||||
s1=''
|
||||
num=1
|
||||
cat ../lang_en.txt | sed "s/\\\\/\\\\\\\\/g" | while read -r s; do
|
||||
if [ -z "$s" ]; then
|
||||
echo " processing $num of $num_texts" >&2
|
||||
search=$(/bin/echo -e "$s0")
|
||||
found=$(grep -m1 -n -F "$search" $files | head -n1 | cut -f1-2 -d':' | sed "s/^.*\///")
|
||||
echo "$s1" | sed 's/ c=0//;s/ r=0//;s/^#/# /'
|
||||
echo "#: $found"
|
||||
#echo "#, fuzzy"
|
||||
/bin/echo -e "msgid $s0"
|
||||
echo 'msgstr ""'
|
||||
echo
|
||||
num=$((num+1))
|
||||
fi
|
||||
s1=$s0
|
||||
s0=$s
|
||||
done >> lang.pot
|
||||
|
||||
#replace LF with CRLF
|
||||
sync
|
||||
sed -i 's/$/\r/' lang.pot
|
||||
|
||||
echo "make_pot.sh finished" >&2
|
||||
read
|
||||
exit 0
|
1873
lang/po_new/de.po
1873
lang/po_new/de.po
File diff suppressed because it is too large
Load Diff
1708
lang/po_new/es.po
1708
lang/po_new/es.po
File diff suppressed because it is too large
Load Diff
@ -1,28 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
#
|
||||
|
||||
LNG=$1
|
||||
if [ -z "$LNG" ]; then exit -1; fi
|
||||
|
||||
#convert '\\e' sequencies to 'x1b' and '\\' to '\'
|
||||
cat $LNG.po | sed 's/\\\\e/\\x1b/g;s/\\\\/\\/g' > $LNG'_filtered.po'
|
||||
|
||||
#join lines with multi-line string constants
|
||||
cat $LNG'_filtered.po' | sed ':a;N;$!ba;s/\x22\n\x22//g' > $LNG'_new.po'
|
||||
|
||||
#generate dictionary
|
||||
cat ../lang_en.txt | sed 's/\\/\\\\/g' | while read -r s; do
|
||||
/bin/echo -e "$s"
|
||||
if [ "${s:0:1}" = "\"" ]; then
|
||||
# /bin/echo -e "$s"
|
||||
s=$(/bin/echo -e "$s")
|
||||
s2=$(grep -F -A1 -B0 "$s" "$LNG"_new.po | tail -n1 | sed 's/^msgstr //')
|
||||
if [ -z "$s2" ]; then
|
||||
echo '"\x00"'
|
||||
else
|
||||
echo "$s2"
|
||||
fi
|
||||
# echo
|
||||
fi
|
||||
done > lang_en_$LNG.txt
|
@ -33,12 +33,10 @@ if [ -z "$1" ]; then PROGMEM=progmem1; fi
|
||||
# 0. check input files
|
||||
# 1. remove output files
|
||||
# 2. list symbol table of section '.text' from output elf file to text.sym (sorted by address)
|
||||
# 3. list symbol table of section '.$PROGMEM' from all output object files to $PROGMEM.sym
|
||||
# 4. filter only $PROGMEM symbols from text.sym and store it back to $PROGMEM.sym with absolute address
|
||||
# 5. calculate start and stop address of section '.$PROGMEM'
|
||||
# 6. extract string data from elf file to $PROGMEM.hex
|
||||
# 7. prepare string data for character check and conversion (output to $PROGMEM.chr)
|
||||
# 8. perform character check and conversion (output to $PROGMEM.var and $PROGMEM.txt)
|
||||
# 3. calculate start and stop address of section '.$PROGMEM'
|
||||
# 4. extract string data from elf file to $PROGMEM.hex
|
||||
# 5. prepare string data for character check and conversion (output to $PROGMEM.chr)
|
||||
# 6. perform character check and conversion (output to $PROGMEM.var and $PROGMEM.txt)
|
||||
#
|
||||
|
||||
echo "progmem.sh started" >&2
|
||||
@ -61,71 +59,56 @@ if [ -e $PROGMEM.txt ]; then rm $PROGMEM.txt; fi
|
||||
# (2)
|
||||
echo " progmem.sh (2) - listing symbol table of section '.text'" >&2
|
||||
#list symbols from section '.text' into file text.sym (only address, size and name)
|
||||
$OBJDUMP -t -j ".text" $INOELF | tail -n +5 | grep -E "^[0-9a-f]{8} [gl] O" | cut -c1-9,28-36,37- | sed "/^$/d" | sort >> text.sym
|
||||
#$OBJDUMP -t -j ".text" $INOELF | sort > text.sym
|
||||
$OBJDUMP -t -j ".text" $INOELF | tail -n +5 | grep -E "^[0-9a-f]{8} [gl] [O ]" | cut -c1-9,28-36,37- | sed "/^$/d" | sort > text.sym
|
||||
|
||||
# (3)
|
||||
echo " progmem.sh (3) - listing symbol table of section '.$PROGMEM'" >&2
|
||||
#loop over all object files
|
||||
ls "$OBJDIR"/*.o | while read fn; do
|
||||
echo " processing $fn" >&2
|
||||
#list symbols from section $PROGMEM (only address, size and name)
|
||||
$OBJDUMP -t -j ".$PROGMEM" $fn 2>/dev/null | tail -n +5 | cut -c1-9,28-36,37- | sed "/^$/d" | sort >> $PROGMEM.sym
|
||||
done
|
||||
|
||||
# (4)
|
||||
echo " progmem.sh (4) - filtering $PROGMEM symbols" >&2
|
||||
#create list of $PROGMEM symbol names separated by '\|'
|
||||
progmem=$(cut -c19- $PROGMEM.sym)
|
||||
progmem=$(echo $progmem | sed "s/ /\\\b\\\|\\\b/g")
|
||||
progmem='\b'$progmem'\b'
|
||||
#filter $PROGMEM symbols from section '.text' (result file will contain list sorted by absolute address)
|
||||
cat text.sym | grep $progmem > $PROGMEM.sym
|
||||
|
||||
# (5)
|
||||
echo " progmem.sh (5) - calculating start and stop address" >&2
|
||||
echo " progmem.sh (3) - calculating start and end address" >&2
|
||||
#calculate start addres of section ".$PROGMEM"
|
||||
PROGMEM_BEG=$(head -n1 $PROGMEM.sym | while read offs size name; do echo "0x"$offs; done)
|
||||
PROGMEM_BEG=$(cat text.sym | grep "__loc_pri_start" | while read offs size name; do echo "0x"$offs; done)
|
||||
#calculate stop addres of section ".$PROGMEM"
|
||||
PROGMEM_END=$(tail -n1 $PROGMEM.sym | while read offs size name; do printf "0x%x" $((0x$offs + 0x$size)); done)
|
||||
PROGMEM_END=$(cat text.sym | grep "__loc_pri_end" | while read offs size name; do echo "0x"$offs; done)
|
||||
echo " START address = "$PROGMEM_BEG >&2
|
||||
echo " STOP address = "$PROGMEM_END >&2
|
||||
|
||||
# (6)
|
||||
echo " progmem.sh (6) - extracting string data from elf" >&2
|
||||
#dump $PROGMEM data in hex format, cut textual data (keep hex data only)
|
||||
$OBJDUMP -d -j ".text" -w -z --start-address=$PROGMEM_BEG --stop-address=$PROGMEM_END $INOELF | cut -c1-57 > $PROGMEM.lss
|
||||
# (4)
|
||||
echo " progmem.sh (4) - extracting string data from elf" >&2
|
||||
#dump $PROGMEM data in hex format, cut disassembly (keep hex data only)
|
||||
$OBJDUMP -D -j ".text" -w -z --start-address=$PROGMEM_BEG --stop-address=$PROGMEM_END $INOELF |\
|
||||
tail -n +7 | sed "s/ \t.*$//" > $PROGMEM.lss
|
||||
#convert $PROGMEM.lss to $PROGMEM.hex:
|
||||
# replace empty lines with '|' (variables separated by empty lines)
|
||||
# remove address from multiline variables (keep address at first variable line only)
|
||||
# remove '<' and '>:', remove whitespace at end of lines
|
||||
# remove line-endings, replace separator with '\n' (join hex data lines - each line will contain single variable)
|
||||
# filter progmem symbols
|
||||
cat $PROGMEM.lss | tail -n +7 | sed -E 's/^$/|/;s/^........:\t/ /;s/<//g;s/>:/ /g;s/[ \t]*$//' |\
|
||||
tr -d '\n' | sed "s/[|]/\n/g" | grep $progmem > $PROGMEM.hex
|
||||
cat $PROGMEM.lss | sed -E 's/^$/|/;s/^ ....:\t//;s/[ ]*$/ /' | tr -d '\n' | tr '|' '\n' |\
|
||||
sed "s/^ //;s/<//;s/>:/ /;s/00 [1-9a-f][1-9a-f] $/00 /; s/ $//" > $PROGMEM.hex
|
||||
|
||||
# (7)
|
||||
echo " progmem.sh (7) - preparing string data" >&2
|
||||
# (5)
|
||||
echo " progmem.sh (5) - preparing string data" >&2
|
||||
#convert $PROGMEM.hex to $PROGMEM.chr (prepare string data for character check and conversion)
|
||||
# replace first space with tab
|
||||
# replace second space with tab and space
|
||||
# replace second and third space with tab and space
|
||||
# replace all remaining spaces with '\x'
|
||||
# replace all tabs with spaces
|
||||
cat $PROGMEM.hex | sed 's/ /\t/;s/ /\t /;s/ /\\x/g;s/\t/ /g' > $PROGMEM.chr
|
||||
cat $PROGMEM.hex | sed 's/ /\t/;s/ /\t /;s/ /\\x/g;s/\t/ /g' > $PROGMEM.chr
|
||||
|
||||
|
||||
# (8)
|
||||
#convert $PROGMEM.chr to $PROGMEM.var (convert data to text, TODO: rewrite as awk script)
|
||||
echo " progmem.sh (8) - converting string data" >&2
|
||||
# (6)
|
||||
#convert $PROGMEM.chr to $PROGMEM.var (convert data to text)
|
||||
echo " progmem.sh (6) - converting string data" >&2
|
||||
(\
|
||||
echo "/bin\/echo -e \\"; \
|
||||
cat $PROGMEM.chr | \
|
||||
sed 's/ \\xff\\xff/ /;' | \
|
||||
sed 's/\\x22/\\\\\\x22/g;' | \
|
||||
sed 's/\\x1b/\\\\\\x1b/g;' | \
|
||||
sed 's/\\x01/\\\\\\x01/g;' | \
|
||||
sed 's/\\xf8/\\\\\\xf8/g;' | \
|
||||
sed 's/\\x00$//;s/^/\/bin\/echo -e "/;s/$/"/' | sh > $PROGMEM.var
|
||||
sed 's/\\x00$/\n/;s/^/\"/;s/$/\"\\/'; \
|
||||
) | sh > $PROGMEM.var
|
||||
|
||||
#this step can be omitted because .txt file is not used
|
||||
#cat $PROGMEM.var | sed 's/\r/\n/g' | sed -E 's/^[0-9a-f]{8} [^ ]* //' >$PROGMEM.txt
|
||||
cat $PROGMEM.var | sed 's/\r/\n/g' | sed -E 's/^[0-9a-f]{8} [^ ]* //' >$PROGMEM.txt
|
||||
|
||||
echo "progmem.sh finished" >&2
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user