Update config.h translation documentation and move language to group2
Update fw-build.sh - Output used space of each translation (easier to troubleshoot) - Read config.h max size per translation - output variant .map files (easier to troubleshoot and finding missing/unused messages)
This commit is contained in:
parent
0580eaada9
commit
83315d0494
1
.gitignore
vendored
1
.gitignore
vendored
@ -12,6 +12,7 @@
|
||||
/lang/tmp/
|
||||
/lang/Firmware-intl.hex
|
||||
/lang/Firmware-intl-en_*.hex
|
||||
/lang/*.map
|
||||
|
||||
# Temporary files and directories
|
||||
*[~#]
|
||||
|
@ -59,7 +59,9 @@
|
||||
//#define LANG_MODE 0 // primary language only
|
||||
#define LANG_MODE 1 // sec. language support
|
||||
|
||||
#define LANG_SIZE_RESERVED 0x3000 // reserved space for secondary language (12288 bytes). Maximum 32768 bytes
|
||||
#define LANG_SIZE_RESERVED 0x3900 // reserved space for secondary language (14592 bytes).
|
||||
// 0x3D00 Maximum 15616 bytes as it depends on xflash_layout.h
|
||||
// 16 Languages max. per group including stock
|
||||
|
||||
#if (LANG_SIZE_RESERVED % 256)
|
||||
#error "LANG_SIZE_RESERVED should be a multiple of a page size"
|
||||
@ -79,9 +81,12 @@
|
||||
//#define COMMUNITY_LANG_GROUP1_DA // Community Danish language
|
||||
//#define COMMUNITY_LANG_GROUP1_SL // Community Slovanian language
|
||||
//#define COMMUNITY_LANG_GROUP1_LB // Community Luxembourgish language
|
||||
//#define COMMUNITY_LANG_GROUP1_LT // Community Lithuanian language
|
||||
#endif //COMMUNITY_LANG_GROUP 1
|
||||
|
||||
#if (COMMUNITY_LANG_GROUP == 2)
|
||||
#define COMMUNITY_LANG_GROUP2_LT // Community Lithuanian language
|
||||
//#define COMMUNITY_LANG_GROUP1_QR // Community new language //..use this as a template and replace 'QR'
|
||||
#endif
|
||||
#endif //COMMUNITY_LANG_GROUP 2
|
||||
|
||||
#if (COMMUNITY_LANG_GROUP >=1 )
|
||||
#define COMMUNITY_LANGUAGE_SUPPORT
|
||||
|
@ -240,9 +240,9 @@ const char* lang_get_name_by_code(uint16_t code)
|
||||
#ifdef COMMUNITY_LANG_GROUP1_HR
|
||||
case LANG_CODE_HR: return _n("Hrvatski"); //community Croatian contribution
|
||||
#endif // COMMUNITY_LANG_GROUP1_HR
|
||||
#ifdef COMMUNITY_LANG_GROUP1_LT
|
||||
#ifdef COMMUNITY_LANG_GROUP2_LT
|
||||
case LANG_CODE_LT: return _n("Lietuviu"); //community Lithuanian contribution
|
||||
#endif // COMMUNITY_LANG_GROUP1_LT
|
||||
#endif // COMMUNITY_LANG_GROUP2_LT
|
||||
#ifdef COMMUNITY_LANG_GROUP1_RO
|
||||
case LANG_CODE_RO: return _n("Romana"); //community Romanian contribution
|
||||
#endif // COMMUNITY_LANG_GROUP1_RO
|
||||
|
@ -123,9 +123,9 @@ typedef struct
|
||||
#ifdef COMMUNITY_LANG_GROUP1_HR
|
||||
#define LANG_CODE_HR 0x6872 //!<'hr'
|
||||
#endif // COMMUNITY_LANG_GROUP1_HR
|
||||
#ifdef COMMUNITY_LANG_GROUP1_LT
|
||||
#ifdef COMMUNITY_LANG_GROUP2_LT
|
||||
#define LANG_CODE_LT 0x6C74 //!<'lt'
|
||||
#endif // COMMUNITY_LANG_GROUP1_LT
|
||||
#endif // COMMUNITY_LANG_GROUP2_LT
|
||||
#ifdef COMMUNITY_LANG_GROUP1_SK
|
||||
#define LANG_CODE_SK 0x736b //!<'sk'
|
||||
#endif // COMMUNITY_LANG_GROUP1_SK
|
||||
|
@ -35,11 +35,14 @@ rm -rf "$TMPDIR"
|
||||
mkdir -p "$TMPDIR"
|
||||
BIN=$TMPDIR/firmware.bin
|
||||
MAP=$TMPDIR/firmware.map
|
||||
VARIANT=$(grep '^#define \+PRINTER_TYPE ' "$SRCDIR/Firmware/Configuration_prusa.h"|cut -d '_' -f3)
|
||||
|
||||
|
||||
# Extract and patch the symbol table/language map
|
||||
color 4 "generating firmware symbol map" >&2
|
||||
"$OBJCOPY" -I ihex -O binary "$INOHEX" "$BIN"
|
||||
./lang-map.py "$INOELF" "$BIN" > "$MAP"
|
||||
cp -f $MAP firmware_$VARIANT.map
|
||||
|
||||
# Get the maximum size of a single language table
|
||||
maxsize=$(grep '^#define \+LANG_SIZE_RESERVED \+' "$SRCDIR/Firmware/config.h" | sed -e 's/\s\+/ /g' | cut -d ' ' -f3)
|
||||
@ -78,8 +81,25 @@ if [ "$has_xflash" = 1 ]; then
|
||||
color 4 "assembling final firmware image" >&2
|
||||
"$OBJCOPY" -I binary -O ihex "$BIN" "$OUTHEX"
|
||||
truncate -s0 "$TMPDIR/lang.bin"
|
||||
individual_lang_reserved_hex=$(grep --max-count=1 "^#define LANG_SIZE_RESERVED *" $SRCDIR/Firmware/config.h|sed -e's/ */ /g'|cut -d ' ' -f3|cut -d 'x' -f2)
|
||||
individual_lang_reserved=$((16#$individual_lang_reserved_hex))
|
||||
for lang in $LANGUAGES; do
|
||||
cat "$TMPDIR/lang_$lang.bin" >> "$TMPDIR/lang.bin"
|
||||
lang_size=$(stat -c '%s' "$TMPDIR/lang_$lang.bin")
|
||||
lang_size_pad=$(( ($lang_size+256-1) / 256 * 256 ))
|
||||
lang_free=$(($individual_lang_reserved - $lang_size))
|
||||
echo >&2
|
||||
echo -n " size usage" >&2
|
||||
[ $lang_size -gt $individual_lang_reserved ] && c=1 || c=2
|
||||
color $c " $lang $lang_size_pad ($lang_size)" >&2
|
||||
echo -n " reserved size " >&2
|
||||
color 2 "$individual_lang_reserved" >&2
|
||||
echo -n " free bytes " >&2
|
||||
color 2 "$lang_free" >&2
|
||||
if [ $lang_size_pad -gt $individual_lang_reserved ]; then
|
||||
color 1 "NG! - language $lang data too large" >&2
|
||||
finish 1
|
||||
fi
|
||||
done
|
||||
"$OBJCOPY" -I binary -O ihex "$TMPDIR/lang.bin" "$TMPDIR/lang.hex"
|
||||
cat "$TMPDIR/lang.hex" >> "$OUTHEX"
|
||||
|
Loading…
Reference in New Issue
Block a user