This is an automated email from the ASF dual-hosted git repository.
aguettouche pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new e30a5f3 arch/sim: Add new option to enable arch specific hostfs
e30a5f3 is described below
commit e30a5f3790dbf7bce34783304d7e38840b7e2c7c
Author: Xiang Xiao <[email protected]>
AuthorDate: Wed Nov 24 22:23:14 2021 +0800
arch/sim: Add new option to enable arch specific hostfs
we have many different hostfs implementation now, so it's better
to select the implementation explicitly, just like what we have
done for arm(FS_HOSTFS vs. ARM_SEMIHOSTING_HOSTFS).
Signed-off-by: Xiang Xiao <[email protected]>
---
arch/sim/Kconfig | 6 ++++++
arch/sim/src/Makefile | 4 +---
arch/xtensa/Kconfig | 13 +++++++++++--
arch/xtensa/src/common/xtensa_hostfs.c | 6 +++---
arch/xtensa/src/esp32/Make.defs | 2 +-
arch/xtensa/src/esp32s2/Make.defs | 2 +-
boards/sim/sim/sim/configs/alsa/defconfig | 1 +
boards/sim/sim/sim/configs/libcxxtest/defconfig | 1 +
boards/sim/sim/sim/configs/loadable/defconfig | 1 +
boards/sim/sim/sim/configs/rpserver/defconfig | 1 +
boards/sim/sim/sim/configs/tcpblaster/defconfig | 1 +
boards/sim/sim/sim/configs/vpnkit/defconfig | 1 +
12 files changed, 29 insertions(+), 10 deletions(-)
diff --git a/arch/sim/Kconfig b/arch/sim/Kconfig
index 455abd4..74fbba8 100644
--- a/arch/sim/Kconfig
+++ b/arch/sim/Kconfig
@@ -134,6 +134,12 @@ config SIM_WALLTIME_SIGNAL
endchoice
+config SIM_HOSTFS
+ bool "Simulated HostFS"
+ depends on FS_HOSTFS
+ ---help---
+ Access host filesystem through HostFS.
+
choice
prompt "Simulated Network Interface"
default SIM_NETDEV
diff --git a/arch/sim/src/Makefile b/arch/sim/src/Makefile
index a549a50..227106f 100644
--- a/arch/sim/src/Makefile
+++ b/arch/sim/src/Makefile
@@ -207,8 +207,7 @@ ifeq ($(CONFIG_SIM_SOUND_ALSA),y)
STDLIBS += -lasound
endif
-ifeq ($(CONFIG_FS_HOSTFS),y)
-ifneq ($(CONFIG_FS_HOSTFS_RPMSG),y)
+ifeq ($(CONFIG_SIM_HOSTFS),y)
HOSTSRCS += up_hostfs.c
hostfs.h: $(TOPDIR)/include/nuttx/fs/hostfs.h
@@ -217,7 +216,6 @@ hostfs.h: $(TOPDIR)/include/nuttx/fs/hostfs.h
up_hostfs.c: hostfs.h
endif
-endif
COBJS = $(CSRCS:.c=$(OBJEXT))
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index 83268aa..3c5caea 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -220,9 +220,18 @@ config XTENSA_EXTMEM_BSS
Adds a section and an attribute that allows to force variables
into
the external memory.
-if CONFIG_FS_HOSTFS
+config XTENSA_SEMIHOSTING_HOSTFS
+ bool "Semihosting HostFS"
+ depends on FS_HOSTFS
+ ---help---
+ Mount HostFS through semihosting.
+
+ This doesn't support some directory operations like readdir
because
+ of the limitations of semihosting mechanism.
+
+if XTENSA_SEMIHOSTING_HOSTFS
-config XTENSA_HOSTFS_CACHE_COHERENCE
+config XTENSA_SEMIHOSTING_HOSTFS_CACHE_COHERENCE
bool "Cache coherence in semihosting hostfs"
depends on ARCH_DCACHE
---help---
diff --git a/arch/xtensa/src/common/xtensa_hostfs.c
b/arch/xtensa/src/common/xtensa_hostfs.c
index 20e62df..39fce29 100644
--- a/arch/xtensa/src/common/xtensa_hostfs.c
+++ b/arch/xtensa/src/common/xtensa_hostfs.c
@@ -97,7 +97,7 @@ int host_open(const char *pathname, int flags, int mode)
simcall_flags |= SIMCALL_O_EXCL;
}
-#ifdef CONFIG_XTENSA_HOSTFS_CACHE_COHERENCE
+#ifdef CONFIG_XTENSA_SEMIHOSTING_HOSTFS_CACHE_COHERENCE
up_clean_dcache(pathname, pathname + strlen(pathname) + 1);
#endif
return host_call(SIMCALL_SYS_OPEN, (int)pathname, simcall_flags, mode);
@@ -110,7 +110,7 @@ int host_close(int fd)
ssize_t host_read(int fd, void *buf, size_t count)
{
-#ifdef CONFIG_XTENSA_HOSTFS_CACHE_COHERENCE
+#ifdef CONFIG_XTENSA_SEMIHOSTING_HOSTFS_CACHE_COHERENCE
up_invalidate_dcache(buf, buf + count);
#endif
@@ -119,7 +119,7 @@ ssize_t host_read(int fd, void *buf, size_t count)
ssize_t host_write(int fd, const void *buf, size_t count)
{
-#ifdef CONFIG_XTENSA_HOSTFS_CACHE_COHERENCE
+#ifdef CONFIG_XTENSA_SEMIHOSTING_HOSTFS_CACHE_COHERENCE
up_clean_dcache(buf, buf + count);
#endif
diff --git a/arch/xtensa/src/esp32/Make.defs b/arch/xtensa/src/esp32/Make.defs
index e8f901b..d2a923c 100644
--- a/arch/xtensa/src/esp32/Make.defs
+++ b/arch/xtensa/src/esp32/Make.defs
@@ -64,7 +64,7 @@ ifeq ($(CONFIG_STACK_COLORATION),y)
CMN_CSRCS += xtensa_checkstack.c
endif
-ifeq ($(CONFIG_FS_HOSTFS),y)
+ifeq ($(CONFIG_XTENSA_SEMIHOSTING_HOSTFS),y)
CMN_ASRCS += xtensa_simcall.S
CMN_CSRCS += xtensa_hostfs.c
endif
diff --git a/arch/xtensa/src/esp32s2/Make.defs
b/arch/xtensa/src/esp32s2/Make.defs
index 3fde1cb..496a061 100644
--- a/arch/xtensa/src/esp32s2/Make.defs
+++ b/arch/xtensa/src/esp32s2/Make.defs
@@ -55,7 +55,7 @@ ifeq ($(CONFIG_STACK_COLORATION),y)
CMN_CSRCS += xtensa_checkstack.c
endif
-ifeq ($(CONFIG_FS_HOSTFS),y)
+ifeq ($(CONFIG_XTENSA_SEMIHOSTING_HOSTFS),y)
CMN_ASRCS += xtensa_simcall.S
CMN_CSRCS += xtensa_hostfs.c
endif
diff --git a/boards/sim/sim/sim/configs/alsa/defconfig
b/boards/sim/sim/sim/configs/alsa/defconfig
index b0d1880..c69a6b8 100644
--- a/boards/sim/sim/sim/configs/alsa/defconfig
+++ b/boards/sim/sim/sim/configs/alsa/defconfig
@@ -48,6 +48,7 @@ CONFIG_SCHED_HAVE_PARENT=y
CONFIG_SCHED_ONEXIT=y
CONFIG_SCHED_WAITPID=y
CONFIG_SDCLONE_DISABLE=y
+CONFIG_SIM_HOSTFS=y
CONFIG_START_MONTH=6
CONFIG_START_YEAR=2008
CONFIG_SYSTEM_NSH=y
diff --git a/boards/sim/sim/sim/configs/libcxxtest/defconfig
b/boards/sim/sim/sim/configs/libcxxtest/defconfig
index b5954e7..f5501e9 100644
--- a/boards/sim/sim/sim/configs/libcxxtest/defconfig
+++ b/boards/sim/sim/sim/configs/libcxxtest/defconfig
@@ -86,6 +86,7 @@ CONFIG_SCHED_HAVE_PARENT=y
CONFIG_SCHED_ONEXIT=y
CONFIG_SCHED_WAITPID=y
CONFIG_SDCLONE_DISABLE=y
+CONFIG_SIM_HOSTFS=y
CONFIG_SIM_NETDEV=y
CONFIG_START_MONTH=6
CONFIG_START_YEAR=2008
diff --git a/boards/sim/sim/sim/configs/loadable/defconfig
b/boards/sim/sim/sim/configs/loadable/defconfig
index ac4acc8..aa91b15 100644
--- a/boards/sim/sim/sim/configs/loadable/defconfig
+++ b/boards/sim/sim/sim/configs/loadable/defconfig
@@ -44,6 +44,7 @@ CONFIG_SCHED_HAVE_PARENT=y
CONFIG_SCHED_ONEXIT=y
CONFIG_SCHED_WAITPID=y
CONFIG_SDCLONE_DISABLE=y
+CONFIG_SIM_HOSTFS=y
CONFIG_SIM_M32=y
CONFIG_START_MONTH=6
CONFIG_START_YEAR=2008
diff --git a/boards/sim/sim/sim/configs/rpserver/defconfig
b/boards/sim/sim/sim/configs/rpserver/defconfig
index bf6c33e..d00884e 100644
--- a/boards/sim/sim/sim/configs/rpserver/defconfig
+++ b/boards/sim/sim/sim/configs/rpserver/defconfig
@@ -62,6 +62,7 @@ CONFIG_SCHED_HAVE_PARENT=y
CONFIG_SCHED_HPWORK=y
CONFIG_SCHED_WAITPID=y
CONFIG_SIG_DEFAULT=y
+CONFIG_SIM_HOSTFS=y
CONFIG_SIM_M32=y
CONFIG_SIM_NETDEV=y
CONFIG_SIM_NET_BRIDGE=y
diff --git a/boards/sim/sim/sim/configs/tcpblaster/defconfig
b/boards/sim/sim/sim/configs/tcpblaster/defconfig
index 6ace500..edb2275 100644
--- a/boards/sim/sim/sim/configs/tcpblaster/defconfig
+++ b/boards/sim/sim/sim/configs/tcpblaster/defconfig
@@ -100,6 +100,7 @@ CONFIG_SCHED_ONEXIT=y
CONFIG_SERIAL_TERMIOS=y
CONFIG_SIG_DEFAULT=y
CONFIG_SIG_EVTHREAD=y
+CONFIG_SIM_HOSTFS=y
CONFIG_STACK_COLORATION=y
CONFIG_SYSLOG_BUFFER=y
CONFIG_SYSLOG_CONSOLE=y
diff --git a/boards/sim/sim/sim/configs/vpnkit/defconfig
b/boards/sim/sim/sim/configs/vpnkit/defconfig
index d82b8ab..d844908 100644
--- a/boards/sim/sim/sim/configs/vpnkit/defconfig
+++ b/boards/sim/sim/sim/configs/vpnkit/defconfig
@@ -81,6 +81,7 @@ CONFIG_SCHED_HAVE_PARENT=y
CONFIG_SCHED_ONEXIT=y
CONFIG_SCHED_WAITPID=y
CONFIG_SDCLONE_DISABLE=y
+CONFIG_SIM_HOSTFS=y
CONFIG_SIM_NETDEV=y
CONFIG_SIM_NETDEV_VPNKIT=y
CONFIG_START_MONTH=6