stm32f1.nut 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. --
  2. -- * Copyright (C) 2010 by Ulrich Prinz (uprinz2@netscape.net)
  3. --
  4. -- Redistribution and use in source and binary forms, with or without
  5. -- modification, are permitted provided that the following conditions
  6. -- are met:
  7. --
  8. -- 1. Redistributions of source code must retain the above copyright
  9. -- notice, this list of conditions and the following disclaimer.
  10. -- 2. Redistributions in binary form must reproduce the above copyright
  11. -- notice, this list of conditions and the following disclaimer in the
  12. -- documentation and/or other materials provided with the distribution.
  13. -- 3. Neither the name of the copyright holders nor the names of
  14. -- contributors may be used to endorse or promote products derived
  15. -- from this software without specific prior written permission.
  16. --
  17. -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  18. -- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  19. -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  20. -- FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  21. -- COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  22. -- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  23. -- BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  24. -- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  25. -- AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  26. -- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  27. -- THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  28. -- SUCH DAMAGE.
  29. --
  30. -- For additional information see http://www.ethernut.de/
  31. --
  32. -- ARM CortexM3 Architecture
  33. -- STMicroelectronics STM32F1 Family Devices
  34. --
  35. -- $Id: stm32f1.nut 5628 2014-04-07 13:48:44Z u_bonnes $
  36. --
  37. --
  38. stm32_memory_f10x = { "16", "32", "64", "128", "256", "384", "512", "768", "1024" }
  39. stm32_device_class = { "STM32F10X_LD", "STM32F10X_LD_VL",
  40. "STM32F10X_MD", "STM32F10X_MD_VL",
  41. "STM32F10X_HD", "STM32F10X_CL", "STM32F10X_XL" }
  42. --
  43. -- ********************************************************************************
  44. -- STM32F1 Family
  45. -- ********************************************************************************
  46. --
  47. nutarch_cm3_stm32f1 =
  48. {
  49. --
  50. -- MCU Family
  51. --
  52. {
  53. name = "nutarch_cm3_stm32f1_family",
  54. brief = "MCU F1 Family",
  55. sources = { "cm3/dev/stm/stm32f1_clk.c"},
  56. options =
  57. {
  58. {
  59. macro = "MCU_STM32F1",
  60. brief = "STM32F1",
  61. type = "integer",
  62. default = 1,
  63. requires = { "HW_MCU_CM3" },
  64. provides = {
  65. "HW_RCC_STM32",
  66. "HW_RTC_STM32F1",
  67. "HW_FLASH_STM32F1_3",
  68. "HW_GPIO_STM32V1",
  69. "HW_CRC32_STM32",
  70. "DEV_IRQ_STM32",
  71. "HW_EXTI04_STM32",
  72. "HW_WWDG_STM32",
  73. "HW_DMA1_STM32F1",
  74. "HW_EXTI95_STM32",
  75. "HW_I2C1_STM32",
  76. "HW_SPI1_STM32",
  77. "HW_USART1_STM32",
  78. "HW_USART2_STM32",
  79. "HW_EXTI1510_STM32",
  80. "HW_TIM2_STM32",
  81. "HW_TIM3_STM32",
  82. },
  83. file = "include/cfg/arch.h"
  84. }
  85. }
  86. },
  87. --
  88. -- STM32F1 MCU Classes
  89. --
  90. {
  91. name = "nutarch_cm3_stm32f_class",
  92. brief = "STM32F1 Device Classes",
  93. requires = { "HW_MCU_STM32" },
  94. options =
  95. {
  96. {
  97. macro = "STM32F10X_LD",
  98. brief = "STM32F LD Series",
  99. description = "STM32F Low Density devices.",
  100. flavor = "booldata",
  101. exclusivity = stm32_device_class,
  102. makedefs = { "HWDEF+=-DSTM32F10X_LD" },
  103. provides = {
  104. "STM32F10X_LD",
  105. "HW_USB_CAN1_STM32",
  106. "HW_TIM1_STM32",
  107. "HW_ADC1_2_STM32F1",
  108. },
  109. file = "include/cfg/arch.h"
  110. },
  111. {
  112. macro = "STM32F10X_LD_VL",
  113. brief = "STM32F LD-VL Series",
  114. description = "STM32F Low Density devices.",
  115. flavor = "booldata",
  116. exclusivity = stm32_device_class,
  117. makedefs = { "HWDEF+=-DSTM32F10X_LD_VL" },
  118. provides = {
  119. "STM32F10X_LD_VL",
  120. "HW_CEC_STM32_STM32",
  121. "HW_TIM1_TIM15_TIM16_TIM17_STM32",
  122. "HW_TIM6_DAC_STM32",
  123. "HW_TIM7_STM32",
  124. "HW_ADC1_STM32F1",
  125. },
  126. file = "include/cfg/arch.h"
  127. },
  128. {
  129. macro = "STM32F10X_MD",
  130. brief = "STM32F MD Series",
  131. description = "STM32F Medium Density devices.",
  132. flavor = "booldata",
  133. exclusivity = stm32_device_class,
  134. makedefs = { "HWDEF+=-DSTM32F10X_MD" },
  135. provides = {
  136. "STM32F10X_MD",
  137. "HW_USB_CAN1_STM32",
  138. "HW_TIM1_STM32",
  139. "HW_TIM4_STM32",
  140. "HW_I2C2_STM32",
  141. "HW_SPI2_STM32",
  142. "HW_USART3_STM32",
  143. "HW_ADC1_2_STM32F1",
  144. },
  145. file = "include/cfg/arch.h"
  146. },
  147. {
  148. macro = "STM32F10X_MD_VL",
  149. brief = "STM32F MD-VL Series",
  150. description = "STM32F Medium Density devices.",
  151. flavor = "booldata",
  152. exclusivity = stm32_device_class,
  153. makedefs = { "HWDEF+=-DSTM32F10X_MD_VL" },
  154. provides = {
  155. "STM32F10X_MD_VL",
  156. "HW_TIM1_TIM15_TIM16_TIM17_STM32",
  157. "HW_TIM4_STM32",
  158. "HW_TIM6_DAC_STM32",
  159. "HW_TIM7_STM32",
  160. "HW_I2C2_STM32",
  161. "HW_SPI2_STM32",
  162. "HW_USART3_STM32",
  163. "HW_CEC_STM32",
  164. "HW_ADC1_STM32F1",
  165. },
  166. file = "include/cfg/arch.h"
  167. },
  168. {
  169. macro = "STM32F10X_HD",
  170. brief = "STM32F HD Series",
  171. description = "STM32F HD-Series devices.",
  172. flavor = "booldata",
  173. exclusivity = stm32_device_class,
  174. makedefs = { "HWDEF+=-DSTM32F10X_HD" },
  175. provides = {
  176. "STM32F10X_HD",
  177. "HW_USB_CAN1_STM32",
  178. "HW_TIM1_STM32",
  179. "HW_TIM4_STM32",
  180. "HW_TIM5_STM32",
  181. "HW_TIM6_DAC_STM32",
  182. "HW_TIM7_STM32",
  183. "HW_TIM8_STM32",
  184. "HW_I2C2_STM32",
  185. "HW_SPI2_STM32",
  186. "HW_USART3_STM32",
  187. "HW_FSMC_STM32",
  188. "HW_SDIO_STM32",
  189. "HW_SPI3_STM32",
  190. "HW_UART4_STM32",
  191. "HW_UART5_STM32",
  192. "HW_DMA2_CH4_5_STM32F1",
  193. "HW_ADC1_2_STM32F1",
  194. "HW_ADC3_STM32F1",
  195. },
  196. file = "include/cfg/arch.h"
  197. },
  198. {
  199. macro = "STM32F10X_XL",
  200. brief = "STM32F XL Devices",
  201. description = "STM32F XL-Series devices.",
  202. flavor = "booldata",
  203. exclusivity = stm32_device_class,
  204. makedefs = { "HWDEF+=-DSTM32F10X_XL" },
  205. provides = {
  206. "STM32F10X_XL",
  207. "HW_USB_CAN1_STM32",
  208. "HW_TIM1_TIM9_TIM10_TIM11_STM32",
  209. "HW_TIM4_STM32",
  210. "HW_TIM5_STM32",
  211. "HW_TIM6_STM32",
  212. "HW_TIM7_STM32",
  213. "HW_TIM8_TIM12_TIM13_TIM14_STM32",
  214. "HW_I2C2_STM32",
  215. "HW_SPI2_STM32",
  216. "HW_USART3_STM32",
  217. "HW_FSMC_STM32",
  218. "HW_SDIO_STM32",
  219. "HW_SPI3_STM32",
  220. "HW_UART4_STM32",
  221. "HW_UART5_STM32",
  222. "HW_DMA2_CH4_5_STM32F1",
  223. "HW_ADC1_2_STM32F1",
  224. "HW_ADC3_STM32F1",
  225. },
  226. file = "include/cfg/arch.h"
  227. },
  228. {
  229. macro = "STM32F10X_CL",
  230. brief = "STM32F CL Series",
  231. description = "STM32F Connectivity line devices.",
  232. flavor = "booldata",
  233. exclusivity = stm32_device_class,
  234. makedefs = { "HWDEF+=-DSTM32F10X_CL" },
  235. provides = {
  236. "STM32F10X_CL",
  237. "HW_OTG_STM32",
  238. "HW_CAN1_STM32",
  239. "HW_CAN2_STM32",
  240. "HW_TIM1_STM32",
  241. "HW_TIM4_STM32",
  242. "HW_TIM5_STM32",
  243. "HW_TIM6_STM32",
  244. "HW_TIM7_STM32",
  245. "HW_I2C2_STM32",
  246. "HW_SPI2_STM32",
  247. "HW_USART3_STM32",
  248. "HW_OTG1_STM32",
  249. "HW_SPI3_STM32",
  250. "HW_UART4_STM32",
  251. "HW_UART5_STM32",
  252. "HW_EMAC_STM32",
  253. "HW_DMA2_STM32F1",
  254. "HW_ADC1_2_STM32F1",
  255. },
  256. file = "include/cfg/arch.h"
  257. },
  258. }
  259. },
  260. --
  261. -- STM32F Memory Configuration
  262. --
  263. {
  264. name = "nutarch_cm3_stm32f_memory",
  265. brief = "STM32F Device Memory",
  266. requires = { "HW_MCU_STM32" },
  267. options =
  268. {
  269. {
  270. macro = "MCU_STM32F10X",
  271. brief = "STM32F10x memory",
  272. description = "Select your devices memory by the marked alphanumeric code on the chip:\n"..
  273. "STM32F10x>Y<zz where Y is one of the list below.\n\n"..
  274. "4 = 16 kbytes Flash\n"..
  275. "6 = 32 kbytes Flash\n"..
  276. "7 = 48 kbytes Flash\n"..
  277. "8 = 60/64 kbytes Flash\n"..
  278. "9 = 72 kbytes Flash\n"..
  279. "A = 96 kbytes Flash\n"..
  280. "B = 128 kbytes Flash\n"..
  281. "C = 256 kbytes Flash\n"..
  282. "D = 384 kbytes Flash\n"..
  283. "E = 512 kbytes Flash\n"..
  284. "Z = 1024 kbytes Flash\n",
  285. requires = { "HW_MCU_STM32F10X" },
  286. type = "enumerated",
  287. choices = stm32_memory_f10x,
  288. file = "include/cfg/arch.h"
  289. },
  290. }
  291. },
  292. --
  293. -- STM32F Flexible Static Memory Controller
  294. --
  295. {
  296. name = "nutarch_cm3_stm32f_fsmc",
  297. brief = "STM32F Static Memory Controller",
  298. description = "Routines for configuration of the FSMC in STM32F controllers.\n"..
  299. "The FSMC access access to SRAM, NAND- and NOR-Flash and PC-Memory Cards.",
  300. requires = { "HW_FSMC_STM32" },
  301. -- sources = { "cm3/dev/stm/stm32_fsmc.c" },
  302. },
  303. --
  304. -- STM32F Flash Memory Controller
  305. --
  306. {
  307. name = "nutarch_cm3_stm32f_flash",
  308. brief = "STM32F Flash Memory Controller",
  309. description = "Routines for setup and programming STM32F series internal FLASH.\n",
  310. requires = { "HW_FLASHF1_STM32" },
  311. sources = { "cm3/dev/stm/stm32f1_flash.c" },
  312. },
  313. -- ***********************************
  314. --
  315. -- STM32F Device Drivers
  316. --
  317. -- ***********************************
  318. --
  319. -- STM32F1 GPIO Interface
  320. --
  321. {
  322. name = "nutarch_cm3_stm32f1_gpio",
  323. brief = "STM32F1 GPIO",
  324. description = "Generic port I/O API.",
  325. requires = { "HW_MCU_STM32", "HW_GPIO_STM32V1" },
  326. provides = { "HW_GPIO_V1" };
  327. sources = { "cm3/dev/stm/stm32f1_gpio.c"}
  328. },
  329. }