summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2013-04-30 15:54:02 -0600
committerGregory Nutt <gnutt@nuttx.org>2013-04-30 15:54:02 -0600
commit45c144ba134835b0a66bdcb7dd40114c7b6a8249 (patch)
tree3ee75ed806c7f0de92d28b1bb00dd6d017fab0cf
parent8241609e9edbab8443fb4a3f278bfc7a924c05b1 (diff)
downloadnuttx-45c144ba134835b0a66bdcb7dd40114c7b6a8249.tar.gz
nuttx-45c144ba134835b0a66bdcb7dd40114c7b6a8249.tar.bz2
nuttx-45c144ba134835b0a66bdcb7dd40114c7b6a8249.zip
Add configuration and example to test MTD partitions
-rw-r--r--apps/ChangeLog.txt2
-rw-r--r--apps/examples/Kconfig3
-rw-r--r--apps/examples/Make.defs4
-rw-r--r--apps/examples/README.txt27
-rw-r--r--apps/examples/mtdpart/.gitignore11
-rw-r--r--apps/examples/mtdpart/Kconfig46
-rwxr-xr-xapps/examples/mtdpart/Makefile96
-rw-r--r--apps/examples/mtdpart/mtdpart_main.c379
-rw-r--r--apps/examples/nxffs/Kconfig58
-rw-r--r--apps/examples/nxffs/nxffs_main.c11
-rw-r--r--nuttx/ChangeLog6
-rw-r--r--nuttx/arch/sim/src/up_releasestack.c2
-rw-r--r--nuttx/configs/sim/README.txt10
-rw-r--r--nuttx/configs/sim/mtdpart/Make.defs111
-rw-r--r--nuttx/configs/sim/mtdpart/defconfig496
-rwxr-xr-x[-rw-r--r--]nuttx/configs/sim/mtdpart/setenv.sh (renamed from nuttx/configs/sim/nxffs/appconfig)18
-rw-r--r--nuttx/configs/sim/nxffs/defconfig617
-rw-r--r--nuttx/drivers/mtd/Kconfig29
-rw-r--r--nuttx/drivers/mtd/rammtd.c14
-rw-r--r--nuttx/fs/nxffs/Kconfig8
-rw-r--r--nuttx/fs/nxffs/nxffs.h4
-rw-r--r--nuttx/fs/nxffs/nxffs_initialize.c16
-rw-r--r--nuttx/fs/nxffs/nxffs_open.c10
-rw-r--r--nuttx/libc/Kconfig8
-rw-r--r--nuttx/libc/spawn/lib_psa_init.c2
25 files changed, 1779 insertions, 209 deletions
diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt
index 0749237ef..4676d8b8e 100644
--- a/apps/ChangeLog.txt
+++ b/apps/ChangeLog.txt
@@ -534,3 +534,5 @@
Petit (2014-4-24).
6.28 2013-xx-xx Gregory Nutt <gnutt@nuttx.org>
+
+ * apps/examples/mtdpart: Provides a simple test of MTD partitions.
diff --git a/apps/examples/Kconfig b/apps/examples/Kconfig
index ec0a97dd4..cf70ae53e 100644
--- a/apps/examples/Kconfig
+++ b/apps/examples/Kconfig
@@ -21,8 +21,9 @@ source "$APPSDIR/examples/keypadtest/Kconfig"
source "$APPSDIR/examples/igmp/Kconfig"
source "$APPSDIR/examples/lcdrw/Kconfig"
source "$APPSDIR/examples/mm/Kconfig"
-source "$APPSDIR/examples/mount/Kconfig"
source "$APPSDIR/examples/modbus/Kconfig"
+source "$APPSDIR/examples/mount/Kconfig"
+source "$APPSDIR/examples/mtdpart/Kconfig"
source "$APPSDIR/examples/nettest/Kconfig"
source "$APPSDIR/examples/nsh/Kconfig"
source "$APPSDIR/examples/null/Kconfig"
diff --git a/apps/examples/Make.defs b/apps/examples/Make.defs
index 68d4d4340..4026edcbd 100644
--- a/apps/examples/Make.defs
+++ b/apps/examples/Make.defs
@@ -118,6 +118,10 @@ ifeq ($(CONFIG_EXAMPLES_MOUNT),y)
CONFIGURED_APPS += examples/mount
endif
+ifeq ($(CONFIG_EXAMPLES_MTDPART),y)
+CONFIGURED_APPS += examples/mtdpart
+endif
+
ifeq ($(CONFIG_EXAMPLES_NETTEST),y)
CONFIGURED_APPS += examples/nettest
endif
diff --git a/apps/examples/README.txt b/apps/examples/README.txt
index 3c6fd7029..cd6701e9c 100644
--- a/apps/examples/README.txt
+++ b/apps/examples/README.txt
@@ -671,6 +671,33 @@ examples/mount
when CONFIG_EXAMPLES_MOUNT_DEVNAME is not defined. The
default is zero (meaning that "/dev/ram0" will be used).
+examples/mtdpart
+^^^^^^^^^^^^^^^^
+
+ This examples provides a simple test of MTD partition logic.
+
+ * CONFIG_EXAMPLES_MTDPART - Enables the MTD partition test example
+ * CONFIG_EXAMPLES_MTDPART_ARCHINIT - The default is to use the RAM MTD
+ device at drivers/mtd/rammtd.c. But an architecture-specific MTD driver
+ can be used instead by defining CONFIG_EXAMPLES_MTDPART_ARCHINIT. In
+ this case, the initialization logic will call mtdpart_archinitialize()
+ to obtain the MTD driver instance.
+ * CONFIG_EXAMPLES_MTDPART_NPARTITIONS - This setting provides the number
+ of partitions to test. The test will divide the reported size of the
+ MTD device into equal-sized sub-regions for each test partition. Default:
+ 3
+
+ When CONFIG_EXAMPLES_MTDPART_ARCHINIT is not defined, this test will use
+ the RAM MTD device at drivers/mtd/rammtd.c to simulate FLASH. The size of
+ the allocated RAM drive will be: CONFIG_EXMPLES_RAMMTD_ERASESIZE *
+ CONFIG_EXAMPLES_MTDPART_NEBLOCKS
+
+ * CONFIG_EXAMPLES_MTDPART_ERASESIZE - This value gives the size of one
+ erase block in the MTD RAM device. This must exactly match the default
+ configuration in drivers/mtd/rammtd.c!
+ * CONFIG_EXAMPLES_MTDPART_NEBLOCKS - This value gives the nubmer of erase
+ blocks in MTD RAM device.
+
examples/nettest
^^^^^^^^^^^^^^^^
diff --git a/apps/examples/mtdpart/.gitignore b/apps/examples/mtdpart/.gitignore
new file mode 100644
index 000000000..106e96227
--- /dev/null
+++ b/apps/examples/mtdpart/.gitignore
@@ -0,0 +1,11 @@
+Make.dep
+.depend
+.built
+*.swp
+*.asm
+*.rel
+*.lst
+*.sym
+*.adb
+*.lib
+*.src
diff --git a/apps/examples/mtdpart/Kconfig b/apps/examples/mtdpart/Kconfig
new file mode 100644
index 000000000..363b6091f
--- /dev/null
+++ b/apps/examples/mtdpart/Kconfig
@@ -0,0 +1,46 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+config EXAMPLES_MTDPART
+ bool "MTD partition test"
+ default n
+ ---help---
+ Enable the MTD partition test example
+
+if EXAMPLES_MTDPART
+
+config EXAMPLES_MTDPART_ARCHINIT
+ bool "Architecture-specific initialization"
+ default n
+ ---help---
+ The default is to use the RAM MTD device at drivers/mtd/rammtd.c.
+ But an architecture-specific MTD driver can be used instead by
+ defining EXAMPLES_MTDPART_ARCHINIT. In this case, the
+ initialization logic will call mtdpart_archinitialize() to obtain
+ the MTD driver instance.
+
+config EXAMPLES_MTDPART_NEBLOCKS
+ int "Number of erase blocks (simulated)"
+ default 32
+ depends on !EXAMPLES_MTDPART_ARCHINIT
+ ---help---
+ When EXAMPLES_MTDPART_ARCHINIT is not defined, this test will use
+ the RAM MTD device at drivers/mtd/rammtd.c to simulate FLASH. In
+ this case, this value must be provided to give the nubmer of erase
+ blocks in MTD RAM device.
+
+ The size of the allocated RAM drive will be:
+
+ EXAMPLES_MTDPART_ERASESIZE * EXAMPLES_MTDPART_NEBLOCKS
+
+config EXAMPLES_MTDPART_NPARTITIONS
+ int "Number of partitions"
+ default 3
+ ---help---
+ This setting provides the number of partitions to test. The
+ test will divide the reported size of the MTD device into equal-
+ sized sub-regions for each test partition.
+
+endif
diff --git a/apps/examples/mtdpart/Makefile b/apps/examples/mtdpart/Makefile
new file mode 100755
index 000000000..56f9afa84
--- /dev/null
+++ b/apps/examples/mtdpart/Makefile
@@ -0,0 +1,96 @@
+############################################################################
+# apps/examples/mtdpart/Makefile
+#
+# Copyright (C) 2013 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/.config
+-include $(TOPDIR)/Make.defs
+include $(APPDIR)/Make.defs
+
+# Hello, World! Example
+
+ASRCS =
+CSRCS = mtdpart_main.c
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ BIN = ..\..\libapps$(LIBEXT)
+else
+ifeq ($(WINTOOL),y)
+ BIN = ..\\..\\libapps$(LIBEXT)
+else
+ BIN = ../../libapps$(LIBEXT)
+endif
+endif
+
+ROOTDEPPATH = --dep-path .
+
+# Common build
+
+VPATH =
+
+all: .built
+.PHONY: clean depend distclean
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+.built: $(OBJS)
+ $(call ARCHIVE, $(BIN), $(OBJS))
+ @touch .built
+
+context:
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ $(call DELFILE, .built)
+ $(call CLEAN)
+
+distclean: clean
+ $(call DELFILE, Make.dep)
+ $(call DELFILE, .depend)
+
+-include Make.dep
diff --git a/apps/examples/mtdpart/mtdpart_main.c b/apps/examples/mtdpart/mtdpart_main.c
new file mode 100644
index 000000000..9b22aaf13
--- /dev/null
+++ b/apps/examples/mtdpart/mtdpart_main.c
@@ -0,0 +1,379 @@
+/****************************************************************************
+ * examples/mtdpart/mtdpart_main.c
+ *
+ * Copyright (C) 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/mtd.h>
+#include <nuttx/fs/fs.h>
+#include <nuttx/fs/ioctl.h>
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+/* Make sure that support for MTD partitions is enabled */
+
+#ifndef CONFIG_MTD_PARTITION
+# error "CONFIG_MTD_PARTITION is required"
+#endif
+
+/* The default is to use the RAM MTD device at drivers/mtd/rammtd.c. But
+ * an architecture-specific MTD driver can be used instead by defining
+ * CONFIG_EXAMPLES_MTDPART_ARCHINIT. In this case, the initialization logic
+ * will call mtdpart_archinitialize() to obtain the MTD driver instance.
+ */
+
+#ifndef CONFIG_EXAMPLES_MTDPART_ARCHINIT
+
+/* Make sure that the RAM MTD driver is enabled */
+
+# ifndef CONFIG_RAMMTD
+# error "CONFIG_RAMMTD is required without CONFIG_EXAMPLES_MTDPART_ARCHINIT"
+# endif
+
+/* This must exactly match the default configuration in drivers/mtd/rammtd.c */
+
+# ifndef CONFIG_RAMMTD_ERASESIZE
+# define CONFIG_RAMMTD_ERASESIZE 4096
+# endif
+
+/* Given the ERASESIZE, CONFIG_EXAMPLES_MTDPART_NEBLOCKS will determine the
+ * size of the RAM allocation needed.
+ */
+
+# ifndef CONFIG_EXAMPLES_MTDPART_NEBLOCKS
+# define CONFIG_EXAMPLES_MTDPART_NEBLOCKS (32)
+# endif
+
+# undef MTDPART_BUFSIZE
+# define MTDPART_BUFSIZE \
+ (CONFIG_RAMMTD_ERASESIZE * CONFIG_EXAMPLES_MTDPART_NEBLOCKS)
+
+#endif
+
+#ifdef CONFIG_EXAMPLES_MTDPART_NPARTITIONS
+# define CONFIG_EXAMPLES_MTDPART_NPARTITIONS 3
+#endif
+
+/* Debug ********************************************************************/
+#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_FS)
+# define message syslog
+# define msgflush()
+#else
+# define message printf
+# define msgflush() fflush(stdout);
+#endif
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+struct mtdpart_filedesc_s
+{
+ FAR char *name;
+ bool deleted;
+ size_t len;
+ uint32_t crc;
+};
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+/* Pre-allocated simulated flash */
+
+#ifndef CONFIG_EXAMPLES_MTDPART_ARCHINIT
+static uint8_t g_simflash[MTDPART_BUFSIZE];
+#endif
+
+/****************************************************************************
+ * External Functions
+ ****************************************************************************/
+
+#ifdef CONFIG_EXAMPLES_MTDPART_ARCHINIT
+extern FAR struct mtd_dev_s *mtdpart_archinitialize(void);
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: mtdpart_main
+ ****************************************************************************/
+
+int mtdpart_main(int argc, char *argv[])
+{
+ FAR struct mtd_dev_s *master;
+ FAR struct mtd_dev_s *part[CONFIG_EXAMPLES_MTDPART_NPARTITIONS];
+ FAR struct mtd_geometry_s geo;
+ FAR uint32_t *buffer;
+ char blockname[32];
+ char charname[32];
+ ssize_t nbytes;
+ off_t nblocks;
+ off_t offset;
+ off_t check;
+ unsigned int blkpererase;
+ int fd;
+ int i;
+ int j;
+ int k;
+ int ret;
+
+ /* Create and initialize a RAM MTD FLASH driver instance */
+
+#ifdef CONFIG_EXAMPLES_MTDPART_ARCHINIT
+ master = mtdpart_archinitialize();
+#else
+ master = rammtd_initialize(g_simflash, MTDPART_BUFSIZE);
+#endif
+ if (!master)
+ {
+ message("ERROR: Failed to create RAM MTD instance\n");
+ msgflush();
+ exit(1);
+ }
+
+ /* Initialize to provide an FTL block driver on the MTD FLASH interface.
+ *
+ * NOTE: We could just skip all of this FTL and BCH stuff. We could
+ * instead just use the MTD drivers bwrite and bread to perform this
+ * test. Creating the character drivers, however, makes this test more
+ * interesting.
+ */
+
+ ret = ftl_initialize(0, master);
+ if (ret < 0)
+ {
+ message("ERROR: ftl_initialize /dev/mtdblock0 failed: %d\n", ret);
+ msgflush();
+ exit(2);
+ }
+
+ /* Now create a character device on the block device */
+
+ ret = bchdev_register("/dev/mtdblock0", "/dev/mtd0", false);
+ if (ret < 0)
+ {
+ message("ERROR: bchdev_register /dev/mtd0 failed: %d\n", ret);
+ msgflush();
+ exit(3);
+ }
+
+ /* Get the geometry of the FLASH device */
+
+ ret = master->ioctl(master, MTDIOC_GEOMETRY, (unsigned long)((uintptr_t)&geo));
+ if (ret < 0)
+ {
+ fdbg("ERROR: mtd->ioctl failed: %d\n", ret);
+ exit(3);
+ }
+
+ message("Flash Geometry:\n");
+ message(" blocksize: %uld\n", (unsigned long)geo.blocksize);
+ message(" erasesize: %uld\n", (unsigned long)geo.erasesize);
+ message(" neraseblocks: %uld\n", (unsigned long)geo.neraseblocks);
+
+ /* Determine the size of each partition */
+
+ blkpererase = geo.erasesize / geo.blocksize;
+ nblocks = geo.neraseblocks * blkpererase / CONFIG_EXAMPLES_MTDPART_NPARTITIONS;
+
+ /* Now create MTD FLASH partitions */
+
+ for (offset = 0, i = 1;
+ i <= CONFIG_EXAMPLES_MTDPART_NPARTITIONS;
+ offset += nblocks, i++)
+ {
+ /* Create the partition */
+
+ part[i] = mtd_partition(master, offset, nblocks);
+ if (!part[i])
+ {
+ message("ERROR: mtd_partition failed. offset=%uld nblocks=%uld\n",
+ (unsigned long)offset, (unsigned long)nblocks);
+ msgflush();
+ exit(4);
+ }
+
+ /* Initialize to provide an FTL block driver on the MTD FLASH interface */
+
+ snprintf(blockname, 32, "/dev/mtdblock%d", i);
+ snprintf(charname, 32, "/dev/mtd%d", i);
+
+ ret = ftl_initialize(i, part[i]);
+ if (ret < 0)
+ {
+ message("ERROR: ftl_initialize %s failed: %d\n", blockname, ret);
+ msgflush();
+ exit(5);
+ }
+
+ /* Now create a character device on the block device */
+
+ ret = bchdev_register(blockname, charname, false);
+ if (ret < 0)
+ {
+ message("ERROR: bchdev_register %s failed: %d\n", charname, ret);
+ msgflush();
+ exit(6);
+ }
+ }
+
+ /* Allocate a buffer */
+
+ buffer = (FAR uint32_t *)malloc(geo.blocksize);
+ if (!buffer)
+ {
+ message("ERROR: failed to allocate a sector buffer\n");
+ msgflush();
+ exit(7);
+ }
+
+ /* Open the master MTD FLASH character driver for writing */
+
+ fd = open("/dev/mtd0", O_WRONLY);
+ if (fd < 0)
+ {
+ message("ERROR: open /dev/mtd0 failed: %d\n", errno);
+ msgflush();
+ exit(8);
+ }
+
+ /* Now write the offset into every block */
+
+ offset = 0;
+ for (i = 0; i < geo.neraseblocks; i++)
+ {
+ for (j = 0; j < blkpererase; j++)
+ {
+ /* Fill the block with the offset */
+
+ for (k = 0; k < geo.blocksize / sizeof(uint32_t); k++)
+ {
+ buffer[k] = offset;
+ offset += 4;
+ }
+
+ /* And write it using the character driver */
+
+ nbytes = write(fd, buffer, geo.blocksize);
+ if (nbytes < 0)
+ {
+ message("ERROR: write to /dev/mtd0 failed: %d\n", errno);
+ msgflush();
+ exit(9);
+ }
+ }
+ }
+
+ close(fd);
+
+ /* Now read each partition */
+
+ for (offset = 0, i = 1;
+ i <= CONFIG_EXAMPLES_MTDPART_NPARTITIONS;
+ offset += nblocks, i++)
+ {
+ /* Open the master MTD partition character driver for writing */
+
+ snprintf(charname, 32, "/dev/mtd%d", i);
+ fd = open(charname, O_RDONLY);
+ if (fd < 0)
+ {
+ message("ERROR: open %s failed: %d\n", charname, errno);
+ msgflush();
+ exit(10);
+ }
+
+ /* Now verify the offset in every block */
+
+ check = offset;
+ for (i = 0; i < nblocks; i++)
+ {
+ for (j = 0; j < blkpererase; j++)
+ {
+ /* Read the next block into memory */
+
+ nbytes = read(fd, buffer, geo.blocksize);
+ if (nbytes < 0)
+ {
+ message("ERROR: read from %s failed: %d\n", charname, errno);
+ msgflush();
+ exit(11);
+ }
+
+ /* Verfy the offsets in the block */
+
+ check = offset;
+ for (k = 0; k < geo.blocksize / sizeof(uint32_t); k++)
+ {
+ if (buffer[k] != check)
+ {
+ message("ERROR: Bad offset %uld, expected %uld\n",
+ buffer[k], check);
+ msgflush();
+ exit(12);
+ }
+
+ check += 4;
+ }
+ }
+ }
+
+ close(fd);
+ }
+
+ /* And exit without bothering to clean up */
+
+ msgflush();
+ return 0;
+}
+
diff --git a/apps/examples/nxffs/Kconfig b/apps/examples/nxffs/Kconfig
index 074ace872..57c55787c 100644
--- a/apps/examples/nxffs/Kconfig
+++ b/apps/examples/nxffs/Kconfig
@@ -10,4 +10,62 @@ config EXAMPLES_NXFFS
Enable the NXFFS file system example
if EXAMPLES_NXFFS
+
+config EXAMPLES_NXFFS_ARCHINIT
+ bool "Architecture-specific initialization"
+ default n
+ ---help---
+ The default is to use the RAM MTD device at drivers/mtd/rammtd.c.
+ But an architecture-specific MTD driver can be used instead by
+ defining EXAMPLES_NXFFS_ARCHINIT. In this case, the
+ initialization logic will call mtdpart_archinitialize() to obtain
+ the MTD driver instance.
+
+config EXAMPLES_NXFFS_NEBLOCKS
+ int "Number of erase blocks (simulated)"
+ default 32
+ depends on !EXAMPLES_NXFFS_ARCHINIT
+ ---help---
+ When EXAMPLES_NXFFS_ARCHINIT is not defined, this test will use
+ the RAM MTD device at drivers/mtd/rammtd.c to simulate FLASH. In
+ this case, this value must be provided to give the nubmer of erase
+ blocks in MTD RAM device.
+
+ The size of the allocated RAM drive will be:
+
+ RAMMTD_ERASESIZE * EXAMPLES_NXFFS_NEBLOCKS
+
+config EXAMPLES_NXFFS_MAXNAME
+ int "Max name size"
+ default 128
+ range 1 255
+ ---help---
+ Determines the maximum size of names used in the filesystem
+
+ config EXAMPLES_NXFFS_MAXFILE
+ int "Max file size"
+ default 8192
+ ---help---
+ Determines the maximum size of a file
+
+config EXAMPLES_NXFFS_MAXIO
+ int "Max I/O"
+ default 347
+
+config EXAMPLES_NXFFS_MAXOPEN
+ int "Max open files"
+ default 512
+
+config EXAMPLES_NXFFS_MOUNTPT
+ string "NXFFS mountpoint"
+ default "/mnt/nxffs"
+
+config EXAMPLES_NXFFS_NLOOPS
+ int "Number of test loops"
+ default 100
+
+config EXAMPLES_NXFFS_VERBOSE
+ bool "Verbose output"
+ default n
+
endif
diff --git a/apps/examples/nxffs/nxffs_main.c b/apps/examples/nxffs/nxffs_main.c
index 8bb5cd1fe..23b02cc16 100644
--- a/apps/examples/nxffs/nxffs_main.c
+++ b/apps/examples/nxffs/nxffs_main.c
@@ -69,10 +69,6 @@
/* This must exactly match the default configuration in drivers/mtd/rammtd.c */
-# ifndef CONFIG_RAMMTD_BLOCKSIZE
-# define CONFIG_RAMMTD_BLOCKSIZE 512
-# endif
-
# ifndef CONFIG_RAMMTD_ERASESIZE
# define CONFIG_RAMMTD_ERASESIZE 4096
# endif
@@ -81,8 +77,7 @@
# define CONFIG_EXAMPLES_NXFFS_NEBLOCKS (32)
# endif
-# undef CONFIG_EXAMPLES_NXFFS_BUFSIZE
-# define CONFIG_EXAMPLES_NXFFS_BUFSIZE \
+# define EXAMPLES_NXFFS_BUFSIZE \
(CONFIG_RAMMTD_ERASESIZE * CONFIG_EXAMPLES_NXFFS_NEBLOCKS)
#endif
@@ -145,7 +140,7 @@ struct nxffs_filedesc_s
/* Pre-allocated simulated flash */
#ifndef CONFIG_EXAMPLES_NXFFS_ARCHINIT
-static uint8_t g_simflash[CONFIG_EXAMPLES_NXFFS_BUFSIZE];
+static uint8_t g_simflash[EXAMPLES_NXFFS_BUFSIZE];
#endif
static uint8_t g_fileimage[CONFIG_EXAMPLES_NXFFS_MAXFILE];
@@ -807,7 +802,7 @@ int nxffs_main(int argc, char *argv[])
#ifdef CONFIG_EXAMPLES_NXFFS_ARCHINIT
mtd = nxffs_archinitialize();
#else
- mtd = rammtd_initialize(g_simflash, CONFIG_EXAMPLES_NXFFS_BUFSIZE);
+ mtd = rammtd_initialize(g_simflash, EXAMPLES_NXFFS_BUFSIZE);
#endif
if (!mtd)
{
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog
index 49696bed1..6734664e4 100644
--- a/nuttx/ChangeLog
+++ b/nuttx/ChangeLog
@@ -4645,4 +4645,8 @@
sense, so it is disabled in the code (2013-4-30).
* drivers/mtd/mtd_partition.c: Support capability to clone one
MTD driver into several, MTD partition drivers, each of which
- can manage a sub-region of the FLASH.
+ can manage a sub-region of the FLASH (2013-4-30).
+ * configs/sim/nxffs: Converted to use the kconfig-frontends
+ tools (20130-4-30).
+ * configs/sim/mtdpart: A new configuration to test MTD
+ partitions (2013-4-30).
diff --git a/nuttx/arch/sim/src/up_releasestack.c b/nuttx/arch/sim/src/up_releasestack.c
index 248f6b712..49a68eb8d 100644
--- a/nuttx/arch/sim/src/up_releasestack.c
+++ b/nuttx/arch/sim/src/up_releasestack.c
@@ -40,7 +40,9 @@
#include <nuttx/config.h>
#include <stdlib.h>
+
#include <nuttx/arch.h>
+#include <nuttx/kmalloc.h>
#include "up_internal.h"
diff --git a/nuttx/configs/sim/README.txt b/nuttx/configs/sim/README.txt
index 8127acc03..7db2e11a8 100644
--- a/nuttx/configs/sim/README.txt
+++ b/nuttx/configs/sim/README.txt
@@ -240,6 +240,11 @@ mount
cd <nuttx-directory>/tools
./configure.sh sim/mount
+mtdpart
+
+ This is the apps/examples/mtdpart test using a MTD RAM driver to
+ simulate the FLASH part.
+
nettest
Description
@@ -487,6 +492,11 @@ nx11
See apps/examples/README.txt for further details.
+nxffs
+
+ This is the apps/examples/nxffs test using a MTD RAM driver to
+ simulate the FLASH part.
+
nxlines
This is the apps/examples/nxlines test.
diff --git a/nuttx/configs/sim/mtdpart/Make.defs b/nuttx/configs/sim/mtdpart/Make.defs
new file mode 100644
index 000000000..31f89a7fe
--- /dev/null
+++ b/nuttx/configs/sim/mtdpart/Make.defs
@@ -0,0 +1,111 @@
+############################################################################
+# configs/sim/mtdpart/Make.defs
+#
+# Copyright (C) 2013 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+HOSTOS = ${shell uname -o 2>/dev/null || echo "Other"}
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = -O2
+endif
+
+ARCHCPUFLAGS = -fno-builtin
+ARCHCPUFLAGSXX = -fno-builtin -fno-exceptions -fno-rtti
+ARCHPICFLAGS = -fpic
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ARCHINCLUDESXX = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ARCHSCRIPT =
+
+ifeq ($(CONFIG_SIM_M32),y)
+ ARCHCPUFLAGS += -m32
+ ARCHCPUFLAGSXX += -m32
+endif
+
+CROSSDEV =
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXFLAGS = $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGSXX) $(ARCHINCLUDESXX) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+OBJEXT = .o
+LIBEXT = .a
+
+ifeq ($(HOSTOS),Cygwin)
+ EXEEXT = .exe
+else
+ EXEEXT =
+endif
+
+LDLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(LD)
+CCLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(CC)
+LDFLAGS = $(ARCHSCRIPT) # For backward compatibility, same as CCLINKFLAGS
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDLINKFLAGS += -g
+ CCLINKFLAGS += -g
+ LDFLAGS += -g
+endif
+
+ifeq ($(CONFIG_SIM_M32),y)
+ LDLINKFLAGS += -melf_i386
+ CCLINKFLAGS += -m32
+ LDFLAGS += -m32
+endif
+
+
+MKDEP = $(TOPDIR)/tools/mkdeps.sh
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(HOSTINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+HOSTLDFLAGS =
diff --git a/nuttx/configs/sim/mtdpart/defconfig b/nuttx/configs/sim/mtdpart/defconfig
new file mode 100644
index 000000000..f3e195919
--- /dev/null
+++ b/nuttx/configs/sim/mtdpart/defconfig
@@ -0,0 +1,496 @@
+#
+# Automatically generated file; DO NOT EDIT.
+# Nuttx/ Configuration
+#
+CONFIG_NUTTX_NEWCONFIG=y
+
+#
+# Build Setup
+#
+# CONFIG_EXPERIMENTAL is not set
+CONFIG_HOST_LINUX=y
+# CONFIG_HOST_OSX is not set
+# CONFIG_HOST_WINDOWS is not set
+# CONFIG_HOST_OTHER is not set
+
+#
+# Build Configuration
+#
+# CONFIG_APPS_DIR="../apps"
+# CONFIG_BUILD_2PASS is not set
+
+#
+# Binary Output Formats
+#
+# CONFIG_RRLOAD_BINARY is not set
+# CONFIG_INTELHEX_BINARY is not set
+# CONFIG_MOTOROLA_SREC is not set
+# CONFIG_RAW_BINARY is not set
+
+#
+# Customize Header Files
+#
+# CONFIG_ARCH_STDBOOL_H is not set
+# CONFIG_ARCH_MATH_H is not set
+# CONFIG_ARCH_FLOAT_H is not set
+# CONFIG_ARCH_STDARG_H is not set
+
+#
+# Debug Options
+#
+CONFIG_DEBUG=y
+# CONFIG_DEBUG_VERBOSE is not set
+
+#
+# Subsystem Debug Options
+#
+# CONFIG_DEBUG_MM is not set
+# CONFIG_DEBUG_SCHED is not set
+CONFIG_DEBUG_FS=y
+# CONFIG_DEBUG_LIB is not set
+# CONFIG_DEBUG_BINFMT is not set
+# CONFIG_DEBUG_GRAPHICS is not set
+
+#
+# Driver Debug Options
+#
+# CONFIG_DEBUG_ANALOG is not set
+# CONFIG_DEBUG_GPIO is not set
+CONFIG_DEBUG_SYMBOLS=y
+
+#
+# System Type
+#
+# CONFIG_ARCH_8051 is not set
+# CONFIG_ARCH_ARM is not set
+# CONFIG_ARCH_AVR is not set
+# CONFIG_ARCH_HC is not set
+# CONFIG_ARCH_MIPS is not set
+# CONFIG_ARCH_RGMP is not set
+# CONFIG_ARCH_SH is not set
+CONFIG_ARCH_SIM=y
+# CONFIG_ARCH_X86 is not set
+# CONFIG_ARCH_Z16 is not set
+# CONFIG_ARCH_Z80 is not set
+CONFIG_ARCH="sim"
+
+#
+# Simulation Configuration Options
+#
+# CONFIG_SIM_M32 is not set
+# CONFIG_SIM_WALLTIME is not set
+
+#
+# External Memory Configuration
+#
+
+#
+# Architecture Options
+#
+# CONFIG_ARCH_NOINTC is not set
+# CONFIG_ARCH_VECNOTIRQ is not set
+# CONFIG_ARCH_DMA is not set
+# CONFIG_ARCH_IRQPRIO is not set
+# CONFIG_CUSTOM_STACK is not set
+# CONFIG_ADDRENV is not set
+# CONFIG_ARCH_HAVE_VFORK is not set
+# CONFIG_ARCH_STACKDUMP is not set
+# CONFIG_ENDIAN_BIG is not set
+# CONFIG_ARCH_HAVE_RAMFUNCS is not set
+# CONFIG_ARCH_HAVE_RAMVECTORS is not set
+
+#
+# Board Settings
+#
+CONFIG_BOARD_LOOPSPERMSEC=5000
+# CONFIG_ARCH_CALIBRATION is not set
+CONFIG_DRAM_START=
+CONFIG_DRAM_SIZE=
+
+#
+# Boot options
+#
+# CONFIG_BOOT_RUNFROMEXTSRAM is not set
+CONFIG_BOOT_RUNFROMFLASH=y
+# CONFIG_BOOT_RUNFROMISRAM is not set
+# CONFIG_BOOT_RUNFROMSDRAM is not set
+# CONFIG_BOOT_COPYTORAM is not set
+
+#
+# Board Selection
+#
+CONFIG_ARCH_BOARD_SIM=y
+# CONFIG_ARCH_BOARD_CUSTOM is not set
+CONFIG_ARCH_BOARD="sim"
+
+#
+# Common Board Options
+#
+
+#
+# Board-Specific Options
+#
+
+#
+# RTOS Features
+#
+# CONFIG_BOARD_INITIALIZE is not set
+CONFIG_MSEC_PER_TICK=10
+CONFIG_RR_INTERVAL=0
+# CONFIG_SCHED_INSTRUMENTATION is not set
+CONFIG_TASK_NAME_SIZE=32
+# CONFIG_SCHED_HAVE_PARENT is not set
+# CONFIG_JULIAN_TIME is not set
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=4
+CONFIG_START_DAY=29
+CONFIG_DEV_CONSOLE=y
+CONFIG_MUTEX_TYPES=y
+# CONFIG_PRIORITY_INHERITANCE is not set
+# CONFIG_FDCLONE_DISABLE is not set
+# CONFIG_FDCLONE_STDIO is not set
+CONFIG_SDCLONE_DISABLE=y
+# CONFIG_SCHED_WAITPID is not set
+# CONFIG_SCHED_STARTHOOK is not set
+# CONFIG_SCHED_ATEXIT is not set
+# CONFIG_SCHED_ONEXIT is not set
+CONFIG_USER_ENTRYPOINT="mtdpart_main"
+CONFIG_DISABLE_OS_API=y
+# CONFIG_DISABLE_CLOCK is not set
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=y
+CONFIG_DISABLE_MQUEUE=y
+# CONFIG_DISABLE_ENVIRON is not set
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=64
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=32
+CONFIG_NFILE_STREAMS=16
+CONFIG_NAME_MAX=32
+CONFIG_PREALLOC_MQ_MSGS=32
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=32
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# Stack and heap information
+#
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=8192
+
+#
+# Device Drivers
+#
+CONFIG_DISABLE_POLL=y
+CONFIG_DEV_NULL=y
+# CONFIG_DEV_ZERO is not set
+# CONFIG_LOOP is not set
+# CONFIG_RAMDISK is not set
+# CONFIG_CAN is not set
+# CONFIG_PWM is not set
+# CONFIG_I2C is not set
+# CONFIG_SPI is not set
+# CONFIG_RTC is not set
+# CONFIG_WATCHDOG is not set
+# CONFIG_ANALOG is not set
+# CONFIG_BCH is not set
+# CONFIG_INPUT is not set
+# CONFIG_LCD is not set
+# CONFIG_MMCSD is not set
+CONFIG_MTD=y
+CONFIG_MTD_PARTITION=y
+CONFIG_RAMMTD=y
+CONFIG_RAMMTD_BLOCKSIZE=512
+CONFIG_RAMMTD_ERASESIZE=4096
+CONFIG_RAMMTD_ERASESTATE=0xff
+CONFIG_RAMMTD_FLASHSIM=y
+# CONFIG_MTD_AT24XX is not set
+# CONFIG_MTD_AT45DB is not set
+# CONFIG_MTD_MP25P is not set
+# CONFIG_MTD_RAMTRON is not set
+# CONFIG_MTD_RAM is not set
+# CONFIG_MTD_SST25 is not set
+# CONFIG_MTD_SST39FV is not set
+# CONFIG_MTD_W25 is not set
+# CONFIG_PIPES is not set
+# CONFIG_PM is not set
+# CONFIG_POWER is not set
+# CONFIG_SENSORS is not set
+# CONFIG_SERCOMM_CONSOLE is not set
+CONFIG_SERIAL=y
+# CONFIG_DEV_LOWCONSOLE is not set
+# CONFIG_16550_UART is not set
+# CONFIG_STANDARD_SERIAL is not set
+# CONFIG_USBDEV is not set
+# CONFIG_USBHOST is not set
+# CONFIG_WIRELESS is not set
+
+#
+# System Logging Device Options
+#
+
+#
+# System Logging
+#
+# CONFIG_RAMLOG is not set
+
+#
+# Networking Support
+#
+# CONFIG_NET is not set
+
+#
+# File Systems
+#
+
+#
+# File system configuration
+#
+# CONFIG_DISABLE_MOUNTPOINT is not set
+# CONFIG_FS_RAMMAP is not set
+CONFIG_FS_FAT=y
+# CONFIG_FAT_LCNAMES is not set
+# CONFIG_FAT_LFN is not set
+# CONFIG_FS_FATTIME is not set
+# CONFIG_FAT_DMAMEMORY is not set
+# CONFIG_FS_NXFFS is not set
+# CONFIG_FS_ROMFS is not set
+
+#
+# System Logging
+#
+# CONFIG_SYSLOG_ENABLE is not set
+# CONFIG_SYSLOG is not set
+
+#
+# Graphics Support
+#
+# CONFIG_NX is not set
+
+#
+# Memory Management
+#
+# CONFIG_MM_MULTIHEAP is not set
+# CONFIG_MM_SMALL is not set
+CONFIG_MM_REGIONS=1
+# CONFIG_GRAN is not set
+
+#
+# Binary Formats
+#
+# CONFIG_BINFMT_DISABLE is not set
+# CONFIG_BINFMT_EXEPATH is not set
+# CONFIG_NXFLAT is not set
+# CONFIG_ELF is not set
+# CONFIG_BUILTIN is not set
+# CONFIG_PIC is not set
+# CONFIG_SYMTAB_ORDEREDBYNAME is not set
+
+#
+# Library Routines
+#
+
+#
+# Standard C Library Options
+#
+CONFIG_STDIO_BUFFER_SIZE=64
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=2
+CONFIG_LIB_HOMEDIR="/"
+# CONFIG_LIBM is not set
+# CONFIG_NOPRINTF_FIELDWIDTH is not set
+# CONFIG_LIBC_FLOATINGPOINT is not set
+CONFIG_LIB_RAND_ORDER=3
+# CONFIG_EOL_IS_CR is not set
+# CONFIG_EOL_IS_LF is not set
+# CONFIG_EOL_IS_BOTH_CRLF is not set
+CONFIG_EOL_IS_EITHER_CRLF=y
+# CONFIG_LIBC_EXECFUNCS is not set
+CONFIG_POSIX_SPAWN_PROXY_STACKSIZE=1024
+CONFIG_TASK_SPAWN_DEFAULT_STACKSIZE=2048
+# CONFIG_LIBC_STRERROR is not set
+# CONFIG_LIBC_PERROR_STDOUT is not set
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_LIB_SENDFILE_BUFSIZE=512
+# CONFIG_ARCH_ROMGETC is not set
+# CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set
+
+#
+# Non-standard Library Support
+#
+# CONFIG_LIB_KBDCODEC is not set
+
+#
+# Basic CXX Support
+#
+# CONFIG_C99_BOOL8 is not set
+# CONFIG_HAVE_CXX is not set
+
+#
+# Application Configuration
+#
+
+#
+# Built-In Applications
+#
+
+#
+# Examples
+#
+# CONFIG_EXAMPLES_BUTTONS is not set
+# CONFIG_EXAMPLES_CAN is not set
+# CONFIG_EXAMPLES_COMPOSITE is not set
+# CONFIG_EXAMPLES_DHCPD is not set
+# CONFIG_EXAMPLES_ELF is not set
+# CONFIG_EXAMPLES_FTPC is not set
+# CONFIG_EXAMPLES_FTPD is not set
+# CONFIG_EXAMPLES_HELLO is not set
+# CONFIG_EXAMPLES_HELLOXX is not set
+# CONFIG_EXAMPLES_JSON is not set
+# CONFIG_EXAMPLES_HIDKBD is not set
+# CONFIG_EXAMPLES_KEYPADTEST is not set
+# CONFIG_EXAMPLES_IGMP is not set
+# CONFIG_EXAMPLES_LCDRW is not set
+# CONFIG_EXAMPLES_MM is not set
+# CONFIG_EXAMPLES_MODBUS is not set
+# CONFIG_EXAMPLES_MOUNT is not set
+CONFIG_EXAMPLES_MTDPART=y
+# CONFIG_EXAMPLES_MTDPART_ARCHINIT is not set
+CONFIG_EXAMPLES_MTDPART_NEBLOCKS=32
+CONFIG_EXAMPLES_MTDPART_NPARTITIONS=3
+# CONFIG_EXAMPLES_NSH is not set
+# CONFIG_EXAMPLES_NULL is not set
+# CONFIG_EXAMPLES_NX is not set
+# CONFIG_EXAMPLES_NXCONSOLE is not set
+# CONFIG_EXAMPLES_NXFFS is not set
+# CONFIG_EXAMPLES_NXFLAT is not set
+# CONFIG_EXAMPLES_NXHELLO is not set
+# CONFIG_EXAMPLES_NXIMAGE is not set
+# CONFIG_EXAMPLES_NXLINES is not set
+# CONFIG_EXAMPLES_NXTEXT is not set
+# CONFIG_EXAMPLES_OSTEST is not set
+# CONFIG_EXAMPLES_PASHELLO is not set
+# CONFIG_EXAMPLES_PIPE is not set
+# CONFIG_EXAMPLES_POLL is not set
+# CONFIG_EXAMPLES_POSIXSPAWN is not set
+# CONFIG_EXAMPLES_QENCODER is not set
+# CONFIG_EXAMPLES_RGMP is not set
+# CONFIG_EXAMPLES_ROMFS is not set
+# CONFIG_EXAMPLES_SENDMAIL is not set
+# CONFIG_EXAMPLES_SERLOOP is not set
+# CONFIG_EXAMPLES_TELNETD is not set
+# CONFIG_EXAMPLES_THTTPD is not set
+# CONFIG_EXAMPLES_TIFF is not set
+# CONFIG_EXAMPLES_TOUCHSCREEN is not set
+# CONFIG_EXAMPLES_UDP is not set
+# CONFIG_EXAMPLES_UIP is not set
+# CONFIG_EXAMPLES_USBSERIAL is not set
+# CONFIG_EXAMPLES_USBMSC is not set
+# CONFIG_EXAMPLES_USBTERM is not set
+# CONFIG_EXAMPLES_WATCHDOG is not set
+
+#
+# Graphics Support
+#
+# CONFIG_TIFF is not set
+
+#
+# Interpreters
+#
+# CONFIG_INTERPRETERS_FICL is not set
+# CONFIG_INTERPRETERS_PCODE is not set
+
+#
+# Network Utilities
+#
+
+#
+# Networking Utilities
+#
+# CONFIG_NETUTILS_CODECS is not set
+# CONFIG_NETUTILS_DHCPC is not set
+# CONFIG_NETUTILS_DHCPD is not set
+# CONFIG_NETUTILS_FTPC is not set
+# CONFIG_NETUTILS_FTPD is not set
+# CONFIG_NETUTILS_JSON is not set
+# CONFIG_NETUTILS_RESOLV is not set
+# CONFIG_NETUTILS_SMTP is not set
+# CONFIG_NETUTILS_TELNETD is not set
+# CONFIG_NETUTILS_TFTPC is not set
+# CONFIG_NETUTILS_THTTPD is not set
+# CONFIG_NETUTILS_UIPLIB is not set
+# CONFIG_NETUTILS_WEBCLIENT is not set
+
+#
+# FreeModBus
+#
+# CONFIG_MODBUS is not set
+
+#
+# NSH Library
+#
+# CONFIG_NSH_LIBRARY is not set
+
+#
+# NxWidgets/NxWM
+#
+
+#
+# System NSH Add-Ons
+#
+
+#
+# Custom Free Memory Command
+#
+# CONFIG_SYSTEM_FREE is not set
+
+#
+# I2C tool
+#
+
+#
+# FLASH Program Installation
+#
+# CONFIG_SYSTEM_INSTALL is not set
+
+#
+# RAM Test
+#
+# CONFIG_SYSTEM_RAMTEST is not set
+
+#
+# readline()
+#
+# CONFIG_SYSTEM_READLINE is not set
+
+#
+# Power Off
+#
+# CONFIG_SYSTEM_POWEROFF is not set
+
+#
+# RAMTRON
+#
+# CONFIG_SYSTEM_RAMTRON is not set
+
+#
+# SD Card
+#
+# CONFIG_SYSTEM_SDCARD is not set
+
+#
+# Sysinfo
+#
+# CONFIG_SYSTEM_SYSINFO is not set
+
+#
+# USB Monitor
+#
diff --git a/nuttx/configs/sim/nxffs/appconfig b/nuttx/configs/sim/mtdpart/setenv.sh
index 6eb93ac77..2f5c6f40b 100644..100755
--- a/nuttx/configs/sim/nxffs/appconfig
+++ b/nuttx/configs/sim/mtdpart/setenv.sh
@@ -1,7 +1,7 @@
-############################################################################
-# configs/sim/nxffs/appconfig
+#!/bin/bash
+# confisgs/sim/mtdpart/setenv.sh
#
-# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Copyright (C) 2013 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -31,9 +31,15 @@
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
-############################################################################
-# Path to example in apps/examples containing the user_start entry point
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
-CONFIGURED_APPS += examples/nxffs
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+#export NUTTX_BIN=
+#export PATH=${NUTTX_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/sim/nxffs/defconfig b/nuttx/configs/sim/nxffs/defconfig
index c18a77a62..a2e663e8a 100644
--- a/nuttx/configs/sim/nxffs/defconfig
+++ b/nuttx/configs/sim/nxffs/defconfig
@@ -1,124 +1,167 @@
-############################################################################
-# configs/sim/nxffs/defconfig
-#
-# Copyright (C) 2011 Gregory Nutt. All rights reserved.
-# Author: Gregory Nutt <gnutt@nuttx.org>
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-# 3. Neither the name NuttX nor the names of its contributors may be
-# used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-############################################################################
-#
-# Architecture selection
#
-CONFIG_ARCH="sim"
-CONFIG_ARCH_SIM=y
-CONFIG_ARCH_BOARD="sim"
-CONFIG_ARCH_BOARD_SIM=y
+# Automatically generated file; DO NOT EDIT.
+# Nuttx/ Configuration
+#
+CONFIG_NUTTX_NEWCONFIG=y
+
+#
+# Build Setup
+#
+# CONFIG_EXPERIMENTAL is not set
+CONFIG_HOST_LINUX=y
+# CONFIG_HOST_OSX is not set
+# CONFIG_HOST_WINDOWS is not set
+# CONFIG_HOST_OTHER is not set
+
+#
+# Build Configuration
+#
+# CONFIG_APPS_DIR="../apps"
+# CONFIG_BUILD_2PASS is not set
#
-# General OS setup
+# Binary Output Formats
+#
+# CONFIG_RRLOAD_BINARY is not set
+# CONFIG_INTELHEX_BINARY is not set
+# CONFIG_MOTOROLA_SREC is not set
+# CONFIG_RAW_BINARY is not set
+
+#
+# Customize Header Files
+#
+# CONFIG_ARCH_STDBOOL_H is not set
+# CONFIG_ARCH_MATH_H is not set
+# CONFIG_ARCH_FLOAT_H is not set
+# CONFIG_ARCH_STDARG_H is not set
+
+#
+# Debug Options
#
-CONFIG_USER_ENTRYPOINT="nxffs_main"
CONFIG_DEBUG=y
-CONFIG_DEBUG_VERBOSE=n
-CONFIG_DEBUG_SYMBOLS=y
+# CONFIG_DEBUG_VERBOSE is not set
+
+#
+# Subsystem Debug Options
+#
+# CONFIG_DEBUG_MM is not set
+# CONFIG_DEBUG_SCHED is not set
CONFIG_DEBUG_FS=y
-CONFIG_MM_REGIONS=1
-CONFIG_ARCH_LOWPUTC=y
-CONFIG_RR_INTERVAL=0
-CONFIG_SCHED_INSTRUMENTATION=n
-CONFIG_TASK_NAME_SIZE=32
-CONFIG_START_YEAR=2011
-CONFIG_START_MONTH=4
-CONFIG_START_DAY=29
-CONFIG_JULIAN_TIME=n
-CONFIG_DEV_CONSOLE=y
-CONFIG_DEV_LOWCONSOLE=n
-CONFIG_MUTEX_TYPES=y
-CONFIG_PRIORITY_INHERITANCE=n
-CONFIG_SEM_PREALLOCHOLDERS=0
-CONFIG_SEM_NNESTPRIO=0
-CONFIG_FDCLONE_DISABLE=n
-CONFIG_FDCLONE_STDIO=n
-CONFIG_SDCLONE_DISABLE=y
+# CONFIG_DEBUG_LIB is not set
+# CONFIG_DEBUG_BINFMT is not set
+# CONFIG_DEBUG_GRAPHICS is not set
#
-# The following can be used to disable categories of
-# APIs supported by the OS. If the compiler supports
-# weak functions, then it should not be necessary to
-# disable functions unless you want to restrict usage
-# of those APIs.
+# Driver Debug Options
#
-# There are certain dependency relationships in these
-# features.
+# CONFIG_DEBUG_ANALOG is not set
+# CONFIG_DEBUG_GPIO is not set
+CONFIG_DEBUG_SYMBOLS=y
+
#
-# o mq_notify logic depends on signals to awaken tasks
-# waiting for queues to become full or empty.
-# o pthread_condtimedwait() depends on signals to wake
-# up waiting tasks.
+# System Type
+#
+# CONFIG_ARCH_8051 is not set
+# CONFIG_ARCH_ARM is not set
+# CONFIG_ARCH_AVR is not set
+# CONFIG_ARCH_HC is not set
+# CONFIG_ARCH_MIPS is not set
+# CONFIG_ARCH_RGMP is not set
+# CONFIG_ARCH_SH is not set
+CONFIG_ARCH_SIM=y
+# CONFIG_ARCH_X86 is not set
+# CONFIG_ARCH_Z16 is not set
+# CONFIG_ARCH_Z80 is not set
+CONFIG_ARCH="sim"
+
+#
+# Simulation Configuration Options
+#
+# CONFIG_SIM_M32 is not set
+# CONFIG_SIM_WALLTIME is not set
+
+#
+# External Memory Configuration
#
-CONFIG_DISABLE_CLOCK=n
-CONFIG_DISABLE_POSIX_TIMERS=y
-CONFIG_DISABLE_PTHREAD=y
-CONFIG_DISABLE_SIGNALS=y
-CONFIG_DISABLE_MQUEUE=y
-CONFIG_DISABLE_MOUNTPOINT=n
-CONFIG_DISABLE_ENVIRON=n
-CONFIG_DISABLE_POLL=y
#
-# Misc libc settings
+# Architecture Options
+#
+# CONFIG_ARCH_NOINTC is not set
+# CONFIG_ARCH_VECNOTIRQ is not set
+# CONFIG_ARCH_DMA is not set
+# CONFIG_ARCH_IRQPRIO is not set
+# CONFIG_CUSTOM_STACK is not set
+# CONFIG_ADDRENV is not set
+# CONFIG_ARCH_HAVE_VFORK is not set
+# CONFIG_ARCH_STACKDUMP is not set
+# CONFIG_ENDIAN_BIG is not set
+# CONFIG_ARCH_HAVE_RAMFUNCS is not set
+# CONFIG_ARCH_HAVE_RAMVECTORS is not set
+
+#
+# Board Settings
+#
+CONFIG_BOARD_LOOPSPERMSEC=5000
+# CONFIG_ARCH_CALIBRATION is not set
+CONFIG_DRAM_START=
+CONFIG_DRAM_SIZE=
+
+#
+# Boot options
+#
+# CONFIG_BOOT_RUNFROMEXTSRAM is not set
+CONFIG_BOOT_RUNFROMFLASH=y
+# CONFIG_BOOT_RUNFROMISRAM is not set
+# CONFIG_BOOT_RUNFROMSDRAM is not set
+# CONFIG_BOOT_COPYTORAM is not set
+
+#
+# Board Selection
#
-CONFIG_NOPRINTF_FIELDWIDTH=n
+CONFIG_ARCH_BOARD_SIM=y
+# CONFIG_ARCH_BOARD_CUSTOM is not set
+CONFIG_ARCH_BOARD="sim"
#
-# Allow for architecture optimized implementations
+# Common Board Options
+#
+
#
-# The architecture can provide optimized versions of the
-# following to improve sysem performance
+# Board-Specific Options
#
-CONFIG_ARCH_MEMCPY=n
-CONFIG_ARCH_MEMCMP=n
-CONFIG_ARCH_MEMMOVE=n
-CONFIG_ARCH_MEMSET=n
-CONFIG_ARCH_STRCMP=n
-CONFIG_ARCH_STRCPY=n
-CONFIG_ARCH_STRNCPY=n
-CONFIG_ARCH_STRLEN=n
-CONFIG_ARCH_STRNLEN=n
-CONFIG_ARCH_BZERO=n
-##
-# General build options
#
-CONFIG_RRLOAD_BINARY=n
-CONFIG_INTELHEX_BINARY=n
-CONFIG_RAW_BINARY=n
+# RTOS Features
+#
+# CONFIG_BOARD_INITIALIZE is not set
+CONFIG_MSEC_PER_TICK=10
+CONFIG_RR_INTERVAL=0
+# CONFIG_SCHED_INSTRUMENTATION is not set
+CONFIG_TASK_NAME_SIZE=32
+# CONFIG_SCHED_HAVE_PARENT is not set
+# CONFIG_JULIAN_TIME is not set
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=4
+CONFIG_START_DAY=29
+CONFIG_DEV_CONSOLE=y
+CONFIG_MUTEX_TYPES=y
+# CONFIG_PRIORITY_INHERITANCE is not set
+# CONFIG_FDCLONE_DISABLE is not set
+# CONFIG_FDCLONE_STDIO is not set
+CONFIG_SDCLONE_DISABLE=y
+# CONFIG_SCHED_WAITPID is not set
+# CONFIG_SCHED_STARTHOOK is not set
+# CONFIG_SCHED_ATEXIT is not set
+# CONFIG_SCHED_ONEXIT is not set
+CONFIG_USER_ENTRYPOINT="mtdpart_main"
+CONFIG_DISABLE_OS_API=y
+# CONFIG_DISABLE_CLOCK is not set
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=y
+CONFIG_DISABLE_MQUEUE=y
+# CONFIG_DISABLE_ENVIRON is not set
#
# Sizes of configurable things (0 disables)
@@ -129,8 +172,6 @@ CONFIG_NPTHREAD_KEYS=4
CONFIG_NFILE_DESCRIPTORS=32
CONFIG_NFILE_STREAMS=16
CONFIG_NAME_MAX=32
-CONFIG_STDIO_BUFFER_SIZE=64
-CONFIG_NUNGET_CHARS=2
CONFIG_PREALLOC_MQ_MSGS=32
CONFIG_MQ_MAXMSGSIZE=32
CONFIG_MAX_WDOGPARMS=4
@@ -138,95 +179,329 @@ CONFIG_PREALLOC_WDOGS=32
CONFIG_PREALLOC_TIMERS=8
#
-# FAT filesystem configuration
+# Stack and heap information
#
-CONFIG_FS_FAT=y
-CONFIG_FS_ROMFS=n
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=8192
#
-# TCP/IP and UDP support via uIP
+# Device Drivers
#
-CONFIG_NET=n
-CONFIG_NET_IPv6=n
-CONFIG_NSOCKET_DESCRIPTORS=0
-CONFIG_NET_SOCKOPTS=y
-CONFIG_NET_BUFSIZE=420
-CONFIG_NET_TCP=n
-CONFIG_NET_TCP_CONNS=40
-CONFIG_NET_MAX_LISTENPORTS=40
-CONFIG_NET_UDP=n
-CONFIG_NET_UDP_CHECKSUMS=y
-#CONFIG_NET_UDP_CONNS=10
-CONFIG_NET_ICMP=n
-CONFIG_NET_ICMP_PING=n
-#CONFIG_NET_PINGADDRCONF=0
-CONFIG_NET_STATISTICS=y
-#CONFIG_NET_RECEIVE_WINDOW=
-#CONFIG_NET_ARPTAB_SIZE=8
-CONFIG_NET_BROADCAST=n
+CONFIG_DISABLE_POLL=y
+CONFIG_DEV_NULL=y
+# CONFIG_DEV_ZERO is not set
+# CONFIG_LOOP is not set
+# CONFIG_RAMDISK is not set
+# CONFIG_CAN is not set
+# CONFIG_PWM is not set
+# CONFIG_I2C is not set
+# CONFIG_SPI is not set
+# CONFIG_RTC is not set
+# CONFIG_WATCHDOG is not set
+# CONFIG_ANALOG is not set
+# CONFIG_BCH is not set
+# CONFIG_INPUT is not set
+# CONFIG_LCD is not set
+# CONFIG_MMCSD is not set
+CONFIG_MTD=y
+# CONFIG_MTD_PARTITION is not set
+CONFIG_RAMMTD=y
+CONFIG_RAMMTD_BLOCKSIZE=512
+CONFIG_RAMMTD_ERASESIZE=4096
+CONFIG_RAMMTD_ERASESTATE=0xff
+CONFIG_RAMMTD_FLASHSIM=y
+# CONFIG_MTD_AT24XX is not set
+# CONFIG_MTD_AT45DB is not set
+# CONFIG_MTD_MP25P is not set
+# CONFIG_MTD_RAMTRON is not set
+# CONFIG_MTD_RAM is not set
+# CONFIG_MTD_SST25 is not set
+# CONFIG_MTD_SST39FV is not set
+# CONFIG_MTD_W25 is not set
+# CONFIG_PIPES is not set
+# CONFIG_PM is not set
+# CONFIG_POWER is not set
+# CONFIG_SENSORS is not set
+# CONFIG_SERCOMM_CONSOLE is not set
+CONFIG_SERIAL=y
+# CONFIG_DEV_LOWCONSOLE is not set
+# CONFIG_16550_UART is not set
+# CONFIG_STANDARD_SERIAL is not set
+# CONFIG_USBDEV is not set
+# CONFIG_USBHOST is not set
+# CONFIG_WIRELESS is not set
#
-# UIP Network Utilities
+# System Logging Device Options
#
-CONFIG_NET_DHCP_LIGHT=n
-CONFIG_NET_RESOLV_ENTRIES=4
#
-# Settings for examples/uip
-CONFIG_EXAMPLES_UIP_IPADDR=0xc0a80080
-CONFIG_EXAMPLES_UIP_DRIPADDR=0xc0a80001
-CONFIG_EXAMPLES_UIP_NETMASK=0xffffff00
-CONFIG_EXAMPLES_UIP_DHCPC=n
-
+# System Logging
#
-# Settings for examples/nettest
-CONFIG_EXAMPLES_NETTEST_SERVER=n
-CONFIG_EXAMPLES_NETTEST_PERFORMANCE=n
-CONFIG_EXAMPLES_NETTEST_NOMAC=n
-CONFIG_EXAMPLES_NETTEST_IPADDR=0xc0a80080
-CONFIG_EXAMPLES_NETTEST_DRIPADDR=0xc0a80001
-CONFIG_EXAMPLES_NETTEST_NETMASK=0xffffff00
-CONFIG_EXAMPLES_NETTEST_CLIENTIP=0xc0a8006a
+# CONFIG_RAMLOG is not set
#
-# Settings for examples/ostest
+# Networking Support
#
-CONFIG_EXAMPLES_OSTEST_LOOPS=100
-CONFIG_EXAMPLES_OSTEST_STACKSIZE=8192
+# CONFIG_NET is not set
#
-# Settings for apps/nshlib
-CONFIG_NSH_CONSOLE=y
-CONFIG_NSH_TELNET=n
-CONFIG_NSH_IOBUFFER_SIZE=512
-CONFIG_NSH_CMD_SIZE=40
-CONFIG_NSH_DHCPC=n
-CONFIG_NSH_NOMAC=n
-CONFIG_NSH_IPADDR=0x0a000002
-CONFIG_NSH_DRIPADDR=0x0a000001
-CONFIG_NSH_NETMASK=0xffffff00
+# File Systems
+#
#
-# Various FS, NXFFS, RAMMTD and other settings needed for
-# apps/examples/nxffs
+# File system configuration
#
-CONFIG_LIB_RAND_ORDER=3
+# CONFIG_DISABLE_MOUNTPOINT is not set
+# CONFIG_FS_RAMMAP is not set
+CONFIG_FS_FAT=y
+# CONFIG_FAT_LCNAMES is not set
+# CONFIG_FAT_LFN is not set
+# CONFIG_FS_FATTIME is not set
+# CONFIG_FAT_DMAMEMORY is not set
CONFIG_FS_NXFFS=y
+CONFIG_NXFFS_PREALLOCATED=y
CONFIG_NXFFS_ERASEDSTATE=0xff
-CONFIG_NXFSS_PREALLOCATED=y
-CONFIG_RAMMTD_BLOCKSIZE=512
-CONFIG_RAMMTD_ERASESIZE=4096
-CONFIG_RAMMTD_ERASESTATE=0xff
-CONFIG_RAMMTD_FLASHSIM=y
+CONFIG_NXFFS_PACKTHRESHOLD=32
+CONFIG_NXFFS_MAXNAMLEN=255
+CONFIG_NXFFS_TAILTHRESHOLD=8192
+# CONFIG_FS_ROMFS is not set
+
+#
+# System Logging
+#
+# CONFIG_SYSLOG_ENABLE is not set
+# CONFIG_SYSLOG is not set
+
+#
+# Graphics Support
+#
+# CONFIG_NX is not set
+
+#
+# Memory Management
+#
+# CONFIG_MM_MULTIHEAP is not set
+# CONFIG_MM_SMALL is not set
+CONFIG_MM_REGIONS=1
+# CONFIG_GRAN is not set
+
+#
+# Binary Formats
+#
+# CONFIG_BINFMT_DISABLE is not set
+# CONFIG_BINFMT_EXEPATH is not set
+# CONFIG_NXFLAT is not set
+# CONFIG_ELF is not set
+# CONFIG_BUILTIN is not set
+# CONFIG_PIC is not set
+# CONFIG_SYMTAB_ORDEREDBYNAME is not set
+
+#
+# Library Routines
+#
+
+#
+# Standard C Library Options
+#
+CONFIG_STDIO_BUFFER_SIZE=64
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=2
+CONFIG_LIB_HOMEDIR="/"
+# CONFIG_LIBM is not set
+# CONFIG_NOPRINTF_FIELDWIDTH is not set
+# CONFIG_LIBC_FLOATINGPOINT is not set
+CONFIG_LIB_RAND_ORDER=3
+# CONFIG_EOL_IS_CR is not set
+# CONFIG_EOL_IS_LF is not set
+# CONFIG_EOL_IS_BOTH_CRLF is not set
+CONFIG_EOL_IS_EITHER_CRLF=y
+# CONFIG_LIBC_EXECFUNCS is not set
+CONFIG_POSIX_SPAWN_PROXY_STACKSIZE=1024
+CONFIG_TASK_SPAWN_DEFAULT_STACKSIZE=2048
+# CONFIG_LIBC_STRERROR is not set
+# CONFIG_LIBC_PERROR_STDOUT is not set
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_LIB_SENDFILE_BUFSIZE=512
+# CONFIG_ARCH_ROMGETC is not set
+# CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set
+
+#
+# Non-standard Library Support
+#
+# CONFIG_LIB_KBDCODEC is not set
+
+#
+# Basic CXX Support
+#
+# CONFIG_C99_BOOL8 is not set
+# CONFIG_HAVE_CXX is not set
+
+#
+# Application Configuration
+#
+
+#
+# Built-In Applications
+#
+
+#
+# Examples
+#
+# CONFIG_EXAMPLES_BUTTONS is not set
+# CONFIG_EXAMPLES_CAN is not set
+# CONFIG_EXAMPLES_COMPOSITE is not set
+# CONFIG_EXAMPLES_DHCPD is not set
+# CONFIG_EXAMPLES_ELF is not set
+# CONFIG_EXAMPLES_FTPC is not set
+# CONFIG_EXAMPLES_FTPD is not set
+# CONFIG_EXAMPLES_HELLO is not set
+# CONFIG_EXAMPLES_HELLOXX is not set
+# CONFIG_EXAMPLES_JSON is not set
+# CONFIG_EXAMPLES_HIDKBD is not set
+# CONFIG_EXAMPLES_KEYPADTEST is not set
+# CONFIG_EXAMPLES_IGMP is not set
+# CONFIG_EXAMPLES_LCDRW is not set
+# CONFIG_EXAMPLES_MM is not set
+# CONFIG_EXAMPLES_MODBUS is not set
+# CONFIG_EXAMPLES_MOUNT is not set
+# CONFIG_EXAMPLES_MTDPART is not set
+# CONFIG_EXAMPLES_NSH is not set
+# CONFIG_EXAMPLES_NULL is not set
+# CONFIG_EXAMPLES_NX is not set
+# CONFIG_EXAMPLES_NXCONSOLE is not set
+CONFIG_EXAMPLES_NXFFS=y
+# CONFIG_EXAMPLES_NXFFS_ARCHINIT is not set
CONFIG_EXAMPLES_NXFFS_NEBLOCKS=32
+CONFIG_EXAMPLES_NXFFS_MAXNAME=128
+CONFIG_EXAMPLES_NXFFS_MAXFILE=8192
+CONFIG_EXAMPLES_NXFFS_MAXIO=347
+CONFIG_EXAMPLES_NXFFS_MAXOPEN=512
+CONFIG_EXAMPLES_NXFFS_MOUNTPT="/mnt/nxffs"
+CONFIG_EXAMPLES_NXFFS_NLOOPS=100
+# CONFIG_EXAMPLES_NXFFS_VERBOSE is not set
+# CONFIG_EXAMPLES_NXFLAT is not set
+# CONFIG_EXAMPLES_NXHELLO is not set
+# CONFIG_EXAMPLES_NXIMAGE is not set
+# CONFIG_EXAMPLES_NXLINES is not set
+# CONFIG_EXAMPLES_NXTEXT is not set
+# CONFIG_EXAMPLES_OSTEST is not set
+# CONFIG_EXAMPLES_PASHELLO is not set
+# CONFIG_EXAMPLES_PIPE is not set
+# CONFIG_EXAMPLES_POLL is not set
+# CONFIG_EXAMPLES_POSIXSPAWN is not set
+# CONFIG_EXAMPLES_QENCODER is not set
+# CONFIG_EXAMPLES_RGMP is not set
+# CONFIG_EXAMPLES_ROMFS is not set
+# CONFIG_EXAMPLES_SENDMAIL is not set
+# CONFIG_EXAMPLES_SERLOOP is not set
+# CONFIG_EXAMPLES_TELNETD is not set
+# CONFIG_EXAMPLES_THTTPD is not set
+# CONFIG_EXAMPLES_TIFF is not set
+# CONFIG_EXAMPLES_TOUCHSCREEN is not set
+# CONFIG_EXAMPLES_UDP is not set
+# CONFIG_EXAMPLES_UIP is not set
+# CONFIG_EXAMPLES_USBSERIAL is not set
+# CONFIG_EXAMPLES_USBMSC is not set
+# CONFIG_EXAMPLES_USBTERM is not set
+# CONFIG_EXAMPLES_WATCHDOG is not set
#
-# Stack and heap information
+# Graphics Support
+#
+# CONFIG_TIFF is not set
+
+#
+# Interpreters
+#
+# CONFIG_INTERPRETERS_FICL is not set
+# CONFIG_INTERPRETERS_PCODE is not set
+
+#
+# Network Utilities
+#
+
+#
+# Networking Utilities
+#
+# CONFIG_NETUTILS_CODECS is not set
+# CONFIG_NETUTILS_DHCPC is not set
+# CONFIG_NETUTILS_DHCPD is not set
+# CONFIG_NETUTILS_FTPC is not set
+# CONFIG_NETUTILS_FTPD is not set
+# CONFIG_NETUTILS_JSON is not set
+# CONFIG_NETUTILS_RESOLV is not set
+# CONFIG_NETUTILS_SMTP is not set
+# CONFIG_NETUTILS_TELNETD is not set
+# CONFIG_NETUTILS_TFTPC is not set
+# CONFIG_NETUTILS_THTTPD is not set
+# CONFIG_NETUTILS_UIPLIB is not set
+# CONFIG_NETUTILS_WEBCLIENT is not set
+
+#
+# FreeModBus
+#
+# CONFIG_MODBUS is not set
+
+#
+# NSH Library
+#
+# CONFIG_NSH_LIBRARY is not set
+
+#
+# NxWidgets/NxWM
+#
+
+#
+# System NSH Add-Ons
+#
+
+#
+# Custom Free Memory Command
+#
+# CONFIG_SYSTEM_FREE is not set
+
+#
+# I2C tool
+#
+
+#
+# FLASH Program Installation
+#
+# CONFIG_SYSTEM_INSTALL is not set
+
+#
+# RAM Test
+#
+# CONFIG_SYSTEM_RAMTEST is not set
+
+#
+# readline()
+#
+# CONFIG_SYSTEM_READLINE is not set
+
+#
+# Power Off
+#
+# CONFIG_SYSTEM_POWEROFF is not set
+
+#
+# RAMTRON
+#
+# CONFIG_SYSTEM_RAMTRON is not set
+
+#
+# SD Card
+#
+# CONFIG_SYSTEM_SDCARD is not set
+
+#
+# Sysinfo
+#
+# CONFIG_SYSTEM_SYSINFO is not set
+
+#
+# USB Monitor
#
-CONFIG_BOOT_RUNFROMFLASH=n
-CONFIG_BOOT_COPYTORAM=n
-CONFIG_CUSTOM_STACK=n
-CONFIG_IDLETHREAD_STACKSIZE=4096
-CONFIG_USERMAIN_STACKSIZE=4096
-CONFIG_PTHREAD_STACK_MIN=256
-CONFIG_PTHREAD_STACK_DEFAULT=8192
diff --git a/nuttx/drivers/mtd/Kconfig b/nuttx/drivers/mtd/Kconfig
index 99aea5813..f7ded475a 100644
--- a/nuttx/drivers/mtd/Kconfig
+++ b/nuttx/drivers/mtd/Kconfig
@@ -24,6 +24,35 @@ config MTD_PARTITION
managing the sub-region of flash beginning at 'offset' (in blocks)
and of size 'nblocks' on the device specified by 'mtd'.
+config RAMMTD
+ bool "RAM-based MTD driver"
+ default n
+ ---help---
+ Build support for a RAM-based MTD driver.
+
+if RAMMTD
+
+config RAMMTD_BLOCKSIZE
+ int "RAM MTD block size"
+ default 512
+
+config RAMMTD_ERASESIZE
+ int "RAM MTD erase block size"
+ default 4096
+
+config RAMMTD_ERASESTATE
+ hex "Simulated erase state"
+ default 0xff
+
+config RAMMTD_FLASHSIM
+ bool "RAM MTD FLASH Simulation"
+ default n
+ ---help---
+ RAMMTD_FLASHSIM will add some extra logic to improve the level of
+ FLASH simulation.
+
+endif
+
config MTD_AT24XX
bool "I2C-based AT24XX eeprom"
default n
diff --git a/nuttx/drivers/mtd/rammtd.c b/nuttx/drivers/mtd/rammtd.c
index 82a7191ea..1d7a570e1 100644
--- a/nuttx/drivers/mtd/rammtd.c
+++ b/nuttx/drivers/mtd/rammtd.c
@@ -75,10 +75,10 @@
# error "Must have CONFIG_RAMMTD_BLOCKSIZE <= CONFIG_RAMMTD_ERASESIZE"
#endif
-#undef CONFIG_RAMMTD_BLKPER
-#define CONFIG_RAMMTD_BLKPER (CONFIG_RAMMTD_ERASESIZE/CONFIG_RAMMTD_BLOCKSIZE)
+#undef RAMMTD_BLKPER
+#define RAMMTD_BLKPER (CONFIG_RAMMTD_ERASESIZE/CONFIG_RAMMTD_BLOCKSIZE)
-#if CONFIG_RAMMTD_BLKPER*CONFIG_RAMMTD_BLOCKSIZE != CONFIG_RAMMTD_ERASESIZE
+#if RAMMTD_BLKPER*CONFIG_RAMMTD_BLOCKSIZE != CONFIG_RAMMTD_ERASESIZE
# error "CONFIG_RAMMTD_ERASESIZE must be an even multiple of CONFIG_RAMMTD_BLOCKSIZE"
#endif
@@ -208,8 +208,8 @@ static int ram_erase(FAR struct mtd_dev_s *dev, off_t startblock, size_t nblocks
* in logical block numbers
*/
- startblock *= CONFIG_RAMMTD_BLKPER;
- nblocks *= CONFIG_RAMMTD_BLKPER;
+ startblock *= RAMMTD_BLKPER;
+ nblocks *= RAMMTD_BLKPER;
/* Get the offset corresponding to the first block and the size
* corresponding to the number of blocks.
@@ -240,7 +240,7 @@ static ssize_t ram_bread(FAR struct mtd_dev_s *dev, off_t startblock, size_t nbl
/* Don't let the read exceed the size of the ram buffer */
- maxblock = priv->nblocks * CONFIG_RAMMTD_BLKPER;
+ maxblock = priv->nblocks * RAMMTD_BLKPER;
if (startblock >= maxblock)
{
return 0;
@@ -280,7 +280,7 @@ static ssize_t ram_bwrite(FAR struct mtd_dev_s *dev, off_t startblock,
/* Don't let the write exceed the size of the ram buffer */
- maxblock = priv->nblocks * CONFIG_RAMMTD_BLKPER;
+ maxblock = priv->nblocks * RAMMTD_BLKPER;
if (startblock >= maxblock)
{
return 0;
diff --git a/nuttx/fs/nxffs/Kconfig b/nuttx/fs/nxffs/Kconfig
index 9f4ef8231..b9ef3b276 100644
--- a/nuttx/fs/nxffs/Kconfig
+++ b/nuttx/fs/nxffs/Kconfig
@@ -11,6 +11,14 @@ config FS_NXFFS
Enable NuttX FLASH file system (NXFF) support.
if FS_NXFFS
+
+config NXFFS_PREALLOCATED
+ bool "Single, preallocated volume"
+ default n
+ ---help---
+ If CONFIG_NXFSS_PREALLOCATED is defined, then this is the single, pre-
+ allocated NXFFS volume instance.
+
config NXFFS_ERASEDSTATE
hex "FLASH erased state"
default 0xff
diff --git a/nuttx/fs/nxffs/nxffs.h b/nuttx/fs/nxffs/nxffs.h
index 083e00fa7..80e34939c 100644
--- a/nuttx/fs/nxffs/nxffs.h
+++ b/nuttx/fs/nxffs/nxffs.h
@@ -334,11 +334,11 @@ extern const uint8_t g_inodemagic[NXFFS_MAGICSIZE];
extern const uint8_t g_datamagic[NXFFS_MAGICSIZE];
-/* If CONFIG_NXFSS_PREALLOCATED is defined, then this is the single, pre-
+/* If CONFIG_NXFFS_PREALLOCATED is defined, then this is the single, pre-
* allocated NXFFS volume instance.
*/
-#ifdef CONFIG_NXFSS_PREALLOCATED
+#ifdef CONFIG_NXFFS_PREALLOCATED
extern struct nxffs_volume_s g_volume;
#endif
diff --git a/nuttx/fs/nxffs/nxffs_initialize.c b/nuttx/fs/nxffs/nxffs_initialize.c
index 4e7428c73..65b39d19c 100644
--- a/nuttx/fs/nxffs/nxffs_initialize.c
+++ b/nuttx/fs/nxffs/nxffs_initialize.c
@@ -122,11 +122,11 @@ const uint8_t g_inodemagic[NXFFS_MAGICSIZE] = { 'I', 'n', 'o', 'd' };
const uint8_t g_datamagic[NXFFS_MAGICSIZE] = { 'D', 'a', 't', 'a' };
-/* If CONFIG_NXFSS_PREALLOCATED is defined, then this is the single, pre-
+/* If CONFIG_NXFFS_PREALLOCATED is defined, then this is the single, pre-
* allocated NXFFS volume instance.
*/
-#ifdef CONFIG_NXFSS_PREALLOCATED
+#ifdef CONFIG_NXFFS_PREALLOCATED
struct nxffs_volume_s g_volume;
#endif
@@ -160,11 +160,11 @@ int nxffs_initialize(FAR struct mtd_dev_s *mtd)
off_t threshold;
int ret;
- /* If CONFIG_NXFSS_PREALLOCATED is defined, then this is the single, pre-
+ /* If CONFIG_NXFFS_PREALLOCATED is defined, then this is the single, pre-
* allocated NXFFS volume instance.
*/
-#ifdef CONFIG_NXFSS_PREALLOCATED
+#ifdef CONFIG_NXFFS_PREALLOCATED
volume = &g_volume;
memset(volume, 0, sizeof(struct nxffs_volume_s));
@@ -282,7 +282,7 @@ errout_with_buffer:
errout_with_cache:
kfree(volume->cache);
errout_with_volume:
-#ifndef CONFIG_NXFSS_PREALLOCATED
+#ifndef CONFIG_NXFFS_PREALLOCATED
kfree(volume);
#endif
return ret;
@@ -490,11 +490,11 @@ int nxffs_limits(FAR struct nxffs_volume_s *volume)
int nxffs_bind(FAR struct inode *blkdriver, FAR const void *data,
FAR void **handle)
{
-#ifndef CONFIG_NXFSS_PREALLOCATED
+#ifndef CONFIG_NXFFS_PREALLOCATED
# error "No design to support dynamic allocation of volumes"
#else
- /* If CONFIG_NXFSS_PREALLOCATED is defined, then this is the single, pre-
+ /* If CONFIG_NXFFS_PREALLOCATED is defined, then this is the single, pre-
* allocated NXFFS volume instance.
*/
@@ -514,7 +514,7 @@ int nxffs_bind(FAR struct inode *blkdriver, FAR const void *data,
int nxffs_unbind(FAR void *handle, FAR struct inode **blkdriver)
{
-#ifndef CONFIG_NXFSS_PREALLOCATED
+#ifndef CONFIG_NXFFS_PREALLOCATED
# error "No design to support dynamic allocation of volumes"
#else
return g_volume.ofiles ? -EBUSY : OK;
diff --git a/nuttx/fs/nxffs/nxffs_open.c b/nuttx/fs/nxffs/nxffs_open.c
index 9fa4ef2e0..4d8f62c84 100644
--- a/nuttx/fs/nxffs/nxffs_open.c
+++ b/nuttx/fs/nxffs/nxffs_open.c
@@ -71,7 +71,7 @@
* to pre-allocate the write state structure.
*/
-#ifdef CONFIG_NXFSS_PREALLOCATED
+#ifdef CONFIG_NXFFS_PREALLOCATED
static struct nxffs_wrfile_s g_wrfile;
#endif
@@ -503,7 +503,7 @@ static inline int nxffs_wropen(FAR struct nxffs_volume_s *volume,
* that includes additional information to support the write operation.
*/
-#ifdef CONFIG_NXFSS_PREALLOCATED
+#ifdef CONFIG_NXFFS_PREALLOCATED
wrfile = &g_wrfile;
memset(wrfile, 0, sizeof(struct nxffs_wrfile_s));
#else
@@ -673,7 +673,7 @@ static inline int nxffs_wropen(FAR struct nxffs_volume_s *volume,
errout_with_name:
kfree(wrfile->ofile.entry.name);
errout_with_ofile:
-#ifndef CONFIG_NXFSS_PREALLOCATED
+#ifndef CONFIG_NXFFS_PREALLOCATED
kfree(wrfile);
#endif
@@ -845,7 +845,7 @@ static inline void nxffs_freeofile(FAR struct nxffs_volume_s *volume,
* write-only open file container)
*/
-#ifdef CONFIG_NXFSS_PREALLOCATED
+#ifdef CONFIG_NXFFS_PREALLOCATED
if ((FAR struct nxffs_wrfile_s*)ofile != &g_wrfile)
#endif
{
@@ -983,7 +983,7 @@ FAR struct nxffs_wrfile_s *nxffs_findwriter(FAR struct nxffs_volume_s *volume)
* name attached.
*/
-#ifdef CONFIG_NXFSS_PREALLOCATED
+#ifdef CONFIG_NXFFS_PREALLOCATED
return g_wrfile.ofile.entry.name != NULL ? &g_wrfile : NULL;
#else
# error "Missing implementation"
diff --git a/nuttx/libc/Kconfig b/nuttx/libc/Kconfig
index a549ced45..09c332725 100644
--- a/nuttx/libc/Kconfig
+++ b/nuttx/libc/Kconfig
@@ -48,6 +48,14 @@ config LIBC_FLOATINGPOINT
By default, floating point
support in printf, sscanf, etc. is disabled.
+config LIB_RAND_ORDER
+ int "Order of the random number generate"
+ default 1
+ range 1 3
+ ---help---
+ The order of the random number generator. 1=fast but very bad random
+ numbers, 3=slow but very good random numbers.
+
choice
prompt "Newline Options"
default EOL_IS_EITHER_CRLF
diff --git a/nuttx/libc/spawn/lib_psa_init.c b/nuttx/libc/spawn/lib_psa_init.c
index c016cc6cd..c70421f36 100644
--- a/nuttx/libc/spawn/lib_psa_init.c
+++ b/nuttx/libc/spawn/lib_psa_init.c
@@ -98,9 +98,11 @@ int posix_spawnattr_init(posix_spawnattr_t *attr)
attr->policy = sched_getscheduler(0);
+#ifndef CONFIG_DISABLE_SIGNALS
/* Empty signal masek */
attr->sigmask = 0;
+#endif
/* Default stack size */