hw_config.h 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095
  1. /*
  2. * hw_config.h
  3. *
  4. * Created on: May 17, 2015
  5. * Author: david_s5
  6. */
  7. #ifndef HW_CONFIG_H_
  8. #define HW_CONFIG_H_
  9. /****************************************************************************
  10. * 10-8--2016:
  11. * To simplify the ripple effect on the tools, we will be using
  12. * /dev/serial/by-id/<asterisk>PX4<asterisk> to locate PX4 devices. Therefore
  13. * moving forward all Bootloaders must contain the prefix "PX4 BL "
  14. * in the USBDEVICESTRING
  15. * This Change will be made in an upcoming BL release
  16. ****************************************************************************/
  17. /*
  18. * Define usage to configure a bootloader
  19. *
  20. *
  21. * Constant example Usage
  22. * APP_LOAD_ADDRESS 0x08004000 - The address in Linker Script, where the app fw is org-ed
  23. * BOOTLOADER_DELAY 5000 - Ms to wait while under USB pwr or bootloader request
  24. * BOARD_FMUV2
  25. * INTERFACE_USB 1 - (Optional) Scan and use the USB interface for bootloading
  26. * INTERFACE_USART 1 - (Optional) Scan and use the Serial interface for bootloading
  27. * USBDEVICESTRING "PX4 BL FMU v2.x" - USB id string
  28. * USBPRODUCTID 0x0011 - PID Should match defconfig
  29. * BOOT_DELAY_ADDRESS 0x000001a0 - (Optional) From the linker script from Linker Script to get a custom
  30. * delay provided by an APP FW
  31. * BOARD_TYPE 9 - Must match .prototype boad_id
  32. * _FLASH_KBYTES (*(uint16_t *)0x1fff7a22) - Run time flash size detection
  33. * BOARD_FLASH_SECTORS ((_FLASH_KBYTES == 0x400) ? 11 : 23) - Run time determine the physical last sector
  34. * BOARD_FLASH_SECTORS 11 - Hard coded zero based last sector
  35. * BOARD_FLASH_SIZE (_FLASH_KBYTES*1024)- Total Flash size of device, determined at run time.
  36. * (1024 * 1024) - Hard coded Total Flash of device - The bootloader and app reserved will be deducted
  37. * programmatically
  38. *
  39. * BOARD_FIRST_FLASH_SECTOR_TO_ERASE 2 - Optional sectors index in the flash_sectors table (F4 only), to begin erasing.
  40. * This is to allow sectors to be reserved for app fw usage. That will NOT be erased
  41. * during a FW upgrade.
  42. * The default is 0, and selects the first sector to be erased, as the 0th entry in the
  43. * flash_sectors table. Which is the second physical sector of FLASH in the device.
  44. * The first physical sector of FLASH is used by the bootloader, and is not defined
  45. * in the table.
  46. *
  47. * APP_RESERVATION_SIZE (BOARD_FIRST_FLASH_SECTOR_TO_ERASE * 16 * 1024) - Number of bytes reserved by the APP FW. This number plus
  48. * BOOTLOADER_RESERVATION_SIZE will be deducted from
  49. * BOARD_FLASH_SIZE to determine the size of the App FW
  50. * and hence the address space of FLASH to erase and program.
  51. * USBMFGSTRING "PX4 AP" - Optional USB MFG string (default is '3D Robotics' if not defined.)
  52. * SERIAL_BREAK_DETECT_DISABLED - Optional prevent break selection on Serial port from entering or staying in BL
  53. *
  54. * * Other defines are somewhat self explanatory.
  55. */
  56. /* Boot device selection list*/
  57. #define USB0_DEV 0x01
  58. #define SERIAL0_DEV 0x02
  59. #define SERIAL1_DEV 0x04
  60. #if defined(TARGET_HW_PX4_FMU_V1)
  61. # define APP_LOAD_ADDRESS 0x08004000
  62. # define BOOTLOADER_DELAY 5000
  63. # define BOARD_FMU
  64. # define INTERFACE_USB 1
  65. # define INTERFACE_USART 1
  66. # define USBDEVICESTRING "PX4 BL FMU v1.x"
  67. # define USBPRODUCTID 0x0010
  68. # define BOOT_DELAY_ADDRESS 0x000001a0
  69. # define BOARD_TYPE 5
  70. # define BOARD_FLASH_SECTORS 11
  71. # define BOARD_FLASH_SIZE (1024 * 1024)
  72. # define OSC_FREQ 24
  73. # define BOARD_PIN_LED_ACTIVITY GPIO15
  74. # define BOARD_PIN_LED_BOOTLOADER GPIO14
  75. # define BOARD_PORT_LEDS GPIOB
  76. # define BOARD_CLOCK_LEDS RCC_AHB1ENR_IOPBEN
  77. # define BOARD_LED_ON gpio_clear
  78. # define BOARD_LED_OFF gpio_set
  79. # define BOARD_USART USART1
  80. # define BOARD_USART_CLOCK_REGISTER RCC_APB2ENR
  81. # define BOARD_USART_CLOCK_BIT RCC_APB2ENR_USART1EN
  82. # define BOARD_PORT_USART GPIOB
  83. # define BOARD_PORT_USART_AF GPIO_AF7
  84. # define BOARD_PIN_TX GPIO6
  85. # define BOARD_PIN_RX GPIO7
  86. # define BOARD_USART_PIN_CLOCK_REGISTER RCC_AHB1ENR
  87. # define BOARD_USART_PIN_CLOCK_BIT RCC_AHB1ENR_IOPBEN
  88. # define SERIAL_BREAK_DETECT_DISABLED 1
  89. /*
  90. * Uncommenting this allows to force the bootloader through
  91. * the PPM-in pin. Some receivers pull their PPM output low
  92. * when the transmitter is off, resulting in a stuck bootup,
  93. * so this feature is best disabled.
  94. *
  95. * # define BOARD_FORCE_BL_PIN GPIO10
  96. * # define BOARD_FORCE_BL_PORT GPIOA
  97. * # define BOARD_FORCE_BL_CLOCK_REGISTER RCC_AHB1ENR
  98. * # define BOARD_FORCE_BL_CLOCK_BIT RCC_AHB1ENR_IOPAEN
  99. * # define BOARD_FORCE_BL_PULL GPIO_PUPD_PULLUP
  100. * # define BOARD_FORCE_BL_STATE 0
  101. */
  102. /****************************************************************************
  103. * TARGET_HW_PX4_FMU_V2
  104. ****************************************************************************/
  105. #elif defined(TARGET_HW_PX4_FMU_V2)
  106. # define APP_LOAD_ADDRESS 0x08004000
  107. # define BOOTLOADER_DELAY 5000
  108. # define BOARD_FMUV2
  109. # define INTERFACE_USB 1
  110. # define INTERFACE_USART 1
  111. # define USBDEVICESTRING "PX4 BL FMU v2.x"
  112. # define USBPRODUCTID 0x0011
  113. # define BOOT_DELAY_ADDRESS 0x000001a0
  114. # define BOARD_TYPE 9
  115. # define _FLASH_KBYTES (*(uint16_t *)0x1fff7a22)
  116. # define BOARD_FLASH_SECTORS ((_FLASH_KBYTES == 0x400) ? 11 : 23)
  117. # define BOARD_FLASH_SIZE (_FLASH_KBYTES * 1024)
  118. # define OSC_FREQ 24
  119. # define BOARD_PIN_LED_ACTIVITY 0 // no activity LED
  120. # define BOARD_PIN_LED_BOOTLOADER GPIO12
  121. # define BOARD_PORT_LEDS GPIOE
  122. # define BOARD_CLOCK_LEDS RCC_AHB1ENR_IOPEEN
  123. # define BOARD_LED_ON gpio_clear
  124. # define BOARD_LED_OFF gpio_set
  125. # define BOARD_USART USART2
  126. # define BOARD_USART_CLOCK_REGISTER RCC_APB1ENR
  127. # define BOARD_USART_CLOCK_BIT RCC_APB1ENR_USART2EN
  128. # define BOARD_PORT_USART GPIOD
  129. # define BOARD_PORT_USART_AF GPIO_AF7
  130. # define BOARD_PIN_TX GPIO5
  131. # define BOARD_PIN_RX GPIO6
  132. # define BOARD_USART_PIN_CLOCK_REGISTER RCC_AHB1ENR
  133. # define BOARD_USART_PIN_CLOCK_BIT RCC_AHB1ENR_IOPDEN
  134. # define SERIAL_BREAK_DETECT_DISABLED 1
  135. /*
  136. * Uncommenting this allows to force the bootloader through
  137. * a PWM output pin. As this can accidentally initialize
  138. * an ESC prematurely, it is not recommended. This feature
  139. * has not been used and hence defaults now to off.
  140. *
  141. * # define BOARD_FORCE_BL_PIN_OUT GPIO14
  142. * # define BOARD_FORCE_BL_PIN_IN GPIO11
  143. * # define BOARD_FORCE_BL_PORT GPIOE
  144. * # define BOARD_FORCE_BL_CLOCK_REGISTER RCC_AHB1ENR
  145. * # define BOARD_FORCE_BL_CLOCK_BIT RCC_AHB1ENR_IOPEEN
  146. * # define BOARD_FORCE_BL_PULL GPIO_PUPD_PULLUP
  147. */
  148. /****************************************************************************
  149. * TARGET_HW_PX4_FMU_V3
  150. ****************************************************************************/
  151. #elif defined(TARGET_HW_PX4_FMU_V3)
  152. # define APP_LOAD_ADDRESS 0x08004000
  153. # define BOOTLOADER_DELAY 5000
  154. # define BOARD_FMUV2
  155. # define INTERFACE_USB 1
  156. # define INTERFACE_USART 1
  157. # define USBDEVICESTRING "PX4 BL FMU v3.x"
  158. # define USBPRODUCTID 0x0011
  159. # define BOOT_DELAY_ADDRESS 0x000001a0
  160. # define BOARD_TYPE 9
  161. # define _FLASH_KBYTES (*(uint16_t *)0x1fff7a22)
  162. # define BOARD_FLASH_SECTORS ((_FLASH_KBYTES == 0x400) ? 11 : 23)
  163. # define BOARD_FLASH_SIZE (_FLASH_KBYTES * 1024)
  164. # define OSC_FREQ 24
  165. # define BOARD_PIN_LED_ACTIVITY 0 // no activity LED
  166. # define BOARD_PIN_LED_BOOTLOADER GPIO12
  167. # define BOARD_PORT_LEDS GPIOE
  168. # define BOARD_CLOCK_LEDS RCC_AHB1ENR_IOPEEN
  169. # define BOARD_LED_ON gpio_clear
  170. # define BOARD_LED_OFF gpio_set
  171. # define BOARD_USART USART2
  172. # define BOARD_USART_CLOCK_REGISTER RCC_APB1ENR
  173. # define BOARD_USART_CLOCK_BIT RCC_APB1ENR_USART2EN
  174. # define BOARD_PORT_USART GPIOD
  175. # define BOARD_PORT_USART_AF GPIO_AF7
  176. # define BOARD_PIN_TX GPIO5
  177. # define BOARD_PIN_RX GPIO6
  178. # define BOARD_USART_PIN_CLOCK_REGISTER RCC_AHB1ENR
  179. # define BOARD_USART_PIN_CLOCK_BIT RCC_AHB1ENR_IOPDEN
  180. # define SERIAL_BREAK_DETECT_DISABLED 1
  181. /*
  182. * Uncommenting this allows to force the bootloader through
  183. * a PWM output pin. As this can accidentally initialize
  184. * an ESC prematurely, it is not recommended. This feature
  185. * has not been used and hence defaults now to off.
  186. *
  187. * # define BOARD_FORCE_BL_PIN_OUT GPIO14
  188. * # define BOARD_FORCE_BL_PIN_IN GPIO11
  189. * # define BOARD_FORCE_BL_PORT GPIOE
  190. * # define BOARD_FORCE_BL_CLOCK_REGISTER RCC_AHB1ENR
  191. * # define BOARD_FORCE_BL_CLOCK_BIT RCC_AHB1ENR_IOPEEN
  192. * # define BOARD_FORCE_BL_PULL GPIO_PUPD_PULLUP
  193. */
  194. /****************************************************************************
  195. * TARGET_HW_PX4_FMU_V4
  196. ****************************************************************************/
  197. #elif defined(TARGET_HW_PX4_FMU_V4)
  198. # define APP_LOAD_ADDRESS 0x08004000
  199. # define BOOTLOADER_DELAY 5000
  200. # define BOARD_FMUV2
  201. # define INTERFACE_USB 1
  202. # define INTERFACE_USART 1
  203. # define USBDEVICESTRING "PX4 BL FMU v4.x"
  204. # define USBPRODUCTID 0x0012
  205. # define BOOT_DELAY_ADDRESS 0x000001a0
  206. # define BOARD_TYPE 11
  207. # define _FLASH_KBYTES (*(uint16_t *)0x1fff7a22)
  208. # define BOARD_FLASH_SECTORS ((_FLASH_KBYTES == 0x400) ? 11 : 23)
  209. # define BOARD_FLASH_SIZE (_FLASH_KBYTES * 1024)
  210. # define OSC_FREQ 24
  211. # define BOARD_PIN_LED_ACTIVITY GPIO3
  212. # define BOARD_PIN_LED_BOOTLOADER GPIO11|GPIO1
  213. # define BOARD_PORT_LEDS GPIOB
  214. # define BOARD_CLOCK_LEDS RCC_AHB1ENR_IOPBEN
  215. # define BOARD_LED_ON gpio_clear
  216. # define BOARD_LED_OFF gpio_set
  217. # define BOARD_USART USART1
  218. # define BOARD_USART_CLOCK_REGISTER RCC_APB2ENR
  219. # define BOARD_USART_CLOCK_BIT RCC_APB2ENR_USART1EN
  220. # define BOARD_PORT_USART GPIOB
  221. # define BOARD_PORT_USART_AF GPIO_AF7
  222. # define BOARD_PIN_TX GPIO6
  223. # define BOARD_PIN_RX GPIO7
  224. # define BOARD_USART_PIN_CLOCK_REGISTER RCC_AHB1ENR
  225. # define BOARD_USART_PIN_CLOCK_BIT RCC_AHB1ENR_IOPBEN
  226. # define SERIAL_BREAK_DETECT_DISABLED 1
  227. /*
  228. * Uncommenting this allows to force the bootloader through
  229. * a PWM output pin. As this can accidentally initialize
  230. * an ESC prematurely, it is not recommended. This feature
  231. * has not been used and hence defaults now to off.
  232. *
  233. * # define BOARD_FORCE_BL_PIN_OUT GPIO14
  234. * # define BOARD_FORCE_BL_PIN_IN GPIO11
  235. * # define BOARD_FORCE_BL_PORT GPIOE
  236. * # define BOARD_FORCE_BL_CLOCK_REGISTER RCC_AHB1ENR
  237. * # define BOARD_FORCE_BL_CLOCK_BIT RCC_AHB1ENR_IOPEEN
  238. * # define BOARD_FORCE_BL_PULL GPIO_PUPD_PULLUP
  239. */
  240. /****************************************************************************
  241. * TARGET_HW_PX4_FMU_V4_PRO
  242. ****************************************************************************/
  243. #elif defined(TARGET_HW_PX4_FMU_V4_PRO)
  244. # define APP_LOAD_ADDRESS 0x08004000
  245. # define BOOTLOADER_DELAY 5000
  246. # define BOARD_FMUV2
  247. # define INTERFACE_USB 1
  248. # define INTERFACE_USART 1
  249. # define USBDEVICESTRING "PX4 BL FMU v4.x PRO"
  250. # define USBPRODUCTID 0x0013
  251. # define BOOT_DELAY_ADDRESS 0x000001a0
  252. # define BOARD_TYPE 13
  253. # define _FLASH_KBYTES (*(uint16_t *)0x1fff7a22)
  254. # define BOARD_FLASH_SECTORS ((_FLASH_KBYTES == 0x400) ? 11 : 23)
  255. # define BOARD_FLASH_SIZE (_FLASH_KBYTES * 1024)
  256. # define OSC_FREQ 24
  257. # define BOARD_PIN_LED_ACTIVITY GPIO3
  258. # define BOARD_PIN_LED_BOOTLOADER GPIO11|GPIO1
  259. # define BOARD_PORT_LEDS GPIOB
  260. # define BOARD_CLOCK_LEDS RCC_AHB1ENR_IOPBEN
  261. # define BOARD_LED_ON gpio_clear
  262. # define BOARD_LED_OFF gpio_set
  263. # define BOARD_USART USART2
  264. # define BOARD_USART_CLOCK_REGISTER RCC_APB1ENR
  265. # define BOARD_USART_CLOCK_BIT RCC_APB1ENR_USART2EN
  266. # define BOARD_PORT_USART GPIOD
  267. # define BOARD_PORT_USART_AF GPIO_AF7
  268. # define BOARD_PIN_TX GPIO5
  269. # define BOARD_PIN_RX GPIO6
  270. # define BOARD_USART_PIN_CLOCK_REGISTER RCC_AHB1ENR
  271. # define BOARD_USART_PIN_CLOCK_BIT RCC_AHB1ENR_IOPDEN
  272. # define SERIAL_BREAK_DETECT_DISABLED 1
  273. /*
  274. * Uncommenting this allows to force the bootloader through
  275. * a PWM output pin. As this can accidentally initialize
  276. * an ESC prematurely, it is not recommended. This feature
  277. * has not been used and hence defaults now to off.
  278. *
  279. * # define BOARD_FORCE_BL_PIN_OUT GPIO14
  280. * # define BOARD_FORCE_BL_PIN_IN GPIO11
  281. * # define BOARD_FORCE_BL_PORT GPIOE
  282. * # define BOARD_FORCE_BL_CLOCK_REGISTER RCC_AHB1ENR
  283. * # define BOARD_FORCE_BL_CLOCK_BIT RCC_AHB1ENR_IOPEEN
  284. * # define BOARD_FORCE_BL_PULL GPIO_PUPD_PULLUP
  285. */
  286. /****************************************************************************
  287. * TARGET_HW_PX4_FMU_V5
  288. ****************************************************************************/
  289. #elif defined(TARGET_HW_PX4_FMU_V5)
  290. # define APP_LOAD_ADDRESS 0x08008000
  291. # define BOOTLOADER_DELAY 5000
  292. # define INTERFACE_USB 1
  293. # define INTERFACE_USART 1
  294. # define USBDEVICESTRING "PX4 BL FMU v5.x"
  295. # define USBPRODUCTID 0x0032
  296. # define BOOT_DELAY_ADDRESS 0x000001a0
  297. # define BOARD_TYPE 50
  298. # define _FLASH_KBYTES (*(uint16_t *)0x1ff0f442)
  299. # define BOARD_FLASH_SECTORS ((_FLASH_KBYTES == 0x400) ? 7 : 11)
  300. # define BOARD_FLASH_SIZE (_FLASH_KBYTES * 1024)
  301. # define OSC_FREQ 16
  302. # define BOARD_PIN_LED_ACTIVITY GPIO7 // BLUE
  303. # define BOARD_PIN_LED_BOOTLOADER GPIO6 // GREEN
  304. # define BOARD_PORT_LEDS GPIOC
  305. # define BOARD_CLOCK_LEDS RCC_AHB1ENR_GPIOCEN
  306. # define BOARD_LED_ON gpio_clear
  307. # define BOARD_LED_OFF gpio_set
  308. # define BOARD_USART USART2
  309. # define BOARD_USART_CLOCK_REGISTER RCC_APB1ENR
  310. # define BOARD_USART_CLOCK_BIT RCC_APB1ENR_USART2EN
  311. # define BOARD_PORT_USART GPIOD
  312. # define BOARD_PORT_USART_AF GPIO_AF7
  313. # define BOARD_PIN_TX GPIO5
  314. # define BOARD_PIN_RX GPIO6
  315. # define BOARD_USART_PIN_CLOCK_REGISTER RCC_AHB1ENR
  316. # define BOARD_USART_PIN_CLOCK_BIT RCC_AHB1ENR_GPIODEN
  317. # define SERIAL_BREAK_DETECT_DISABLED 1
  318. /*
  319. * Uncommenting this allows to force the bootloader through
  320. * a PWM output pin. As this can accidentally initialize
  321. * an ESC prematurely, it is not recommended. This feature
  322. * has not been used and hence defaults now to off.
  323. *
  324. * # define BOARD_FORCE_BL_PIN_OUT GPIO14
  325. * # define BOARD_FORCE_BL_PIN_IN GPIO11
  326. * # define BOARD_FORCE_BL_PORT GPIOE
  327. * # define BOARD_FORCE_BL_CLOCK_REGISTER RCC_AHB1ENR
  328. * # define BOARD_FORCE_BL_CLOCK_BIT RCC_AHB1ENR_IOPEEN
  329. * # define BOARD_FORCE_BL_PULL GPIO_PUPD_PULLUP
  330. */
  331. /****************************************************************************
  332. * TARGET_HW_MINDPX_V2
  333. ****************************************************************************/
  334. #elif defined(TARGET_HW_MINDPX_V2)
  335. # define APP_LOAD_ADDRESS 0x08004000
  336. # define BOOTLOADER_DELAY 5000
  337. # define BOARD_FMUV2
  338. # define INTERFACE_USB 1
  339. # define INTERFACE_USART 1
  340. # define USBDEVICESTRING "MindPX BL FMU v2.x"
  341. # define USBPRODUCTID 0x0030
  342. # define BOOT_DELAY_ADDRESS 0x000001a0
  343. # define BOARD_TYPE 88
  344. # define _FLASH_KBYTES (*(uint16_t *)0x1fff7a22)
  345. # define BOARD_FLASH_SECTORS ((_FLASH_KBYTES == 0x400) ? 11 : 23)
  346. # define BOARD_FLASH_SIZE (_FLASH_KBYTES * 1024)
  347. # define OSC_FREQ 8
  348. # define BOARD_PIN_LED_ACTIVITY 0 // no activity LED
  349. # define BOARD_PIN_LED_BOOTLOADER GPIO8
  350. # define BOARD_PORT_LEDS GPIOA
  351. # define BOARD_CLOCK_LEDS RCC_AHB1ENR_IOPAEN
  352. # define BOARD_LED_ON gpio_clear
  353. # define BOARD_LED_OFF gpio_set
  354. # define BOARD_USART USART2
  355. # define BOARD_USART_CLOCK_REGISTER RCC_APB1ENR
  356. # define BOARD_USART_CLOCK_BIT RCC_APB1ENR_USART2EN
  357. # define BOARD_PORT_USART GPIOD
  358. # define BOARD_PORT_USART_AF GPIO_AF7
  359. # define BOARD_PIN_TX GPIO5
  360. # define BOARD_PIN_RX GPIO6
  361. # define BOARD_USART_PIN_CLOCK_REGISTER RCC_AHB1ENR
  362. # define BOARD_USART_PIN_CLOCK_BIT RCC_AHB1ENR_IOPDEN
  363. # define SERIAL_BREAK_DETECT_DISABLED 1
  364. /*
  365. * Uncommenting this allows to force the bootloader through
  366. * a PWM output pin. As this can accidentally initialize
  367. * an ESC prematurely, it is not recommended. This feature
  368. * has not been used and hence defaults now to off.
  369. *
  370. * # define BOARD_FORCE_BL_PIN_OUT GPIO14
  371. * # define BOARD_FORCE_BL_PIN_IN GPIO11
  372. * # define BOARD_FORCE_BL_PORT GPIOE
  373. * # define BOARD_FORCE_BL_CLOCK_REGISTER RCC_AHB1ENR
  374. * # define BOARD_FORCE_BL_CLOCK_BIT RCC_AHB1ENR_IOPEEN
  375. * # define BOARD_FORCE_BL_PULL GPIO_PUPD_PULLUP
  376. */
  377. /****************************************************************************
  378. * TARGET_HW_PX4_FLOW_V1
  379. ****************************************************************************/
  380. #elif defined(TARGET_HW_PX4_FLOW_V1)
  381. # define APP_LOAD_ADDRESS 0x08004000
  382. # define BOOTLOADER_DELAY 5000
  383. # define BOARD_FLOW
  384. # define INTERFACE_USB 1
  385. # define INTERFACE_USART 0
  386. # define USBDEVICESTRING "PX4 BL FLOW v1.3"
  387. # define USBPRODUCTID 0x0015
  388. # define BOARD_TYPE 6
  389. # define BOARD_FLASH_SECTORS 11
  390. # define BOARD_FLASH_SIZE (1024 * 1024)
  391. # define OSC_FREQ 24
  392. # define BOARD_PIN_LED_ACTIVITY GPIO3
  393. # define BOARD_PIN_LED_BOOTLOADER GPIO2
  394. # define BOARD_PORT_LEDS GPIOE
  395. # define BOARD_CLOCK_LEDS RCC_AHB1ENR_IOPEEN
  396. # define BOARD_LED_ON gpio_clear
  397. # define BOARD_LED_OFF gpio_set
  398. /****************************************************************************
  399. * TARGET_HW_PX4_DISCOVERY_V1
  400. ****************************************************************************/
  401. #elif defined(TARGET_HW_PX4_DISCOVERY_V1)
  402. # define APP_LOAD_ADDRESS 0x08004000
  403. # define BOOTLOADER_DELAY 5000
  404. # define BOARD_DISCOVERY
  405. # define INTERFACE_USB 1
  406. # define INTERFACE_USART 0
  407. # define USBDEVICESTRING "PX4 BL DISCOVERY"
  408. # define USBPRODUCTID 0x0001
  409. # define BOARD_TYPE 99
  410. # define BOARD_FLASH_SECTORS 11
  411. # define BOARD_FLASH_SIZE (1024 * 1024)
  412. # define OSC_FREQ 8
  413. # define BOARD_PIN_LED_ACTIVITY GPIO12
  414. # define BOARD_PIN_LED_BOOTLOADER GPIO13
  415. # define BOARD_PORT_LEDS GPIOD
  416. # define BOARD_CLOCK_LEDS RCC_AHB1ENR_IOPDEN
  417. # define BOARD_LED_ON gpio_set
  418. # define BOARD_LED_OFF gpio_clear
  419. /****************************************************************************
  420. * TARGET_HW_PX4_PIO_V1 or TARGET_HW_PX4_PIO_V2
  421. ****************************************************************************/
  422. #elif defined(TARGET_HW_PX4_PIO_V1) || defined(TARGET_HW_PX4_PIO_V2)
  423. # define APP_LOAD_ADDRESS 0x08001000
  424. # define APP_SIZE_MAX 0xf000
  425. # define BOOTLOADER_DELAY 200
  426. # define BOARD_PIO
  427. # define INTERFACE_USB 0
  428. # define INTERFACE_USART 1
  429. # define USBDEVICESTRING ""
  430. # define USBPRODUCTID -1
  431. # define OSC_FREQ 24
  432. # define BOARD_PIN_LED_ACTIVITY GPIO14
  433. # define BOARD_PIN_LED_BOOTLOADER GPIO15
  434. # define BOARD_PORT_LEDS GPIOB
  435. # define BOARD_CLOCK_LEDS_REGISTER RCC_APB2ENR
  436. # define BOARD_CLOCK_LEDS RCC_APB2ENR_IOPBEN
  437. # define BOARD_LED_ON gpio_clear
  438. # define BOARD_LED_OFF gpio_set
  439. # define BOARD_USART USART2
  440. # define BOARD_USART_CLOCK_REGISTER RCC_APB1ENR
  441. # define BOARD_USART_CLOCK_BIT RCC_APB1ENR_USART2EN
  442. # define BOARD_PORT_USART GPIOA
  443. # define BOARD_PIN_TX GPIO_USART2_TX
  444. # define BOARD_PIN_RX GPIO_USART2_RX
  445. # define BOARD_USART_PIN_CLOCK_REGISTER RCC_APB2ENR
  446. # define BOARD_USART_PIN_CLOCK_BIT RCC_APB2ENR_IOPAEN
  447. # define BOARD_FORCE_BL_PIN GPIO5
  448. # define BOARD_FORCE_BL_PORT GPIOB
  449. # define BOARD_FORCE_BL_CLOCK_REGISTER RCC_APB2ENR
  450. # define BOARD_FORCE_BL_CLOCK_BIT RCC_APB2ENR_IOPBEN
  451. # define BOARD_FORCE_BL_PULL GPIO_CNF_INPUT_FLOAT // depend on external pull
  452. # define BOARD_FORCE_BL_VALUE BOARD_FORCE_BL_PIN
  453. # define BOARD_FLASH_SECTORS 60
  454. # define BOARD_TYPE 10
  455. # define FLASH_SECTOR_SIZE 0x400
  456. /****************************************************************************
  457. * TARGET_HW_PX4_PIO_V3
  458. ****************************************************************************/
  459. #elif defined(TARGET_HW_PX4_PIO_V3)
  460. # define APP_LOAD_ADDRESS 0x08001000
  461. # define APP_SIZE_MAX 0x3f000
  462. # define BOOTLOADER_DELAY 200
  463. # define BOARD_PIO
  464. # define INTERFACE_USB 0
  465. # define INTERFACE_USART 1
  466. # define USBDEVICESTRING ""
  467. # define USBPRODUCTID -1
  468. # define OSC_FREQ 24
  469. # define BOARD_PIN_LED_ACTIVITY 0
  470. # define BOARD_PIN_LED_BOOTLOADER GPIO13
  471. # define BOARD_PORT_LEDS GPIOB
  472. # define BOARD_CLOCK_LEDS_REGISTER RCC_AHBENR
  473. # define BOARD_CLOCK_LEDS RCC_AHBENR_IOPBEN
  474. # define BOARD_LED_ON gpio_clear
  475. # define BOARD_LED_OFF gpio_set
  476. # define BOARD_USART USART2
  477. # define BOARD_USART_CLOCK_REGISTER RCC_APB1ENR
  478. # define BOARD_USART_CLOCK_BIT RCC_APB1ENR_USART2EN
  479. # define BOARD_PORT_USART GPIOA
  480. # define BOARD_PORT_USART_AF GPIO_AF7
  481. # define BOARD_PIN_TX GPIO2
  482. # define BOARD_PIN_RX GPIO3
  483. # define BOARD_USART_PIN_CLOCK_REGISTER RCC_AHBENR
  484. # define BOARD_USART_PIN_CLOCK_BIT RCC_AHBENR_IOPAEN
  485. # define BOARD_FORCE_BL_PIN GPIO5
  486. # define BOARD_FORCE_BL_PORT GPIOB
  487. # define BOARD_FORCE_BL_CLOCK_REGISTER RCC_AHBENR
  488. # define BOARD_FORCE_BL_CLOCK_BIT RCC_AHBENR_IOPBEN
  489. # define BOARD_FORCE_BL_PULL GPIO_PUPD_NONE // depend on external pull
  490. # define BOARD_FORCE_BL_VALUE BOARD_FORCE_BL_PIN
  491. # define BOARD_FLASH_SECTORS (128-4) /* application #sec - bootloader - sec */
  492. # define BOARD_TYPE 13
  493. # define FLASH_SECTOR_SIZE 0x800
  494. /****************************************************************************
  495. * TARGET_HW_PX4_AEROCORE_V1
  496. ****************************************************************************/
  497. #elif defined(TARGET_HW_PX4_AEROCORE_V1)
  498. # define APP_LOAD_ADDRESS 0x08004000
  499. # define BOOTLOADER_DELAY 5000
  500. # define BOARD_AEROCORE
  501. # define INTERFACE_USB 1
  502. # define INTERFACE_USART 0
  503. # define USBDEVICESTRING "Gumstix BL AEROCORE"
  504. # define USBPRODUCTID 0x1001
  505. # define BOARD_TYPE 98
  506. # define BOARD_FLASH_SECTORS 23
  507. # define BOARD_FLASH_SIZE (2048 * 1024)
  508. # define OSC_FREQ 24
  509. # define BOARD_PIN_LED_ACTIVITY GPIO10 // Yellow
  510. # define BOARD_PIN_LED_BOOTLOADER GPIO9 // Blue
  511. # define BOARD_PORT_LEDS GPIOE
  512. # define BOARD_CLOCK_LEDS RCC_AHB1ENR_IOPEEN
  513. # define BOARD_LED_ON gpio_clear
  514. # define BOARD_LED_OFF gpio_set
  515. # define BOARD_FORCE_BL_PIN_OUT GPIO0 // J11 header, pin 1
  516. # define BOARD_FORCE_BL_PIN_IN GPIO1 // J11 header, pin 3
  517. # define BOARD_FORCE_BL_PORT GPIOB
  518. # define BOARD_FORCE_BL_CLOCK_REGISTER RCC_AHB1ENR
  519. # define BOARD_FORCE_BL_CLOCK_BIT RCC_AHB1ENR_IOPBEN
  520. # define BOARD_FORCE_BL_PULL GPIO_PUPD_PULLUP
  521. /****************************************************************************
  522. * TARGET_HW_TAP_V1
  523. ****************************************************************************/
  524. #elif defined(TARGET_HW_TAP_V1)
  525. # define APP_LOAD_ADDRESS 0x0800C000
  526. # define BOOTLOADER_DELAY 5000
  527. # define BOARD_TAP
  528. # define INTERFACE_USB 1
  529. # define INTERFACE_USART 1
  530. # define USBDEVICESTRING "PX4 BL TAP v1.x"
  531. # define USBPRODUCTID 0x0040
  532. # define BOOT_DELAY_ADDRESS 0x000001a0
  533. # define BOARD_TYPE 64
  534. # define BOARD_FLASH_SECTORS 11
  535. # define BOARD_FLASH_SIZE (1024 * 1024)
  536. # define BOARD_FIRST_FLASH_SECTOR_TO_ERASE 2
  537. # define APP_RESERVATION_SIZE (2 * 16 * 1024) /* 2 16 Kib Sectors */
  538. # define OSC_FREQ 16
  539. # define BOARD_USART USART2
  540. # define BOARD_USART_CLOCK_REGISTER RCC_APB1ENR
  541. # define BOARD_USART_CLOCK_BIT RCC_APB1ENR_USART2EN
  542. # define BOARD_PORT_USART GPIOA
  543. # define BOARD_PORT_USART_AF GPIO_AF7
  544. # define BOARD_PIN_TX GPIO2
  545. # define BOARD_PIN_RX GPIO3
  546. # define BOARD_USART_PIN_CLOCK_REGISTER RCC_AHB1ENR
  547. # define BOARD_USART_PIN_CLOCK_BIT RCC_AHB1ENR_IOPAEN
  548. # define BOARD_PIN_LED_ACTIVITY GPIO4
  549. # define BOARD_PIN_LED_BOOTLOADER GPIO5
  550. # define BOARD_PORT_LEDS GPIOC
  551. # define BOARD_CLOCK_LEDS RCC_AHB1ENR_IOPCEN
  552. # define BOARD_LED_ON gpio_clear
  553. # define BOARD_LED_OFF gpio_set
  554. # define BOARD_POWER_PIN_OUT GPIO4
  555. # define BOARD_POWER_PORT GPIOA
  556. # define BOARD_POWER_CLOCK_REGISTER RCC_AHB1ENR
  557. # define BOARD_POWER_CLOCK_BIT RCC_AHB1ENR_IOPAEN
  558. # define BOARD_POWER_ON gpio_set
  559. # define BOARD_POWER_OFF gpio_clear
  560. # undef BOARD_POWER_PIN_RELEASE /* Leave pin enabling Power - un comment to release (disable power)*/
  561. # define USBMFGSTRING "The Autopilot"
  562. # define USB_FORCE_DISCONNECT 1
  563. #define SERIAL_BREAK_DETECT_DISABLED 1
  564. /****************************************************************************
  565. * TARGET_HW_CRAZYFLIE
  566. ****************************************************************************/
  567. #elif defined(TARGET_HW_CRAZYFLIE)
  568. # define APP_LOAD_ADDRESS 0x08004000
  569. # define BOOTLOADER_DELAY 5000
  570. # define BOARD_CRAZYFLIE
  571. # define INTERFACE_USB 1
  572. # define INTERFACE_USART 0
  573. # define USBDEVICESTRING "Crazyflie BL"
  574. # define USBPRODUCTID 0x0016
  575. # define BOARD_TYPE 12
  576. # define BOARD_FLASH_SECTORS 11
  577. # define BOARD_FLASH_SIZE (1024 * 1024)
  578. # define OSC_FREQ 8
  579. # define BOARD_PIN_LED_ACTIVITY GPIO0
  580. # define BOARD_PIN_LED_BOOTLOADER GPIO2
  581. # define BOARD_PORT_LEDS GPIOC
  582. # define BOARD_CLOCK_LEDS RCC_AHB1ENR_IOPCEN
  583. # define BOARD_LED_ON gpio_clear
  584. # define BOARD_LED_OFF gpio_set
  585. # define BOARD_USB_VBUS_SENSE_DISABLED
  586. # define USBMFGSTRING "Bitcraze AB"
  587. /****************************************************************************
  588. * TARGET_HW_OMNIBUS_NXT
  589. ****************************************************************************/
  590. #elif defined(TARGET_HW_OMNIBUSF4SD)
  591. # define APP_LOAD_ADDRESS 0x08008000
  592. # define BOOTLOADER_DELAY 5000
  593. # define INTERFACE_USB 1
  594. # define INTERFACE_USART 0
  595. # define USBDEVICESTRING "PX4 OmnibusF4SD"
  596. # define USBPRODUCTID 0x0016
  597. # define BOARD_TYPE 42
  598. # define BOARD_FLASH_SECTORS 11
  599. # define BOARD_FLASH_SIZE (1024 * 1024)
  600. # define BOARD_FIRST_FLASH_SECTOR_TO_ERASE 1
  601. # define APP_RESERVATION_SIZE (1 * 16 * 1024) /* 1 16 Kib Sectors */
  602. # define OSC_FREQ 8
  603. # define BOARD_PIN_LED_ACTIVITY GPIO5
  604. # define BOARD_PIN_LED_BOOTLOADER GPIO4
  605. # define BOARD_PORT_LEDS GPIOB
  606. # define BOARD_CLOCK_LEDS RCC_AHB1ENR_IOPBEN
  607. # define BOARD_LED_ON gpio_clear
  608. # define BOARD_LED_OFF gpio_set
  609. # define BOARD_USB_VBUS_SENSE_DISABLED
  610. # define USBMFGSTRING "Vertile"
  611. /****************************************************************************
  612. * TARGET_HW_KAKUTEF7
  613. ****************************************************************************/
  614. #elif defined(TARGET_HW_KAKUTEF7)
  615. # define APP_LOAD_ADDRESS 0x08018000
  616. # define BOOTLOADER_DELAY 5000
  617. # define INTERFACE_USB 1
  618. # define INTERFACE_USART 0
  619. # define USBDEVICESTRING "PX4 KakuteF7"
  620. # define USBPRODUCTID 0x0016
  621. # define BOOT_DELAY_ADDRESS 0x000001a0
  622. # define BOARD_TYPE 123
  623. # define BOARD_FLASH_SECTORS 7
  624. # define BOARD_FLASH_SIZE (1024 * 1024)
  625. # define BOARD_FIRST_FLASH_SECTOR_TO_ERASE 2
  626. # define APP_RESERVATION_SIZE (2 * 32 * 1024) /* 2 32 Kib Sectors */
  627. # define OSC_FREQ 8
  628. # define BOARD_PIN_LED_ACTIVITY 0
  629. # define BOARD_PIN_LED_BOOTLOADER GPIO2 // BLUE
  630. # define BOARD_PORT_LEDS GPIOA
  631. # define BOARD_CLOCK_LEDS RCC_AHB1ENR_GPIOAEN
  632. # define BOARD_LED_ON gpio_clear
  633. # define BOARD_LED_OFF gpio_set
  634. # define USBMFGSTRING "Holybro"
  635. // VBUS sense is connected to PA8 instead of PA9
  636. # define BOARD_USB_VBUS_SENSE_DISABLED
  637. # define BOARD_PORT_VBUS GPIOA
  638. # define BOARD_PIN_VBUS GPIO8
  639. # define BOARD_USART USART3 // labeled as UART3
  640. # define BOARD_USART_CLOCK_REGISTER RCC_APB1ENR
  641. # define BOARD_USART_CLOCK_BIT RCC_APB1ENR_USART3EN
  642. # define BOARD_PORT_USART GPIOB
  643. # define BOARD_PORT_USART_AF GPIO_AF7
  644. # define BOARD_PIN_TX GPIO10
  645. # define BOARD_PIN_RX GPIO11
  646. # define BOARD_USART_PIN_CLOCK_REGISTER RCC_AHB1ENR
  647. # define BOARD_USART_PIN_CLOCK_BIT RCC_AHB1ENR_GPIOBEN
  648. # define SERIAL_BREAK_DETECT_DISABLED 1
  649. /****************************************************************************
  650. * TARGET_HW_AUAV_X2V1
  651. ****************************************************************************/
  652. #elif defined(TARGET_HW_AUAV_X2V1)
  653. # define APP_LOAD_ADDRESS 0x08004000
  654. # define BOOTLOADER_DELAY 5000
  655. # define BOARD_FMUV2
  656. # define INTERFACE_USB 1
  657. # define INTERFACE_USART 1
  658. # define USBDEVICESTRING "PX4 BL AUAV X2.1"
  659. # define USBPRODUCTID 0x0021
  660. # define BOOT_DELAY_ADDRESS 0x000001a0
  661. # define BOARD_TYPE 33
  662. # define _FLASH_KBYTES (*(uint16_t *)0x1fff7a22)
  663. # define BOARD_FLASH_SECTORS ((_FLASH_KBYTES == 0x400) ? 11 : 23)
  664. # define BOARD_FLASH_SIZE (_FLASH_KBYTES * 1024)
  665. # define OSC_FREQ 24
  666. # define BOARD_PIN_LED_ACTIVITY 0 // no activity LED
  667. # define BOARD_PIN_LED_BOOTLOADER GPIO12
  668. # define BOARD_PORT_LEDS GPIOE
  669. # define BOARD_CLOCK_LEDS RCC_AHB1ENR_IOPEEN
  670. # define BOARD_LED_ON gpio_clear
  671. # define BOARD_LED_OFF gpio_set
  672. # define BOARD_USART USART2
  673. # define BOARD_USART_CLOCK_REGISTER RCC_APB1ENR
  674. # define BOARD_USART_CLOCK_BIT RCC_APB1ENR_USART2EN
  675. # define BOARD_PORT_USART GPIOD
  676. # define BOARD_PORT_USART_AF GPIO_AF7
  677. # define BOARD_PIN_TX GPIO5
  678. # define BOARD_PIN_RX GPIO6
  679. # define BOARD_USART_PIN_CLOCK_REGISTER RCC_AHB1ENR
  680. # define BOARD_USART_PIN_CLOCK_BIT RCC_AHB1ENR_IOPDEN
  681. # define SERIAL_BREAK_DETECT_DISABLED 1
  682. /*
  683. * Uncommenting this allows to force the bootloader through
  684. * a PWM output pin. As this can accidentally initialize
  685. * an ESC prematurely, it is not recommended. This feature
  686. * has not been used and hence defaults now to off.
  687. *
  688. * # define BOARD_FORCE_BL_PIN_OUT GPIO14
  689. * # define BOARD_FORCE_BL_PIN_IN GPIO11
  690. * # define BOARD_FORCE_BL_PORT GPIOE
  691. * # define BOARD_FORCE_BL_CLOCK_REGISTER RCC_AHB1ENR
  692. * # define BOARD_FORCE_BL_CLOCK_BIT RCC_AHB1ENR_IOPEEN
  693. * # define BOARD_FORCE_BL_PULL GPIO_PUPD_PULLUP
  694. */
  695. # define USBMFGSTRING "AUAV"
  696. /****************************************************************************
  697. * TARGET_HW_PX4_AEROFC_V1
  698. ****************************************************************************/
  699. #elif defined(TARGET_HW_AEROFC_V1)
  700. # define APP_LOAD_ADDRESS 0x0800C000
  701. # define BOOTLOADER_DELAY 5000
  702. # define INTERFACE_USB 0
  703. # define USBDEVICESTRING ""
  704. # define USBPRODUCTID 0
  705. # define INTERFACE_USART 1
  706. # define BOOT_DELAY_ADDRESS 0x000001a0
  707. # define BOARD_TYPE 65
  708. # define BOARD_FLASH_SECTORS 11
  709. # define BOARD_FLASH_SIZE (1024 * 1024)
  710. # define BOARD_FIRST_FLASH_SECTOR_TO_ERASE 2
  711. # define APP_RESERVATION_SIZE (2 * 16 * 1024) /* 2 16 Kib Sectors */
  712. # define OSC_FREQ 16
  713. # define BOARD_PIN_LED_ACTIVITY GPIO12
  714. # define BOARD_PIN_LED_BOOTLOADER GPIO9 | GPIO10 | GPIO11 | GPIO13 | GPIO14 | GPIO15
  715. # define BOARD_PORT_LEDS GPIOE
  716. # define BOARD_CLOCK_LEDS RCC_AHB1ENR_IOPEEN
  717. # define BOARD_LED_ON gpio_clear
  718. # define BOARD_LED_OFF gpio_set
  719. # define BOARD_USART USART2
  720. # define BOARD_USART_CLOCK_REGISTER RCC_APB1ENR
  721. # define BOARD_USART_CLOCK_BIT RCC_APB1ENR_USART2EN
  722. # define BOARD_PORT_USART GPIOA
  723. # define BOARD_PORT_USART_AF GPIO_AF7
  724. # define BOARD_PIN_TX GPIO2
  725. # define BOARD_PIN_RX GPIO3
  726. # define BOARD_USART_PIN_CLOCK_REGISTER RCC_AHB1ENR
  727. # define BOARD_USART_PIN_CLOCK_BIT RCC_AHB1ENR_IOPAEN
  728. # define BOARD_FORCE_BL_PIN GPIO11
  729. # define BOARD_FORCE_BL_PORT GPIOA
  730. # define BOARD_FORCE_BL_CLOCK_REGISTER RCC_AHB1ENR
  731. # define BOARD_FORCE_BL_CLOCK_BIT RCC_AHB1ENR_IOPAEN
  732. # define BOARD_FORCE_BL_PULL GPIO_PUPD_PULLDOWN
  733. # define BOARD_FORCE_BL_STATE 1
  734. /****************************************************************************
  735. * TARGET_HW_FMUK66_V3
  736. ****************************************************************************/
  737. #elif defined(TARGET_HW_FMUK66_V3)
  738. # define APP_LOAD_ADDRESS 0x00006000 // Reserve 24K for BL
  739. # define BOOTLOADER_DELAY 5000
  740. # define BOARD_NXPHLITEV3
  741. # define INTERFACE_USB 1
  742. # define INTERFACE_USART 0
  743. # define USBDEVICESTRING "PX4 BL FMUK66 v3.x"
  744. # define USBPRODUCTID 0x001c
  745. # define USBVENDORID 0x1fc9
  746. # define BOARD_TYPE 28
  747. # define _FLASH_KBYTES 2048
  748. # define FLASH_SECTOR_SIZE 4096
  749. # define BOARD_FLASH_SIZE (_FLASH_KBYTES * 1024)
  750. # define BOARD_FLASH_SECTORS ((BOARD_FLASH_SIZE / FLASH_SECTOR_SIZE)- \
  751. (BOOTLOADER_RESERVATION_SIZE/FLASH_SECTOR_SIZE))
  752. # define OSC_FREQ 16
  753. # define BOARD_PIN_LED_ACTIVITY 14 // green LED
  754. # define BOARD_PIN_LED_BOOTLOADER 13 // Amber LED
  755. # define BOARD_PORT_LEDS D
  756. # define BOARD_LED_ON GPIO_ClearPinsOutput
  757. # define BOARD_LED_OFF GPIO_SetPinsOutput
  758. # define BOARD_USART 4
  759. # define BOARD_PORT_USART C
  760. # define BOARD_PORT_USART_AF kPORT_MuxAlt3
  761. # define BOARD_PIN_TX 15
  762. # define BOARD_PIN_RX 14
  763. # define BOARD_PORT_VBUS E
  764. # define BOARD_PIN_VBUS 8
  765. # define SERIAL_BREAK_DETECT_DISABLED 1
  766. # define USB_DATA_ALIGN __attribute__((aligned(2)))
  767. /****************************************************************************
  768. * TARGET_HW_CUBE_F4
  769. ****************************************************************************/
  770. #elif defined(TARGET_HW_CUBE_F4)
  771. # define APP_LOAD_ADDRESS 0x08004000
  772. # define BOOTLOADER_DELAY 5000
  773. # define BOARD_FMUV2
  774. # define INTERFACE_USB 1
  775. # define INTERFACE_USART 1
  776. # define USBDEVICESTRING "ProfiCNC CUBE F4 BL"
  777. # define USBPRODUCTID 0x0001
  778. # define USBMFGSTRING "Hex Technology Limited"
  779. # define USBVENDORID 0x2DAE
  780. # define BOOT_DELAY_ADDRESS 0x000001a0
  781. # define BOARD_TYPE 9
  782. # define _FLASH_KBYTES (*(uint16_t *)0x1fff7a22)
  783. # define BOARD_FLASH_SECTORS ((_FLASH_KBYTES == 0x400) ? 11 : 23)
  784. # define BOARD_FLASH_SIZE (_FLASH_KBYTES * 1024)
  785. # define OSC_FREQ 24
  786. # define BOARD_PIN_LED_ACTIVITY 0 // no activity LED
  787. # define BOARD_PIN_LED_BOOTLOADER GPIO12
  788. # define BOARD_PORT_LEDS GPIOE
  789. # define BOARD_CLOCK_LEDS RCC_AHB1ENR_IOPEEN
  790. # define BOARD_LED_ON gpio_clear
  791. # define BOARD_LED_OFF gpio_set
  792. # define BOARD_USART USART2
  793. # define BOARD_USART_CLOCK_REGISTER RCC_APB1ENR
  794. # define BOARD_USART_CLOCK_BIT RCC_APB1ENR_USART2EN
  795. # define BOARD_PORT_USART GPIOD
  796. # define BOARD_PORT_USART_AF GPIO_AF7
  797. # define BOARD_PIN_TX GPIO5
  798. # define BOARD_PIN_RX GPIO6
  799. # define BOARD_USART_PIN_CLOCK_REGISTER RCC_AHB1ENR
  800. # define BOARD_USART_PIN_CLOCK_BIT RCC_AHB1ENR_IOPDEN
  801. # define SERIAL_BREAK_DETECT_DISABLED 1
  802. /*
  803. * Uncommenting this allows to force the bootloader through
  804. * a PWM output pin. As this can accidentally initialize
  805. * an ESC prematurely, it is not recommended. This feature
  806. * has not been used and hence defaults now to off.
  807. *
  808. * # define BOARD_FORCE_BL_PIN_OUT GPIO14
  809. * # define BOARD_FORCE_BL_PIN_IN GPIO11
  810. * # define BOARD_FORCE_BL_PORT GPIOE
  811. * # define BOARD_FORCE_BL_CLOCK_REGISTER RCC_AHB1ENR
  812. * # define BOARD_FORCE_BL_CLOCK_BIT RCC_AHB1ENR_IOPEEN
  813. * # define BOARD_FORCE_BL_PULL GPIO_PUPD_PULLUP
  814. */
  815. /****************************************************************************
  816. * TARGET_HW_AV_V1
  817. ****************************************************************************/
  818. #elif defined(TARGET_HW_AV_X_V1)
  819. # define APP_LOAD_ADDRESS 0x08008000
  820. # define BOOTLOADER_DELAY 5000
  821. # define INTERFACE_USB 0
  822. # define INTERFACE_USART 1
  823. # define BOOT_DELAY_ADDRESS 0x000001a0
  824. # define BOARD_TYPE 29
  825. # define _FLASH_KBYTES (*(uint16_t *)0x1ff0f442)
  826. # define BOARD_FLASH_SECTORS ((_FLASH_KBYTES == 0x400) ? 7 : 11)
  827. # define BOARD_FLASH_SIZE (_FLASH_KBYTES * 1024)
  828. # define OSC_FREQ 16
  829. # define BOARD_USART UART8
  830. # define BOARD_USART_CLOCK_REGISTER RCC_APB1ENR
  831. # define BOARD_USART_CLOCK_BIT RCC_APB1ENR_UART8EN
  832. # define BOARD_PORT_USART GPIOE
  833. # define BOARD_PORT_USART_AF GPIO_AF7
  834. # define BOARD_PIN_TX GPIO1
  835. # define BOARD_PIN_RX GPIO0
  836. # define BOARD_USART_PIN_CLOCK_REGISTER RCC_AHB1ENR
  837. # define BOARD_USART_PIN_CLOCK_BIT RCC_AHB1ENR_GPIODEN
  838. # define SERIAL_BREAK_DETECT_DISABLED 1
  839. /****************************************************************************
  840. * TARGET_HW_SMARTAP_PRO
  841. ****************************************************************************/
  842. #elif defined(TARGET_HW_SMARTAP_PRO)
  843. # define APP_LOAD_ADDRESS 0x08008000
  844. # define BOOTLOADER_DELAY 5000
  845. # define INTERFACE_USB 1
  846. # define INTERFACE_USART 0
  847. # define USBDEVICESTRING "PX4 BL SmartAP PRO"
  848. # define USBPRODUCTID 0x0020
  849. # define BOOT_DELAY_ADDRESS 0x000001a0
  850. # define BOARD_TYPE 32
  851. # define _FLASH_KBYTES (*(uint16_t *)0x1ff0f442)
  852. # define BOARD_FLASH_SECTORS ((_FLASH_KBYTES == 0x400) ? 7 : 11)
  853. # define BOARD_FLASH_SIZE (_FLASH_KBYTES * 1024)
  854. # define OSC_FREQ 8
  855. # define BOARD_PIN_LED_ACTIVITY GPIO3
  856. # define BOARD_PIN_LED_BOOTLOADER GPIO2
  857. # define BOARD_PORT_LEDS GPIOH
  858. # define BOARD_CLOCK_LEDS RCC_AHB1ENR_GPIOHEN
  859. # define BOARD_LED_ON gpio_set
  860. # define BOARD_LED_OFF gpio_clear
  861. #else
  862. # error Undefined Target Hardware
  863. #endif
  864. #if !defined(USBMFGSTRING)
  865. # define USBMFGSTRING "3D Robotics"
  866. #endif
  867. #if !defined(USBVENDORID)
  868. # define USBVENDORID 0x26AC
  869. #endif
  870. #if !defined(APP_RESERVATION_SIZE)
  871. # define APP_RESERVATION_SIZE 0
  872. #endif
  873. #if !defined(BOARD_FIRST_FLASH_SECTOR_TO_ERASE)
  874. # define BOARD_FIRST_FLASH_SECTOR_TO_ERASE 0
  875. #endif
  876. #if defined(OVERRIDE_USART_BAUDRATE)
  877. # define USART_BAUDRATE OVERRIDE_USART_BAUDRATE
  878. #else
  879. # define USART_BAUDRATE 115200
  880. #endif
  881. #if INTERFACE_USART
  882. # if !defined(BOARD_PORT_USART_TX)
  883. # define BOARD_PORT_USART_TX BOARD_PORT_USART
  884. # define BOARD_PORT_USART_RX BOARD_PORT_USART
  885. # endif
  886. # if !defined(BOARD_USART_PIN_CLOCK_BIT_TX)
  887. # define BOARD_USART_PIN_CLOCK_BIT_TX BOARD_USART_PIN_CLOCK_BIT
  888. # define BOARD_USART_PIN_CLOCK_BIT_RX BOARD_USART_PIN_CLOCK_BIT
  889. # endif
  890. #endif
  891. #if !defined(USB_DATA_ALIGN)
  892. # define USB_DATA_ALIGN
  893. #endif
  894. #ifndef BOOT_DEVICES_SELECTION
  895. # define BOOT_DEVICES_SELECTION USB0_DEV|SERIAL0_DEV|SERIAL1_DEV
  896. #endif
  897. #ifndef BOOT_DEVICES_FILTER_ONUSB
  898. # define BOOT_DEVICES_FILTER_ONUSB USB0_DEV|SERIAL0_DEV|SERIAL1_DEV
  899. #endif
  900. #endif /* HW_CONFIG_H_ */