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 <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2021-11-24 22:23:14 +08:00 committed by Abdelatif Guettouche
parent 624b8d0776
commit e30a5f3790
12 changed files with 29 additions and 10 deletions

View File

@ -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

View File

@ -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))

View File

@ -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---

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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