Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix up AVR production build target. #23190

Merged
merged 1 commit into from
Mar 1, 2024

Conversation

tzarc
Copy link
Member

@tzarc tzarc commented Mar 1, 2024

Description

Building AVR targets with embedded bootloader had make environment contamination.
This PR fixes the intended build target when building the bootloader, as well as ensuring it's correctly sequenced in a parallel build.

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Keyboard (addition or update)
  • Keymap/layout/userspace (addition or update)
  • Documentation

Checklist

  • My code follows the code style of this project: C, Python
  • I have read the PR Checklist document and have made the appropriate changes.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

@tzarc tzarc requested a review from a team March 1, 2024 11:15
@github-actions github-actions bot added the core label Mar 1, 2024
@tzarc tzarc added the bug label Mar 1, 2024
@tzarc tzarc merged commit 8b8f730 into qmk:master Mar 1, 2024
4 checks passed
@tzarc tzarc deleted the bugfix/avr-production-targets branch March 1, 2024 21:44
@MaxJ345
Copy link

MaxJ345 commented Mar 1, 2024

Hello,

I'm still experiencing issues when I try to build a "production" firmware. I see errors when using make and qmk compile:

$ make clean

QMK Firmware 0.24.1
Deleting .build/ ... done.



$ make project_vanguard/full_size/v1:default:production

QMK Firmware 0.24.1
Making project_vanguard/full_size/v1 with keymap default and target production

Generating: .build/obj_project_vanguard_full_size_v1_default/src/info_deps.d                        [OK]
avr-gcc.exe (GCC) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Generating: .build/obj_project_vanguard_full_size_v1_default/src/info_config.h                      [OK]
Generating: .build/obj_project_vanguard_full_size_v1_default/src/default_keyboard.c                 [OK]
Generating: .build/obj_project_vanguard_full_size_v1_default/src/default_keyboard.h                 [OK]
Compiling: keyboards/project_vanguard/full_size/v1/v1.c                                             [OK]
Compiling: .build/obj_project_vanguard_full_size_v1_default/src/default_keyboard.c                  [OK]
Compiling: quantum/keymap_introspection.c                                                           [OK]
Compiling: quantum/quantum.c                                                                        [OK]
Compiling: quantum/bitwise.c                                                                        [OK]
Compiling: quantum/led.c                                                                            [OK]
Compiling: quantum/action.c                                                                         [OK]
Compiling: quantum/action_layer.c                                                                   [OK]
Compiling: quantum/action_tapping.c                                                                 [OK]
Compiling: quantum/action_util.c                                                                    [OK]
Compiling: quantum/eeconfig.c                                                                       [OK]
Compiling: quantum/keyboard.c                                                                       [OK]
Compiling: quantum/keymap_common.c                                                                  [OK]
Compiling: quantum/keycode_config.c                                                                 [OK]
Compiling: quantum/sync_timer.c                                                                     [OK]
Compiling: quantum/logging/debug.c                                                                  [OK]
Compiling: quantum/logging/sendchar.c                                                               [OK]
Compiling: quantum/matrix_common.c                                                                  [OK]
Compiling: quantum/matrix.c                                                                         [OK]
Compiling: quantum/debounce/sym_defer_g.c                                                           [OK]
Compiling: quantum/main.c                                                                           [OK]
Assembling: platforms/avr/xprintf.S                                                                 [OK]
Compiling: platforms/avr/printf.c                                                                   [OK]
Compiling: quantum/process_keycode/process_grave_esc.c                                              [OK]
Compiling: quantum/process_keycode/process_magic.c                                                  [OK]
Compiling: quantum/send_string/send_string.c                                                        [OK]
Compiling: quantum/process_keycode/process_space_cadet.c                                            [OK]
Compiling: tmk_core/protocol/host.c                                                                 [OK]
Compiling: tmk_core/protocol/report.c                                                               [OK]
Compiling: tmk_core/protocol/usb_device_state.c                                                     [OK]
Compiling: tmk_core/protocol/usb_util.c                                                             [OK]
Compiling: platforms/suspend.c                                                                      [OK]
Compiling: platforms/synchronization_util.c                                                         [OK]
Compiling: platforms/timer.c                                                                        [OK]
Compiling: platforms/avr/hardware_id.c                                                              [OK]
Compiling: platforms/avr/platform.c                                                                 [OK]
Compiling: platforms/avr/suspend.c                                                                  [OK]
Compiling: platforms/avr/timer.c                                                                    [OK]
Compiling: platforms/avr/bootloaders/dfu.c                                                          [OK]
Compiling: tmk_core/protocol/lufa/lufa.c                                                            [OK]
Compiling: tmk_core/protocol/usb_descriptor.c                                                       [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Class/Common/HIDParser.c                                       [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.c                                        [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c                                [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.c                                      [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c                                          [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.c                                    [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c                                          [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c                                 [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c                                  [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/ConfigDescriptors.c                                       [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/DeviceStandardReq.c                                       [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/Events.c                                                  [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/HostStandardReq.c                                         [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/USBTask.c                                                 [OK]
Compiling: tmk_core/protocol/lufa/usb_util.c                                                        [OK]
Linking: .build/project_vanguard_full_size_v1_default.elf                                           [OK]
Creating load file for flashing: .build/project_vanguard_full_size_v1_default.hex                   [OK]
Copying project_vanguard_full_size_v1_default.hex to qmk_firmware folder                            [OK]
 [RM]      : Removing object files of "BootloaderDFU"
rm -f obj/BootloaderDFU.o obj/Descriptors.o obj/BootloaderAPI.o obj/BootloaderAPITable.o obj/HIDParser.o obj/Device_AVR8.o obj/EndpointStream_AVR8.o obj/Endpoint_AVR8.o obj/Host_AVR8.o obj/PipeStream_AVR8.o obj/Pipe_AVR8.o obj/USBController_AVR8.o obj/USBInterrupt_AVR8.o obj/ConfigDescriptors.o obj/DeviceStandardReq.o obj/Events.o obj/HostStandardReq.o obj/USBTask.o
 [RM]      : Removing dependency files of "BootloaderDFU"
rm -f obj/BootloaderDFU.d obj/Descriptors.d obj/BootloaderAPI.d obj/BootloaderAPITable.d obj/HIDParser.d obj/Device_AVR8.d obj/EndpointStream_AVR8.d obj/Endpoint_AVR8.d obj/Host_AVR8.d obj/PipeStream_AVR8.d obj/Pipe_AVR8.d obj/USBController_AVR8.d obj/USBInterrupt_AVR8.d obj/ConfigDescriptors.d obj/DeviceStandardReq.d obj/Events.d obj/HostStandardReq.d obj/USBTask.d
 [RM]      : Removing output files of "BootloaderDFU"
rm -f BootloaderDFU.elf BootloaderDFU.hex BootloaderDFU.bin BootloaderDFU.eep BootloaderDFU.map BootloaderDFU.lss BootloaderDFU.sym libBootloaderDFU.a
 [INFO]    : Begin compilation of project "BootloaderDFU"...

avr-gcc.exe (GCC) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 [GCC]     : Compiling C file "BootloaderDFU.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega32u4 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DDMBS_ARCH_AVR8 -mrelax -fno-jump-tables -flto -fuse-linker-plugin -x c -Os -std=gnu99 -Wstrict-prototypes -DF_CPU=8000000UL -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DBOOT_START_ADDR=0x7000 -I. -I../../LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_QMK -DF_USB=8000000UL   -MMD -MP -MF obj/BootloaderDFU.d BootloaderDFU.c -o obj/BootloaderDFU.o
In file included from ../../LUFA/../LUFA/Drivers/Board/LEDs.h:139,
                 from BootloaderDFU.h:55,
                 from BootloaderDFU.c:37:
../../LUFA/../LUFA/Drivers/Board/AVR8/QMK/LEDs.h: In function 'LEDs_TurnOnLEDs':
../../LUFA/../LUFA/Drivers/Board/AVR8/QMK/LEDs.h:217:38: warning: overflow in conversion from 'int' to 'uint8_t' {aka 'unsigned char'} changes value from '(int)*33 & (~(int)LEDMask & -32768)' to '0' [-Woverflow]
  217 |                 PORT(QMK_SPEAKER) &= (LEDS_LED2 & ~LEDMask);
      |                                      ^
../../LUFA/../LUFA/Drivers/Board/AVR8/QMK/LEDs.h: In function 'LEDs_ToggleLEDs':
../../LUFA/../LUFA/Drivers/Board/AVR8/QMK/LEDs.h:242:37: warning: overflow in conversion from 'int' to 'uint8_t' {aka 'unsigned char'} changes value from '(int)LEDMask & -32768' to '0' [-Woverflow]
  242 |                 PIN(QMK_SPEAKER)  = (LEDS_LED2 & LEDMask);
      |                                     ^
../../LUFA/../LUFA/Drivers/Board/AVR8/QMK/LEDs.h: In function 'LEDs_GetLEDs':
../../LUFA/../LUFA/Drivers/Board/AVR8/QMK/LEDs.h:248:53: warning: overflow in conversion from 'int' to 'uint8_t' {aka 'unsigned char'} changes value from '~(int)*43 & 8 | ~((int)*33 & -32768)' to '255' [-Woverflow]
  248 |                 return (~PORT(QMK_LED) & LEDS_LED1) | (~(PORT(QMK_SPEAKER) & LEDS_LED2));
      |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BootloaderDFU.c: In function 'main':
BootloaderDFU.c:185:35: warning: unsigned conversion from 'int' to 'uint8_t' {aka 'const unsigned char'} changes value from '-32760' to '8' [-Woverflow]
  185 |         LEDs_SetAllLEDs(LEDS_LED1 | LEDS_LED2);
BootloaderDFU.c: In function '__vector_20':
BootloaderDFU.c:276:35: warning: unsigned conversion from 'int' to 'uint8_t' {aka 'const unsigned char'} changes value from '-32760' to '8' [-Woverflow]
  276 |         LEDs_ToggleLEDs(LEDS_LED1 | LEDS_LED2);
BootloaderDFU.c: In function 'EVENT_USB_Device_ControlRequest':
BootloaderDFU.c:293:35: warning: unsigned conversion from 'int' to 'uint8_t' {aka 'const unsigned char'} changes value from '-32760' to '8' [-Woverflow]
  293 |         LEDs_ToggleLEDs(LEDS_LED1 | LEDS_LED2);
 [GCC]     : Compiling C file "Descriptors.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega32u4 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DDMBS_ARCH_AVR8 -mrelax -fno-jump-tables -flto -fuse-linker-plugin -x c -Os -std=gnu99 -Wstrict-prototypes -DF_CPU=8000000UL -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DBOOT_START_ADDR=0x7000 -I. -I../../LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_QMK -DF_USB=8000000UL   -MMD -MP -MF obj/Descriptors.d Descriptors.c -o obj/Descriptors.o
 [GCC]     : Compiling C file "BootloaderAPI.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega32u4 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DDMBS_ARCH_AVR8 -mrelax -fno-jump-tables -flto -fuse-linker-plugin -x c -Os -std=gnu99 -Wstrict-prototypes -DF_CPU=8000000UL -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DBOOT_START_ADDR=0x7000 -I. -I../../LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_QMK -DF_USB=8000000UL   -MMD -MP -MF obj/BootloaderAPI.d BootloaderAPI.c -o obj/BootloaderAPI.o
 [GAS]     : Assembling "BootloaderAPITable.S"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega32u4 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DDMBS_ARCH_AVR8 -mrelax -fno-jump-tables -flto -fuse-linker-plugin -x assembler-with-cpp -DF_CPU=8000000 -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DBOOT_START_ADDR=0x7000   -MMD -MP -MF obj/BootloaderAPITable.d BootloaderAPITable.S -o obj/BootloaderAPITable.o
 [GCC]     : Compiling C file "HIDParser.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega32u4 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DDMBS_ARCH_AVR8 -mrelax -fno-jump-tables -flto -fuse-linker-plugin -x c -Os -std=gnu99 -Wstrict-prototypes -DF_CPU=8000000UL -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DBOOT_START_ADDR=0x7000 -I. -I../../LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_QMK -DF_USB=8000000UL   -MMD -MP -MF obj/HIDParser.d ../../LUFA/Drivers/USB/Class/Common/HIDParser.c -o obj/HIDParser.o
 [GCC]     : Compiling C file "Device_AVR8.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega32u4 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DDMBS_ARCH_AVR8 -mrelax -fno-jump-tables -flto -fuse-linker-plugin -x c -Os -std=gnu99 -Wstrict-prototypes -DF_CPU=8000000UL -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DBOOT_START_ADDR=0x7000 -I. -I../../LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_QMK -DF_USB=8000000UL   -MMD -MP -MF obj/Device_AVR8.d ../../LUFA/Drivers/USB/Core/AVR8/Device_AVR8.c -o obj/Device_AVR8.o
 [GCC]     : Compiling C file "EndpointStream_AVR8.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega32u4 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DDMBS_ARCH_AVR8 -mrelax -fno-jump-tables -flto -fuse-linker-plugin -x c -Os -std=gnu99 -Wstrict-prototypes -DF_CPU=8000000UL -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DBOOT_START_ADDR=0x7000 -I. -I../../LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_QMK -DF_USB=8000000UL   -MMD -MP -MF obj/EndpointStream_AVR8.d ../../LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c -o obj/EndpointStream_AVR8.o
 [GCC]     : Compiling C file "Endpoint_AVR8.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega32u4 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DDMBS_ARCH_AVR8 -mrelax -fno-jump-tables -flto -fuse-linker-plugin -x c -Os -std=gnu99 -Wstrict-prototypes -DF_CPU=8000000UL -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DBOOT_START_ADDR=0x7000 -I. -I../../LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_QMK -DF_USB=8000000UL   -MMD -MP -MF obj/Endpoint_AVR8.d ../../LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.c -o obj/Endpoint_AVR8.o
 [GCC]     : Compiling C file "Host_AVR8.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega32u4 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DDMBS_ARCH_AVR8 -mrelax -fno-jump-tables -flto -fuse-linker-plugin -x c -Os -std=gnu99 -Wstrict-prototypes -DF_CPU=8000000UL -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DBOOT_START_ADDR=0x7000 -I. -I../../LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_QMK -DF_USB=8000000UL   -MMD -MP -MF obj/Host_AVR8.d ../../LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c -o obj/Host_AVR8.o
 [GCC]     : Compiling C file "PipeStream_AVR8.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega32u4 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DDMBS_ARCH_AVR8 -mrelax -fno-jump-tables -flto -fuse-linker-plugin -x c -Os -std=gnu99 -Wstrict-prototypes -DF_CPU=8000000UL -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DBOOT_START_ADDR=0x7000 -I. -I../../LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_QMK -DF_USB=8000000UL   -MMD -MP -MF obj/PipeStream_AVR8.d ../../LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.c -o obj/PipeStream_AVR8.o
 [GCC]     : Compiling C file "Pipe_AVR8.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega32u4 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DDMBS_ARCH_AVR8 -mrelax -fno-jump-tables -flto -fuse-linker-plugin -x c -Os -std=gnu99 -Wstrict-prototypes -DF_CPU=8000000UL -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DBOOT_START_ADDR=0x7000 -I. -I../../LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_QMK -DF_USB=8000000UL   -MMD -MP -MF obj/Pipe_AVR8.d ../../LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c -o obj/Pipe_AVR8.o
 [GCC]     : Compiling C file "USBController_AVR8.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega32u4 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DDMBS_ARCH_AVR8 -mrelax -fno-jump-tables -flto -fuse-linker-plugin -x c -Os -std=gnu99 -Wstrict-prototypes -DF_CPU=8000000UL -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DBOOT_START_ADDR=0x7000 -I. -I../../LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_QMK -DF_USB=8000000UL   -MMD -MP -MF obj/USBController_AVR8.d ../../LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c -o obj/USBController_AVR8.o
 [GCC]     : Compiling C file "USBInterrupt_AVR8.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega32u4 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DDMBS_ARCH_AVR8 -mrelax -fno-jump-tables -flto -fuse-linker-plugin -x c -Os -std=gnu99 -Wstrict-prototypes -DF_CPU=8000000UL -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DBOOT_START_ADDR=0x7000 -I. -I../../LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_QMK -DF_USB=8000000UL   -MMD -MP -MF obj/USBInterrupt_AVR8.d ../../LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c -o obj/USBInterrupt_AVR8.o
 [GCC]     : Compiling C file "ConfigDescriptors.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega32u4 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DDMBS_ARCH_AVR8 -mrelax -fno-jump-tables -flto -fuse-linker-plugin -x c -Os -std=gnu99 -Wstrict-prototypes -DF_CPU=8000000UL -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DBOOT_START_ADDR=0x7000 -I. -I../../LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_QMK -DF_USB=8000000UL   -MMD -MP -MF obj/ConfigDescriptors.d ../../LUFA/Drivers/USB/Core/ConfigDescriptors.c -o obj/ConfigDescriptors.o
 [GCC]     : Compiling C file "DeviceStandardReq.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega32u4 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DDMBS_ARCH_AVR8 -mrelax -fno-jump-tables -flto -fuse-linker-plugin -x c -Os -std=gnu99 -Wstrict-prototypes -DF_CPU=8000000UL -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DBOOT_START_ADDR=0x7000 -I. -I../../LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_QMK -DF_USB=8000000UL   -MMD -MP -MF obj/DeviceStandardReq.d ../../LUFA/Drivers/USB/Core/DeviceStandardReq.c -o obj/DeviceStandardReq.o
 [GCC]     : Compiling C file "Events.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega32u4 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DDMBS_ARCH_AVR8 -mrelax -fno-jump-tables -flto -fuse-linker-plugin -x c -Os -std=gnu99 -Wstrict-prototypes -DF_CPU=8000000UL -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DBOOT_START_ADDR=0x7000 -I. -I../../LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_QMK -DF_USB=8000000UL   -MMD -MP -MF obj/Events.d ../../LUFA/Drivers/USB/Core/Events.c -o obj/Events.o
 [GCC]     : Compiling C file "HostStandardReq.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega32u4 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DDMBS_ARCH_AVR8 -mrelax -fno-jump-tables -flto -fuse-linker-plugin -x c -Os -std=gnu99 -Wstrict-prototypes -DF_CPU=8000000UL -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DBOOT_START_ADDR=0x7000 -I. -I../../LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_QMK -DF_USB=8000000UL   -MMD -MP -MF obj/HostStandardReq.d ../../LUFA/Drivers/USB/Core/HostStandardReq.c -o obj/HostStandardReq.o
 [GCC]     : Compiling C file "USBTask.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega32u4 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DDMBS_ARCH_AVR8 -mrelax -fno-jump-tables -flto -fuse-linker-plugin -x c -Os -std=gnu99 -Wstrict-prototypes -DF_CPU=8000000UL -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DBOOT_START_ADDR=0x7000 -I. -I../../LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_QMK -DF_USB=8000000UL   -MMD -MP -MF obj/USBTask.d ../../LUFA/Drivers/USB/Core/USBTask.c -o obj/USBTask.o
 [LNK]     : Linking object files into "BootloaderDFU.elf"
avr-gcc obj/BootloaderDFU.o obj/Descriptors.o obj/BootloaderAPI.o obj/BootloaderAPITable.o obj/HIDParser.o obj/Device_AVR8.o obj/EndpointStream_AVR8.o obj/Endpoint_AVR8.o obj/Host_AVR8.o obj/PipeStream_AVR8.o obj/Pipe_AVR8.o obj/USBController_AVR8.o obj/USBInterrupt_AVR8.o obj/ConfigDescriptors.o obj/DeviceStandardReq.o obj/Events.o obj/HostStandardReq.o obj/USBTask.o -o BootloaderDFU.elf -lm -Wl,-Map=BootloaderDFU.map,--cref -Wl,--gc-sections -Wl,--relax -mmcu=atmega32u4 -flto -fuse-linker-plugin -Wl,--section-start=.text=0x7000 -Wl,--section-start=.apitable_trampolines=0x7FA0 -Wl,--undefined=BootloaderAPI_Trampolines -Wl,--section-start=.apitable_jumptable=0x7FE0 -Wl,--undefined=BootloaderAPI_JumpTable -Wl,--section-start=.apitable_signatures=0x7FF8 -Wl,--undefined=BootloaderAPI_Signatures
c:/qmk_msys/mingw64/bin/../lib/gcc/avr/12.2.0/../../../../avr/bin/ld.exe: section .apitable_trampolines LMA [00007fa0,00007fb7] overlaps section .data LMA [00007f26,00007fb5]
collect2.exe: error: ld returned 1 exit status
make[2]: *** [../../LUFA/Build/DMBS/DMBS/gcc.mk:251: BootloaderDFU.elf] Error 1
make[1]: *** [platforms/avr/platform.mk:214: bootloader] Error 2
Make finished with errors
make: *** [Makefile:415: project_vanguard/full_size/v1:default:production] Error 1
$ qmk clean --all

QMK Firmware 0.24.1
Deleting .build/ ... done.
Deleting *.bin, *.hex, and *.uf2 ... done.



$ qmk compile --keyboard project_vanguard/full_size/v1 --keymap default --target production

Ψ Compiling keymap with make -r -R -f builddefs/build_keyboard.mk -s production KEYBOARD=project_vanguard/full_size/v1 KEYMAP=default KEYBOARD_FILESAFE=project_vanguard_full_size_v1 TARGET=project_vanguard_full_size_v1_default INTERMEDIATE_OUTPUT=.build/obj_project_vanguard_full_size_v1_default VERBOSE=false COLOR=true SILENT=false QMK_BIN="qmk"


Generating: .build/obj_project_vanguard_full_size_v1_default/src/info_deps.d                        [OK]
avr-gcc.exe (GCC) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Generating: .build/obj_project_vanguard_full_size_v1_default/src/info_config.h                      [OK]
Generating: .build/obj_project_vanguard_full_size_v1_default/src/default_keyboard.c                 [OK]
Generating: .build/obj_project_vanguard_full_size_v1_default/src/default_keyboard.h                 [OK]
Compiling: keyboards/project_vanguard/full_size/v1/v1.c                                             [OK]
Compiling: .build/obj_project_vanguard_full_size_v1_default/src/default_keyboard.c                  [OK]
Compiling: quantum/keymap_introspection.c                                                           [OK]
Compiling: quantum/quantum.c                                                                        [OK]
Compiling: quantum/bitwise.c                                                                        [OK]
Compiling: quantum/led.c                                                                            [OK]
Compiling: quantum/action.c                                                                         [OK]
Compiling: quantum/action_layer.c                                                                   [OK]
Compiling: quantum/action_tapping.c                                                                 [OK]
Compiling: quantum/action_util.c                                                                    [OK]
Compiling: quantum/eeconfig.c                                                                       [OK]
Compiling: quantum/keyboard.c                                                                       [OK]
Compiling: quantum/keymap_common.c                                                                  [OK]
Compiling: quantum/keycode_config.c                                                                 [OK]
Compiling: quantum/sync_timer.c                                                                     [OK]
Compiling: quantum/logging/debug.c                                                                  [OK]
Compiling: quantum/logging/sendchar.c                                                               [OK]
Compiling: quantum/matrix_common.c                                                                  [OK]
Compiling: quantum/matrix.c                                                                         [OK]
Compiling: quantum/debounce/sym_defer_g.c                                                           [OK]
Compiling: quantum/main.c                                                                           [OK]
Assembling: platforms/avr/xprintf.S                                                                 [OK]
Compiling: platforms/avr/printf.c                                                                   [OK]
Compiling: quantum/process_keycode/process_grave_esc.c                                              [OK]
Compiling: quantum/process_keycode/process_magic.c                                                  [OK]
Compiling: quantum/send_string/send_string.c                                                        [OK]
Compiling: quantum/process_keycode/process_space_cadet.c                                            [OK]
Compiling: tmk_core/protocol/host.c                                                                 [OK]
Compiling: tmk_core/protocol/report.c                                                               [OK]
Compiling: tmk_core/protocol/usb_device_state.c                                                     [OK]
Compiling: tmk_core/protocol/usb_util.c                                                             [OK]
Compiling: platforms/suspend.c                                                                      [OK]
Compiling: platforms/synchronization_util.c                                                         [OK]
Compiling: platforms/timer.c                                                                        [OK]
Compiling: platforms/avr/hardware_id.c                                                              [OK]
Compiling: platforms/avr/platform.c                                                                 [OK]
Compiling: platforms/avr/suspend.c                                                                  [OK]
Compiling: platforms/avr/timer.c                                                                    [OK]
Compiling: platforms/avr/bootloaders/dfu.c                                                          [OK]
Compiling: tmk_core/protocol/lufa/lufa.c                                                            [OK]
Compiling: tmk_core/protocol/usb_descriptor.c                                                       [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Class/Common/HIDParser.c                                       [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.c                                        [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c                                [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.c                                      [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c                                          [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.c                                    [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c                                          [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c                                 [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c                                  [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/ConfigDescriptors.c                                       [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/DeviceStandardReq.c                                       [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/Events.c                                                  [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/HostStandardReq.c                                         [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/USBTask.c                                                 [OK]
Compiling: tmk_core/protocol/lufa/usb_util.c                                                        [OK]
Linking: .build/project_vanguard_full_size_v1_default.elf                                           [OK]
Creating load file for flashing: .build/project_vanguard_full_size_v1_default.hex                   [OK]
Copying project_vanguard_full_size_v1_default.hex to qmk_firmware folder                            [OK]
 [RM]      : Removing object files of "BootloaderDFU"
 [RM]      : Removing dependency files of "BootloaderDFU"
 [RM]      : Removing output files of "BootloaderDFU"
 [INFO]    : Begin compilation of project "BootloaderDFU"...

avr-gcc.exe (GCC) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 [GCC]     : Compiling C file "BootloaderDFU.c"
In file included from ../../LUFA/../LUFA/Drivers/Board/LEDs.h:139,
                 from BootloaderDFU.h:55,
                 from BootloaderDFU.c:37:
../../LUFA/../LUFA/Drivers/Board/AVR8/QMK/LEDs.h: In function 'LEDs_TurnOnLEDs':
../../LUFA/../LUFA/Drivers/Board/AVR8/QMK/LEDs.h:217:38: warning: overflow in conversion from 'int' to 'uint8_t' {aka 'unsigned char'} changes value from '(int)*33 & (~(int)LEDMask & -32768)' to '0' [-Woverflow]
  217 |                 PORT(QMK_SPEAKER) &= (LEDS_LED2 & ~LEDMask);
      |                                      ^
../../LUFA/../LUFA/Drivers/Board/AVR8/QMK/LEDs.h: In function 'LEDs_ToggleLEDs':
../../LUFA/../LUFA/Drivers/Board/AVR8/QMK/LEDs.h:242:37: warning: overflow in conversion from 'int' to 'uint8_t' {aka 'unsigned char'} changes value from '(int)LEDMask & -32768' to '0' [-Woverflow]
  242 |                 PIN(QMK_SPEAKER)  = (LEDS_LED2 & LEDMask);
      |                                     ^
../../LUFA/../LUFA/Drivers/Board/AVR8/QMK/LEDs.h: In function 'LEDs_GetLEDs':
../../LUFA/../LUFA/Drivers/Board/AVR8/QMK/LEDs.h:248:53: warning: overflow in conversion from 'int' to 'uint8_t' {aka 'unsigned char'} changes value from '~(int)*43 & 8 | ~((int)*33 & -32768)' to '255' [-Woverflow]
  248 |                 return (~PORT(QMK_LED) & LEDS_LED1) | (~(PORT(QMK_SPEAKER) & LEDS_LED2));
      |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BootloaderDFU.c: In function 'main':
BootloaderDFU.c:185:35: warning: unsigned conversion from 'int' to 'uint8_t' {aka 'const unsigned char'} changes value from '-32760' to '8' [-Woverflow]
  185 |         LEDs_SetAllLEDs(LEDS_LED1 | LEDS_LED2);
BootloaderDFU.c: In function '__vector_20':
BootloaderDFU.c:276:35: warning: unsigned conversion from 'int' to 'uint8_t' {aka 'const unsigned char'} changes value from '-32760' to '8' [-Woverflow]
  276 |         LEDs_ToggleLEDs(LEDS_LED1 | LEDS_LED2);
BootloaderDFU.c: In function 'EVENT_USB_Device_ControlRequest':
BootloaderDFU.c:293:35: warning: unsigned conversion from 'int' to 'uint8_t' {aka 'const unsigned char'} changes value from '-32760' to '8' [-Woverflow]
  293 |         LEDs_ToggleLEDs(LEDS_LED1 | LEDS_LED2);
 [GCC]     : Compiling C file "Descriptors.c"
 [GCC]     : Compiling C file "BootloaderAPI.c"
 [GAS]     : Assembling "BootloaderAPITable.S"
 [GCC]     : Compiling C file "HIDParser.c"
 [GCC]     : Compiling C file "Device_AVR8.c"
 [GCC]     : Compiling C file "EndpointStream_AVR8.c"
 [GCC]     : Compiling C file "Endpoint_AVR8.c"
 [GCC]     : Compiling C file "Host_AVR8.c"
 [GCC]     : Compiling C file "PipeStream_AVR8.c"
 [GCC]     : Compiling C file "Pipe_AVR8.c"
 [GCC]     : Compiling C file "USBController_AVR8.c"
 [GCC]     : Compiling C file "USBInterrupt_AVR8.c"
 [GCC]     : Compiling C file "ConfigDescriptors.c"
 [GCC]     : Compiling C file "DeviceStandardReq.c"
 [GCC]     : Compiling C file "Events.c"
 [GCC]     : Compiling C file "HostStandardReq.c"
 [GCC]     : Compiling C file "USBTask.c"
 [LNK]     : Linking object files into "BootloaderDFU.elf"
c:/qmk_msys/mingw64/bin/../lib/gcc/avr/12.2.0/../../../../avr/bin/ld.exe: section .apitable_trampolines LMA [00007fa0,00007fb7] overlaps section .data LMA [00007f26,00007fb5]
collect2.exe: error: ld returned 1 exit status
make[1]: *** [../../LUFA/Build/DMBS/DMBS/gcc.mk:251: BootloaderDFU.elf] Error 1
make: *** [platforms/avr/platform.mk:214: bootloader] Error 2

Let me know if this is unrelated and should be opened up as a separate issue.

@tzarc
Copy link
Member Author

tzarc commented Mar 2, 2024

Seems unrelated, likely due to the compiler producing larger binaries. If you’re able to use docker, perhaps try prefixing the command with ./util/docker_cmd.sh to run the compile with a known-working version. If you’ve still got issues, it’s probably to do with your code — building production binaries worked fine when I sorted out the PR.

@MaxJ345
Copy link

MaxJ345 commented Mar 2, 2024

Although my code is old (QMK has moved a lot of the options and other stuff to the info.json file), I don't believe I'm using anything "weird". If I am, please point it out to me!

Here is my code for reference: MaxJ345/qmk_firmware@master...MaxJ345:qmk_firmware:test

dlip added a commit to dlip/qmk_firmware that referenced this pull request Mar 6, 2024
* upstream/master: (245 commits)
  Attempt to fix changed files on CI workflow (qmk#23205)
  Bump peter-evans/create-pull-request from 5 to 6 (qmk#22995)
  Iron180 V2 H: correct key sizes (qmk#23214)
  `mntre_v3`: correct layout data (qmk#23216)
  Iron180 V2 S: correct ANSI Enter key sizes (qmk#23215)
  Workaround for uart makefile issues (qmk#23192)
  Normalise .editorconfig. (qmk#23186)
  Remove cd suggestion from new-keyboard (qmk#23194)
  CLI Speed improvements. (qmk#23189)
  Fix up AVR production build target. (qmk#23190)
  Fixing typos for OSAv2 and OSAv2_Topre (qmk#23161)
  geistmaschine/geist: enable mousekey, fix issues in default/via keymap (qmk#23187)
  Merge point for 2024q1 Breaking Change
  2024q1 `develop` changelog. (qmk#23150)
  Update Atmel DFU driver assignments for dfu-programmer 1.x (qmk#23165)
  Merge upstream uf2conv.py changes (qmk#23163)
  Satisfaction75 post merge updates (qmk#23158)
  Ensmallification of `helix/rev3_5rows:via`. (qmk#23159)
  Cleanup Satisfaction75 Firmware and add new revisions (qmk#22082)
  cipulot/common: Fix for multiple AMUX usage (qmk#23155)
  ...
@MaxJ345
Copy link

MaxJ345 commented Mar 22, 2024

I'm leaving this here in case it helps anyone else having similar issues:

At the time of writing, compiling bootloader or production firmware in a Windows environment is not possible due to dependency issues. MSYS2 (which is used by QMK MSYS in Windows) ships with avr-gcc version 12.2.0, which has errors when trying to run the build. A later version (e.g. 13.2.0) or older version (e.g. 8.3.0) would be necessary to build properly. See here for details.

whoisjordangarcia pushed a commit to whoisjordangarcia/qmk_firmware that referenced this pull request Jun 8, 2024
@dotleon
Copy link

dotleon commented Jul 3, 2024

Downgrading avr-gcc solved this for me.

At the time of writing this, avr-gcc 8.5.0 for MSYS2 is available at msys2 repo site (mingw-w64-x86_64-avr-gcc-8.5.0-1-any.pkg.tar.zst)

Then you can downgrade with
pacman -U mingw-w64-x86_64-avr-gcc-8.5.0-1-any.pkg.tar.zst

After this, production compiles.

nuess0r pushed a commit to nuess0r/qmk_firmware that referenced this pull request Sep 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants