aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/chibios_upgrade_instructions.md23
-rw-r--r--keyboards/matrix/m20add/mcuconf.h65
-rw-r--r--keyboards/matrix/noah/mcuconf.h65
m---------lib/chibios0
-rw-r--r--platforms/chibios/boards/BLACKPILL_STM32_F401/configs/mcuconf.h71
-rw-r--r--platforms/chibios/boards/BLACKPILL_STM32_F411/configs/mcuconf.h65
-rw-r--r--platforms/chibios/boards/GENERIC_STM32_F405XG/configs/mcuconf.h3
-rw-r--r--platforms/chibios/boards/GENERIC_STM32_F407XE/configs/mcuconf.h3
-rw-r--r--platforms/chibios/boards/GENERIC_STM32_F446XE/configs/mcuconf.h108
-rw-r--r--platforms/chibios/boards/GENERIC_STM32_G431XB/configs/mcuconf.h15
-rw-r--r--platforms/chibios/boards/GENERIC_STM32_G474XE/configs/mcuconf.h15
-rw-r--r--platforms/chibios/boards/QMK_PROTON_C/configs/chconf.h2
-rw-r--r--platforms/chibios/boards/common/configs/chconf.h2
-rw-r--r--tmk_core/chibios.mk24
-rw-r--r--tmk_core/protocol/chibios/usb_main.c12
-rwxr-xr-xutil/chibios_conf_updater.sh101
-rwxr-xr-xutil/update_chibios_mirror.sh4
17 files changed, 275 insertions, 303 deletions
diff --git a/docs/chibios_upgrade_instructions.md b/docs/chibios_upgrade_instructions.md
index 40c2faafc..b0a71142a 100644
--- a/docs/chibios_upgrade_instructions.md
+++ b/docs/chibios_upgrade_instructions.md
@@ -14,10 +14,10 @@ ChibiOS and ChibiOS-Contrib need to be updated in tandem -- the latter has a bra
14 * First time around this will take several hours 14 * First time around this will take several hours
15 * Subsequent updates will be incremental only 15 * Subsequent updates will be incremental only
16* Tagging example (work out which version first!): 16* Tagging example (work out which version first!):
17 * `git tag -a ver20.3.3 -m ver20.3.3 svn/tags/ver20.3.3` 17 * `git tag -a ver20.3.4 -m ver20.3.4 svn/tags/ver20.3.4`
18 * `git push qmk ver20.3.3` 18 * `git push qmk ver20.3.4`
19 * `git tag -a breaking_YYYY_qN -m breaking_YYYY_qN svn/tags/ver20.3.3` 19 * `git tag -a develop_YYYY_qN -m develop_YYYY_qN svn/tags/ver20.3.4`
20 * `git push qmk breaking_YYYY_qN` 20 * `git push qmk develop_YYYY_qN`
21 21
22## Getting ChibiOS-Contrib 22## Getting ChibiOS-Contrib
23 23
@@ -30,8 +30,8 @@ ChibiOS and ChibiOS-Contrib need to be updated in tandem -- the latter has a bra
30 * `git checkout chibios-20.3.x` 30 * `git checkout chibios-20.3.x`
31 * `git pull --ff-only` 31 * `git pull --ff-only`
32 * `git push origin chibios-20.3.x` 32 * `git push origin chibios-20.3.x`
33 * `git tag -a breaking_YYYY_qN -m breaking_YYYY_qN chibios-20.3.x` 33 * `git tag -a develop_YYYY_qN -m develop_YYYY_qN chibios-20.3.x`
34 * `git push origin breaking_YYYY_qN` 34 * `git push origin develop_YYYY_qN`
35 35
36## Updating submodules 36## Updating submodules
37 37
@@ -42,15 +42,18 @@ ChibiOS and ChibiOS-Contrib need to be updated in tandem -- the latter has a bra
42 * `git checkout -b chibios-version-bump` 42 * `git checkout -b chibios-version-bump`
43 * `cd lib/chibios` 43 * `cd lib/chibios`
44 * `git fetch --all --tags --prune` 44 * `git fetch --all --tags --prune`
45 * `git checkout breaking_YYYY_qN` 45 * `git checkout develop_YYYY_qN`
46 * `cd ../chibios-contrib` 46 * `cd ../chibios-contrib`
47 * `git fetch --all --tags --prune` 47 * `git fetch --all --tags --prune`
48 * `git checkout breaking_YYYY_qN` 48 * `git checkout develop_YYYY_qN`
49* Update ChibiOS configs within QMK
50 * `cd $QMK_FIRMWARE`
51 * `./util/chibios_conf_updater.sh`
49* Build everything 52* Build everything
50 * `cd $QMK_FIRMWARE` 53 * `cd $QMK_FIRMWARE`
51 * `qmk multibuild -j4` 54 * `qmk multibuild -j4`
52 * Make sure there are no errors 55 * Make sure there are no errors
53* Push to the repo 56* Push to the repo
54 * `git commit -am 'Update ChibiOS to XXXXXXXXX'` 57 * `git commit -am 'Update ChibiOS to 99.9.9'`
55 * `git push --set-upstream origin chibios-version-bump` 58 * `git push --set-upstream origin chibios-version-bump`
56* Make a PR to qmk_firmware with the new branch \ No newline at end of file 59* Make a PR to qmk_firmware with the new branch
diff --git a/keyboards/matrix/m20add/mcuconf.h b/keyboards/matrix/m20add/mcuconf.h
index 54a1f2661..00216f690 100644
--- a/keyboards/matrix/m20add/mcuconf.h
+++ b/keyboards/matrix/m20add/mcuconf.h
@@ -1,5 +1,5 @@
1/* 1/*
2 ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio 2 ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
3 3
4 Licensed under the Apache License, Version 2.0 (the "License"); 4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License. 5 you may not use this file except in compliance with the License.
@@ -32,11 +32,15 @@
32 */ 32 */
33 33
34#define STM32F4xx_MCUCONF 34#define STM32F4xx_MCUCONF
35#define STM32F411_MCUCONF
35 36
36/* 37/*
37 * HAL driver system settings. 38 * HAL driver system settings.
38 */ 39 */
39#define STM32_NO_INIT FALSE 40#define STM32_NO_INIT FALSE
41#define STM32_PVD_ENABLE FALSE
42#define STM32_PLS STM32_PLS_LEV0
43#define STM32_BKPRAM_ENABLE FALSE
40#define STM32_HSI_ENABLED TRUE 44#define STM32_HSI_ENABLED TRUE
41#define STM32_LSI_ENABLED TRUE 45#define STM32_LSI_ENABLED TRUE
42#define STM32_HSE_ENABLED TRUE 46#define STM32_HSE_ENABLED TRUE
@@ -60,9 +64,6 @@
60#define STM32_I2SSRC STM32_I2SSRC_CKIN 64#define STM32_I2SSRC STM32_I2SSRC_CKIN
61#define STM32_PLLI2SN_VALUE 192 65#define STM32_PLLI2SN_VALUE 192
62#define STM32_PLLI2SR_VALUE 5 66#define STM32_PLLI2SR_VALUE 5
63#define STM32_PVD_ENABLE FALSE
64#define STM32_PLS STM32_PLS_LEV0
65#define STM32_BKPRAM_ENABLE FALSE
66 67
67/* 68/*
68 * IRQ system settings. 69 * IRQ system settings.
@@ -82,6 +83,19 @@
82#define STM32_IRQ_EXTI21_PRIORITY 15 83#define STM32_IRQ_EXTI21_PRIORITY 15
83#define STM32_IRQ_EXTI22_PRIORITY 15 84#define STM32_IRQ_EXTI22_PRIORITY 15
84 85
86#define STM32_IRQ_TIM1_BRK_TIM9_PRIORITY 7
87#define STM32_IRQ_TIM1_UP_TIM10_PRIORITY 7
88#define STM32_IRQ_TIM1_TRGCO_TIM11_PRIORITY 7
89#define STM32_IRQ_TIM1_CC_PRIORITY 7
90#define STM32_IRQ_TIM2_PRIORITY 7
91#define STM32_IRQ_TIM3_PRIORITY 7
92#define STM32_IRQ_TIM4_PRIORITY 7
93#define STM32_IRQ_TIM5_PRIORITY 7
94
95#define STM32_IRQ_USART1_PRIORITY 12
96#define STM32_IRQ_USART2_PRIORITY 12
97#define STM32_IRQ_USART6_PRIORITY 12
98
85/* 99/*
86 * ADC driver system settings. 100 * ADC driver system settings.
87 */ 101 */
@@ -101,14 +115,8 @@
101#define STM32_GPT_USE_TIM4 TRUE 115#define STM32_GPT_USE_TIM4 TRUE
102#define STM32_GPT_USE_TIM5 FALSE 116#define STM32_GPT_USE_TIM5 FALSE
103#define STM32_GPT_USE_TIM9 FALSE 117#define STM32_GPT_USE_TIM9 FALSE
118#define STM32_GPT_USE_TIM10 FALSE
104#define STM32_GPT_USE_TIM11 FALSE 119#define STM32_GPT_USE_TIM11 FALSE
105#define STM32_GPT_TIM1_IRQ_PRIORITY 7
106#define STM32_GPT_TIM2_IRQ_PRIORITY 7
107#define STM32_GPT_TIM3_IRQ_PRIORITY 7
108#define STM32_GPT_TIM4_IRQ_PRIORITY 7
109#define STM32_GPT_TIM5_IRQ_PRIORITY 7
110#define STM32_GPT_TIM9_IRQ_PRIORITY 7
111#define STM32_GPT_TIM11_IRQ_PRIORITY 7
112 120
113/* 121/*
114 * I2C driver system settings. 122 * I2C driver system settings.
@@ -155,29 +163,28 @@
155#define STM32_ICU_USE_TIM4 FALSE 163#define STM32_ICU_USE_TIM4 FALSE
156#define STM32_ICU_USE_TIM5 FALSE 164#define STM32_ICU_USE_TIM5 FALSE
157#define STM32_ICU_USE_TIM9 FALSE 165#define STM32_ICU_USE_TIM9 FALSE
158#define STM32_ICU_TIM1_IRQ_PRIORITY 7 166#define STM32_ICU_USE_TIM10 FALSE
159#define STM32_ICU_TIM2_IRQ_PRIORITY 7 167#define STM32_ICU_USE_TIM11 FALSE
160#define STM32_ICU_TIM3_IRQ_PRIORITY 7
161#define STM32_ICU_TIM4_IRQ_PRIORITY 7
162#define STM32_ICU_TIM5_IRQ_PRIORITY 7
163#define STM32_ICU_TIM9_IRQ_PRIORITY 7
164 168
165/* 169/*
166 * PWM driver system settings. 170 * PWM driver system settings.
167 */ 171 */
168#define STM32_PWM_USE_ADVANCED FALSE
169#define STM32_PWM_USE_TIM1 FALSE 172#define STM32_PWM_USE_TIM1 FALSE
170#define STM32_PWM_USE_TIM2 FALSE 173#define STM32_PWM_USE_TIM2 FALSE
171#define STM32_PWM_USE_TIM3 FALSE 174#define STM32_PWM_USE_TIM3 FALSE
172#define STM32_PWM_USE_TIM4 FALSE 175#define STM32_PWM_USE_TIM4 FALSE
173#define STM32_PWM_USE_TIM5 FALSE 176#define STM32_PWM_USE_TIM5 FALSE
174#define STM32_PWM_USE_TIM9 FALSE 177#define STM32_PWM_USE_TIM9 FALSE
175#define STM32_PWM_TIM1_IRQ_PRIORITY 7 178#define STM32_PWM_USE_TIM10 FALSE
176#define STM32_PWM_TIM2_IRQ_PRIORITY 7 179#define STM32_PWM_USE_TIM11 FALSE
177#define STM32_PWM_TIM3_IRQ_PRIORITY 7 180
178#define STM32_PWM_TIM4_IRQ_PRIORITY 7 181/*
179#define STM32_PWM_TIM5_IRQ_PRIORITY 7 182 * RTC driver system settings.
180#define STM32_PWM_TIM9_IRQ_PRIORITY 7 183 */
184#define STM32_RTC_PRESA_VALUE 32
185#define STM32_RTC_PRESS_VALUE 1024
186#define STM32_RTC_CR_INIT 0
187#define STM32_RTC_TAMPCR_INIT 0
181 188
182/* 189/*
183 * SERIAL driver system settings. 190 * SERIAL driver system settings.
@@ -185,9 +192,6 @@
185#define STM32_SERIAL_USE_USART1 FALSE 192#define STM32_SERIAL_USE_USART1 FALSE
186#define STM32_SERIAL_USE_USART2 FALSE 193#define STM32_SERIAL_USE_USART2 FALSE
187#define STM32_SERIAL_USE_USART6 FALSE 194#define STM32_SERIAL_USE_USART6 FALSE
188#define STM32_SERIAL_USART1_PRIORITY 12
189#define STM32_SERIAL_USART2_PRIORITY 12
190#define STM32_SERIAL_USART6_PRIORITY 12
191 195
192/* 196/*
193 * SPI driver system settings. 197 * SPI driver system settings.
@@ -227,9 +231,6 @@
227#define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6) 231#define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
228#define STM32_UART_USART6_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 2) 232#define STM32_UART_USART6_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 2)
229#define STM32_UART_USART6_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 7) 233#define STM32_UART_USART6_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 7)
230#define STM32_UART_USART1_IRQ_PRIORITY 12
231#define STM32_UART_USART2_IRQ_PRIORITY 12
232#define STM32_UART_USART6_IRQ_PRIORITY 12
233#define STM32_UART_USART1_DMA_PRIORITY 0 234#define STM32_UART_USART1_DMA_PRIORITY 0
234#define STM32_UART_USART2_DMA_PRIORITY 0 235#define STM32_UART_USART2_DMA_PRIORITY 0
235#define STM32_UART_USART6_DMA_PRIORITY 0 236#define STM32_UART_USART6_DMA_PRIORITY 0
@@ -241,9 +242,7 @@
241#define STM32_USB_USE_OTG1 TRUE 242#define STM32_USB_USE_OTG1 TRUE
242#define STM32_USB_OTG1_IRQ_PRIORITY 14 243#define STM32_USB_OTG1_IRQ_PRIORITY 14
243#define STM32_USB_OTG1_RX_FIFO_SIZE 512 244#define STM32_USB_OTG1_RX_FIFO_SIZE 512
244#define STM32_USB_OTG_THREAD_PRIO LOWPRIO 245#define STM32_USB_HOST_WAKEUP_DURATION 2
245#define STM32_USB_OTG_THREAD_STACK_SIZE 128
246#define STM32_USB_OTGFIFO_FILL_BASEPRI 0
247 246
248/* 247/*
249 * WDG driver system settings. 248 * WDG driver system settings.
diff --git a/keyboards/matrix/noah/mcuconf.h b/keyboards/matrix/noah/mcuconf.h
index 54a1f2661..00216f690 100644
--- a/keyboards/matrix/noah/mcuconf.h
+++ b/keyboards/matrix/noah/mcuconf.h
@@ -1,5 +1,5 @@
1/* 1/*
2 ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio 2 ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
3 3
4 Licensed under the Apache License, Version 2.0 (the "License"); 4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License. 5 you may not use this file except in compliance with the License.
@@ -32,11 +32,15 @@
32 */ 32 */
33 33
34#define STM32F4xx_MCUCONF 34#define STM32F4xx_MCUCONF
35#define STM32F411_MCUCONF
35 36
36/* 37/*
37 * HAL driver system settings. 38 * HAL driver system settings.
38 */ 39 */
39#define STM32_NO_INIT FALSE 40#define STM32_NO_INIT FALSE
41#define STM32_PVD_ENABLE FALSE
42#define STM32_PLS STM32_PLS_LEV0
43#define STM32_BKPRAM_ENABLE FALSE
40#define STM32_HSI_ENABLED TRUE 44#define STM32_HSI_ENABLED TRUE
41#define STM32_LSI_ENABLED TRUE 45#define STM32_LSI_ENABLED TRUE
42#define STM32_HSE_ENABLED TRUE 46#define STM32_HSE_ENABLED TRUE
@@ -60,9 +64,6 @@
60#define STM32_I2SSRC STM32_I2SSRC_CKIN 64#define STM32_I2SSRC STM32_I2SSRC_CKIN
61#define STM32_PLLI2SN_VALUE 192 65#define STM32_PLLI2SN_VALUE 192
62#define STM32_PLLI2SR_VALUE 5 66#define STM32_PLLI2SR_VALUE 5
63#define STM32_PVD_ENABLE FALSE
64#define STM32_PLS STM32_PLS_LEV0
65#define STM32_BKPRAM_ENABLE FALSE
66 67
67/* 68/*
68 * IRQ system settings. 69 * IRQ system settings.
@@ -82,6 +83,19 @@
82#define STM32_IRQ_EXTI21_PRIORITY 15 83#define STM32_IRQ_EXTI21_PRIORITY 15
83#define STM32_IRQ_EXTI22_PRIORITY 15 84#define STM32_IRQ_EXTI22_PRIORITY 15
84 85
86#define STM32_IRQ_TIM1_BRK_TIM9_PRIORITY 7
87#define STM32_IRQ_TIM1_UP_TIM10_PRIORITY 7
88#define STM32_IRQ_TIM1_TRGCO_TIM11_PRIORITY 7
89#define STM32_IRQ_TIM1_CC_PRIORITY 7
90#define STM32_IRQ_TIM2_PRIORITY 7
91#define STM32_IRQ_TIM3_PRIORITY 7
92#define STM32_IRQ_TIM4_PRIORITY 7
93#define STM32_IRQ_TIM5_PRIORITY 7
94
95#define STM32_IRQ_USART1_PRIORITY 12
96#define STM32_IRQ_USART2_PRIORITY 12
97#define STM32_IRQ_USART6_PRIORITY 12
98
85/* 99/*
86 * ADC driver system settings. 100 * ADC driver system settings.
87 */ 101 */
@@ -101,14 +115,8 @@
101#define STM32_GPT_USE_TIM4 TRUE 115#define STM32_GPT_USE_TIM4 TRUE
102#define STM32_GPT_USE_TIM5 FALSE 116#define STM32_GPT_USE_TIM5 FALSE
103#define STM32_GPT_USE_TIM9 FALSE 117#define STM32_GPT_USE_TIM9 FALSE
118#define STM32_GPT_USE_TIM10 FALSE
104#define STM32_GPT_USE_TIM11 FALSE 119#define STM32_GPT_USE_TIM11 FALSE
105#define STM32_GPT_TIM1_IRQ_PRIORITY 7
106#define STM32_GPT_TIM2_IRQ_PRIORITY 7
107#define STM32_GPT_TIM3_IRQ_PRIORITY 7
108#define STM32_GPT_TIM4_IRQ_PRIORITY 7
109#define STM32_GPT_TIM5_IRQ_PRIORITY 7
110#define STM32_GPT_TIM9_IRQ_PRIORITY 7
111#define STM32_GPT_TIM11_IRQ_PRIORITY 7
112 120
113/* 121/*
114 * I2C driver system settings. 122 * I2C driver system settings.
@@ -155,29 +163,28 @@
155#define STM32_ICU_USE_TIM4 FALSE 163#define STM32_ICU_USE_TIM4 FALSE
156#define STM32_ICU_USE_TIM5 FALSE 164#define STM32_ICU_USE_TIM5 FALSE
157#define STM32_ICU_USE_TIM9 FALSE 165#define STM32_ICU_USE_TIM9 FALSE
158#define STM32_ICU_TIM1_IRQ_PRIORITY 7 166#define STM32_ICU_USE_TIM10 FALSE
159#define STM32_ICU_TIM2_IRQ_PRIORITY 7 167#define STM32_ICU_USE_TIM11 FALSE
160#define STM32_ICU_TIM3_IRQ_PRIORITY 7
161#define STM32_ICU_TIM4_IRQ_PRIORITY 7
162#define STM32_ICU_TIM5_IRQ_PRIORITY 7
163#define STM32_ICU_TIM9_IRQ_PRIORITY 7
164 168
165/* 169/*
166 * PWM driver system settings. 170 * PWM driver system settings.
167 */ 171 */
168#define STM32_PWM_USE_ADVANCED FALSE
169#define STM32_PWM_USE_TIM1 FALSE 172#define STM32_PWM_USE_TIM1 FALSE
170#define STM32_PWM_USE_TIM2 FALSE 173#define STM32_PWM_USE_TIM2 FALSE
171#define STM32_PWM_USE_TIM3 FALSE 174#define STM32_PWM_USE_TIM3 FALSE
172#define STM32_PWM_USE_TIM4 FALSE 175#define STM32_PWM_USE_TIM4 FALSE
173#define STM32_PWM_USE_TIM5 FALSE 176#define STM32_PWM_USE_TIM5 FALSE
174#define STM32_PWM_USE_TIM9 FALSE 177#define STM32_PWM_USE_TIM9 FALSE
175#define STM32_PWM_TIM1_IRQ_PRIORITY 7 178#define STM32_PWM_USE_TIM10 FALSE
176#define STM32_PWM_TIM2_IRQ_PRIORITY 7 179#define STM32_PWM_USE_TIM11 FALSE
177#define STM32_PWM_TIM3_IRQ_PRIORITY 7 180
178#define STM32_PWM_TIM4_IRQ_PRIORITY 7 181/*
179#define STM32_PWM_TIM5_IRQ_PRIORITY 7 182 * RTC driver system settings.
180#define STM32_PWM_TIM9_IRQ_PRIORITY 7 183 */
184#define STM32_RTC_PRESA_VALUE 32
185#define STM32_RTC_PRESS_VALUE 1024
186#define STM32_RTC_CR_INIT 0
187#define STM32_RTC_TAMPCR_INIT 0
181 188
182/* 189/*
183 * SERIAL driver system settings. 190 * SERIAL driver system settings.
@@ -185,9 +192,6 @@
185#define STM32_SERIAL_USE_USART1 FALSE 192#define STM32_SERIAL_USE_USART1 FALSE
186#define STM32_SERIAL_USE_USART2 FALSE 193#define STM32_SERIAL_USE_USART2 FALSE
187#define STM32_SERIAL_USE_USART6 FALSE 194#define STM32_SERIAL_USE_USART6 FALSE
188#define STM32_SERIAL_USART1_PRIORITY 12
189#define STM32_SERIAL_USART2_PRIORITY 12
190#define STM32_SERIAL_USART6_PRIORITY 12
191 195
192/* 196/*
193 * SPI driver system settings. 197 * SPI driver system settings.
@@ -227,9 +231,6 @@
227#define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6) 231#define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
228#define STM32_UART_USART6_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 2) 232#define STM32_UART_USART6_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 2)
229#define STM32_UART_USART6_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 7) 233#define STM32_UART_USART6_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 7)
230#define STM32_UART_USART1_IRQ_PRIORITY 12
231#define STM32_UART_USART2_IRQ_PRIORITY 12
232#define STM32_UART_USART6_IRQ_PRIORITY 12
233#define STM32_UART_USART1_DMA_PRIORITY 0 234#define STM32_UART_USART1_DMA_PRIORITY 0
234#define STM32_UART_USART2_DMA_PRIORITY 0 235#define STM32_UART_USART2_DMA_PRIORITY 0
235#define STM32_UART_USART6_DMA_PRIORITY 0 236#define STM32_UART_USART6_DMA_PRIORITY 0
@@ -241,9 +242,7 @@
241#define STM32_USB_USE_OTG1 TRUE 242#define STM32_USB_USE_OTG1 TRUE
242#define STM32_USB_OTG1_IRQ_PRIORITY 14 243#define STM32_USB_OTG1_IRQ_PRIORITY 14
243#define STM32_USB_OTG1_RX_FIFO_SIZE 512 244#define STM32_USB_OTG1_RX_FIFO_SIZE 512
244#define STM32_USB_OTG_THREAD_PRIO LOWPRIO 245#define STM32_USB_HOST_WAKEUP_DURATION 2
245#define STM32_USB_OTG_THREAD_STACK_SIZE 128
246#define STM32_USB_OTGFIFO_FILL_BASEPRI 0
247 246
248/* 247/*
249 * WDG driver system settings. 248 * WDG driver system settings.
diff --git a/lib/chibios b/lib/chibios
Subproject 413e39c5681d181720440f2a8b7391f581788d7 Subproject d7b9d1c87f724bd7c8cd1486d6d0dc3ba52e0d5
diff --git a/platforms/chibios/boards/BLACKPILL_STM32_F401/configs/mcuconf.h b/platforms/chibios/boards/BLACKPILL_STM32_F401/configs/mcuconf.h
index ba6e934fe..a21fd7bd1 100644
--- a/platforms/chibios/boards/BLACKPILL_STM32_F401/configs/mcuconf.h
+++ b/platforms/chibios/boards/BLACKPILL_STM32_F401/configs/mcuconf.h
@@ -1,5 +1,5 @@
1/* 1/*
2 ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio 2 ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
3 3
4 Licensed under the Apache License, Version 2.0 (the "License"); 4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License. 5 you may not use this file except in compliance with the License.
@@ -32,11 +32,15 @@
32 */ 32 */
33 33
34#define STM32F4xx_MCUCONF 34#define STM32F4xx_MCUCONF
35#define STM32F401_MCUCONF
35 36
36/* 37/*
37 * HAL driver system settings. 38 * HAL driver system settings.
38 */ 39 */
39#define STM32_NO_INIT FALSE 40#define STM32_NO_INIT FALSE
41#define STM32_PVD_ENABLE FALSE
42#define STM32_PLS STM32_PLS_LEV0
43#define STM32_BKPRAM_ENABLE FALSE
40#define STM32_HSI_ENABLED TRUE 44#define STM32_HSI_ENABLED TRUE
41#define STM32_LSI_ENABLED TRUE 45#define STM32_LSI_ENABLED TRUE
42#define STM32_HSE_ENABLED TRUE 46#define STM32_HSE_ENABLED TRUE
@@ -44,13 +48,13 @@
44#define STM32_CLOCK48_REQUIRED TRUE 48#define STM32_CLOCK48_REQUIRED TRUE
45#define STM32_SW STM32_SW_PLL 49#define STM32_SW STM32_SW_PLL
46#define STM32_PLLSRC STM32_PLLSRC_HSE 50#define STM32_PLLSRC STM32_PLLSRC_HSE
47#define STM32_PLLM_VALUE 25 51#define STM32_PLLM_VALUE 25
48#define STM32_PLLN_VALUE 336 52#define STM32_PLLN_VALUE 336
49#define STM32_PLLP_VALUE 4 53#define STM32_PLLP_VALUE 4
50#define STM32_PLLQ_VALUE 7 54#define STM32_PLLQ_VALUE 7
51#define STM32_HPRE STM32_HPRE_DIV1 55#define STM32_HPRE STM32_HPRE_DIV1
52#define STM32_PPRE1 STM32_PPRE1_DIV4 56#define STM32_PPRE1 STM32_PPRE1_DIV4
53#define STM32_PPRE2 STM32_PPRE2_DIV2 57#define STM32_PPRE2 STM32_PPRE2_DIV2
54#define STM32_RTCSEL STM32_RTCSEL_LSI 58#define STM32_RTCSEL STM32_RTCSEL_LSI
55#define STM32_RTCPRE_VALUE 8 59#define STM32_RTCPRE_VALUE 8
56#define STM32_MCO1SEL STM32_MCO1SEL_HSI 60#define STM32_MCO1SEL STM32_MCO1SEL_HSI
@@ -60,9 +64,6 @@
60#define STM32_I2SSRC STM32_I2SSRC_CKIN 64#define STM32_I2SSRC STM32_I2SSRC_CKIN
61#define STM32_PLLI2SN_VALUE 192 65#define STM32_PLLI2SN_VALUE 192
62#define STM32_PLLI2SR_VALUE 5 66#define STM32_PLLI2SR_VALUE 5
63#define STM32_PVD_ENABLE FALSE
64#define STM32_PLS STM32_PLS_LEV0
65#define STM32_BKPRAM_ENABLE FALSE
66 67
67/* 68/*
68 * IRQ system settings. 69 * IRQ system settings.
@@ -82,6 +83,19 @@
82#define STM32_IRQ_EXTI21_PRIORITY 15 83#define STM32_IRQ_EXTI21_PRIORITY 15
83#define STM32_IRQ_EXTI22_PRIORITY 15 84#define STM32_IRQ_EXTI22_PRIORITY 15
84 85
86#define STM32_IRQ_TIM1_BRK_TIM9_PRIORITY 7
87#define STM32_IRQ_TIM1_UP_TIM10_PRIORITY 7
88#define STM32_IRQ_TIM1_TRGCO_TIM11_PRIORITY 7
89#define STM32_IRQ_TIM1_CC_PRIORITY 7
90#define STM32_IRQ_TIM2_PRIORITY 7
91#define STM32_IRQ_TIM3_PRIORITY 7
92#define STM32_IRQ_TIM4_PRIORITY 7
93#define STM32_IRQ_TIM5_PRIORITY 7
94
95#define STM32_IRQ_USART1_PRIORITY 12
96#define STM32_IRQ_USART2_PRIORITY 12
97#define STM32_IRQ_USART6_PRIORITY 12
98
85/* 99/*
86 * ADC driver system settings. 100 * ADC driver system settings.
87 */ 101 */
@@ -101,14 +115,8 @@
101#define STM32_GPT_USE_TIM4 FALSE 115#define STM32_GPT_USE_TIM4 FALSE
102#define STM32_GPT_USE_TIM5 FALSE 116#define STM32_GPT_USE_TIM5 FALSE
103#define STM32_GPT_USE_TIM9 FALSE 117#define STM32_GPT_USE_TIM9 FALSE
118#define STM32_GPT_USE_TIM10 FALSE
104#define STM32_GPT_USE_TIM11 FALSE 119#define STM32_GPT_USE_TIM11 FALSE
105#define STM32_GPT_TIM1_IRQ_PRIORITY 7
106#define STM32_GPT_TIM2_IRQ_PRIORITY 7
107#define STM32_GPT_TIM3_IRQ_PRIORITY 7
108#define STM32_GPT_TIM4_IRQ_PRIORITY 7
109#define STM32_GPT_TIM5_IRQ_PRIORITY 7
110#define STM32_GPT_TIM9_IRQ_PRIORITY 7
111#define STM32_GPT_TIM11_IRQ_PRIORITY 7
112 120
113/* 121/*
114 * I2C driver system settings. 122 * I2C driver system settings.
@@ -155,29 +163,20 @@
155#define STM32_ICU_USE_TIM4 FALSE 163#define STM32_ICU_USE_TIM4 FALSE
156#define STM32_ICU_USE_TIM5 FALSE 164#define STM32_ICU_USE_TIM5 FALSE
157#define STM32_ICU_USE_TIM9 FALSE 165#define STM32_ICU_USE_TIM9 FALSE
158#define STM32_ICU_TIM1_IRQ_PRIORITY 7 166#define STM32_ICU_USE_TIM10 FALSE
159#define STM32_ICU_TIM2_IRQ_PRIORITY 7 167#define STM32_ICU_USE_TIM11 FALSE
160#define STM32_ICU_TIM3_IRQ_PRIORITY 7
161#define STM32_ICU_TIM4_IRQ_PRIORITY 7
162#define STM32_ICU_TIM5_IRQ_PRIORITY 7
163#define STM32_ICU_TIM9_IRQ_PRIORITY 7
164 168
165/* 169/*
166 * PWM driver system settings. 170 * PWM driver system settings.
167 */ 171 */
168#define STM32_PWM_USE_ADVANCED FALSE
169#define STM32_PWM_USE_TIM1 FALSE 172#define STM32_PWM_USE_TIM1 FALSE
170#define STM32_PWM_USE_TIM2 FALSE 173#define STM32_PWM_USE_TIM2 FALSE
171#define STM32_PWM_USE_TIM3 FALSE 174#define STM32_PWM_USE_TIM3 FALSE
172#define STM32_PWM_USE_TIM4 FALSE 175#define STM32_PWM_USE_TIM4 FALSE
173#define STM32_PWM_USE_TIM5 FALSE 176#define STM32_PWM_USE_TIM5 FALSE
174#define STM32_PWM_USE_TIM9 FALSE 177#define STM32_PWM_USE_TIM9 FALSE
175#define STM32_PWM_TIM1_IRQ_PRIORITY 7 178#define STM32_PWM_USE_TIM10 FALSE
176#define STM32_PWM_TIM2_IRQ_PRIORITY 7 179#define STM32_PWM_USE_TIM11 FALSE
177#define STM32_PWM_TIM3_IRQ_PRIORITY 7
178#define STM32_PWM_TIM4_IRQ_PRIORITY 7
179#define STM32_PWM_TIM5_IRQ_PRIORITY 7
180#define STM32_PWM_TIM9_IRQ_PRIORITY 7
181 180
182/* 181/*
183 * SERIAL driver system settings. 182 * SERIAL driver system settings.
@@ -185,9 +184,6 @@
185#define STM32_SERIAL_USE_USART1 FALSE 184#define STM32_SERIAL_USE_USART1 FALSE
186#define STM32_SERIAL_USE_USART2 FALSE 185#define STM32_SERIAL_USE_USART2 FALSE
187#define STM32_SERIAL_USE_USART6 FALSE 186#define STM32_SERIAL_USE_USART6 FALSE
188#define STM32_SERIAL_USART1_PRIORITY 12
189#define STM32_SERIAL_USART2_PRIORITY 12
190#define STM32_SERIAL_USART6_PRIORITY 12
191 187
192/* 188/*
193 * SPI driver system settings. 189 * SPI driver system settings.
@@ -227,9 +223,6 @@
227#define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6) 223#define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
228#define STM32_UART_USART6_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 2) 224#define STM32_UART_USART6_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 2)
229#define STM32_UART_USART6_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 7) 225#define STM32_UART_USART6_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 7)
230#define STM32_UART_USART1_IRQ_PRIORITY 12
231#define STM32_UART_USART2_IRQ_PRIORITY 12
232#define STM32_UART_USART6_IRQ_PRIORITY 12
233#define STM32_UART_USART1_DMA_PRIORITY 0 226#define STM32_UART_USART1_DMA_PRIORITY 0
234#define STM32_UART_USART2_DMA_PRIORITY 0 227#define STM32_UART_USART2_DMA_PRIORITY 0
235#define STM32_UART_USART6_DMA_PRIORITY 0 228#define STM32_UART_USART6_DMA_PRIORITY 0
@@ -241,9 +234,7 @@
241#define STM32_USB_USE_OTG1 TRUE 234#define STM32_USB_USE_OTG1 TRUE
242#define STM32_USB_OTG1_IRQ_PRIORITY 14 235#define STM32_USB_OTG1_IRQ_PRIORITY 14
243#define STM32_USB_OTG1_RX_FIFO_SIZE 512 236#define STM32_USB_OTG1_RX_FIFO_SIZE 512
244#define STM32_USB_OTG_THREAD_PRIO NORMALPRIO+1 237#define STM32_USB_HOST_WAKEUP_DURATION 2
245#define STM32_USB_OTG_THREAD_STACK_SIZE 128
246#define STM32_USB_OTGFIFO_FILL_BASEPRI 0
247 238
248/* 239/*
249 * WDG driver system settings. 240 * WDG driver system settings.
diff --git a/platforms/chibios/boards/BLACKPILL_STM32_F411/configs/mcuconf.h b/platforms/chibios/boards/BLACKPILL_STM32_F411/configs/mcuconf.h
index 0394ff56b..131c84766 100644
--- a/platforms/chibios/boards/BLACKPILL_STM32_F411/configs/mcuconf.h
+++ b/platforms/chibios/boards/BLACKPILL_STM32_F411/configs/mcuconf.h
@@ -1,5 +1,5 @@
1/* 1/*
2 ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio 2 ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
3 3
4 Licensed under the Apache License, Version 2.0 (the "License"); 4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License. 5 you may not use this file except in compliance with the License.
@@ -32,11 +32,15 @@
32 */ 32 */
33 33
34#define STM32F4xx_MCUCONF 34#define STM32F4xx_MCUCONF
35#define STM32F411_MCUCONF
35 36
36/* 37/*
37 * HAL driver system settings. 38 * HAL driver system settings.
38 */ 39 */
39#define STM32_NO_INIT FALSE 40#define STM32_NO_INIT FALSE
41#define STM32_PVD_ENABLE FALSE
42#define STM32_PLS STM32_PLS_LEV0
43#define STM32_BKPRAM_ENABLE FALSE
40#define STM32_HSI_ENABLED TRUE 44#define STM32_HSI_ENABLED TRUE
41#define STM32_LSI_ENABLED TRUE 45#define STM32_LSI_ENABLED TRUE
42#define STM32_HSE_ENABLED TRUE 46#define STM32_HSE_ENABLED TRUE
@@ -60,9 +64,6 @@
60#define STM32_I2SSRC STM32_I2SSRC_CKIN 64#define STM32_I2SSRC STM32_I2SSRC_CKIN
61#define STM32_PLLI2SN_VALUE 192 65#define STM32_PLLI2SN_VALUE 192
62#define STM32_PLLI2SR_VALUE 5 66#define STM32_PLLI2SR_VALUE 5
63#define STM32_PVD_ENABLE FALSE
64#define STM32_PLS STM32_PLS_LEV0
65#define STM32_BKPRAM_ENABLE FALSE
66 67
67/* 68/*
68 * IRQ system settings. 69 * IRQ system settings.
@@ -82,6 +83,19 @@
82#define STM32_IRQ_EXTI21_PRIORITY 15 83#define STM32_IRQ_EXTI21_PRIORITY 15
83#define STM32_IRQ_EXTI22_PRIORITY 15 84#define STM32_IRQ_EXTI22_PRIORITY 15
84 85
86#define STM32_IRQ_TIM1_BRK_TIM9_PRIORITY 7
87#define STM32_IRQ_TIM1_UP_TIM10_PRIORITY 7
88#define STM32_IRQ_TIM1_TRGCO_TIM11_PRIORITY 7
89#define STM32_IRQ_TIM1_CC_PRIORITY 7
90#define STM32_IRQ_TIM2_PRIORITY 7
91#define STM32_IRQ_TIM3_PRIORITY 7
92#define STM32_IRQ_TIM4_PRIORITY 7
93#define STM32_IRQ_TIM5_PRIORITY 7
94
95#define STM32_IRQ_USART1_PRIORITY 12
96#define STM32_IRQ_USART2_PRIORITY 12
97#define STM32_IRQ_USART6_PRIORITY 12
98
85/* 99/*
86 * ADC driver system settings. 100 * ADC driver system settings.
87 */ 101 */
@@ -101,14 +115,8 @@
101#define STM32_GPT_USE_TIM4 FALSE 115#define STM32_GPT_USE_TIM4 FALSE
102#define STM32_GPT_USE_TIM5 FALSE 116#define STM32_GPT_USE_TIM5 FALSE
103#define STM32_GPT_USE_TIM9 FALSE 117#define STM32_GPT_USE_TIM9 FALSE
118#define STM32_GPT_USE_TIM10 FALSE
104#define STM32_GPT_USE_TIM11 FALSE 119#define STM32_GPT_USE_TIM11 FALSE
105#define STM32_GPT_TIM1_IRQ_PRIORITY 7
106#define STM32_GPT_TIM2_IRQ_PRIORITY 7
107#define STM32_GPT_TIM3_IRQ_PRIORITY 7
108#define STM32_GPT_TIM4_IRQ_PRIORITY 7
109#define STM32_GPT_TIM5_IRQ_PRIORITY 7
110#define STM32_GPT_TIM9_IRQ_PRIORITY 7
111#define STM32_GPT_TIM11_IRQ_PRIORITY 7
112 120
113/* 121/*
114 * I2C driver system settings. 122 * I2C driver system settings.
@@ -155,29 +163,28 @@
155#define STM32_ICU_USE_TIM4 FALSE 163#define STM32_ICU_USE_TIM4 FALSE
156#define STM32_ICU_USE_TIM5 FALSE 164#define STM32_ICU_USE_TIM5 FALSE
157#define STM32_ICU_USE_TIM9 FALSE 165#define STM32_ICU_USE_TIM9 FALSE
158#define STM32_ICU_TIM1_IRQ_PRIORITY 7 166#define STM32_ICU_USE_TIM10 FALSE
159#define STM32_ICU_TIM2_IRQ_PRIORITY 7 167#define STM32_ICU_USE_TIM11 FALSE
160#define STM32_ICU_TIM3_IRQ_PRIORITY 7
161#define STM32_ICU_TIM4_IRQ_PRIORITY 7
162#define STM32_ICU_TIM5_IRQ_PRIORITY 7
163#define STM32_ICU_TIM9_IRQ_PRIORITY 7
164 168
165/* 169/*
166 * PWM driver system settings. 170 * PWM driver system settings.
167 */ 171 */
168#define STM32_PWM_USE_ADVANCED FALSE
169#define STM32_PWM_USE_TIM1 FALSE 172#define STM32_PWM_USE_TIM1 FALSE
170#define STM32_PWM_USE_TIM2 FALSE 173#define STM32_PWM_USE_TIM2 FALSE
171#define STM32_PWM_USE_TIM3 FALSE 174#define STM32_PWM_USE_TIM3 FALSE
172#define STM32_PWM_USE_TIM4 FALSE 175#define STM32_PWM_USE_TIM4 FALSE
173#define STM32_PWM_USE_TIM5 FALSE 176#define STM32_PWM_USE_TIM5 FALSE
174#define STM32_PWM_USE_TIM9 FALSE 177#define STM32_PWM_USE_TIM9 FALSE
175#define STM32_PWM_TIM1_IRQ_PRIORITY 7 178#define STM32_PWM_USE_TIM10 FALSE
176#define STM32_PWM_TIM2_IRQ_PRIORITY 7 179#define STM32_PWM_USE_TIM11 FALSE
177#define STM32_PWM_TIM3_IRQ_PRIORITY 7 180
178#define STM32_PWM_TIM4_IRQ_PRIORITY 7 181/*
179#define STM32_PWM_TIM5_IRQ_PRIORITY 7 182 * RTC driver system settings.
180#define STM32_PWM_TIM9_IRQ_PRIORITY 7 183 */
184#define STM32_RTC_PRESA_VALUE 32
185#define STM32_RTC_PRESS_VALUE 1024
186#define STM32_RTC_CR_INIT 0
187#define STM32_RTC_TAMPCR_INIT 0
181 188
182/* 189/*
183 * SERIAL driver system settings. 190 * SERIAL driver system settings.
@@ -185,9 +192,6 @@
185#define STM32_SERIAL_USE_USART1 FALSE 192#define STM32_SERIAL_USE_USART1 FALSE
186#define STM32_SERIAL_USE_USART2 FALSE 193#define STM32_SERIAL_USE_USART2 FALSE
187#define STM32_SERIAL_USE_USART6 FALSE 194#define STM32_SERIAL_USE_USART6 FALSE
188#define STM32_SERIAL_USART1_PRIORITY 12
189#define STM32_SERIAL_USART2_PRIORITY 12
190#define STM32_SERIAL_USART6_PRIORITY 12
191 195
192/* 196/*
193 * SPI driver system settings. 197 * SPI driver system settings.
@@ -227,9 +231,6 @@
227#define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6) 231#define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
228#define STM32_UART_USART6_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 2) 232#define STM32_UART_USART6_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 2)
229#define STM32_UART_USART6_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 7) 233#define STM32_UART_USART6_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 7)
230#define STM32_UART_USART1_IRQ_PRIORITY 12
231#define STM32_UART_USART2_IRQ_PRIORITY 12
232#define STM32_UART_USART6_IRQ_PRIORITY 12
233#define STM32_UART_USART1_DMA_PRIORITY 0 234#define STM32_UART_USART1_DMA_PRIORITY 0
234#define STM32_UART_USART2_DMA_PRIORITY 0 235#define STM32_UART_USART2_DMA_PRIORITY 0
235#define STM32_UART_USART6_DMA_PRIORITY 0 236#define STM32_UART_USART6_DMA_PRIORITY 0
@@ -241,9 +242,7 @@
241#define STM32_USB_USE_OTG1 TRUE 242#define STM32_USB_USE_OTG1 TRUE
242#define STM32_USB_OTG1_IRQ_PRIORITY 14 243#define STM32_USB_OTG1_IRQ_PRIORITY 14
243#define STM32_USB_OTG1_RX_FIFO_SIZE 512 244#define STM32_USB_OTG1_RX_FIFO_SIZE 512
244#define STM32_USB_OTG_THREAD_PRIO NORMALPRIO+1 245#define STM32_USB_HOST_WAKEUP_DURATION 2
245#define STM32_USB_OTG_THREAD_STACK_SIZE 128
246#define STM32_USB_OTGFIFO_FILL_BASEPRI 0
247 246
248/* 247/*
249 * WDG driver system settings. 248 * WDG driver system settings.
diff --git a/platforms/chibios/boards/GENERIC_STM32_F405XG/configs/mcuconf.h b/platforms/chibios/boards/GENERIC_STM32_F405XG/configs/mcuconf.h
index d2ec632d9..908a580a9 100644
--- a/platforms/chibios/boards/GENERIC_STM32_F405XG/configs/mcuconf.h
+++ b/platforms/chibios/boards/GENERIC_STM32_F405XG/configs/mcuconf.h
@@ -344,9 +344,6 @@
344#define STM32_USB_OTG2_RX_FIFO_SIZE 1024 344#define STM32_USB_OTG2_RX_FIFO_SIZE 1024
345#define STM32_USB_HOST_WAKEUP_DURATION 2 345#define STM32_USB_HOST_WAKEUP_DURATION 2
346 346
347#define STM32_USB_OTG_THREAD_PRIO NORMALPRIO+1
348#define STM32_USB_OTG_THREAD_STACK_SIZE 128
349
350/* 347/*
351 * WDG driver system settings. 348 * WDG driver system settings.
352 */ 349 */
diff --git a/platforms/chibios/boards/GENERIC_STM32_F407XE/configs/mcuconf.h b/platforms/chibios/boards/GENERIC_STM32_F407XE/configs/mcuconf.h
index 4be47fe1b..928ee56c7 100644
--- a/platforms/chibios/boards/GENERIC_STM32_F407XE/configs/mcuconf.h
+++ b/platforms/chibios/boards/GENERIC_STM32_F407XE/configs/mcuconf.h
@@ -344,9 +344,6 @@
344#define STM32_USB_OTG2_RX_FIFO_SIZE 1024 344#define STM32_USB_OTG2_RX_FIFO_SIZE 1024
345#define STM32_USB_HOST_WAKEUP_DURATION 2 345#define STM32_USB_HOST_WAKEUP_DURATION 2
346 346
347#define STM32_USB_OTG_THREAD_PRIO NORMALPRIO+1
348#define STM32_USB_OTG_THREAD_STACK_SIZE 128
349
350/* 347/*
351 * WDG driver system settings. 348 * WDG driver system settings.
352 */ 349 */
diff --git a/platforms/chibios/boards/GENERIC_STM32_F446XE/configs/mcuconf.h b/platforms/chibios/boards/GENERIC_STM32_F446XE/configs/mcuconf.h
index d2de75590..566c146c2 100644
--- a/platforms/chibios/boards/GENERIC_STM32_F446XE/configs/mcuconf.h
+++ b/platforms/chibios/boards/GENERIC_STM32_F446XE/configs/mcuconf.h
@@ -1,5 +1,5 @@
1/* 1/*
2 ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio 2 ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
3 3
4 Licensed under the Apache License, Version 2.0 (the "License"); 4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License. 5 you may not use this file except in compliance with the License.
@@ -32,11 +32,15 @@
32 */ 32 */
33 33
34#define STM32F4xx_MCUCONF 34#define STM32F4xx_MCUCONF
35#define STM32F446_MCUCONF
35 36
36/* 37/*
37 * HAL driver system settings. 38 * HAL driver system settings.
38 */ 39 */
39#define STM32_NO_INIT FALSE 40#define STM32_NO_INIT FALSE
41#define STM32_PVD_ENABLE FALSE
42#define STM32_PLS STM32_PLS_LEV0
43#define STM32_BKPRAM_ENABLE FALSE
40#define STM32_HSI_ENABLED FALSE 44#define STM32_HSI_ENABLED FALSE
41#define STM32_LSI_ENABLED TRUE 45#define STM32_LSI_ENABLED TRUE
42#define STM32_HSE_ENABLED TRUE 46#define STM32_HSE_ENABLED TRUE
@@ -70,9 +74,6 @@
70#define STM32_SAI1SEL STM32_SAI2SEL_PLLR 74#define STM32_SAI1SEL STM32_SAI2SEL_PLLR
71#define STM32_SAI2SEL STM32_SAI2SEL_PLLR 75#define STM32_SAI2SEL STM32_SAI2SEL_PLLR
72#define STM32_CK48MSEL STM32_CK48MSEL_PLLALT 76#define STM32_CK48MSEL STM32_CK48MSEL_PLLALT
73#define STM32_PVD_ENABLE FALSE
74#define STM32_PLS STM32_PLS_LEV0
75#define STM32_BKPRAM_ENABLE FALSE
76 77
77/* 78/*
78 * IRQ system settings. 79 * IRQ system settings.
@@ -92,6 +93,30 @@
92#define STM32_IRQ_EXTI21_PRIORITY 15 93#define STM32_IRQ_EXTI21_PRIORITY 15
93#define STM32_IRQ_EXTI22_PRIORITY 15 94#define STM32_IRQ_EXTI22_PRIORITY 15
94 95
96#define STM32_IRQ_TIM1_BRK_TIM9_PRIORITY 7
97#define STM32_IRQ_TIM1_UP_TIM10_PRIORITY 7
98#define STM32_IRQ_TIM1_TRGCO_TIM11_PRIORITY 7
99#define STM32_IRQ_TIM1_CC_PRIORITY 7
100#define STM32_IRQ_TIM2_PRIORITY 7
101#define STM32_IRQ_TIM3_PRIORITY 7
102#define STM32_IRQ_TIM4_PRIORITY 7
103#define STM32_IRQ_TIM5_PRIORITY 7
104#define STM32_IRQ_TIM6_PRIORITY 7
105#define STM32_IRQ_TIM7_PRIORITY 7
106#define STM32_IRQ_TIM8_BRK_TIM12_PRIORITY 7
107#define STM32_IRQ_TIM8_UP_TIM13_PRIORITY 7
108#define STM32_IRQ_TIM8_TRGCO_TIM14_PRIORITY 7
109#define STM32_IRQ_TIM8_CC_PRIORITY 7
110
111#define STM32_IRQ_USART1_PRIORITY 12
112#define STM32_IRQ_USART2_PRIORITY 12
113#define STM32_IRQ_USART3_PRIORITY 12
114#define STM32_IRQ_UART4_PRIORITY 12
115#define STM32_IRQ_UART5_PRIORITY 12
116#define STM32_IRQ_USART6_PRIORITY 12
117#define STM32_IRQ_UART7_PRIORITY 12
118#define STM32_IRQ_UART8_PRIORITY 12
119
95/* 120/*
96 * ADC driver system settings. 121 * ADC driver system settings.
97 */ 122 */
@@ -143,21 +168,11 @@
143#define STM32_GPT_USE_TIM7 FALSE 168#define STM32_GPT_USE_TIM7 FALSE
144#define STM32_GPT_USE_TIM8 FALSE 169#define STM32_GPT_USE_TIM8 FALSE
145#define STM32_GPT_USE_TIM9 FALSE 170#define STM32_GPT_USE_TIM9 FALSE
171#define STM32_GPT_USE_TIM10 FALSE
146#define STM32_GPT_USE_TIM11 FALSE 172#define STM32_GPT_USE_TIM11 FALSE
147#define STM32_GPT_USE_TIM12 FALSE 173#define STM32_GPT_USE_TIM12 FALSE
174#define STM32_GPT_USE_TIM13 FALSE
148#define STM32_GPT_USE_TIM14 FALSE 175#define STM32_GPT_USE_TIM14 FALSE
149#define STM32_GPT_TIM1_IRQ_PRIORITY 7
150#define STM32_GPT_TIM2_IRQ_PRIORITY 7
151#define STM32_GPT_TIM3_IRQ_PRIORITY 7
152#define STM32_GPT_TIM4_IRQ_PRIORITY 7
153#define STM32_GPT_TIM5_IRQ_PRIORITY 7
154#define STM32_GPT_TIM6_IRQ_PRIORITY 7
155#define STM32_GPT_TIM7_IRQ_PRIORITY 7
156#define STM32_GPT_TIM8_IRQ_PRIORITY 7
157#define STM32_GPT_TIM9_IRQ_PRIORITY 7
158#define STM32_GPT_TIM11_IRQ_PRIORITY 7
159#define STM32_GPT_TIM12_IRQ_PRIORITY 7
160#define STM32_GPT_TIM14_IRQ_PRIORITY 7
161 176
162/* 177/*
163 * I2C driver system settings. 178 * I2C driver system settings.
@@ -205,13 +220,11 @@
205#define STM32_ICU_USE_TIM5 FALSE 220#define STM32_ICU_USE_TIM5 FALSE
206#define STM32_ICU_USE_TIM8 FALSE 221#define STM32_ICU_USE_TIM8 FALSE
207#define STM32_ICU_USE_TIM9 FALSE 222#define STM32_ICU_USE_TIM9 FALSE
208#define STM32_ICU_TIM1_IRQ_PRIORITY 7 223#define STM32_ICU_USE_TIM10 FALSE
209#define STM32_ICU_TIM2_IRQ_PRIORITY 7 224#define STM32_ICU_USE_TIM11 FALSE
210#define STM32_ICU_TIM3_IRQ_PRIORITY 7 225#define STM32_ICU_USE_TIM12 FALSE
211#define STM32_ICU_TIM4_IRQ_PRIORITY 7 226#define STM32_ICU_USE_TIM13 FALSE
212#define STM32_ICU_TIM5_IRQ_PRIORITY 7 227#define STM32_ICU_USE_TIM14 FALSE
213#define STM32_ICU_TIM8_IRQ_PRIORITY 7
214#define STM32_ICU_TIM9_IRQ_PRIORITY 7
215 228
216/* 229/*
217 * MAC driver system settings. 230 * MAC driver system settings.
@@ -227,7 +240,6 @@
227/* 240/*
228 * PWM driver system settings. 241 * PWM driver system settings.
229 */ 242 */
230#define STM32_PWM_USE_ADVANCED FALSE
231#define STM32_PWM_USE_TIM1 FALSE 243#define STM32_PWM_USE_TIM1 FALSE
232#define STM32_PWM_USE_TIM2 FALSE 244#define STM32_PWM_USE_TIM2 FALSE
233#define STM32_PWM_USE_TIM3 FALSE 245#define STM32_PWM_USE_TIM3 FALSE
@@ -235,13 +247,19 @@
235#define STM32_PWM_USE_TIM5 FALSE 247#define STM32_PWM_USE_TIM5 FALSE
236#define STM32_PWM_USE_TIM8 FALSE 248#define STM32_PWM_USE_TIM8 FALSE
237#define STM32_PWM_USE_TIM9 FALSE 249#define STM32_PWM_USE_TIM9 FALSE
238#define STM32_PWM_TIM1_IRQ_PRIORITY 7 250#define STM32_PWM_USE_TIM10 FALSE
239#define STM32_PWM_TIM2_IRQ_PRIORITY 7 251#define STM32_PWM_USE_TIM11 FALSE
240#define STM32_PWM_TIM3_IRQ_PRIORITY 7 252#define STM32_PWM_USE_TIM12 FALSE
241#define STM32_PWM_TIM4_IRQ_PRIORITY 7 253#define STM32_PWM_USE_TIM13 FALSE
242#define STM32_PWM_TIM5_IRQ_PRIORITY 7 254#define STM32_PWM_USE_TIM14 FALSE
243#define STM32_PWM_TIM8_IRQ_PRIORITY 7 255
244#define STM32_PWM_TIM9_IRQ_PRIORITY 7 256/*
257 * RTC driver system settings.
258 */
259#define STM32_RTC_PRESA_VALUE 32
260#define STM32_RTC_PRESS_VALUE 1024
261#define STM32_RTC_CR_INIT 0
262#define STM32_RTC_TAMPCR_INIT 0
245 263
246/* 264/*
247 * SDC driver system settings. 265 * SDC driver system settings.
@@ -265,14 +283,6 @@
265#define STM32_SERIAL_USE_USART6 FALSE 283#define STM32_SERIAL_USE_USART6 FALSE
266#define STM32_SERIAL_USE_UART7 FALSE 284#define STM32_SERIAL_USE_UART7 FALSE
267#define STM32_SERIAL_USE_UART8 FALSE 285#define STM32_SERIAL_USE_UART8 FALSE
268#define STM32_SERIAL_USART1_PRIORITY 12
269#define STM32_SERIAL_USART2_PRIORITY 12
270#define STM32_SERIAL_USART3_PRIORITY 12
271#define STM32_SERIAL_UART4_PRIORITY 12
272#define STM32_SERIAL_UART5_PRIORITY 12
273#define STM32_SERIAL_USART6_PRIORITY 12
274#define STM32_SERIAL_UART7_PRIORITY 12
275#define STM32_SERIAL_UART8_PRIORITY 12
276 286
277/* 287/*
278 * SPI driver system settings. 288 * SPI driver system settings.
@@ -281,6 +291,8 @@
281#define STM32_SPI_USE_SPI2 FALSE 291#define STM32_SPI_USE_SPI2 FALSE
282#define STM32_SPI_USE_SPI3 FALSE 292#define STM32_SPI_USE_SPI3 FALSE
283#define STM32_SPI_USE_SPI4 FALSE 293#define STM32_SPI_USE_SPI4 FALSE
294#define STM32_SPI_USE_SPI5 FALSE
295#define STM32_SPI_USE_SPI6 FALSE
284#define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 0) 296#define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 0)
285#define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 3) 297#define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 3)
286#define STM32_SPI_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3) 298#define STM32_SPI_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
@@ -289,14 +301,22 @@
289#define STM32_SPI_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7) 301#define STM32_SPI_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
290#define STM32_SPI_SPI4_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 0) 302#define STM32_SPI_SPI4_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 0)
291#define STM32_SPI_SPI4_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 1) 303#define STM32_SPI_SPI4_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 1)
304#define STM32_SPI_SPI5_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 3)
305#define STM32_SPI_SPI5_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 4)
306#define STM32_SPI_SPI6_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 6)
307#define STM32_SPI_SPI6_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 5)
292#define STM32_SPI_SPI1_DMA_PRIORITY 1 308#define STM32_SPI_SPI1_DMA_PRIORITY 1
293#define STM32_SPI_SPI2_DMA_PRIORITY 1 309#define STM32_SPI_SPI2_DMA_PRIORITY 1
294#define STM32_SPI_SPI3_DMA_PRIORITY 1 310#define STM32_SPI_SPI3_DMA_PRIORITY 1
295#define STM32_SPI_SPI4_DMA_PRIORITY 1 311#define STM32_SPI_SPI4_DMA_PRIORITY 1
312#define STM32_SPI_SPI5_DMA_PRIORITY 1
313#define STM32_SPI_SPI6_DMA_PRIORITY 1
296#define STM32_SPI_SPI1_IRQ_PRIORITY 10 314#define STM32_SPI_SPI1_IRQ_PRIORITY 10
297#define STM32_SPI_SPI2_IRQ_PRIORITY 10 315#define STM32_SPI_SPI2_IRQ_PRIORITY 10
298#define STM32_SPI_SPI3_IRQ_PRIORITY 10 316#define STM32_SPI_SPI3_IRQ_PRIORITY 10
299#define STM32_SPI_SPI4_IRQ_PRIORITY 10 317#define STM32_SPI_SPI4_IRQ_PRIORITY 10
318#define STM32_SPI_SPI5_IRQ_PRIORITY 10
319#define STM32_SPI_SPI6_IRQ_PRIORITY 10
300#define STM32_SPI_DMA_ERROR_HOOK(spip) osalSysHalt("DMA failure") 320#define STM32_SPI_DMA_ERROR_HOOK(spip) osalSysHalt("DMA failure")
301 321
302/* 322/*
@@ -326,12 +346,6 @@
326#define STM32_UART_UART5_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7) 346#define STM32_UART_UART5_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
327#define STM32_UART_USART6_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 2) 347#define STM32_UART_USART6_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 2)
328#define STM32_UART_USART6_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 7) 348#define STM32_UART_USART6_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 7)
329#define STM32_UART_USART1_IRQ_PRIORITY 12
330#define STM32_UART_USART2_IRQ_PRIORITY 12
331#define STM32_UART_USART3_IRQ_PRIORITY 12
332#define STM32_UART_UART4_IRQ_PRIORITY 12
333#define STM32_UART_UART5_IRQ_PRIORITY 12
334#define STM32_UART_USART6_IRQ_PRIORITY 12
335#define STM32_UART_USART1_DMA_PRIORITY 0 349#define STM32_UART_USART1_DMA_PRIORITY 0
336#define STM32_UART_USART2_DMA_PRIORITY 0 350#define STM32_UART_USART2_DMA_PRIORITY 0
337#define STM32_UART_USART3_DMA_PRIORITY 0 351#define STM32_UART_USART3_DMA_PRIORITY 0
@@ -349,9 +363,7 @@
349#define STM32_USB_OTG2_IRQ_PRIORITY 14 363#define STM32_USB_OTG2_IRQ_PRIORITY 14
350#define STM32_USB_OTG1_RX_FIFO_SIZE 512 364#define STM32_USB_OTG1_RX_FIFO_SIZE 512
351#define STM32_USB_OTG2_RX_FIFO_SIZE 1024 365#define STM32_USB_OTG2_RX_FIFO_SIZE 1024
352#define STM32_USB_OTG_THREAD_PRIO LOWPRIO 366#define STM32_USB_HOST_WAKEUP_DURATION 2
353#define STM32_USB_OTG_THREAD_STACK_SIZE 128
354#define STM32_USB_OTGFIFO_FILL_BASEPRI 0
355 367
356/* 368/*
357 * WDG driver system settings. 369 * WDG driver system settings.
diff --git a/platforms/chibios/boards/GENERIC_STM32_G431XB/configs/mcuconf.h b/platforms/chibios/boards/GENERIC_STM32_G431XB/configs/mcuconf.h
index 182d4885d..d11502830 100644
--- a/platforms/chibios/boards/GENERIC_STM32_G431XB/configs/mcuconf.h
+++ b/platforms/chibios/boards/GENERIC_STM32_G431XB/configs/mcuconf.h
@@ -40,9 +40,24 @@
40 */ 40 */
41#define STM32_NO_INIT FALSE 41#define STM32_NO_INIT FALSE
42#define STM32_VOS STM32_VOS_RANGE1 42#define STM32_VOS STM32_VOS_RANGE1
43#define STM32_PWR_BOOST TRUE
43#define STM32_PWR_CR2 (PWR_CR2_PLS_LEV0) 44#define STM32_PWR_CR2 (PWR_CR2_PLS_LEV0)
44#define STM32_PWR_CR3 (PWR_CR3_EIWF) 45#define STM32_PWR_CR3 (PWR_CR3_EIWF)
45#define STM32_PWR_CR4 (0U) 46#define STM32_PWR_CR4 (0U)
47#define STM32_PWR_PUCRA (0U)
48#define STM32_PWR_PDCRA (0U)
49#define STM32_PWR_PUCRB (0U)
50#define STM32_PWR_PDCRB (0U)
51#define STM32_PWR_PUCRC (0U)
52#define STM32_PWR_PDCRC (0U)
53#define STM32_PWR_PUCRD (0U)
54#define STM32_PWR_PDCRD (0U)
55#define STM32_PWR_PUCRE (0U)
56#define STM32_PWR_PDCRE (0U)
57#define STM32_PWR_PUCRF (0U)
58#define STM32_PWR_PDCRF (0U)
59#define STM32_PWR_PUCRG (0U)
60#define STM32_PWR_PDCRG (0U)
46#define STM32_HSI16_ENABLED TRUE 61#define STM32_HSI16_ENABLED TRUE
47#define STM32_HSI48_ENABLED TRUE 62#define STM32_HSI48_ENABLED TRUE
48#define STM32_HSE_ENABLED FALSE 63#define STM32_HSE_ENABLED FALSE
diff --git a/platforms/chibios/boards/GENERIC_STM32_G474XE/configs/mcuconf.h b/platforms/chibios/boards/GENERIC_STM32_G474XE/configs/mcuconf.h
index 117e920e3..5710e2cb4 100644
--- a/platforms/chibios/boards/GENERIC_STM32_G474XE/configs/mcuconf.h
+++ b/platforms/chibios/boards/GENERIC_STM32_G474XE/configs/mcuconf.h
@@ -42,9 +42,24 @@
42 */ 42 */
43#define STM32_NO_INIT FALSE 43#define STM32_NO_INIT FALSE
44#define STM32_VOS STM32_VOS_RANGE1 44#define STM32_VOS STM32_VOS_RANGE1
45#define STM32_PWR_BOOST TRUE
45#define STM32_PWR_CR2 (PWR_CR2_PLS_LEV0) 46#define STM32_PWR_CR2 (PWR_CR2_PLS_LEV0)
46#define STM32_PWR_CR3 (PWR_CR3_EIWF) 47#define STM32_PWR_CR3 (PWR_CR3_EIWF)
47#define STM32_PWR_CR4 (0U) 48#define STM32_PWR_CR4 (0U)
49#define STM32_PWR_PUCRA (0U)
50#define STM32_PWR_PDCRA (0U)
51#define STM32_PWR_PUCRB (0U)
52#define STM32_PWR_PDCRB (0U)
53#define STM32_PWR_PUCRC (0U)
54#define STM32_PWR_PDCRC (0U)
55#define STM32_PWR_PUCRD (0U)
56#define STM32_PWR_PDCRD (0U)
57#define STM32_PWR_PUCRE (0U)
58#define STM32_PWR_PDCRE (0U)
59#define STM32_PWR_PUCRF (0U)
60#define STM32_PWR_PDCRF (0U)
61#define STM32_PWR_PUCRG (0U)
62#define STM32_PWR_PDCRG (0U)
48#define STM32_HSI16_ENABLED TRUE 63#define STM32_HSI16_ENABLED TRUE
49#define STM32_HSI48_ENABLED TRUE 64#define STM32_HSI48_ENABLED TRUE
50#define STM32_HSE_ENABLED FALSE 65#define STM32_HSE_ENABLED FALSE
diff --git a/platforms/chibios/boards/QMK_PROTON_C/configs/chconf.h b/platforms/chibios/boards/QMK_PROTON_C/configs/chconf.h
index a1cbf6808..f81233296 100644
--- a/platforms/chibios/boards/QMK_PROTON_C/configs/chconf.h
+++ b/platforms/chibios/boards/QMK_PROTON_C/configs/chconf.h
@@ -40,7 +40,7 @@
40 40
41/** 41/**
42 * @brief System time counter resolution. 42 * @brief System time counter resolution.
43 * @note Allowed values are 16 or 32 bits. 43 * @note Allowed values are 16, 32 or 64 bits.
44 */ 44 */
45#if !defined(CH_CFG_ST_RESOLUTION) 45#if !defined(CH_CFG_ST_RESOLUTION)
46#define CH_CFG_ST_RESOLUTION 32 46#define CH_CFG_ST_RESOLUTION 32
diff --git a/platforms/chibios/boards/common/configs/chconf.h b/platforms/chibios/boards/common/configs/chconf.h
index 44327a82d..18ad609ca 100644
--- a/platforms/chibios/boards/common/configs/chconf.h
+++ b/platforms/chibios/boards/common/configs/chconf.h
@@ -40,7 +40,7 @@
40 40
41/** 41/**
42 * @brief System time counter resolution. 42 * @brief System time counter resolution.
43 * @note Allowed values are 16 or 32 bits. 43 * @note Allowed values are 16, 32 or 64 bits.
44 */ 44 */
45#if !defined(CH_CFG_ST_RESOLUTION) 45#if !defined(CH_CFG_ST_RESOLUTION)
46#define CH_CFG_ST_RESOLUTION 32 46#define CH_CFG_ST_RESOLUTION 32
diff --git a/tmk_core/chibios.mk b/tmk_core/chibios.mk
index 957a25922..6b298732c 100644
--- a/tmk_core/chibios.mk
+++ b/tmk_core/chibios.mk
@@ -42,6 +42,11 @@ ifeq ($(strip $(MCU)), risc-v)
42 PLATFORM_MK = $(CHIBIOS_CONTRIB)/os/hal/ports/GD/GD32VF103/platform.mk 42 PLATFORM_MK = $(CHIBIOS_CONTRIB)/os/hal/ports/GD/GD32VF103/platform.mk
43else 43else
44 # ARM Support 44 # ARM Support
45 CHIBIOS_PORT ?=
46 ifeq ("$(CHIBIOS_PORT)","")
47 CHIBIOS_PORT = ARMv$(ARMV)-M
48 endif
49
45 # Startup files. Try a few different locations, for compability with old versions and 50 # Startup files. Try a few different locations, for compability with old versions and
46 # for things hardware in the contrib repository 51 # for things hardware in the contrib repository
47 STARTUP_MK = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_$(MCU_STARTUP).mk 52 STARTUP_MK = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_$(MCU_STARTUP).mk
@@ -52,15 +57,24 @@ else
52 endif 57 endif
53 endif 58 endif
54 59
55 # Compability with old version 60 # Port files. Try a few different locations, for compability with old versions and
56 PORT_V = $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v$(ARMV)m.mk 61 # for things hardware in the contrib repository
62 PORT_V = $(CHIBIOS)/os/common/ports/$(CHIBIOS_PORT)/compilers/GCC/mk/port.mk
57 ifeq ("$(wildcard $(PORT_V))","") 63 ifeq ("$(wildcard $(PORT_V))","")
58 PORT_V = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v$(ARMV)m.mk 64 PORT_V = $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v$(ARMV)m.mk
65 ifeq ("$(wildcard $(PORT_V))","")
66 PORT_V = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v$(ARMV)m.mk
67 endif
59 endif 68 endif
60 69
61 RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC 70 # Rules location. Try a few different locations, for compability with old versions and
71 # for things hardware in the contrib repository
72 RULESPATH = $(CHIBIOS)/os/common/ports/$(CHIBIOS_PORT)/compilers/GCC
62 ifeq ("$(wildcard $(RULESPATH)/rules.mk)","") 73 ifeq ("$(wildcard $(RULESPATH)/rules.mk)","")
63 RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC 74 RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC
75 ifeq ("$(wildcard $(RULESPATH)/rules.mk)","")
76 RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC
77 endif
64 endif 78 endif
65endif 79endif
66 80
diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c
index 3b16a0ff7..a7db3e3ab 100644
--- a/tmk_core/protocol/chibios/usb_main.c
+++ b/tmk_core/protocol/chibios/usb_main.c
@@ -71,7 +71,12 @@ uint8_t keyboard_protocol __attribute__((aligned(2))) = 1;
71uint8_t keyboard_led_state = 0; 71uint8_t keyboard_led_state = 0;
72volatile uint16_t keyboard_idle_count = 0; 72volatile uint16_t keyboard_idle_count = 0;
73static virtual_timer_t keyboard_idle_timer; 73static virtual_timer_t keyboard_idle_timer;
74static void keyboard_idle_timer_cb(void *arg); 74
75#if CH_KERNEL_MAJOR >= 7
76static void keyboard_idle_timer_cb(struct ch_virtual_timer *, void *arg);
77#elif CH_KERNEL_MAJOR <= 6
78static void keyboard_idle_timer_cb(void *arg);
79#endif
75 80
76report_keyboard_t keyboard_report_sent = {{0}}; 81report_keyboard_t keyboard_report_sent = {{0}};
77#ifdef MOUSE_ENABLE 82#ifdef MOUSE_ENABLE
@@ -774,7 +779,12 @@ void kbd_sof_cb(USBDriver *usbp) { (void)usbp; }
774 779
775/* Idle requests timer code 780/* Idle requests timer code
776 * callback (called from ISR, unlocked state) */ 781 * callback (called from ISR, unlocked state) */
782#if CH_KERNEL_MAJOR >= 7
783static void keyboard_idle_timer_cb(struct ch_virtual_timer *timer, void *arg) {
784 (void)timer;
785#elif CH_KERNEL_MAJOR <= 6
777static void keyboard_idle_timer_cb(void *arg) { 786static void keyboard_idle_timer_cb(void *arg) {
787#endif
778 USBDriver *usbp = (USBDriver *)arg; 788 USBDriver *usbp = (USBDriver *)arg;
779 789
780 osalSysLockFromISR(); 790 osalSysLockFromISR();
diff --git a/util/chibios_conf_updater.sh b/util/chibios_conf_updater.sh
index d1640b672..a5699ca3c 100755
--- a/util/chibios_conf_updater.sh
+++ b/util/chibios_conf_updater.sh
@@ -3,6 +3,17 @@
3set -eEuo pipefail 3set -eEuo pipefail
4umask 022 4umask 022
5 5
6#####################
7# You will need to get an older JDK -- JDK 8
8#
9# !!!!!!!! DO NOT INSTALL THIS IF YOU HAVE AN EXISTING JDK OR JRE INSTALLED !!!!!!!!
10#
11# For Debian 10-ish distro's:
12# wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | sudo apt-key add -
13# sudo add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/
14# sudo apt-get update && sudo apt-get install adoptopenjdk-8-hotspot
15
16
6sinfo() { echo "$@" >&2 ; } 17sinfo() { echo "$@" >&2 ; }
7shead() { sinfo "" ; sinfo "---------------------------------" ; sinfo "-- $@" ; sinfo "---------------------------------" ; } 18shead() { sinfo "" ; sinfo "---------------------------------" ; sinfo "-- $@" ; sinfo "---------------------------------" ; }
8havecmd() { command command type "${1}" >/dev/null 2>&1 || return 1 ; } 19havecmd() { command command type "${1}" >/dev/null 2>&1 || return 1 ; }
@@ -11,8 +22,6 @@ this_script="$(realpath "${BASH_SOURCE[0]}")"
11script_dir="$(realpath "$(dirname "$this_script")")" 22script_dir="$(realpath "$(dirname "$this_script")")"
12qmk_firmware_dir="$(realpath "$script_dir/../")" 23qmk_firmware_dir="$(realpath "$script_dir/../")"
13 24
14declare -A file_hashes
15
16export PATH="$PATH:$script_dir/fmpp/bin" 25export PATH="$PATH:$script_dir/fmpp/bin"
17 26
18build_fmpp() { 27build_fmpp() {
@@ -45,67 +54,6 @@ find_chibi_files() {
45 done 54 done
46} 55}
47 56
48revert_chibi_files() {
49 local search_path="$1"
50 shead "Reverting ChibiOS config/board files..."
51 for file in $(find_chibi_files "$search_path" -name chconf.h -or -name halconf.h -or -name mcuconf.h -or -name board.c -or -name board.h -or -name board.mk -or -name board.chcfg) ; do
52 pushd "$search_path" >/dev/null 2>&1
53 local relpath=$(realpath --relative-to="$search_path" "$file")
54 git checkout upstream/develop -- "$relpath" || git checkout origin/develop -- "$relpath" || true
55 popd >/dev/null 2>&1
56 done
57}
58
59populate_file_hashes() {
60 local search_path="$1"
61 shead "Determining duplicate config/board files..."
62 for file in $(find_chibi_files "$search_path" -name chconf.h -or -name halconf.h -or -name mcuconf.h -or -name board.c -or -name board.h) ; do
63 local key="file_$(clang-format "$file" | sha1sum | cut -d' ' -f1)"
64 local relpath=$(realpath --relative-to="$search_path" "$file")
65 file_hashes[$key]="${file_hashes[$key]:-} $relpath"
66 done
67 for file in $(find_chibi_files "$search_path" -name board.mk -or -name board.chcfg) ; do
68 local key="file_$(cat "$file" | sha1sum | cut -d' ' -f1)"
69 local relpath=$(realpath --relative-to="$search_path" "$file")
70 file_hashes[$key]="${file_hashes[$key]:-} $relpath"
71 done
72}
73
74determine_equivalent_files() {
75 local search_file="$1"
76 for K in "${!file_hashes[@]}"; do
77 for V in ${file_hashes[$K]}; do
78 if [[ "$V" == "$search_file" ]] ; then
79 for V in ${file_hashes[$K]}; do
80 echo "$V"
81 done
82 return 0
83 fi
84 done
85 done
86 return 1
87}
88
89deploy_staged_files() {
90 shead "Deploying staged files..."
91 for file in $(find "$qmk_firmware_dir/util/chibios-upgrade-staging" -type f) ; do
92 local relpath=$(realpath --relative-to="$qmk_firmware_dir/util/chibios-upgrade-staging" "$file")
93 sinfo "Deploying staged file: $relpath"
94 for other in $(determine_equivalent_files "$relpath") ; do
95 sinfo " => $other"
96 cp "$qmk_firmware_dir/util/chibios-upgrade-staging/$relpath" "$qmk_firmware_dir/$other"
97 done
98 done
99}
100
101swap_mcuconf_f3xx_f303() {
102 shead "Swapping STM32F3xx_MCUCONF -> STM32F303_MCUCONF..."
103 for file in $(find_chibi_files "$qmk_firmware_dir" -name mcuconf.h) ; do
104 sed -i 's#STM32F3xx_MCUCONF#STM32F303_MCUCONF#g' "$file"
105 dos2unix "$file" >/dev/null 2>&1
106 done
107}
108
109upgrade_conf_files_generic() { 57upgrade_conf_files_generic() {
110 local search_filename="$1" 58 local search_filename="$1"
111 local update_script="$2" 59 local update_script="$2"
@@ -150,35 +98,8 @@ upgrade_mcuconf_files() {
150 popd >/dev/null 2>&1 98 popd >/dev/null 2>&1
151} 99}
152 100
153update_staged_files() {
154 shead "Updating staged files with ChibiOS upgraded versions..."
155 for file in $(find "$qmk_firmware_dir/util/chibios-upgrade-staging" -type f) ; do
156 local relpath=$(realpath --relative-to="$qmk_firmware_dir/util/chibios-upgrade-staging" "$file")
157 sinfo "Updating staged file: $relpath"
158 cp "$qmk_firmware_dir/$relpath" "$qmk_firmware_dir/util/chibios-upgrade-staging/$relpath"
159 done
160}
161
162havecmd fmpp || build_fmpp 101havecmd fmpp || build_fmpp
163revert_chibi_files "$qmk_firmware_dir"
164populate_file_hashes "$qmk_firmware_dir"
165
166shead "Showing duplicate ChibiOS files..."
167for K in "${!file_hashes[@]}"; do
168 sinfo ${K#file_}:
169 for V in ${file_hashes[$K]}; do
170 sinfo " $V"
171 done
172done
173
174if [ "${1:-}" == "-r" ] ; then
175 exit 0
176fi
177
178swap_mcuconf_f3xx_f303
179 102
180deploy_staged_files
181upgrade_mcuconf_files 103upgrade_mcuconf_files
182upgrade_chconf_files 104upgrade_chconf_files
183upgrade_halconf_files 105upgrade_halconf_files
184update_staged_files
diff --git a/util/update_chibios_mirror.sh b/util/update_chibios_mirror.sh
index 83aee2281..0bf648ebf 100755
--- a/util/update_chibios_mirror.sh
+++ b/util/update_chibios_mirror.sh
@@ -7,10 +7,10 @@
7chibios_branches="trunk stable_20.3.x stable_21.6.x" 7chibios_branches="trunk stable_20.3.x stable_21.6.x"
8 8
9# The ChibiOS tags to mirror 9# The ChibiOS tags to mirror
10chibios_tags="ver20.3.1 ver20.3.2 ver20.3.3 ver21.6.0" 10chibios_tags="ver20.3.1 ver20.3.2 ver20.3.3 ver20.3.4 ver21.6.0"
11 11
12# The ChibiOS-Contrib branches to mirror 12# The ChibiOS-Contrib branches to mirror
13contrib_branches="chibios-20.3.x" 13contrib_branches="chibios-20.3.x chibios-21.6.x"
14 14
15################################ 15################################
16# Actions 16# Actions