You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

353 lines
10 KiB

Add ChibiOS support for QMK (#465) * Modularity and gcc warnings fixes. * Add ChibiOS support (USB stack + support files). * Make usb_main more USB_DRIVER #define independent. * Move chibios to tool. * Implement jump-to-bootloader. * Small updates. * Fix bootloader-jump compiling. * Move AVR specific sleep_led.c into avr. * Add basic sleep_led for chibios. * Update chibios README. * NKRO fixes. * Rename some Makefile defines. * Move STM32 bootloader address config to separate .h file. * Add ARM Teensies bootloader code. * Fix chibios/usb_main GET_REPORT handing. * Add missing #include to keymap.c. * Make bootmagic.c code portable (_delay_ms -> wait_ms). * Move declaration of keymap_config. Should really not declare variables in .h files - since it's included in different .c files, a proper linker then complains that the same variable is declared more than once (once for each .c file that the offending .h is included in). * Add eeprom support for chibios/kinetis. * Rename chibios example keyboard. * Move chibios/cortex selection to local Makefiles. * Chibios: use WFI in idle. WIP suspend stuff. * ChibiOS/kinetis: sending remote wakeup. * ChibiOS/STM32: send remote wakeup. * Fix report size of boot protocol. * Fix drop key stroke Keyboard report should be checked if its transfer finishs successfully. Otherwise key stroke can be missing when other key event occurs before the last report transfer is done. Boot protocol 10ms interval probably causes this problem in case it receives key events in a row within the period. NKRO protocol suffers less or nothing due to its interval 1ms. * Chibios/usb_main: rename a variable for clarity. * Add correct chibios/bootloader_jump for infinity KB. * ChibiOS: make reset request more CMSISy. * Chibios: Add breathing sleep LED on Kinetis MCUs. * ChibiOS: Update infinity bootloader code to match updated ChibiOS. * ChibiOS: prettify/document sleep_led code. * Chibios: Remove the wait in the main loop. * Add maple mini code. * Do timeout when writing to CONSOLE EP queue. Fixes TMK bug #266. * Chibios: add 'core/protocol' to the makefiles' search path. * Chibios: Update to new USB API. * Chibios: add more guards for transmitting (fix a deadlock bug). * Add update for chibios in README * Chibios: Fix a HardFault bug (wait after start). * Chibios: cleanup usb_main code. * Chibios: Revert common.mk change (fix AVR linking problem). * core: Fix chibios user compile options Compile options can be defined in project Makefile such as UDEFS, UADEFS, UINCDIR, ULIBDIR and ULIBS. * Sysv format for ChibiOS arm-none-eabi-size Some new patches to ChibiOS puts heap as it's own section. So the berkeley format is now useless, as the heap will be included in the BSS report. The sysv format displays the bss size correctly. * Fix hard-coded path of CHIBIOS * Add support for new version of ChibiOS and Contrib The Kinetis support has moved to a separate Contrib repository in the newest version of Chibios. There has also been some structure changes. So this adds support for those, while maintaining back- wards compability. * Update ChibiOS instructions * Chibios: implement sleep LED for STM32. * Chibios: Update the main chibios README. * Chibios: fix STM32_BOOTLOADER_ADDRESS name. * Chibios: make the default bootloader_jump redefinable (weak). * Chibios: disable LTO (link-time optimisation). With LTO enabled, sometimes things fail for mysterious reasons (e.g. bootloader jump on WF with LEDs enabled), just because the linker optimisation is too aggressive. * Chibios: add default location for chibios-contrib. * ChibiOS: update mk to match chibios/master. * ChibiOS: update instructions.md. * Add chibi_onekey example. * Add comments to chibi_onekey Makefile. * Rename some Makefile defines. * Move STM32 bootloader address config to separate .h file. * Rename chibios example keyboard. * Move chibios/cortex selection to local Makefiles. * Add Teensy LC onekey example. * Chibios: use WFI in idle. WIP suspend stuff. * Update chibi/teensy instructions. * Update chibios/Teensy instructions. * Add infinity_chibios * Add keymap_hasu.c * Infinity_chibios: select correct bootloader_jump. * Infinity_chibios: improve comments. * Add generic STM32F103C8T6 example. * Add maple mini code. * STM32F103x fixes. * Add maple mini pinout pic. * Chibios: updates for 3.0.4 git. * Chibios: rename example stm32_onekey -> stm32_f072_onekey. * Chibios: add makefiles for Teensy 3.x examples. * Chibios: update Teensy 3.x instructions. * Chibios: Tsy LC is cortex-m0plus. * Chibios: add more guards for transmitting (fix a deadlock bug). * Change README for chibios * Chibios: update examples to current chibios git. Match the changes in mainline chibios: - update chconf.h - update supplied ld scripts structure - update Teensy instructions (switch to official chibios and introduce contrib) * Add ChibiOS and ChibiOS-Contrib submodules Also fix the makefile path for them. * Moves chibios keyboards to keyboards folder * First version of ChibiOS compilation Only the stm32_f072_onkey keyboard is ported at the moment. It compiles, but still doesn't link. * More chibios fixes It now compiles without warnings and links * Move the teensy_lc_onekey to the keyboards folder * Clean up the make file rule structure * Remove keymap_fn_to_action * Update more ChibiOS keyboards to QMK Most of them does not compile at the moment though. * Use older version of Chibios libraries The newest ones have problems with compilation * Remove USB_UNCONFIGURED event It isn't present in the older version of ChibiOS * Fix the infinity_chibios compilation * Fix potentially uninitialized variable * Add missing include * Fix the ChibiOS makefile * Fix some Chibios keyboard compilation * Revert the rules.mk file back to master version * Combine the chibios and AVR makefiles With just the required overrides in the respective platform specific one. * Slight makefile restrucuring Platform specific compiler options * Move avr specific targets out of the main rules * Fix ChibiOS objcopy The ChibiOS objcopy needs different parameters, so the parameters are moved to the corresponding platform rule file * Fix the objcopy for real this time The comands were moved around, so chibios used avr and the ohter way around. Also change the objsize output format * Fix the thumb flags * Fix the infinity hasu keymap * Per platform cpp flags * Add gcc-arm-none-eabi package to travis * Add arm-none-eabi-newlib to travis * Fix the name of the libnewlib-arm-none-eabi lib * Fix the ChibiOS paths So that they are properly relative, and builds don't generate extra folders * Fix the board path of stm32_f103_onekey * Only consider folders with Makefiles as subproject
8 years ago
  1. /*
  2. ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. /**
  14. * @file templates/halconf.h
  15. * @brief HAL configuration header.
  16. * @details HAL configuration file, this file allows to enable or disable the
  17. * various device drivers from your application. You may also use
  18. * this file in order to override the device drivers default settings.
  19. *
  20. * @addtogroup HAL_CONF
  21. * @{
  22. */
  23. #ifndef _HALCONF_H_
  24. #define _HALCONF_H_
  25. #include "mcuconf.h"
  26. /**
  27. * @brief Enables the PAL subsystem.
  28. */
  29. #if !defined(HAL_USE_PAL) || defined(__DOXYGEN__)
  30. #define HAL_USE_PAL TRUE
  31. #endif
  32. /**
  33. * @brief Enables the ADC subsystem.
  34. */
  35. #if !defined(HAL_USE_ADC) || defined(__DOXYGEN__)
  36. #define HAL_USE_ADC FALSE
  37. #endif
  38. /**
  39. * @brief Enables the CAN subsystem.
  40. */
  41. #if !defined(HAL_USE_CAN) || defined(__DOXYGEN__)
  42. #define HAL_USE_CAN FALSE
  43. #endif
  44. /**
  45. * @brief Enables the DAC subsystem.
  46. */
  47. #if !defined(HAL_USE_DAC) || defined(__DOXYGEN__)
  48. #define HAL_USE_DAC FALSE
  49. #endif
  50. /**
  51. * @brief Enables the EXT subsystem.
  52. */
  53. #if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
  54. #define HAL_USE_EXT FALSE
  55. #endif
  56. /**
  57. * @brief Enables the GPT subsystem.
  58. */
  59. #if !defined(HAL_USE_GPT) || defined(__DOXYGEN__)
  60. #define HAL_USE_GPT FALSE
  61. #endif
  62. /**
  63. * @brief Enables the I2C subsystem.
  64. */
  65. #if !defined(HAL_USE_I2C) || defined(__DOXYGEN__)
  66. #define HAL_USE_I2C FALSE
  67. #endif
  68. /**
  69. * @brief Enables the I2S subsystem.
  70. */
  71. #if !defined(HAL_USE_I2S) || defined(__DOXYGEN__)
  72. #define HAL_USE_I2S FALSE
  73. #endif
  74. /**
  75. * @brief Enables the ICU subsystem.
  76. */
  77. #if !defined(HAL_USE_ICU) || defined(__DOXYGEN__)
  78. #define HAL_USE_ICU FALSE
  79. #endif
  80. /**
  81. * @brief Enables the MAC subsystem.
  82. */
  83. #if !defined(HAL_USE_MAC) || defined(__DOXYGEN__)
  84. #define HAL_USE_MAC FALSE
  85. #endif
  86. /**
  87. * @brief Enables the MMC_SPI subsystem.
  88. */
  89. #if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__)
  90. #define HAL_USE_MMC_SPI FALSE
  91. #endif
  92. /**
  93. * @brief Enables the PWM subsystem.
  94. */
  95. #if !defined(HAL_USE_PWM) || defined(__DOXYGEN__)
  96. #define HAL_USE_PWM FALSE
  97. #endif
  98. /**
  99. * @brief Enables the RTC subsystem.
  100. */
  101. #if !defined(HAL_USE_RTC) || defined(__DOXYGEN__)
  102. #define HAL_USE_RTC FALSE
  103. #endif
  104. /**
  105. * @brief Enables the SDC subsystem.
  106. */
  107. #if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
  108. #define HAL_USE_SDC FALSE
  109. #endif
  110. /**
  111. * @brief Enables the SERIAL subsystem.
  112. */
  113. #if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__)
  114. #define HAL_USE_SERIAL FALSE
  115. #endif
  116. /**
  117. * @brief Enables the SERIAL over USB subsystem.
  118. */
  119. #if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__)
  120. #define HAL_USE_SERIAL_USB FALSE
  121. #endif
  122. /**
  123. * @brief Enables the SPI subsystem.
  124. */
  125. #if !defined(HAL_USE_SPI) || defined(__DOXYGEN__)
  126. #define HAL_USE_SPI FALSE
  127. #endif
  128. /**
  129. * @brief Enables the UART subsystem.
  130. */
  131. #if !defined(HAL_USE_UART) || defined(__DOXYGEN__)
  132. #define HAL_USE_UART FALSE
  133. #endif
  134. /**
  135. * @brief Enables the USB subsystem.
  136. */
  137. #if !defined(HAL_USE_USB) || defined(__DOXYGEN__)
  138. #define HAL_USE_USB TRUE
  139. #endif
  140. /**
  141. * @brief Enables the WDG subsystem.
  142. */
  143. #if !defined(HAL_USE_WDG) || defined(__DOXYGEN__)
  144. #define HAL_USE_WDG FALSE
  145. #endif
  146. /*===========================================================================*/
  147. /* ADC driver related settings. */
  148. /*===========================================================================*/
  149. /**
  150. * @brief Enables synchronous APIs.
  151. * @note Disabling this option saves both code and data space.
  152. */
  153. #if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__)
  154. #define ADC_USE_WAIT TRUE
  155. #endif
  156. /**
  157. * @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs.
  158. * @note Disabling this option saves both code and data space.
  159. */
  160. #if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
  161. #define ADC_USE_MUTUAL_EXCLUSION TRUE
  162. #endif
  163. /*===========================================================================*/
  164. /* CAN driver related settings. */
  165. /*===========================================================================*/
  166. /**
  167. * @brief Sleep mode related APIs inclusion switch.
  168. */
  169. #if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__)
  170. #define CAN_USE_SLEEP_MODE TRUE
  171. #endif
  172. /*===========================================================================*/
  173. /* I2C driver related settings. */
  174. /*===========================================================================*/
  175. /**
  176. * @brief Enables the mutual exclusion APIs on the I2C bus.
  177. */
  178. #if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
  179. #define I2C_USE_MUTUAL_EXCLUSION TRUE
  180. #endif
  181. /*===========================================================================*/
  182. /* MAC driver related settings. */
  183. /*===========================================================================*/
  184. /**
  185. * @brief Enables an event sources for incoming packets.
  186. */
  187. #if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
  188. #define MAC_USE_ZERO_COPY FALSE
  189. #endif
  190. /**
  191. * @brief Enables an event sources for incoming packets.
  192. */
  193. #if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__)
  194. #define MAC_USE_EVENTS TRUE
  195. #endif
  196. /*===========================================================================*/
  197. /* MMC_SPI driver related settings. */
  198. /*===========================================================================*/
  199. /**
  200. * @brief Delays insertions.
  201. * @details If enabled this options inserts delays into the MMC waiting
  202. * routines releasing some extra CPU time for the threads with
  203. * lower priority, this may slow down the driver a bit however.
  204. * This option is recommended also if the SPI driver does not
  205. * use a DMA channel and heavily loads the CPU.
  206. */
  207. #if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__)
  208. #define MMC_NICE_WAITING TRUE
  209. #endif
  210. /*===========================================================================*/
  211. /* SDC driver related settings. */
  212. /*===========================================================================*/
  213. /**
  214. * @brief Number of initialization attempts before rejecting the card.
  215. * @note Attempts are performed at 10mS intervals.
  216. */
  217. #if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__)
  218. #define SDC_INIT_RETRY 100
  219. #endif
  220. /**
  221. * @brief Include support for MMC cards.
  222. * @note MMC support is not yet implemented so this option must be kept
  223. * at @p FALSE.
  224. */
  225. #if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__)
  226. #define SDC_MMC_SUPPORT FALSE
  227. #endif
  228. /**
  229. * @brief Delays insertions.
  230. * @details If enabled this options inserts delays into the MMC waiting
  231. * routines releasing some extra CPU time for the threads with
  232. * lower priority, this may slow down the driver a bit however.
  233. */
  234. #if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__)
  235. #define SDC_NICE_WAITING TRUE
  236. #endif
  237. /*===========================================================================*/
  238. /* SERIAL driver related settings. */
  239. /*===========================================================================*/
  240. /**
  241. * @brief Default bit rate.
  242. * @details Configuration parameter, this is the baud rate selected for the
  243. * default configuration.
  244. */
  245. #if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__)
  246. #define SERIAL_DEFAULT_BITRATE 38400
  247. #endif
  248. /**
  249. * @brief Serial buffers size.
  250. * @details Configuration parameter, you can change the depth of the queue
  251. * buffers depending on the requirements of your application.
  252. * @note The default is 64 bytes for both the transmission and receive
  253. * buffers.
  254. */
  255. #if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
  256. #define SERIAL_BUFFERS_SIZE 16
  257. #endif
  258. /*===========================================================================*/
  259. /* SERIAL_USB driver related setting. */
  260. /*===========================================================================*/
  261. /**
  262. * @brief Serial over USB buffers size.
  263. * @details Configuration parameter, the buffer size must be a multiple of
  264. * the USB data endpoint maximum packet size.
  265. * @note The default is 64 bytes for both the transmission and receive
  266. * buffers.
  267. */
  268. #if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
  269. #define SERIAL_USB_BUFFERS_SIZE 256
  270. #endif
  271. /*===========================================================================*/
  272. /* SPI driver related settings. */
  273. /*===========================================================================*/
  274. /**
  275. * @brief Enables synchronous APIs.
  276. * @note Disabling this option saves both code and data space.
  277. */
  278. #if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__)
  279. #define SPI_USE_WAIT TRUE
  280. #endif
  281. /**
  282. * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
  283. * @note Disabling this option saves both code and data space.
  284. */
  285. #if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
  286. #define SPI_USE_MUTUAL_EXCLUSION TRUE
  287. #endif
  288. /*===========================================================================*/
  289. /* USB driver related settings. */
  290. /*===========================================================================*/
  291. /**
  292. * @brief Enables synchronous APIs.
  293. * @note Disabling this option saves both code and data space.
  294. */
  295. #if !defined(USB_USE_WAIT) || defined(__DOXYGEN__)
  296. #define USB_USE_WAIT TRUE
  297. #endif
  298. #endif /* _HALCONF_H_ */
  299. /** @} */