Skip to content

Commit 0c716d2

Browse files
authored
Merge pull request prusa3d#3377 from leptun/MK3_fix_lang_reserved_area
Fix lang reserved area alignment
2 parents ce7ccca + 426ab24 commit 0c716d2

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

Firmware/Marlin_main.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1246,9 +1246,9 @@ void setup()
12461246
printf_P(_n("_SEC_LANG_TABLE checksum = %04x\n"), sum);
12471247
sum = (sum >> 8) | ((sum & 0xff) << 8); //swap bytes
12481248
if (sum == header.checksum)
1249-
puts_P(_n("Checksum OK"), sum);
1249+
puts_P(_n("Checksum OK"));
12501250
else
1251-
puts_P(_n("Checksum NG"), sum);
1251+
puts_P(_n("Checksum NG"));
12521252
}
12531253
else
12541254
puts_P(_n("lang_get_header failed!"));

Firmware/language.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//language.c
22
#include "language.h"
33
#include <avr/pgmspace.h>
4+
#include <avr/io.h>
45
#include <avr/eeprom.h>
56
#include "bootapp.h"
67

@@ -28,7 +29,7 @@ uint8_t lang_is_selected(void) { return 1; }
2829
#else //(LANG_MODE == 0) //secondary languages in progmem or xflash
2930

3031
//reserved xx kbytes for secondary language table
31-
const char _SEC_LANG[LANG_SIZE_RESERVED] PROGMEM_I2 = "_SEC_LANG";
32+
const char _SEC_LANG[LANG_SIZE_RESERVED] __attribute__((aligned(SPM_PAGESIZE))) PROGMEM_I2 = "_SEC_LANG";
3233

3334
//primary language signature
3435
const uint32_t _PRI_LANG_SIGNATURE[1] __attribute__((section(".progmem0"))) = {0xffffffff};
@@ -264,7 +265,7 @@ uint16_t lang_print_sec_lang(FILE* out)
264265
printf_P(_n(" _lt_resv0 = 0x%04x\n"), _lt_resv0);
265266
printf_P(_n(" _lt_resv1 = 0x%08lx\n"), _lt_resv1);
266267
if (_lt_magic != LANG_MAGIC) return 0;
267-
puts_P(_n(" strings:\n"));
268+
puts_P(_n(" strings:"));
268269
uint16_t ui = _SEC_LANG_TABLE; //table pointer
269270
for (ui = 0; ui < _lt_count; ui++)
270271
fprintf_P(out, _n(" %3d %S\n"), ui, lang_get_sec_lang_str_by_id(ui));

Firmware/language.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ extern const char _SEC_LANG[LANG_SIZE_RESERVED];
117117
extern const char* lang_get_translation(const char* s);
118118
/** @def _SEC_LANG_TABLE
119119
* @brief Align table to start of 256 byte page */
120-
#define _SEC_LANG_TABLE ((((uint16_t)&_SEC_LANG) + 0x00ff) & 0xff00)
120+
#define _SEC_LANG_TABLE ((uint16_t)&_SEC_LANG)
121121
#endif //(LANG_MODE != 0)
122122

123123
/** @brief selects language, eeprom is updated in case of success */

0 commit comments

Comments
 (0)