From bf45d4dcd161b110fb5179893585223395a9335f Mon Sep 17 00:00:00 2001 From: Alex Voinea Date: Sun, 6 Feb 2022 00:25:51 +0100 Subject: [PATCH] Make the compiler align the lang reserved area to the spm page boundary --- Firmware/language.c | 3 ++- Firmware/language.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Firmware/language.c b/Firmware/language.c index ac892426..b78c709e 100644 --- a/Firmware/language.c +++ b/Firmware/language.c @@ -1,6 +1,7 @@ //language.c #include "language.h" #include +#include #include #include "bootapp.h" @@ -28,7 +29,7 @@ uint8_t lang_is_selected(void) { return 1; } #else //(LANG_MODE == 0) //secondary languages in progmem or xflash //reserved xx kbytes for secondary language table -const char _SEC_LANG[LANG_SIZE_RESERVED] PROGMEM_I2 = "_SEC_LANG"; +const char _SEC_LANG[LANG_SIZE_RESERVED] __attribute__((aligned(SPM_PAGESIZE))) PROGMEM_I2 = "_SEC_LANG"; //primary language signature const uint32_t _PRI_LANG_SIGNATURE[1] __attribute__((section(".progmem0"))) = {0xffffffff}; diff --git a/Firmware/language.h b/Firmware/language.h index 736d522e..651ec038 100644 --- a/Firmware/language.h +++ b/Firmware/language.h @@ -117,7 +117,7 @@ extern const char _SEC_LANG[LANG_SIZE_RESERVED]; extern const char* lang_get_translation(const char* s); /** @def _SEC_LANG_TABLE * @brief Align table to start of 256 byte page */ -#define _SEC_LANG_TABLE ((((uint16_t)&_SEC_LANG) + 0x00ff) & 0xff00) +#define _SEC_LANG_TABLE ((uint16_t)&_SEC_LANG) #endif //(LANG_MODE != 0) /** @brief selects language, eeprom is updated in case of success */