qmk / qmk_firmware

Open-source keyboard firmware for Atmel AVR and Arm USB families
https://qmk.fm
GNU General Public License v2.0
18.24k stars 39.32k forks source link

[Bug] Massdrop::CTRL: MAGIC_ADDR/_eram yields an invalid index in tmk_core #13048

Closed chrisdonlan closed 2 years ago

chrisdonlan commented 3 years ago

Describe the Bug

The ALT keymap compiles for my ALT board. But, my CTRL board fails to compile for reasons related to, it seems, the arm compiler.

Making massdrop/alt with keymap cdonlan and target all

make[3]: Entering directory '/home/chris/shop/interfaces/qmk_firmware'
arm-none-eabi-gcc (Fedora 10.2.0-2.fc33) 10.2.0
Copyright (C) 2020 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.

Size before:
   text    data     bss     dec     hex filename
      0   40328       0   40328    9d88 .build/massdrop_alt_cdonlan.hex

Compiling: keyboards/massdrop/alt/led_programs.c                                                    [OK]
Compiling: keyboards/massdrop/alt/keymaps/cdonlan/keymap.c                                          [OK]
Compiling: tmk_core/common/arm_atsam/bootloader.c                                                   [OK]
Linking: .build/massdrop_alt_cdonlan.elf                                                            [OK]
Creating load file for flashing: .build/massdrop_alt_cdonlan.hex                                    [OK]
Copying massdrop_alt_cdonlan.bin to qmk_firmware folder                                             [OK]
(Firmware size check does not yet support cortex-m4 microprocessors; skipping.)
make[3]: Leaving directory '/home/chris/shop/interfaces/qmk_firmware'
make[2]: Leaving directory '/home/chris/shop/interfaces/qmk_firmware'
cp qmk_firmware/.build/*cdonlan.hex /home/chris/shop/interfaces/.build
make[1]: Leaving directory '/home/chris/shop/interfaces'
./flashboard -x .buld/massdrop_alt_cdonlan.hex
make: ./flashboard: No such file or directory
make: *** [makefile:81: flash-massdrop-alt_cdonlan] Error 127
[chris@localhost interfaces]$ make flash-massdrop-ctrl_cdonlan 
make keyboard path=massdrop/ctrl keyboard=cdonlan
make[1]: Entering directory '/home/chris/shop/interfaces'
cp -r my_keyboards/* qmk_firmware/.
make -C qmk_firmware massdrop/ctrl:cdonlan:all
make[2]: Entering directory '/home/chris/shop/interfaces/qmk_firmware'
QMK Firmware 0.6.199
Making massdrop/ctrl with keymap cdonlan and target all

make[3]: Entering directory '/home/chris/shop/interfaces/qmk_firmware'
arm-none-eabi-gcc (Fedora 10.2.0-2.fc33) 10.2.0
Copyright (C) 2020 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.

Compiling: keyboards/massdrop/ctrl/led_programs.c                                                   [OK]
Compiling: keyboards/massdrop/ctrl/matrix.c                                                         [OK]
Compiling: keyboards/massdrop/ctrl/keymaps/cdonlan/keymap.c                                         [OK]
Compiling: quantum/quantum.c                                                                        [OK]
Compiling: quantum/keymap_common.c                                                                  [OK]
Compiling: quantum/keycode_config.c                                                                 [OK]
Compiling: tmk_core/common/host.c                                                                   [OK]
Compiling: tmk_core/common/keyboard.c                                                               [OK]
Compiling: tmk_core/common/action.c                                                                 [OK]
Compiling: tmk_core/common/action_tapping.c                                                         [OK]
Compiling: tmk_core/common/action_macro.c                                                           [OK]
Compiling: tmk_core/common/action_layer.c                                                           [OK]
Compiling: tmk_core/common/action_util.c                                                            [OK]
Compiling: tmk_core/common/print.c                                                                  [OK]
Compiling: tmk_core/common/debug.c                                                                  [OK]
Compiling: tmk_core/common/util.c                                                                   [OK]
Compiling: tmk_core/common/eeconfig.c                                                               [OK]
Compiling: tmk_core/common/report.c                                                                 [OK]
Compiling: tmk_core/common/arm_atsam/suspend.c                                                      [OK]
Compiling: tmk_core/common/arm_atsam/timer.c                                                        [OK]
Compiling: tmk_core/common/arm_atsam/bootloader.c                                                  tmk_core/common/arm_atsam/bootloader.c: In function 'bootloader_jump':
tmk_core/common/arm_atsam/bootloader.c:35:9: error: array subscript -4 is outside array bounds of 'uint32_t[1]' {aka 'long unsigned int[1]'} [-Werror=array-bounds]
   35 |         *MAGIC_ADDR = BOOTLOADER_MAGIC;                         //Set magic number into RAM
In file included from tmk_core/common/arm_atsam/bootloader.c:19:
tmk_core/protocol/arm_atsam/md_bootloader.h:12:17: note: while referencing '_eram'
   12 | extern uint32_t _eram;
      |                 ^~~~~
cc1: all warnings being treated as errors
 [ERRORS]
 | 
 | 
 | 
make[3]: *** [tmk_core/rules.mk:359: .build/obj_massdrop_ctrl_cdonlan/common/arm_atsam/bootloader.o] Error 1
make[3]: Leaving directory '/home/chris/shop/interfaces/qmk_firmware'
Make finished with errors
make[2]: *** [Makefile:544: massdrop/ctrl:cdonlan:all] Error 1
make[2]: Leaving directory '/home/chris/shop/interfaces/qmk_firmware'
make[1]: *** [makefile:28: keyboard] Error 2
make[1]: Leaving directory '/home/chris/shop/interfaces'
make: *** [makefile:86: flash-massdrop-ctrl_cdonlan] Error 2
[chris@localhost interfaces]$ 

System Information

No additional software installed. I am reflashing with working settings on this updated version of QMK.

I have added -fcommon to the CFLAGS in my rules.mk file to get my ALT to compile. I applied the same change to my CTRL rules.mk.

Additional Context

Looks like _eram is missing.

./tmk_core/protocol/arm_atsam/md_bootloader.h:14:#define MAGIC_ADDR (uint32_t *)(&_eram - 4)
chrisdonlan commented 3 years ago

I should add that I pulled this CTRL out of storage today; it is about 3 years old.

chrisdonlan commented 3 years ago

I deleted the -4 and everything compiles. Checking if the board works...

chrisdonlan commented 3 years ago

Nope, it killed the board.

zvecr commented 2 years ago

This issue has been automatically closed because it has not had any recent activity. If this issue is still valid, re-open the issue and let us know.