[RFC] Multi-language firmware (second try) (#941)
* Impl. sectioned font table in firmware * make_translation.py: Extract build_symbol_conversion_table function * Put translation indices and strings in a struct * Move translation objcopy step to Python * Impl. multi-language firmware demo * Impl. strings-compressed multi-lang firmware demo * Add font compression to multi-lang demo * Refactor Makefile a bit * Fix rules for make < 4.3 * Add more multi-lang groups * Add Pinecil multi-lang CI build * Add lzfx compression license text * Remote multi-language demo group * Fix build after merge * Import code from BriefLZ * Change brieflz for our use case * Change compression to use brieflz * Remove lzfx code * Update license file for brieflz * Exclude brieflz files from format check * Add BriefLZ test
This commit is contained in:
42
source/Core/Inc/Translation_multi.h
Normal file
42
source/Core/Inc/Translation_multi.h
Normal file
@@ -0,0 +1,42 @@
|
||||
#ifndef TRANSLATION_MULTI_H_
|
||||
#define TRANSLATION_MULTI_H_
|
||||
|
||||
#include "Translation.h"
|
||||
|
||||
// The compressed translation data will be decompressed to this buffer. These
|
||||
// data may include:
|
||||
// - TranslationData (translation index table and translation strings)
|
||||
// - Font table(s)
|
||||
// The translation index table consists of uint16_t (half words) which has a
|
||||
// 2-byte alignment. Therefore, the declaration of this buffer must include
|
||||
// the alignment specifier `alignas(TranslationData)` to satisfy its alignment.
|
||||
// TranslationData must always be decompressed to the start of this buffer.
|
||||
extern uint8_t translation_data_out_buffer[];
|
||||
extern const uint16_t translation_data_out_buffer_size;
|
||||
|
||||
struct FontSectionDataInfo {
|
||||
uint16_t symbol_start;
|
||||
uint16_t symbol_count;
|
||||
uint16_t data_size : 15;
|
||||
bool data_is_compressed : 1;
|
||||
|
||||
// Font12x16 data followed by font6x8 data
|
||||
const uint8_t *data_ptr;
|
||||
};
|
||||
|
||||
extern const FontSectionDataInfo FontSectionDataInfos[];
|
||||
extern const uint8_t FontSectionDataCount;
|
||||
|
||||
extern FontSection DynamicFontSections[];
|
||||
|
||||
struct LanguageMeta {
|
||||
char code[8];
|
||||
const uint8_t *translation_data;
|
||||
uint16_t translation_size : 15;
|
||||
bool translation_is_compressed : 1;
|
||||
};
|
||||
|
||||
extern const LanguageMeta LanguageMetas[];
|
||||
extern const uint8_t LanguageCount;
|
||||
|
||||
#endif /* TRANSLATION_MULTI_H_ */
|
||||
Reference in New Issue
Block a user