From 4ea65829e1902e96edba9783f02ecd1bf60d1244 Mon Sep 17 00:00:00 2001 From: Marco Casaroli Date: Sat, 25 Jul 2026 13:08:08 +0200 Subject: [PATCH] boards/sim: Add a xipfs configuration. rammtd answers BIOC_XIPBASE with the base of its RAM buffer, so it is a usable stand-in for memory mapped NOR: extents are directly addressable and the in-place mmap path can be exercised end to end without any flash. Mount xipfs on it when it is the configured file system, and add a configuration that runs the xipfs test suite, fault injection included. Assisted-by: Claude Code:claude-opus-5 Signed-off-by: Marco Casaroli --- boards/sim/sim/sim/configs/xipfs/defconfig | 33 ++++++++++++++++++++++ boards/sim/sim/sim/src/sim_bringup.c | 16 +++++++++++ 2 files changed, 49 insertions(+) create mode 100644 boards/sim/sim/sim/configs/xipfs/defconfig diff --git a/boards/sim/sim/sim/configs/xipfs/defconfig b/boards/sim/sim/sim/configs/xipfs/defconfig new file mode 100644 index 00000000000..53c3eb01192 --- /dev/null +++ b/boards/sim/sim/sim/configs/xipfs/defconfig @@ -0,0 +1,33 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +CONFIG_ARCH="sim" +CONFIG_ARCH_BOARD="sim" +CONFIG_ARCH_BOARD_SIM=y +CONFIG_ARCH_CHIP="sim" +CONFIG_ARCH_SIM=y +CONFIG_BOARDCTL_POWEROFF=y +CONFIG_BOARD_LOOPSPERMSEC=0 +CONFIG_BUILTIN=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_FS_PROCFS=y +CONFIG_FS_XIPFS=y +CONFIG_FS_XIPFS_FAULT_INJECT=y +CONFIG_IDLETHREAD_STACKSIZE=8192 +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_LIBC_STRERROR=y +CONFIG_MTD=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_READLINE=y +CONFIG_RAMMTD=y +CONFIG_RAMMTD_FLASHSIM=y +CONFIG_SCHED_WAITPID=y +CONFIG_START_MONTH=6 +CONFIG_START_YEAR=2008 +CONFIG_SYSTEM_NSH=y +CONFIG_SYSTEM_XIPFS=y +CONFIG_TESTING_FS_XIPFS=y diff --git a/boards/sim/sim/sim/src/sim_bringup.c b/boards/sim/sim/sim/src/sim_bringup.c index c839d223332..3064b1e1a39 100644 --- a/boards/sim/sim/sim/src/sim_bringup.c +++ b/boards/sim/sim/sim/src/sim_bringup.c @@ -212,6 +212,22 @@ int sim_bringup(void) smart_initialize(0, mtd, NULL); +#elif defined(CONFIG_FS_XIPFS) + /* Mount the XIPFS file system. rammtd answers BIOC_XIPBASE with + * the base of its RAM buffer, which makes it a usable stand-in + * for memory mapped NOR: extents are directly addressable, so + * the XIP mmap path can be exercised end to end. + */ + + ret = nx_mount("/dev/rammtd", "/mnt/xipfs", "xipfs", 0, + "autoformat"); + if (ret < 0) + { + syslog(LOG_ERR, + "ERROR: Failed to mount XIPFS at /mnt/xipfs: %d\n", + ret); + } + #elif defined(CONFIG_FS_SPIFFS) /* Mount the SPIFFS file system */