]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
ARM split - Add support for dfu-util EE_HANDS flashing (#6543)
authorJoel Challis <git@zvecr.com>
Fri, 27 Sep 2019 20:33:55 +0000 (21:33 +0100)
committerGitHub <noreply@github.com>
Fri, 27 Sep 2019 20:33:55 +0000 (21:33 +0100)
* Initial stab at some fake dfu-util-split-left behaviour

* Apply suggestions from code review

Co-Authored-By: fauxpark <fauxpark@gmail.com>
* Clang format fixes

* Fake eeprom init for both left and right hand

docs/config_options.md
docs/feature_split_keyboard.md
docs/flashing.md
docs/newbs_flashing.md
tmk_core/chibios.mk
tmk_core/common/eeconfig.c

index 77e2368f3db9b67a7bb07e97b86ef9385c8b93c9..9e43f47c259e4d7a400166eb4d505dddee781dfc 100644 (file)
@@ -224,6 +224,7 @@ There are a few different ways to set handedness for split keyboards (listed in
 2. Set `EE_HANDS` and flash `eeprom-lefthand.eep`/`eeprom-righthand.eep` to each half
    * For boards with DFU bootloader you can use `:dfu-split-left`/`:dfu-split-right` to flash these EEPROM files
    * For boards with Caterina bootloader (like stock Pro Micros), use `:avrdude-split-left`/`:avrdude-split-right`
+   * For boards with ARM DFU bootloader (like Proton C), use `:dfu-util-split-left`/`:dfu-util-split-right`
 3. Set `MASTER_RIGHT`: Half that is plugged into the USB port is determined to be the master and right half (inverse of the default)
 4. Default: The side that is plugged into the USB port is the master half and is assumed to be the left half. The slave side is the right half
 
index 60e0d278c05acd8e066e3bf5db64ba8ff0187ce7..42dd838d0da915b6bbdaf5fb1932dae34c1ec7bc 100644 (file)
@@ -96,6 +96,8 @@ However, you'll have to flash the EEPROM files for the correct hand to each cont
 * `:avrdude-split-right`
 * `:dfu-split-left`
 * `:dfu-split-right`
+* `:dfu-util-split-left`
+* `:dfu-util-split-right`
 
 This setting is not changed when re-initializing the EEPROM using the `EEP_RST` key, or using the `eeconfig_init()` function.  However, if you reset the EEPROM outside of the firmware's built in options (such as flashing a file that overwrites the `EEPROM`, like how the [QMK Toolbox]()'s "Reset EEPROM" button works), you'll need to re-flash the controller with the `EEPROM` files. 
 
index 00350b8406e187868ee52639ef2ecd7819fbd81e..18ae6364d42efdcc6c968097167866d16cab8f56 100644 (file)
@@ -232,4 +232,6 @@ Flashing sequence:
 There are a number of DFU commands that you can use to flash firmware to a STM32 device:
 
 * `:dfu-util` - The default command for flashing to STM32 devices.
-* `:st-link-cli` - This allows you to flash the firmware via ST-LINK's CLI utility, rather than dfu-util.
+* `:dfu-util-split-left` - This flashes the normal firmware, just like the default option (`:dfu-util`). However, this also configures the "Left Side" EEPROM setting for split keyboards.
+* `:dfu-util-split-right` - This flashes the normal firmware, just like the default option (`:dfu-util`). However, this also configures the "Right Side" EEPROM setting for split keyboards.
+* `:st-link-cli` - This allows you to flash the firmware via ST-LINK's CLI utility, rather than dfu-util. 
index 3bf582d7f63169fef98fa94bd776b9764f491840..4fb2f91d578bf0c635101d14674c88bab3d555f1 100644 (file)
@@ -215,7 +215,7 @@ Additionally, if you want to flash multiple boards, use the following command:
 When you're done flashing boards, you'll need to hit Ctrl + C or whatever the correct keystroke is for your operating system to break the loop.
 
 
-## HalfKay
+### HalfKay
 
 For the PJRC devices (Teensy's), when you're ready to compile and flash your firmware, open up your terminal window and run the build command: 
 
@@ -248,7 +248,7 @@ Programming.....................................................................
 Booting
 ```
 
-## BootloadHID
+### BootloadHID
 
 For Bootmapper Client(BMC)/bootloadHID/ATmega32A based boards, when you're ready to compile and flash your firmware, open up your terminal window and run the build command: 
 
@@ -284,7 +284,7 @@ Uploading 22016 (0x5600) bytes starting at 0 (0x0)
 0x05580 ... 0x05600
 ```
 
-## STM32 (ARM)
+### STM32 (ARM)
 
 For a majority of ARM boards (including the Proton C, Planck Rev 6, and Preonic Rev 3), when you're ready to compile and flash your firmware, open up your terminal window and run the build command: 
 
@@ -334,6 +334,16 @@ File downloaded successfully
 Transitioning to dfuMANIFEST state
 ```
 
+#### STM32 Commands
+
+There are a number of DFU commands that you can use to flash firmware to a STM32 device:
+
+* `:dfu-util` - The default command for flashing to STM32 devices. 
+* `:dfu-util-wait` - This works like the default command, but it gives you a (configurable) 10 second timeout before it attempts to flash the firmware.  You can use `TIME_DELAY=20` from the command line to change the timeout.
+   * Eg: `make <keyboard>:<keymap>:dfu-util TIME_DELAY=5`
+* `:dfu-util-split-left` - This flashes the normal firmware, just like the default option (`:dfu-util`). However, this also configures the "Left Side" EEPROM setting for split keyboards.
+* `:dfu-util-split-right` - This flashes the normal firmware, just like the default option (`:dfu-util`). However, this also configures the "Right Side" EEPROM setting for split keyboards.
+
 ## Test It Out!
 
 Congrats! Your custom firmware has been programmed to your keyboard!
index c25e287071f9acaef1dd307a5448109b1eaa36b0..62e1561878aaede93e75c2579249b2b3548ead3f 100644 (file)
@@ -248,6 +248,21 @@ dfu-util: $(BUILD_DIR)/$(TARGET).bin cpfirmware sizeafter
 # Legacy alias
 dfu-util-wait: dfu-util
 
+# TODO: Remove once ARM has a way to configure EECONFIG_HANDEDNESS
+#       within the emulated eeprom via dfu-util or another tool
+ifneq (,$(filter $(MAKECMDGOALS),dfu-util-split-left))
+    OPT_DEFS += -DINIT_EE_HANDS_LEFT
+endif
+
+ifneq (,$(filter $(MAKECMDGOALS),dfu-util-split-right))
+    OPT_DEFS += -DINIT_EE_HANDS_RIGHT
+endif
+
+dfu-util-split-left: dfu-util
+
+dfu-util-split-right: dfu-util
+
+
 st-link-cli: $(BUILD_DIR)/$(TARGET).hex sizeafter
        $(ST_LINK_CLI) $(ST_LINK_ARGS) -q -c SWD -p $(BUILD_DIR)/$(TARGET).hex -Rst
 
index 933ac42bd2d829390f64f22ae5c845300a550cde..4cf4ca3acea5a90eae8889677073420e2d2b9538 100644 (file)
@@ -48,6 +48,16 @@ void eeconfig_init_quantum(void) {
     eeprom_update_dword(EECONFIG_RGB_MATRIX, 0);
     eeprom_update_byte(EECONFIG_RGB_MATRIX_SPEED, 0);
 
+    // TODO: Remove once ARM has a way to configure EECONFIG_HANDEDNESS
+    //        within the emulated eeprom via dfu-util or another tool
+#if defined INIT_EE_HANDS_LEFT
+    #pragma message "Faking EE_HANDS for left hand"
+    eeprom_update_byte(EECONFIG_HANDEDNESS, 1);
+#elif defined INIT_EE_HANDS_RIGHT
+    #pragma message "Faking EE_HANDS for right hand"
+    eeprom_update_byte(EECONFIG_HANDEDNESS, 0);
+#endif
+
     eeconfig_init_kb();
 }