qmk / qmk_firmware

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

EZ configurator keymap.c infinity make error #1080

Closed leshow closed 7 years ago

leshow commented 7 years ago

I have an Ergodox Infinity, one of the newer ones with USB-C & LCD screen. I read your readme so I know layouts inter-operate between the infinity/ez.

The EZ online configurator (http://configure.ergodox-ez.com/keyboard_layouts/) is superior to the input club and massdrop one in the number of options it provides. I wanted to take the keymap generated from it and flash it to my infinity. I downloaded the source generated from the online configurator, made a new dir in keymaps called minelayout, and put the source in that dir as keymap.c.

I then ran make infinity-minelayout and got this error:

ergodox - master! ❯ make infinity-minelayout
Making ergodox/infinity with keymap minelayout

arm-none-eabi-gcc (15:5.4.1+svn241155-1) 5.4.1 20160919
Copyright (C) 2015 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/ergodox/infinity/matrix.c                                                      [OK]
Compiling: keyboards/ergodox/infinity/led.c                                                         [OK]
Compiling: ./tmk_core/protocol/chibios/usb_main.c                                                   [OK]
Compiling: ./tmk_core/protocol/chibios/main.c                                                       [OK]
Compiling: keyboards/ergodox/ergodox.c                                                              [OK]
Compiling: keyboards/ergodox/keymaps/minelayout/keymap.c                                           keyboards/ergodox/keymaps/minelayout/keymap.c: In function 'process_record_user':
keyboards/ergodox/keymaps/minelayout/keymap.c:69:9: warning: implicit declaration of function 'rgblight_mode' [-Wimplicit-function-declaration]
         rgblight_mode(1);
         ^
 [OK]
Compiling: quantum/quantum.c                                                                        [OK]
Compiling: quantum/keymap_common.c                                                                 In file included from ./tmk_core/common/action_macro.h:20:0,
                 from ./tmk_core/common/action.h:25,
                 from quantum/keymap.h:23,
                 from quantum/keymap_common.c:18:
quantum/keymap_common.c: In function 'keymap_function_id_to_action':
quantum/keymap_common.c:179:34: warning: array subscript is above array bounds [-Warray-bounds]
  return pgm_read_word(&fn_actions[function_id]);
                                  ^
./tmk_core/common/progmem.h:9:46: note: in definition of macro 'pgm_read_word'
 #   define pgm_read_word(p)     *((uint16_t*)p)
                                              ^
 [OK]
Compiling: quantum/keycode_config.c                                                                 [OK]
Compiling: quantum/process_keycode/process_leader.c                                                 [OK]
Compiling: keyboards/ergodox/infinity/infinity.c                                                    [OK]
Compiling: quantum/process_keycode/process_unicode.c                                                [OK]
Compiling: ./quantum/serial_link/protocol/transport.c                                               [OK]
Compiling: ./quantum/serial_link/protocol/triple_buffered_object.c                                  [OK]
Compiling: ./quantum/serial_link/protocol/frame_validator.c                                         [OK]
Compiling: ./quantum/serial_link/protocol/frame_router.c                                            [OK]
Compiling: ./quantum/serial_link/protocol/byte_stuffer.c                                            [OK]
Compiling: ./quantum/serial_link/system/serial_link.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/chibios/suspend.c                                                      [OK]
Compiling: ./tmk_core/common/chibios/timer.c                                                        [OK]
Compiling: ./tmk_core/common/chibios/bootloader.c                                                   [OK]
Compiling: ./tmk_core/common/chibios/printf.c                                                       [OK]
Compiling: ./tmk_core/common/chibios/eeprom.c                                                       [OK]
Compiling: ./tmk_core/common/magic.c                                                                [OK]
Compiling: ./tmk_core/common/mousekey.c                                                             [OK]
Compiling: ./tmk_core/common/command.c                                                              [OK]
Compiling: ./tmk_core/common/chibios/sleep_led.c                                                    [OK]
Compiling: lib/chibios/os/common/startup/ARMCMx/compilers/GCC/crt1.c                                [OK]
Compiling: lib/chibios/os/common/startup/ARMCMx/compilers/GCC/vectors.c                             [OK]
Compiling: lib/chibios/os/rt/src/chsys.c                                                            [OK]
Compiling: lib/chibios/os/rt/src/chdebug.c                                                          [OK]
Compiling: lib/chibios/os/rt/src/chtrace.c                                                          [OK]
Compiling: lib/chibios/os/rt/src/chvt.c                                                             [OK]
Compiling: lib/chibios/os/rt/src/chschd.c                                                           [OK]
Compiling: lib/chibios/os/rt/src/chthreads.c                                                        [OK]
Compiling: lib/chibios/os/rt/src/chtm.c                                                             [OK]
Compiling: lib/chibios/os/rt/src/chstats.c                                                          [OK]
Compiling: lib/chibios/os/rt/src/chregistry.c                                                       [OK]
Compiling: lib/chibios/os/rt/src/chsem.c                                                            [OK]
Compiling: lib/chibios/os/rt/src/chmtx.c                                                            [OK]
Compiling: lib/chibios/os/rt/src/chcond.c                                                           [OK]
Compiling: lib/chibios/os/rt/src/chevents.c                                                         [OK]
Compiling: lib/chibios/os/rt/src/chmsg.c                                                            [OK]
Compiling: lib/chibios/os/rt/src/chdynamic.c                                                        [OK]
Compiling: lib/chibios/os/common/oslib/src/chmboxes.c                                               [OK]
Compiling: lib/chibios/os/common/oslib/src/chmemcore.c                                              [OK]
Compiling: lib/chibios/os/common/oslib/src/chheap.c                                                 [OK]
Compiling: lib/chibios/os/common/oslib/src/chmempools.c                                             [OK]
Compiling: lib/chibios/os/common/ports/ARMCMx/chcore.c                                              [OK]
Compiling: lib/chibios/os/common/ports/ARMCMx/chcore_v7m.c                                          [OK]
Compiling: lib/chibios/os/hal/osal/rt/osal.c                                                        [OK]
Compiling: lib/chibios/os/hal/src/hal.c                                                             [OK]
Compiling: lib/chibios/os/hal/src/hal_buffers.c                                                     [OK]
Compiling: lib/chibios/os/hal/src/hal_queues.c                                                      [OK]
Compiling: lib/chibios/os/hal/src/hal_mmcsd.c                                                       [OK]
Compiling: lib/chibios/os/hal/src/hal_adc.c                                                         [OK]
Compiling: lib/chibios/os/hal/src/hal_can.c                                                         [OK]
Compiling: lib/chibios/os/hal/src/hal_dac.c                                                         [OK]
Compiling: lib/chibios/os/hal/src/hal_ext.c                                                         [OK]
Compiling: lib/chibios/os/hal/src/hal_gpt.c                                                         [OK]
Compiling: lib/chibios/os/hal/src/hal_i2c.c                                                         [OK]
Compiling: lib/chibios/os/hal/src/hal_i2s.c                                                         [OK]
Compiling: lib/chibios/os/hal/src/hal_icu.c                                                         [OK]
Compiling: lib/chibios/os/hal/src/hal_mac.c                                                         [OK]
Compiling: lib/chibios/os/hal/src/hal_mmc_spi.c                                                     [OK]
Compiling: lib/chibios/os/hal/src/hal_pal.c                                                         [OK]
Compiling: lib/chibios/os/hal/src/hal_pwm.c                                                         [OK]
Compiling: lib/chibios/os/hal/src/hal_qspi.c                                                        [OK]
Compiling: lib/chibios/os/hal/src/hal_rtc.c                                                         [OK]
Compiling: lib/chibios/os/hal/src/hal_sdc.c                                                         [OK]
Compiling: lib/chibios/os/hal/src/hal_serial.c                                                      [OK]
Compiling: lib/chibios/os/hal/src/hal_serial_usb.c                                                  [OK]
Compiling: lib/chibios/os/hal/src/hal_spi.c                                                         [OK]
Compiling: lib/chibios/os/hal/src/hal_st.c                                                          [OK]
Compiling: lib/chibios/os/hal/src/hal_uart.c                                                        [OK]
Compiling: lib/chibios/os/hal/src/hal_usb.c                                                         [OK]
Compiling: lib/chibios/os/hal/src/hal_wdg.c                                                         [OK]
Compiling: lib/chibios/os/hal/ports/common/ARMCMx/nvic.c                                            [OK]
Compiling: lib/chibios-contrib/os/hal/ports/KINETIS/K20x/hal_lld.c                                  [OK]
Compiling: lib/chibios-contrib/os/hal/ports/KINETIS/LLD/hal_pal_lld.c                               [OK]
Compiling: lib/chibios-contrib/os/hal/ports/KINETIS/LLD/hal_serial_lld.c                            [OK]
Compiling: lib/chibios-contrib/os/hal/ports/KINETIS/K20x/hal_spi_lld.c                              [OK]
Compiling: lib/chibios-contrib/os/hal/ports/KINETIS/LLD/hal_i2c_lld.c                               [OK]
Compiling: lib/chibios-contrib/os/hal/ports/KINETIS/LLD/hal_ext_lld.c                               [OK]
Compiling: lib/chibios-contrib/os/hal/ports/KINETIS/LLD/hal_adc_lld.c                               [OK]
Compiling: lib/chibios-contrib/os/hal/ports/KINETIS/LLD/hal_gpt_lld.c                               [OK]
Compiling: lib/chibios-contrib/os/hal/ports/KINETIS/K20x/hal_pwm_lld.c                              [OK]
Compiling: lib/chibios-contrib/os/hal/ports/KINETIS/LLD/hal_st_lld.c                                [OK]
Compiling: lib/chibios-contrib/os/hal/ports/KINETIS/LLD/hal_usb_lld.c                               [OK]
Compiling: lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3_1/board.c                                [OK]
Compiling: lib/chibios/os/hal/lib/streams/chprintf.c                                                [OK]
Compiling: lib/chibios/os/hal/lib/streams/memstreams.c                                              [OK]
Compiling: lib/chibios/os/hal/lib/streams/nullstreams.c                                             [OK]
Assembling: lib/chibios/os/common/startup/ARMCMx/compilers/GCC/crt0_v7m.S                           [OK]
Assembling: lib/chibios/os/common/ports/ARMCMx/compilers/GCC/chcoreasm_v7m.S                        [OK]
Linking: .build/ergodox_infinity_minelayout.elf                                                     [ERRORS]
 | 
 | .build/obj_ergodox_infinity_minelayout/keyboards/ergodox/keymaps/minelayout/keymap.o: In function `process_record_user':
 | .build/obj_ergodox_infinity_minelayout/keyboards/ergodox/keymaps/minelayout/keymap.o: In function `process_record_user':
 | /home/evan/personal/config/qmk_firmware/keyboards/ergodox/keymaps/minelayout/keymap.c:69: undefined reference to `rgblight_mode'
 | collect2: error: ld returned 1 exit status
 | 
tmk_core/rules.mk:279: recipe for target '.build/ergodox_infinity_minelayout.elf' failed
make[1]: *** [.build/ergodox_infinity_minelayout.elf] Error 1
../../Makefile:489: recipe for target 'infinity-minelayout' failed
Make finished with errors
make: *** [infinity-minelayout] Error 1
leshow commented 7 years ago

Looking at the default keymap.c vs the one generated by the EZ configurator default/keymap.c:

    case RGB_SLD:
      if (record->event.pressed) {
        #ifdef RGBLIGHT_ENABLE
          rgblight_mode(1);
        #endif
      }
      return false;

from ez configurator

    case RGB_SLD:
      if (record->event.pressed) {
        rgblight_mode(1);
      }
      return false;
      break;

  }

If I add this ifdef the EZ layout builds properly using make-infinity.

the EZ also is missing a blank function:

// Runs just one time when the keyboard initializes.
void matrix_init_user(void) {
};

is this function necessary? I was able to build for the infinity without it.

I have the EZ configurator layout built now using make ergodox-infinity. I'm worried I missed something and I'll brick my device if I flash it. Do I have anything to worry about? Will qmk automatically change the LCD when I switch layers, etc?

The keymap() object is also slightly different between them. For example:

KEYMAP(KC_EQUAL,KC_1,KC_2,KC_3,KC_4,KC_5,KC_ESCAPE,KC_DELETE,KC_Q,KC_W,KC_E,KC_R,KC_T,TG(4),GUI_T(KC_TAB),KC_A,KC_S,KC_D,KC_F,LT(3,KC_G),KC_LSHIFT,CTL_T(KC_Z),KC_X,KC_C,KC_V,KC_B,MO(1),KC_LGUI,KC_LALT,KC_GRAVE,MO(3),KC_LCTL,KC_INSERT,KC_CAPSLOCK,KC_HOME,KC_BSPACE,KC_DELETE,KC_END,MO(2),KC_6,KC_7,KC_8,KC_9,KC_0,KC_MINUS,MO(4),KC_Y,KC_U,KC_I,KC_O,KC_P,KC_BSPACE,KC_H,KC_J,KC_K,KC_L,LT(2,KC_SCOLON),GUI_T(KC_QUOTE),MO(1),KC_N,KC_M,KC_COMMA,KC_DOT,CTL_T(KC_SLASH),KC_LSHIFT,KC_LEFT,KC_DOWN,KC_UP,KC_RIGHT,KC_LGUI,KC_LALT,CTL_T(KC_ESCAPE),KC_PGUP,KC_PGDOWN,KC_ENTER,KC_SPACE)
jackhumbert commented 7 years ago

As far as I know, the RGB stuff won't work on ARM, so adding the ifdef or removing the rgblight line should allow things to work :)

The blank function isn't necessary - it's just there in case you'd like to add something to it, but it doesn't hurt to have.

I don't think it's possible to brick ARM by flashing the wrong keymap (it looks like this one will work though), but I'm not the most experienced in ARM right now.

I don't know if QMK's setup to control the LCD on the infinity right now unfortunately!

leshow commented 7 years ago

Thanks. So I was able to flash the firmware and everything appears to be working except for the LCD screens. There is no light coming from them and they aren't displaying anything.

r2d2rogers commented 7 years ago

I have a branch on my fork of qmk that uses the visualizer files to change the background color and display the layer name on the LCD screen, based on @fredizzimo 's TMK fork. I haven't taken the time to do more than see what works. I'm waiting for the new effects system he is working on to do more than that.

leshow commented 7 years ago

@r2d2rogers awesome! I may try flashing yours then. Do I just build how I normally would with creating a keymaps.c and running make, etc? I don't want anything fancy, I'd just like to see the layer number and have the colour change.

Are you waiting for the 'effects system' to be integrated into QMK or in fredizzimo's TMK fork? Is there any timeline for this stuff making it's way in to QMK?

The whole reason I wanted to flash this is because the KLL firmware doesn't seem to support dual-role keys, and I think they are essential. I'd prefer not to sacrifice my LCD for them though.

r2d2rogers commented 7 years ago

Dual role is exactly what I jumped over here for myself. It's the r2d2rogers branch of my fork of qmk_firmware. I was waiting till I filled in a bit more of the spaceFN style layers before I submitted to a pull request.
For the dual role keys, see how I'm using what would be caps lock for a ctrl/esc, and the right hand thumb key that is space and momentary layer, for the spaceFN I was talking about.

Edit: Forgot a question, fredizzimo is working on the effects system for qmk.

leshow commented 7 years ago

@r2d2rogers I have a keymap.c with my own layout an dual role keys set up already. Can I not just overwrite your keymap in ergodox/keymaps/r2d2rogers and then flash?

r2d2rogers commented 7 years ago

That should work, sorry, didn't read up top and see that you had already gotten a keymap setup.

fredizzimo commented 7 years ago

Regarding the original bug. The plan is to have either empty implementation or some kind of emulation of the Ergodox features. So in this case you shouldn't need to add #ifdefs around rgblight_mode. Many other functions are already implemented as dummies, but this function is not for some reason. Is there no keymap in the repository that actually uses it? Since in that case, it should have caused errors in our continous integration system as well.

In any case, I will add an empty implementation to make it work without changes.