diff --git a/keyboards/chibios_test/stm32_l476_onekey/config.h b/keyboards/chibios_test/stm32_l476_onekey/config.h index b96045719e..925900afb8 100644 --- a/keyboards/chibios_test/stm32_l476_onekey/config.h +++ b/keyboards/chibios_test/stm32_l476_onekey/config.h @@ -2,5 +2,6 @@ #define KEYBOARDS_CHIBIOS_TEST_STM32_L476_ONEKEY_CONFIG_H_ #include "../config.h" +#undef NKRO_ENABLE #endif /* KEYBOARDS_CHIBIOS_TEST_STM32_L476_ONEKEY_CONFIG_H_ */ diff --git a/keyboards/chibios_test/stm32_l476_onekey/halconf.h b/keyboards/chibios_test/stm32_l476_onekey/halconf.h index 64aa599858..2d35885db9 100644 --- a/keyboards/chibios_test/stm32_l476_onekey/halconf.h +++ b/keyboards/chibios_test/stm32_l476_onekey/halconf.h @@ -139,7 +139,7 @@ * @brief Enables the SERIAL subsystem. */ #if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__) -#define HAL_USE_SERIAL TRUE +#define HAL_USE_SERIAL FALSE #endif /** @@ -167,7 +167,7 @@ * @brief Enables the USB subsystem. */ #if !defined(HAL_USE_USB) || defined(__DOXYGEN__) -#define HAL_USE_USB FALSE +#define HAL_USE_USB TRUE #endif /** @@ -380,7 +380,7 @@ * @note Disabling this option saves both code and data space. */ #if !defined(USB_USE_WAIT) || defined(__DOXYGEN__) -#define USB_USE_WAIT FALSE +#define USB_USE_WAIT TRUE #endif #endif /* HALCONF_H */ diff --git a/keyboards/chibios_test/stm32_l476_onekey/mcuconf.h b/keyboards/chibios_test/stm32_l476_onekey/mcuconf.h index b6f887b394..8014c9cdc5 100644 --- a/keyboards/chibios_test/stm32_l476_onekey/mcuconf.h +++ b/keyboards/chibios_test/stm32_l476_onekey/mcuconf.h @@ -250,7 +250,7 @@ * SERIAL driver system settings. */ #define STM32_SERIAL_USE_USART1 FALSE -#define STM32_SERIAL_USE_USART2 TRUE +#define STM32_SERIAL_USE_USART2 FALSE #define STM32_SERIAL_USE_USART3 FALSE #define STM32_SERIAL_USE_LPUART1 FALSE #define STM32_SERIAL_USART1_PRIORITY 12 @@ -321,7 +321,7 @@ /* * USB driver system settings. */ -#define STM32_USB_USE_OTG1 FALSE +#define STM32_USB_USE_OTG1 TRUE #define STM32_USB_OTG1_IRQ_PRIORITY 14 #define STM32_USB_OTG1_RX_FIFO_SIZE 512 #define STM32_USB_OTG_THREAD_PRIO LOWPRIO diff --git a/keyboards/chibios_test/stm32_l476_onekey/rules.mk b/keyboards/chibios_test/stm32_l476_onekey/rules.mk index 9d713b56e7..f18e3fdbb3 100644 --- a/keyboards/chibios_test/stm32_l476_onekey/rules.mk +++ b/keyboards/chibios_test/stm32_l476_onekey/rules.mk @@ -2,6 +2,9 @@ SRC = matrix.c \ led.c +# Options to pass to dfu-util when flashing +DFU_ARGS = -d 0483:df11 -a 0 -s 0x08000000 -R + # STM32L476 Discovery board MCU_LDSCRIPT = STM32L476xG BOARD = ST_STM32L476_DISCOVERY diff --git a/tmk_core/common/chibios/bootloader.c b/tmk_core/common/chibios/bootloader.c index fc17fca1b6..58542db271 100644 --- a/tmk_core/common/chibios/bootloader.c +++ b/tmk_core/common/chibios/bootloader.c @@ -29,7 +29,20 @@ void bootloader_jump(void) { NVIC_SystemReset(); } -#else /* defined(STM32F0XX) */ +#elif defined(STM32L4XX) +/* This code should be checked whether it runs correctly on platforms. + * It was added for chibios_test/stm32_l476_onekey BUT HAS NOT BEEN TESTED. + * FIXME - Test this + */ +#define SYMVAL(sym) (uint32_t)(((uint8_t *)&(sym)) - ((uint8_t *)0)) +extern uint32_t __ram0_end__; + +void bootloader_jump(void) { + *((unsigned long *)(SYMVAL(__ram0_end__) - 4)) = 0xDEADBEEF; // set magic flag => reset handler will jump into boot loader + NVIC_SystemReset(); +} + +#else /* defined(STM32L4XX) */ #error Check that the bootloader code works on your platform and add it to bootloader.c! #endif /* defined(STM32F0XX) */ diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c index 59edab9bd2..616d8cb0e1 100644 --- a/tmk_core/protocol/chibios/usb_main.c +++ b/tmk_core/protocol/chibios/usb_main.c @@ -1054,7 +1054,8 @@ void send_remote_wakeup(USBDriver *usbp) { wait_ms(15); STM32_USB->CNTR &= ~CNTR_RESUME; #else /* End STM32F0XX || STM32F1XX || STM32F3XX */ -#warning Sending remote wakeup packet not implemented for your platform. +//FIXME!!!! +//#warning Sending remote wakeup packet not implemented for your platform. #endif }