summaryrefslogtreecommitdiffstats
path: root/tmk_core/avr.mk
diff options
context:
space:
mode:
authorSergey Vlasov <sigprof@gmail.com>2021-06-07 08:42:08 +0300
committerGitHub <noreply@github.com>2021-06-06 22:42:08 -0700
commit680cc1fab4a9e1bc7a75a5a7fe063ae4717a86ae (patch)
treef909de106a763ecb5e326c957d45bb7d437fcc89 /tmk_core/avr.mk
parent2e68897a620fec29772804dd2b1ba9268aec2188 (diff)
Fix firmware size check with avr-libc 1:2.0.0+Atmel3.6.2-1.1 (Debian bullseye) (#12951)
Debian bullseye (testing at the moment, but seems close to release) has avr-libc 1:2.0.0+Atmel3.6.2-1.1 with some changes taken from the Atmel-distributed toolchain. In particular, the <avr/io.h> header for ATmega32A (avr/iom32a.h) now defines the FLASHEND constant as `0x7FFFU`, and that `U` suffix breaks the firmware size check code, because the shell arithmetic expansion that is used to calculate `MAX_SIZE` does not support those C-specific suffixes. As a workaround, add `-D__ASSEMBLER__` to the C preprocessor invocation that is used to expand those macros; in this case avr/iom32a.h defines `FLASHEND` without the `U` suffix, and everything works as it did before with older avr-libc versions. The exact same code is present in two places; they are both changed, even though the code in `tmk_core/avr.mk` is actually never used for ATmega32A (and the header for ATmega32U4 does not add that `U` suffix to `FLASHEND` for some reason).
Diffstat (limited to 'tmk_core/avr.mk')
-rw-r--r--tmk_core/avr.mk2
1 files changed, 1 insertions, 1 deletions
diff --git a/tmk_core/avr.mk b/tmk_core/avr.mk
index 521305f1b4..2ba193c762 100644
--- a/tmk_core/avr.mk
+++ b/tmk_core/avr.mk
@@ -295,7 +295,7 @@ ifneq ($(strip $(BOOTLOADER)), qmk-dfu)
endif
make -C lib/lufa/Bootloaders/DFU/ clean
$(QMK_BIN) generate-dfu-header --quiet --keyboard $(KEYBOARD) --output lib/lufa/Bootloaders/DFU/Keyboard.h
- $(eval MAX_SIZE=$(shell n=`$(CC) -E -mmcu=$(MCU) $(CFLAGS) $(OPT_DEFS) tmk_core/common/avr/bootloader_size.c 2> /dev/null | sed -ne 's/\r//;/^#/n;/^AVR_SIZE:/,$${s/^AVR_SIZE: //;p;}'` && echo $$(($$n)) || echo 0))
+ $(eval MAX_SIZE=$(shell n=`$(CC) -E -mmcu=$(MCU) -D__ASSEMBLER__ $(CFLAGS) $(OPT_DEFS) tmk_core/common/avr/bootloader_size.c 2> /dev/null | sed -ne 's/\r//;/^#/n;/^AVR_SIZE:/,$${s/^AVR_SIZE: //;p;}'` && echo $$(($$n)) || echo 0))
$(eval PROGRAM_SIZE_KB=$(shell n=`expr $(MAX_SIZE) / 1024` && echo $$(($$n)) || echo 0))
$(eval BOOT_SECTION_SIZE_KB=$(shell n=`expr $(BOOTLOADER_SIZE) / 1024` && echo $$(($$n)) || echo 0))
$(eval FLASH_SIZE_KB=$(shell n=`expr $(PROGRAM_SIZE_KB) + $(BOOT_SECTION_SIZE_KB)` && echo $$(($$n)) || echo 0))