diff --git a/demos/STM32/RT-STM32-LWIP-FATFS-USB/.cproject b/demos/STM32/RT-STM32-LWIP-FATFS-USB/.cproject
index 38c205164..07bc7a73d 100644
--- a/demos/STM32/RT-STM32-LWIP-FATFS-USB/.cproject
+++ b/demos/STM32/RT-STM32-LWIP-FATFS-USB/.cproject
@@ -124,16 +124,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
@@ -145,6 +180,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/demos/STM32/RT-STM32-LWIP-FATFS-USB/cfg-stm32f107_goldbull/chconf.h b/demos/STM32/RT-STM32-LWIP-FATFS-USB/cfg-stm32f107_goldbull/chconf.h
index 6641b1397..384e03a78 100644
--- a/demos/STM32/RT-STM32-LWIP-FATFS-USB/cfg-stm32f107_goldbull/chconf.h
+++ b/demos/STM32/RT-STM32-LWIP-FATFS-USB/cfg-stm32f107_goldbull/chconf.h
@@ -391,7 +391,7 @@
*
* @note The default is @p FALSE.
*/
-#define CH_DBG_STATISTICS TRUE
+#define CH_DBG_STATISTICS FALSE
/**
* @brief Debug option, system state check.
@@ -400,7 +400,7 @@
*
* @note The default is @p FALSE.
*/
-#define CH_DBG_SYSTEM_STATE_CHECK TRUE
+#define CH_DBG_SYSTEM_STATE_CHECK FALSE
/**
* @brief Debug option, parameters checks.
@@ -409,7 +409,7 @@
*
* @note The default is @p FALSE.
*/
-#define CH_DBG_ENABLE_CHECKS TRUE
+#define CH_DBG_ENABLE_CHECKS FALSE
/**
* @brief Debug option, consistency checks.
@@ -419,7 +419,7 @@
*
* @note The default is @p FALSE.
*/
-#define CH_DBG_ENABLE_ASSERTS TRUE
+#define CH_DBG_ENABLE_ASSERTS FALSE
/**
* @brief Debug option, trace buffer.
@@ -427,7 +427,7 @@
*
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/
-#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL
+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
/**
* @brief Trace buffer entries.
@@ -446,7 +446,7 @@
* @note The default failure mode is to halt the system with the global
* @p panic_msg variable set to @p NULL.
*/
-#define CH_DBG_ENABLE_STACK_CHECK TRUE
+#define CH_DBG_ENABLE_STACK_CHECK FALSE
/**
* @brief Debug option, stacks initialization.
@@ -456,7 +456,7 @@
*
* @note The default is @p FALSE.
*/
-#define CH_DBG_FILL_THREADS TRUE
+#define CH_DBG_FILL_THREADS FALSE
/**
* @brief Debug option, threads profiling.
@@ -478,6 +478,22 @@
*/
/*===========================================================================*/
+/**
+ * @brief System structure extension.
+ * @details User fields added to the end of the @p ch_system_t structure.
+ */
+#define CH_CFG_SYSTEM_EXTRA_FIELDS \
+ /* Add threads custom fields here.*/
+
+/**
+ * @brief System initialization hook.
+ * @details User initialization code added to the @p chSysInit() function
+ * just before interrupts are enabled globally.
+ */
+#define CH_CFG_SYSTEM_INIT_HOOK(tp) { \
+ /* Add threads initialization code here.*/ \
+}
+
/**
* @brief Threads descriptor structure extension.
* @details User fields added to the end of the @p thread_t structure.
diff --git a/demos/STM32/RT-STM32-LWIP-FATFS-USB/cfg-stm32f107_goldbull/portab.c b/demos/STM32/RT-STM32-LWIP-FATFS-USB/cfg-stm32f107_goldbull/portab.c
index 4c54b2835..f7690df80 100644
--- a/demos/STM32/RT-STM32-LWIP-FATFS-USB/cfg-stm32f107_goldbull/portab.c
+++ b/demos/STM32/RT-STM32-LWIP-FATFS-USB/cfg-stm32f107_goldbull/portab.c
@@ -29,10 +29,22 @@
/* Module local definitions. */
/*===========================================================================*/
+/* Maximum speed SPI configuration (18MHz, CPHA=0, CPOL=0, MSb first).*/
+static const SPIConfig hs_spicfg = {NULL, IOPORT3, GPIOC_SPI3_SD_CS, 0, 0};
+
+/* Low speed SPI configuration (281.250kHz, CPHA=0, CPOL=0, MSb first).*/
+static const SPIConfig ls_spicfg = {NULL, IOPORT3, GPIOC_SPI3_SD_CS,
+ SPI_CR1_BR_2 | SPI_CR1_BR_1,
+ 0};
+
/*===========================================================================*/
/* Module exported variables. */
/*===========================================================================*/
+/* MMC/SD over SPI driver configuration.*/
+MMCConfig const portab_mmccfg = {&SPID3, &ls_spicfg, &hs_spicfg};
+MMCDriver MMCD1;
+
/*===========================================================================*/
/* Module local types. */
/*===========================================================================*/
diff --git a/demos/STM32/RT-STM32-LWIP-FATFS-USB/cfg-stm32f107_goldbull/portab.h b/demos/STM32/RT-STM32-LWIP-FATFS-USB/cfg-stm32f107_goldbull/portab.h
index 4322cedd1..a9ba34d7c 100644
--- a/demos/STM32/RT-STM32-LWIP-FATFS-USB/cfg-stm32f107_goldbull/portab.h
+++ b/demos/STM32/RT-STM32-LWIP-FATFS-USB/cfg-stm32f107_goldbull/portab.h
@@ -55,6 +55,9 @@
/* External declarations. */
/*===========================================================================*/
+extern const MMCConfig portab_mmccfg;
+extern MMCDriver MMCD1;
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/demos/STM32/RT-STM32-LWIP-FATFS-USB/main.c b/demos/STM32/RT-STM32-LWIP-FATFS-USB/main.c
index e34fdb15c..cafb3dece 100644
--- a/demos/STM32/RT-STM32-LWIP-FATFS-USB/main.c
+++ b/demos/STM32/RT-STM32-LWIP-FATFS-USB/main.c
@@ -113,21 +113,6 @@ static FATFS SDC_FS;
/* FS mounted and ready.*/
static bool fs_ready = FALSE;
-#if !HAL_USE_SDC
-
-/* Maximum speed SPI configuration (18MHz, CPHA=0, CPOL=0, MSb first).*/
-static SPIConfig hs_spicfg = {NULL, IOPORT3, GPIOC_SPI3_SD_CS, 0, 0};
-
-/* Low speed SPI configuration (281.250kHz, CPHA=0, CPOL=0, MSb first).*/
-static SPIConfig ls_spicfg = {NULL, IOPORT3, GPIOC_SPI3_SD_CS,
- SPI_CR1_BR_2 | SPI_CR1_BR_1,
- 0};
-
-/* MMC/SD over SPI driver configuration.*/
-static MMCConfig mmccfg = {&SPID3, &ls_spicfg, &hs_spicfg};
-
-#endif
-
/* Generic large buffer.*/
static uint8_t fbuff[1024];
@@ -209,10 +194,6 @@ static const ShellConfig shell_cfg1 = {
static thread_t *shelltp = NULL;
-#if !HAL_USE_SDC
-MMCDriver MMCD1;
-#endif
-
/*
* Card insertion event.
*/
@@ -348,7 +329,7 @@ int main(void) {
*/
palSetPad(IOPORT3, GPIOC_SPI3_SD_CS);
mmcObjectInit(&MMCD1);
- mmcStart(&MMCD1, &mmccfg);
+ mmcStart(&MMCD1, &portab_mmccfg);
/*
* Activates the card insertion monitor.