diff --git a/arch/sim/Kconfig b/arch/sim/Kconfig index 455abd4de3b..74fbba8574c 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 a549a500858..227106fcfb2 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 83268aa9877..3c5caeae543 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. -config XTENSA_HOSTFS_CACHE_COHERENCE + This doesn't support some directory operations like readdir because + of the limitations of semihosting mechanism. + +if XTENSA_SEMIHOSTING_HOSTFS + +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 20e62df51f6..39fce29aa74 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 e8f901b6651..d2a923c98eb 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 3fde1cbf27c..496a06163d0 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 b0d1880f39a..c69a6b81312 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 b5954e7a7a8..f5501e900bd 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 ac4acc84868..aa91b15cb0e 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 bf6c33e43a5..d00884e187b 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 6ace500bc86..edb227541a5 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 d82b8abfe85..d84490854b0 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