当前位置:   article > 正文

STM32F427利用FSMC接口访问FPGA的SRAM(1)—— STM32F427启动文件

STM32F427利用FSMC接口访问FPGA的SRAM(1)—— STM32F427启动文件

该启动文件做好后,才能进行下一步(STM32F427利用FSMC接口访问FPGA的SRAM),所以此文记录如何制作F427的启动文件。

1、参考F407探索者的资料:TFTLCD显示实验、外部SRAM实验。主要了解FSMC的原理。

2、参考STM32F427+FPGA板子的原理图,确定FSMC接口都有啥,包括:D0~D15数据线,A0~A18地址线,NL,CLK,NOE,NWE,NWAIT,NE3,INT0~INT1,NBL0(NLB)~NBL1(NUB)。

3、参考STM32F427 DATASHEET,确定时序图,使用异步非复用的时序图。

     选择异步的原因:异步存储器接口类型是最常见的,也是我们最熟知的,MCU一般均采用此类接口。相应的存储器有:SRAM、Flash、NvRAM……等,另外许多以并行方式接口的模拟/数字I/O器件,如A/D、D/A、开入/开出等,也采用异步存储器接口形式实现。

      选择非复用的原因:非复用模式为16位数据线及26位地址线分开始用,推荐在144脚及以上的STM32产品上使用该模式。

      详细介绍可参考之前的两篇文章。

4、参考STM32F4XX中文参考手册,确定FSMC信号的英文缩写的意思。

 5、由于没有F427例程,因此启动文件需要参考F407和F429的启动文件(均为正点原子的例程里的)来做,使用Beyond Compare工具来比对.S文件的差异,发现差异基本就是外部中断方面,F429比F427多了一些,一些中断的命名不太一样。之后通过STM32F4XX中文参考手册的外部中断章节来检查,确定F427的启动文件。 

贴出来。。。

  1. ;File Name : startup_stm32f427.s
  2. ;date : 2018-9-29
  3. ;*******************************************************************************
  4. ; Amount of memory (in bytes) allocated for Stack
  5. ; Tailor this value to your application needs
  6. ; <h> Stack Configuration
  7. ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
  8. ; </h>
  9. Stack_Size EQU 0x00000400
  10. AREA STACK, NOINIT, READWRITE, ALIGN=3
  11. Stack_Mem SPACE Stack_Size
  12. __initial_sp
  13. ; <h> Heap Configuration
  14. ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
  15. ; </h>
  16. Heap_Size EQU 0x00000200
  17. AREA HEAP, NOINIT, READWRITE, ALIGN=3
  18. __heap_base
  19. Heap_Mem SPACE Heap_Size
  20. __heap_limit
  21. PRESERVE8
  22. THUMB
  23. ; Vector Table Mapped to Address 0 at Reset
  24. AREA RESET, DATA, READONLY
  25. EXPORT __Vectors
  26. EXPORT __Vectors_End
  27. EXPORT __Vectors_Size
  28. __Vectors DCD __initial_sp ; Top of Stack
  29. DCD Reset_Handler ; Reset Handler
  30. DCD NMI_Handler ; NMI Handler
  31. DCD HardFault_Handler ; Hard Fault Handler
  32. DCD MemManage_Handler ; MPU Fault Handler
  33. DCD BusFault_Handler ; Bus Fault Handler
  34. DCD UsageFault_Handler ; Usage Fault Handler
  35. DCD 0 ; Reserved
  36. DCD 0 ; Reserved
  37. DCD 0 ; Reserved
  38. DCD 0 ; Reserved
  39. DCD SVC_Handler ; SVCall Handler
  40. DCD DebugMon_Handler ; Debug Monitor Handler
  41. DCD 0 ; Reserved
  42. DCD PendSV_Handler ; PendSV Handler
  43. DCD SysTick_Handler ; SysTick Handler
  44. ; External Interrupts
  45. DCD WWDG_IRQHandler ; Window WatchDog
  46. DCD PVD_IRQHandler ; PVD through EXTI Line detection
  47. DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line
  48. DCD RTC_WKUP_IRQHandler ; RTC Wakeup through the EXTI line
  49. DCD FLASH_IRQHandler ; FLASH
  50. DCD RCC_IRQHandler ; RCC
  51. DCD EXTI0_IRQHandler ; EXTI Line0
  52. DCD EXTI1_IRQHandler ; EXTI Line1
  53. DCD EXTI2_IRQHandler ; EXTI Line2
  54. DCD EXTI3_IRQHandler ; EXTI Line3
  55. DCD EXTI4_IRQHandler ; EXTI Line4
  56. DCD DMA1_Stream0_IRQHandler ; DMA1 Stream 0
  57. DCD DMA1_Stream1_IRQHandler ; DMA1 Stream 1
  58. DCD DMA1_Stream2_IRQHandler ; DMA1 Stream 2
  59. DCD DMA1_Stream3_IRQHandler ; DMA1 Stream 3
  60. DCD DMA1_Stream4_IRQHandler ; DMA1 Stream 4
  61. DCD DMA1_Stream5_IRQHandler ; DMA1 Stream 5
  62. DCD DMA1_Stream6_IRQHandler ; DMA1 Stream 6
  63. DCD ADC_IRQHandler ; ADC1, ADC2 and ADC3s
  64. DCD CAN1_TX_IRQHandler ; CAN1 TX
  65. DCD CAN1_RX0_IRQHandler ; CAN1 RX0
  66. DCD CAN1_RX1_IRQHandler ; CAN1 RX1
  67. DCD CAN1_SCE_IRQHandler ; CAN1 SCE
  68. DCD EXTI9_5_IRQHandler ; External Line[9:5]s
  69. DCD TIM1_BRK_TIM9_IRQHandler ; TIM1 Break and TIM9
  70. DCD TIM1_UP_TIM10_IRQHandler ; TIM1 Update and TIM10
  71. DCD TIM1_TRG_COM_TIM11_IRQHandler ; TIM1 Trigger and Commutation and TIM11
  72. DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare
  73. DCD TIM2_IRQHandler ; TIM2
  74. DCD TIM3_IRQHandler ; TIM3
  75. DCD TIM4_IRQHandler ; TIM4
  76. DCD I2C1_EV_IRQHandler ; I2C1 Event
  77. DCD I2C1_ER_IRQHandler ; I2C1 Error
  78. DCD I2C2_EV_IRQHandler ; I2C2 Event
  79. DCD I2C2_ER_IRQHandler ; I2C2 Error
  80. DCD SPI1_IRQHandler ; SPI1
  81. DCD SPI2_IRQHandler ; SPI2
  82. DCD USART1_IRQHandler ; USART1
  83. DCD USART2_IRQHandler ; USART2
  84. DCD USART3_IRQHandler ; USART3
  85. DCD EXTI15_10_IRQHandler ; External Line[15:10]s
  86. DCD RTC_Alarm_IRQHandler ; RTC Alarm (A and B) through EXTI Line
  87. DCD OTG_FS_WKUP_IRQHandler ; USB OTG FS Wakeup through EXTI line
  88. DCD TIM8_BRK_TIM12_IRQHandler ; TIM8 Break and TIM12
  89. DCD TIM8_UP_TIM13_IRQHandler ; TIM8 Update and TIM13
  90. DCD TIM8_TRG_COM_TIM14_IRQHandler ; TIM8 Trigger and Commutation and TIM14
  91. DCD TIM8_CC_IRQHandler ; TIM8 Capture Compare
  92. DCD DMA1_Stream7_IRQHandler ; DMA1 Stream7
  93. DCD FSMC_IRQHandler ; FSMC
  94. DCD SDIO_IRQHandler ; SDIO
  95. DCD TIM5_IRQHandler ; TIM5
  96. DCD SPI3_IRQHandler ; SPI3
  97. DCD UART4_IRQHandler ; UART4
  98. DCD UART5_IRQHandler ; UART5
  99. DCD TIM6_DAC_IRQHandler ; TIM6 and DAC1&2 underrun errors
  100. DCD TIM7_IRQHandler ; TIM7
  101. DCD DMA2_Stream0_IRQHandler ; DMA2 Stream 0
  102. DCD DMA2_Stream1_IRQHandler ; DMA2 Stream 1
  103. DCD DMA2_Stream2_IRQHandler ; DMA2 Stream 2
  104. DCD DMA2_Stream3_IRQHandler ; DMA2 Stream 3
  105. DCD DMA2_Stream4_IRQHandler ; DMA2 Stream 4
  106. DCD ETH_IRQHandler ; Ethernet
  107. DCD ETH_WKUP_IRQHandler ; Ethernet Wakeup through EXTI line
  108. DCD CAN2_TX_IRQHandler ; CAN2 TX
  109. DCD CAN2_RX0_IRQHandler ; CAN2 RX0
  110. DCD CAN2_RX1_IRQHandler ; CAN2 RX1
  111. DCD CAN2_SCE_IRQHandler ; CAN2 SCE
  112. DCD OTG_FS_IRQHandler ; USB OTG FS
  113. DCD DMA2_Stream5_IRQHandler ; DMA2 Stream 5
  114. DCD DMA2_Stream6_IRQHandler ; DMA2 Stream 6
  115. DCD DMA2_Stream7_IRQHandler ; DMA2 Stream 7
  116. DCD USART6_IRQHandler ; USART6
  117. DCD I2C3_EV_IRQHandler ; I2C3 event
  118. DCD I2C3_ER_IRQHandler ; I2C3 error
  119. DCD OTG_HS_EP1_OUT_IRQHandler ; USB OTG HS End Point 1 Out
  120. DCD OTG_HS_EP1_IN_IRQHandler ; USB OTG HS End Point 1 In
  121. DCD OTG_HS_WKUP_IRQHandler ; USB OTG HS Wakeup through EXTI
  122. DCD OTG_HS_IRQHandler ; USB OTG HS
  123. DCD DCMI_IRQHandler ; DCMI
  124. DCD CRYP_IRQHandler ; CRYP crypto
  125. DCD HASH_RNG_IRQHandler ; Hash and Rng
  126. DCD FPU_IRQHandler ; FPU
  127. DCD UART7_IRQHandler ; UART7
  128. DCD UART8_IRQHandler ; UART8
  129. DCD SPI4_IRQHandler ; SPI4
  130. DCD SPI5_IRQHandler ; SPI5
  131. DCD SPI6_IRQHandler ; SPI6
  132. __Vectors_End
  133. __Vectors_Size EQU __Vectors_End - __Vectors
  134. AREA |.text|, CODE, READONLY
  135. ; Reset handler
  136. Reset_Handler PROC
  137. EXPORT Reset_Handler [WEAK]
  138. IMPORT SystemInit
  139. IMPORT __main
  140. LDR R0, =SystemInit
  141. BLX R0
  142. LDR R0, =__main
  143. BX R0
  144. ENDP
  145. ; Dummy Exception Handlers (infinite loops which can be modified)
  146. NMI_Handler PROC
  147. EXPORT NMI_Handler [WEAK]
  148. B .
  149. ENDP
  150. HardFault_Handler\
  151. PROC
  152. EXPORT HardFault_Handler [WEAK]
  153. B .
  154. ENDP
  155. MemManage_Handler\
  156. PROC
  157. EXPORT MemManage_Handler [WEAK]
  158. B .
  159. ENDP
  160. BusFault_Handler\
  161. PROC
  162. EXPORT BusFault_Handler [WEAK]
  163. B .
  164. ENDP
  165. UsageFault_Handler\
  166. PROC
  167. EXPORT UsageFault_Handler [WEAK]
  168. B .
  169. ENDP
  170. SVC_Handler PROC
  171. EXPORT SVC_Handler [WEAK]
  172. B .
  173. ENDP
  174. DebugMon_Handler\
  175. PROC
  176. EXPORT DebugMon_Handler [WEAK]
  177. B .
  178. ENDP
  179. PendSV_Handler PROC
  180. EXPORT PendSV_Handler [WEAK]
  181. B .
  182. ENDP
  183. SysTick_Handler PROC
  184. EXPORT SysTick_Handler [WEAK]
  185. B .
  186. ENDP
  187. Default_Handler PROC
  188. EXPORT WWDG_IRQHandler [WEAK]
  189. EXPORT PVD_IRQHandler [WEAK]
  190. EXPORT TAMP_STAMP_IRQHandler [WEAK]
  191. EXPORT RTC_WKUP_IRQHandler [WEAK]
  192. EXPORT FLASH_IRQHandler [WEAK]
  193. EXPORT RCC_IRQHandler [WEAK]
  194. EXPORT EXTI0_IRQHandler [WEAK]
  195. EXPORT EXTI1_IRQHandler [WEAK]
  196. EXPORT EXTI2_IRQHandler [WEAK]
  197. EXPORT EXTI3_IRQHandler [WEAK]
  198. EXPORT EXTI4_IRQHandler [WEAK]
  199. EXPORT DMA1_Stream0_IRQHandler [WEAK]
  200. EXPORT DMA1_Stream1_IRQHandler [WEAK]
  201. EXPORT DMA1_Stream2_IRQHandler [WEAK]
  202. EXPORT DMA1_Stream3_IRQHandler [WEAK]
  203. EXPORT DMA1_Stream4_IRQHandler [WEAK]
  204. EXPORT DMA1_Stream5_IRQHandler [WEAK]
  205. EXPORT DMA1_Stream6_IRQHandler [WEAK]
  206. EXPORT ADC_IRQHandler [WEAK]
  207. EXPORT CAN1_TX_IRQHandler [WEAK]
  208. EXPORT CAN1_RX0_IRQHandler [WEAK]
  209. EXPORT CAN1_RX1_IRQHandler [WEAK]
  210. EXPORT CAN1_SCE_IRQHandler [WEAK]
  211. EXPORT EXTI9_5_IRQHandler [WEAK]
  212. EXPORT TIM1_BRK_TIM9_IRQHandler [WEAK]
  213. EXPORT TIM1_UP_TIM10_IRQHandler [WEAK]
  214. EXPORT TIM1_TRG_COM_TIM11_IRQHandler [WEAK]
  215. EXPORT TIM1_CC_IRQHandler [WEAK]
  216. EXPORT TIM2_IRQHandler [WEAK]
  217. EXPORT TIM3_IRQHandler [WEAK]
  218. EXPORT TIM4_IRQHandler [WEAK]
  219. EXPORT I2C1_EV_IRQHandler [WEAK]
  220. EXPORT I2C1_ER_IRQHandler [WEAK]
  221. EXPORT I2C2_EV_IRQHandler [WEAK]
  222. EXPORT I2C2_ER_IRQHandler [WEAK]
  223. EXPORT SPI1_IRQHandler [WEAK]
  224. EXPORT SPI2_IRQHandler [WEAK]
  225. EXPORT USART1_IRQHandler [WEAK]
  226. EXPORT USART2_IRQHandler [WEAK]
  227. EXPORT USART3_IRQHandler [WEAK]
  228. EXPORT EXTI15_10_IRQHandler [WEAK]
  229. EXPORT RTC_Alarm_IRQHandler [WEAK]
  230. EXPORT OTG_FS_WKUP_IRQHandler [WEAK]
  231. EXPORT TIM8_BRK_TIM12_IRQHandler [WEAK]
  232. EXPORT TIM8_UP_TIM13_IRQHandler [WEAK]
  233. EXPORT TIM8_TRG_COM_TIM14_IRQHandler [WEAK]
  234. EXPORT TIM8_CC_IRQHandler [WEAK]
  235. EXPORT DMA1_Stream7_IRQHandler [WEAK]
  236. EXPORT FSMC_IRQHandler [WEAK]
  237. EXPORT SDIO_IRQHandler [WEAK]
  238. EXPORT TIM5_IRQHandler [WEAK]
  239. EXPORT SPI3_IRQHandler [WEAK]
  240. EXPORT UART4_IRQHandler [WEAK]
  241. EXPORT UART5_IRQHandler [WEAK]
  242. EXPORT TIM6_DAC_IRQHandler [WEAK]
  243. EXPORT TIM7_IRQHandler [WEAK]
  244. EXPORT DMA2_Stream0_IRQHandler [WEAK]
  245. EXPORT DMA2_Stream1_IRQHandler [WEAK]
  246. EXPORT DMA2_Stream2_IRQHandler [WEAK]
  247. EXPORT DMA2_Stream3_IRQHandler [WEAK]
  248. EXPORT DMA2_Stream4_IRQHandler [WEAK]
  249. EXPORT ETH_IRQHandler [WEAK]
  250. EXPORT ETH_WKUP_IRQHandler [WEAK]
  251. EXPORT CAN2_TX_IRQHandler [WEAK]
  252. EXPORT CAN2_RX0_IRQHandler [WEAK]
  253. EXPORT CAN2_RX1_IRQHandler [WEAK]
  254. EXPORT CAN2_SCE_IRQHandler [WEAK]
  255. EXPORT OTG_FS_IRQHandler [WEAK]
  256. EXPORT DMA2_Stream5_IRQHandler [WEAK]
  257. EXPORT DMA2_Stream6_IRQHandler [WEAK]
  258. EXPORT DMA2_Stream7_IRQHandler [WEAK]
  259. EXPORT USART6_IRQHandler [WEAK]
  260. EXPORT I2C3_EV_IRQHandler [WEAK]
  261. EXPORT I2C3_ER_IRQHandler [WEAK]
  262. EXPORT OTG_HS_EP1_OUT_IRQHandler [WEAK]
  263. EXPORT OTG_HS_EP1_IN_IRQHandler [WEAK]
  264. EXPORT OTG_HS_WKUP_IRQHandler [WEAK]
  265. EXPORT OTG_HS_IRQHandler [WEAK]
  266. EXPORT DCMI_IRQHandler [WEAK]
  267. EXPORT CRYP_IRQHandler [WEAK]
  268. EXPORT HASH_RNG_IRQHandler [WEAK]
  269. EXPORT FPU_IRQHandler [WEAK]
  270. EXPORT UART7_IRQHandler [WEAK]
  271. EXPORT UART8_IRQHandler [WEAK]
  272. EXPORT SPI4_IRQHandler [WEAK]
  273. EXPORT SPI5_IRQHandler [WEAK]
  274. EXPORT SPI6_IRQHandler [WEAK]
  275. WWDG_IRQHandler
  276. PVD_IRQHandler
  277. TAMP_STAMP_IRQHandler
  278. RTC_WKUP_IRQHandler
  279. FLASH_IRQHandler
  280. RCC_IRQHandler
  281. EXTI0_IRQHandler
  282. EXTI1_IRQHandler
  283. EXTI2_IRQHandler
  284. EXTI3_IRQHandler
  285. EXTI4_IRQHandler
  286. DMA1_Stream0_IRQHandler
  287. DMA1_Stream1_IRQHandler
  288. DMA1_Stream2_IRQHandler
  289. DMA1_Stream3_IRQHandler
  290. DMA1_Stream4_IRQHandler
  291. DMA1_Stream5_IRQHandler
  292. DMA1_Stream6_IRQHandler
  293. ADC_IRQHandler
  294. CAN1_TX_IRQHandler
  295. CAN1_RX0_IRQHandler
  296. CAN1_RX1_IRQHandler
  297. CAN1_SCE_IRQHandler
  298. EXTI9_5_IRQHandler
  299. TIM1_BRK_TIM9_IRQHandler
  300. TIM1_UP_TIM10_IRQHandler
  301. TIM1_TRG_COM_TIM11_IRQHandler
  302. TIM1_CC_IRQHandler
  303. TIM2_IRQHandler
  304. TIM3_IRQHandler
  305. TIM4_IRQHandler
  306. I2C1_EV_IRQHandler
  307. I2C1_ER_IRQHandler
  308. I2C2_EV_IRQHandler
  309. I2C2_ER_IRQHandler
  310. SPI1_IRQHandler
  311. SPI2_IRQHandler
  312. USART1_IRQHandler
  313. USART2_IRQHandler
  314. USART3_IRQHandler
  315. EXTI15_10_IRQHandler
  316. RTC_Alarm_IRQHandler
  317. OTG_FS_WKUP_IRQHandler
  318. TIM8_BRK_TIM12_IRQHandler
  319. TIM8_UP_TIM13_IRQHandler
  320. TIM8_TRG_COM_TIM14_IRQHandler
  321. TIM8_CC_IRQHandler
  322. DMA1_Stream7_IRQHandler
  323. FSMC_IRQHandler
  324. SDIO_IRQHandler
  325. TIM5_IRQHandler
  326. SPI3_IRQHandler
  327. UART4_IRQHandler
  328. UART5_IRQHandler
  329. TIM6_DAC_IRQHandler
  330. TIM7_IRQHandler
  331. DMA2_Stream0_IRQHandler
  332. DMA2_Stream1_IRQHandler
  333. DMA2_Stream2_IRQHandler
  334. DMA2_Stream3_IRQHandler
  335. DMA2_Stream4_IRQHandler
  336. ETH_IRQHandler
  337. ETH_WKUP_IRQHandler
  338. CAN2_TX_IRQHandler
  339. CAN2_RX0_IRQHandler
  340. CAN2_RX1_IRQHandler
  341. CAN2_SCE_IRQHandler
  342. OTG_FS_IRQHandler
  343. DMA2_Stream5_IRQHandler
  344. DMA2_Stream6_IRQHandler
  345. DMA2_Stream7_IRQHandler
  346. USART6_IRQHandler
  347. I2C3_EV_IRQHandler
  348. I2C3_ER_IRQHandler
  349. OTG_HS_EP1_OUT_IRQHandler
  350. OTG_HS_EP1_IN_IRQHandler
  351. OTG_HS_WKUP_IRQHandler
  352. OTG_HS_IRQHandler
  353. DCMI_IRQHandler
  354. CRYP_IRQHandler
  355. HASH_RNG_IRQHandler
  356. FPU_IRQHandler
  357. UART7_IRQHandler
  358. UART8_IRQHandler
  359. SPI4_IRQHandler
  360. SPI5_IRQHandler
  361. SPI6_IRQHandler
  362. B .
  363. ENDP
  364. ALIGN
  365. ;*******************************************************************************
  366. ; User Stack and Heap initialization
  367. ;*******************************************************************************
  368. IF :DEF:__MICROLIB
  369. EXPORT __initial_sp
  370. EXPORT __heap_base
  371. EXPORT __heap_limit
  372. ELSE
  373. IMPORT __use_two_region_memory
  374. EXPORT __user_initial_stackheap
  375. __user_initial_stackheap
  376. LDR R0, = Heap_Mem
  377. LDR R1, =(Stack_Mem + Stack_Size)
  378. LDR R2, = (Heap_Mem + Heap_Size)
  379. LDR R3, = Stack_Mem
  380. BX LR
  381. ALIGN
  382. ENDIF
  383. END

 

本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号