Browse Source

Make the compiler align the lang reserved area to the spm page boundary

Alex Voinea 2 years ago
parent
commit
bf45d4dcd1
2 changed files with 3 additions and 2 deletions
  1. 2 1
      Firmware/language.c
  2. 1 1
      Firmware/language.h

+ 2 - 1
Firmware/language.c

@@ -1,6 +1,7 @@
 //language.c
 #include "language.h"
 #include <avr/pgmspace.h>
+#include <avr/io.h>
 #include <avr/eeprom.h>
 #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};

+ 1 - 1
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 */