[PATCH 5/5] bsps/stm32h7: allow config and usage of QSPI memory on stm32h747i-disco BSP
Karel Gardas
karel at functional.vision
Fri Jun 10 12:49:30 UTC 2022
The QSPI memory is initialized and used only when the BSP configure file
sets QSPI memory size to non-zero value. Currently QSPI is run in memory
mapped mode which allows future RTEMS binary linkage and upload into QSPI
memory.
Sponsored-By: Precidata
---
.../stm32h747i-disco/stm32h7-bspstarthooks.c | 17 +++++++++++++++++
.../bsps/arm/stm32h7/bspstm32h747i-disco.yml | 5 ++++-
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/bsps/arm/stm32h7/boards/stm/stm32h747i-disco/stm32h7-bspstarthooks.c b/bsps/arm/stm32h7/boards/stm/stm32h747i-disco/stm32h7-bspstarthooks.c
index 8d34e357ee..e18bc3bca9 100644
--- a/bsps/arm/stm32h7/boards/stm/stm32h747i-disco/stm32h7-bspstarthooks.c
+++ b/bsps/arm/stm32h7/boards/stm/stm32h747i-disco/stm32h7-bspstarthooks.c
@@ -36,6 +36,22 @@
#include <string.h>
+#if defined(STM32H7_MEMORY_QUADSPI_SIZE) && STM32H7_MEMORY_QUADSPI_SIZE > 0
+#include <stm32h747i_discovery_qspi.h>
+BSP_QSPI_Init_t QSPinit;
+#endif
+
+void stm32h7_init_qspi(void)
+{
+#if defined(STM32H7_MEMORY_QUADSPI_SIZE) && STM32H7_MEMORY_QUADSPI_SIZE > 0
+ /* let's initialize Quad SPI memory here for memory mapped mode */
+ memset((void*)&(QSPI_Ctx[0]), 0, sizeof(QSPI_Ctx[0]));
+ memset((void*)&QSPinit, 0, sizeof(BSP_QSPI_Init_t));
+ BSP_QSPI_Init(0, &QSPinit);
+ BSP_QSPI_EnableMemoryMappedMode(0);
+#endif
+}
+
void bsp_start_hook_0(void)
{
if ((RCC->AHB3ENR & RCC_AHB3ENR_FMCEN) == 0) {
@@ -52,6 +68,7 @@ void bsp_start_hook_0(void)
HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSI, RCC_MCODIV_1);
HAL_Init();
SystemInit_ExtMemCtl();
+ stm32h7_init_qspi();
}
#if __CORTEX_M == 0x07U
diff --git a/spec/build/bsps/arm/stm32h7/bspstm32h747i-disco.yml b/spec/build/bsps/arm/stm32h7/bspstm32h747i-disco.yml
index 8b13d16844..9111bcf051 100644
--- a/spec/build/bsps/arm/stm32h7/bspstm32h747i-disco.yml
+++ b/spec/build/bsps/arm/stm32h7/bspstm32h747i-disco.yml
@@ -8,7 +8,8 @@ copyrights:
cppflags: []
enabled-by: true
family: stm32h7
-includes: []
+includes:
+- bsps/arm/stm32h7/boards/stm/stm32h747i-disco
install: []
links:
- role: build-dependency
@@ -16,6 +17,8 @@ links:
- role: build-dependency
uid: tststm32h757i-eval
source:
+- bsps/arm/stm32h7/boards/stm/Components/mt25tl01g/mt25tl01g.c
+- bsps/arm/stm32h7/boards/stm/stm32h747i-disco/stm32h747i_discovery_qspi.c
- bsps/arm/stm32h7/boards/stm/stm32h747i-disco/stm32h7-bspstarthooks.c
- bsps/arm/stm32h7/boards/stm/stm32h747i-disco/stm32h7-config-clk.c
- bsps/arm/stm32h7/boards/stm/stm32h747i-disco/stm32h7-config-osc.c
--
2.25.1
More information about the devel
mailing list