summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nuttx/configs/fire-stm32v2/src/up_nsh.c35
-rw-r--r--nuttx/configs/shenzhou/src/up_nsh.c33
2 files changed, 66 insertions, 2 deletions
diff --git a/nuttx/configs/fire-stm32v2/src/up_nsh.c b/nuttx/configs/fire-stm32v2/src/up_nsh.c
index f728a227a..ba93d714f 100644
--- a/nuttx/configs/fire-stm32v2/src/up_nsh.c
+++ b/nuttx/configs/fire-stm32v2/src/up_nsh.c
@@ -57,6 +57,7 @@
#define HAVE_MMCSD 1
#define HAVE_USBDEV 1
+#define HAVE_W25 1
/* Configuration ************************************************************/
/* SPI1 connects to the SD CARD (and to the SPI FLASH) */
@@ -96,6 +97,24 @@
# endif
#endif
+/* Can't support the W25 device if it SPI1 or W25 support is not enabled */
+
+#if !defined(CONFIG_STM32_SPI1) || !defined(CONFIG_MTD_W25)
+# undef HAVE_W25
+#endif
+
+/* Can't support W25 features if mountpoints are disabled */
+
+#if defined(CONFIG_DISABLE_MOUNTPOINT)
+# undef HAVE_W25
+#endif
+
+/* Default W25 minor number */
+
+#if defined(HAVE_W25) && !defined(CONFIG_NSH_W25MINOR)
+# define CONFIG_NSH_W25MINOR 0
+#endif
+
/* Can't support USB host or device features if the USB peripheral or the USB
* device infrastructure is not enabled
*/
@@ -134,11 +153,25 @@
int nsh_archinitialize(void)
{
-#ifdef HAVE_MMCSD
+#if defined(HAVE_MMCSD) || defined(HAVE_W25)
int ret;
+#endif
+
+ /* Initialize and register the W25 FLASH file system. */
+
+#ifdef HAVE_W25
+ ret = stm32_w25initialize(CONFIG_NSH_W25MINOR);
+ if (ret < 0)
+ {
+ message("nsh_archinitialize: Failed to initialize W25 minor %d: %d\n",
+ CONFIG_NSH_W25MINOR, ret);
+ return ret;
+ }
+#endif
/* Initialize the SDIO-based MMC/SD slot */
+#ifdef HAVE_MMCSD
ret = stm32_sdinitialize(CONFIG_NSH_MMCSDMINOR);
if (ret < 0)
{
diff --git a/nuttx/configs/shenzhou/src/up_nsh.c b/nuttx/configs/shenzhou/src/up_nsh.c
index 1324ae0b9..e6126ba4d 100644
--- a/nuttx/configs/shenzhou/src/up_nsh.c
+++ b/nuttx/configs/shenzhou/src/up_nsh.c
@@ -58,6 +58,7 @@
#define HAVE_MMCSD 1
#define HAVE_USBDEV 1
#define HAVE_USBHOST 1
+#define HAVE_W25 1
/* Configuration ************************************************************/
/* SPI1 connects to the SD CARD (and to the SPI FLASH) */
@@ -107,6 +108,24 @@
# endif
#endif
+/* Can't support the W25 device if it SPI1 or W25 support is not enabled */
+
+#if !defined(CONFIG_STM32_SPI1) || !defined(CONFIG_MTD_W25)
+# undef HAVE_W25
+#endif
+
+/* Can't support W25 features if mountpoints are disabled */
+
+#if defined(CONFIG_DISABLE_MOUNTPOINT)
+# undef HAVE_W25
+#endif
+
+/* Default W25 minor number */
+
+#if defined(HAVE_W25) && !defined(CONFIG_NSH_W25MINOR)
+# define CONFIG_NSH_W25MINOR 0
+#endif
+
/* Can't support USB host or device features if USB OTG FS is not enabled */
#ifndef CONFIG_STM32_OTGFS
@@ -156,10 +175,22 @@
int nsh_archinitialize(void)
{
-#if defined(HAVE_MMCSD) || defined(HAVE_USBHOST)
+#if defined(HAVE_MMCSD) || defined(HAVE_USBHOST) || defined(HAVE_W25)
int ret;
#endif
+ /* Initialize and register the W25 FLASH file system. */
+
+#ifdef HAVE_W25
+ ret = stm32_w25initialize(CONFIG_NSH_W25MINOR);
+ if (ret < 0)
+ {
+ message("nsh_archinitialize: Failed to initialize W25 minor %d: %d\n",
+ CONFIG_NSH_W25MINOR, ret);
+ return ret;
+ }
+#endif
+
/* Initialize the SPI-based MMC/SD slot */
#ifdef HAVE_MMCSD