Skip to content

Commit

Permalink
boards/sim: Defconfigs for nand and mnemofs
Browse files Browse the repository at this point in the history
Adds nand and mnemofs sim configs.

Signed-off-by: Saurav Pal <[email protected]>
  • Loading branch information
resyfer authored and Jan Medek committed Sep 19, 2024
1 parent 9adfcc9 commit 80b8ed8
Show file tree
Hide file tree
Showing 14 changed files with 254 additions and 108 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,7 @@ tools/gdb/__pycache__
/build
.ccls-cache
compile_commands.json
imx9-sdimage.img
imx9-sdimage.img
kwarning
SAVEMake.defs
SAVEconfig
39 changes: 15 additions & 24 deletions boards/sim/sim/sim/configs/linuxspi/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,25 @@
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
CONFIG_ARCH="sim"
CONFIG_ARCH_BOARD="sim"
CONFIG_ARCH_BOARD_SIM=y
CONFIG_ARCH_CHIP="sim"
CONFIG_ARCH_SIM=y
CONFIG_BOARDCTL_APP_SYMTAB=y
CONFIG_BOARDCTL_POWEROFF=y
CONFIG_BOARDCTL_ROMDISK=y
CONFIG_BOARD_LOOPSPERMSEC=0
CONFIG_BOOT_RUNFROMEXTSRAM=y
CONFIG_BUILTIN=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DEV_ZERO=y
CONFIG_EXAMPLES_HELLO=y
CONFIG_FS_PROCFS=y
CONFIG_DISABLE_MQUEUE=y
CONFIG_DISABLE_POSIX_TIMERS=y
CONFIG_DISABLE_PTHREAD=y
CONFIG_FS_FAT=y
CONFIG_FS_NXFFS=y
CONFIG_IDLETHREAD_STACKSIZE=4096
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIBC_MAX_EXITFUNS=1
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_READLINE=y
CONFIG_READLINE_TABCOMPLETION=y
CONFIG_SCHED_HAVE_PARENT=y
CONFIG_SCHED_WAITPID=y
CONFIG_SIM_SPI=y
CONFIG_START_MONTH=6
CONFIG_START_YEAR=2008
CONFIG_SYSTEM_NSH=y
CONFIG_SYSTEM_SPITOOL=y
CONFIG_INIT_ENTRYPOINT="nxffs_main"
CONFIG_LIBC_RAND_ORDER=3
CONFIG_MTD=y
CONFIG_NXFFS_SCAN_VOLUME=y
CONFIG_RAMMTD=y
CONFIG_RAMMTD_FLASHSIM=y
CONFIG_START_DAY=29
CONFIG_START_MONTH=4
CONFIG_START_YEAR=2011
CONFIG_TESTING_NXFFS=y
80 changes: 80 additions & 0 deletions boards/sim/sim/sim/configs/mnemofs/defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#
# 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_NSH_CMDOPT_HEXDUMP is not set
CONFIG_ALLOW_BSD_COMPONENTS=y
CONFIG_ARCH="sim"
CONFIG_ARCH_BOARD="sim"
CONFIG_ARCH_BOARD_SIM=y
CONFIG_ARCH_CHIP="sim"
CONFIG_ARCH_SIM=y
CONFIG_BOARDCTL_APP_SYMTAB=y
CONFIG_BOARDCTL_POWEROFF=y
CONFIG_BOARD_LOOPSPERMSEC=0
CONFIG_BOOT_RUNFROMEXTSRAM=y
CONFIG_BUILTIN=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DEV_GPIO=y
CONFIG_DEV_LOOP=y
CONFIG_DEV_ZERO=y
CONFIG_ETC_FATDEVNO=2
CONFIG_ETC_ROMFS=y
CONFIG_ETC_ROMFSDEVNO=1
CONFIG_EXAMPLES_GPIO=y
CONFIG_EXAMPLES_HELLO=y
CONFIG_FAT_LCNAMES=y
CONFIG_FAT_LFN=y
CONFIG_FRAME_POINTER=y
CONFIG_FSUTILS_PASSWD=y
CONFIG_FSUTILS_PASSWD_READONLY=y
CONFIG_FS_BINFS=y
CONFIG_FS_FAT=y
CONFIG_FS_MNEMOFS=y
CONFIG_FS_PROCFS=y
CONFIG_FS_RAMMAP=y
CONFIG_FS_ROMFS=y
CONFIG_GPIO_LOWER_HALF=y
CONFIG_IDLETHREAD_STACKSIZE=4096
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_IOEXPANDER=y
CONFIG_IOEXPANDER_DUMMY=y
CONFIG_LIBC_ENVPATH=y
CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIBC_LOCALE=y
CONFIG_LIBC_LOCALE_CATALOG=y
CONFIG_LIBC_LOCALE_GETTEXT=y
CONFIG_LIBC_MAX_EXITFUNS=1
CONFIG_LIBC_NUMBERED_ARGS=y
CONFIG_MM_CUSTOMIZE_MANAGER=y
CONFIG_MTD=y
CONFIG_MTD_NAND=y
CONFIG_MTD_NAND_RAM=y
CONFIG_MTD_NAND_RAM_DEBUG=y
CONFIG_MTD_NAND_RAM_STATUS=5
CONFIG_MTD_NAND_WRAPPER=y
CONFIG_MTD_NAND_WRAPPER_DEBUG_LEVEL=3
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_CONSOLE_LOGIN=y
CONFIG_NSH_FILE_APPS=y
CONFIG_NSH_MOTD=y
CONFIG_NSH_MOTD_STRING="MOTD: username=admin password=Administrator"
CONFIG_NSH_READLINE=y
CONFIG_PATH_INITIAL="/bin"
CONFIG_PSEUDOFS_ATTRIBUTES=y
CONFIG_PSEUDOFS_SOFTLINKS=y
CONFIG_READLINE_TABCOMPLETION=y
CONFIG_SCHED_BACKTRACE=y
CONFIG_SCHED_HAVE_PARENT=y
CONFIG_SCHED_WAITPID=y
CONFIG_SIM_ASAN=y
CONFIG_SIM_WALLTIME_SIGNAL=y
CONFIG_START_MONTH=6
CONFIG_START_YEAR=2008
CONFIG_SYSTEM_DUMPSTACK=y
CONFIG_SYSTEM_NSH=y
CONFIG_TESTING_NAND_SIM=y
79 changes: 79 additions & 0 deletions boards/sim/sim/sim/configs/nand/defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#
# 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_NSH_CMDOPT_HEXDUMP is not set
CONFIG_ALLOW_BSD_COMPONENTS=y
CONFIG_ARCH="sim"
CONFIG_ARCH_BOARD="sim"
CONFIG_ARCH_BOARD_SIM=y
CONFIG_ARCH_CHIP="sim"
CONFIG_ARCH_SIM=y
CONFIG_BOARDCTL_APP_SYMTAB=y
CONFIG_BOARDCTL_POWEROFF=y
CONFIG_BOARD_LOOPSPERMSEC=0
CONFIG_BOOT_RUNFROMEXTSRAM=y
CONFIG_BUILTIN=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DEV_GPIO=y
CONFIG_DEV_LOOP=y
CONFIG_DEV_ZERO=y
CONFIG_ETC_FATDEVNO=2
CONFIG_ETC_ROMFS=y
CONFIG_ETC_ROMFSDEVNO=1
CONFIG_EXAMPLES_GPIO=y
CONFIG_EXAMPLES_HELLO=y
CONFIG_FAT_LCNAMES=y
CONFIG_FAT_LFN=y
CONFIG_FRAME_POINTER=y
CONFIG_FSUTILS_PASSWD=y
CONFIG_FSUTILS_PASSWD_READONLY=y
CONFIG_FS_BINFS=y
CONFIG_FS_FAT=y
CONFIG_FS_PROCFS=y
CONFIG_FS_RAMMAP=y
CONFIG_FS_ROMFS=y
CONFIG_GPIO_LOWER_HALF=y
CONFIG_IDLETHREAD_STACKSIZE=4096
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_IOEXPANDER=y
CONFIG_IOEXPANDER_DUMMY=y
CONFIG_LIBC_ENVPATH=y
CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIBC_LOCALE=y
CONFIG_LIBC_LOCALE_CATALOG=y
CONFIG_LIBC_LOCALE_GETTEXT=y
CONFIG_LIBC_MAX_EXITFUNS=1
CONFIG_LIBC_NUMBERED_ARGS=y
CONFIG_MM_CUSTOMIZE_MANAGER=y
CONFIG_MTD=y
CONFIG_MTD_NAND=y
CONFIG_MTD_NAND_RAM=y
CONFIG_MTD_NAND_RAM_DEBUG=y
CONFIG_MTD_NAND_RAM_STATUS=5
CONFIG_MTD_NAND_WRAPPER=y
CONFIG_MTD_NAND_WRAPPER_DEBUG_LEVEL=3
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_CONSOLE_LOGIN=y
CONFIG_NSH_FILE_APPS=y
CONFIG_NSH_MOTD=y
CONFIG_NSH_MOTD_STRING="MOTD: username=admin password=Administrator"
CONFIG_NSH_READLINE=y
CONFIG_PATH_INITIAL="/bin"
CONFIG_PSEUDOFS_ATTRIBUTES=y
CONFIG_PSEUDOFS_SOFTLINKS=y
CONFIG_READLINE_TABCOMPLETION=y
CONFIG_SCHED_BACKTRACE=y
CONFIG_SCHED_HAVE_PARENT=y
CONFIG_SCHED_WAITPID=y
CONFIG_SIM_ASAN=y
CONFIG_SIM_WALLTIME_SIGNAL=y
CONFIG_START_MONTH=6
CONFIG_START_YEAR=2008
CONFIG_SYSTEM_DUMPSTACK=y
CONFIG_SYSTEM_NSH=y
CONFIG_TESTING_NAND_SIM=y
3 changes: 2 additions & 1 deletion drivers/mtd/mtd_nand.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@

static int nand_markblock(FAR struct nand_dev_s *nand, off_t block);
static int nand_checkblock(FAR struct nand_dev_s *nand, off_t block);
#ifdef CONFIG_MTD_NAND_BLOCKCHECK
#if defined(CONFIG_MTD_NAND_BLOCKCHECK) && defined(CONFIG_DEBUG_INFO) && \
defined(CONFIG_DEBUG_FS)
static int nand_devscan(FAR struct nand_dev_s *nand);
#endif

Expand Down
26 changes: 14 additions & 12 deletions drivers/mtd/mtd_nandram.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ static void nand_ram_storage_status(void)
bad = (nand_ram_flash_spare[i].bad != NAND_RAM_BLOCK_GOOD);

NAND_RAM_STATUS_LOG(
"Block %3d, Page %6d, Bad: %1d |"
" Reads: %6d, Writes: %6d, Erases: %6d\n",
"Block %3" PRIi32 ", Page %6" PRIi32 ", Bad: %1" PRIi32 " |"
" Reads: %6" PRIi32 ", Writes: %6" PRIi32 ", Erases: %6" PRIi32 "\n",
i >> NAND_RAM_LOG_PAGES_PER_BLOCK, i, bad,
reads, writes, erases);
}
Expand Down Expand Up @@ -289,9 +289,9 @@ int nand_ram_eraseblock(FAR struct nand_raw_s *raw, off_t block)
nand_ram_ins_i++;

NAND_RAM_LOG(
"[LOWER %lu | %s] Block %d, Start Page: %d, Last Page: %d",
nand_ram_ins_i, "eraseblock", block, start_page, end_page - 1
);
"[LOWER %" PRIu64 " | %s] Block %" PRIi32 ", Start Page: %" PRIi32
", Last Page: %" PRIi32, nand_ram_ins_i, "eraseblock", block, start_page,
end_page - 1);
nand_ram_status();

/* [start_page, end_page) is cleared (all bits are set) */
Expand All @@ -304,7 +304,8 @@ int nand_ram_eraseblock(FAR struct nand_raw_s *raw, off_t block)
nand_ram_flash_spare[i].free = NAND_RAM_PAGE_FREE;
}

NAND_RAM_LOG("[LOWER %lu | %s] Done\n", nand_ram_ins_i, "eraseblock");
NAND_RAM_LOG("[LOWER %" PRIu64 " | %s] Done\n", nand_ram_ins_i,
"eraseblock");

nxmutex_unlock(&nand_ram_dev_mut);

Expand Down Expand Up @@ -345,14 +346,14 @@ int nand_ram_rawread(FAR struct nand_raw_s *raw, off_t block,
nxmutex_lock(&nand_ram_dev_mut);
nand_ram_ins_i++;

NAND_RAM_LOG("[LOWER %lu | %s] Page %d\n",
NAND_RAM_LOG("[LOWER %" PRIu64 " | %s] Page %" PRIi32 "\n",
nand_ram_ins_i, "rawread", read_page);
nand_ram_status();

if (nand_ram_flash_spare[read_page].bad != NAND_RAM_BLOCK_GOOD)
{
ret = -EFAULT;
NAND_RAM_LOG("[LOWER %lu | %s] Failed: %s\n",
NAND_RAM_LOG("[LOWER %" PRIu64 " | %s] Failed: %s\n",
nand_ram_ins_i, "rawread", EFAULT_STR);
goto errout;
}
Expand All @@ -377,7 +378,7 @@ int nand_ram_rawread(FAR struct nand_raw_s *raw, off_t block,
memcpy(spare, (const void *)read_page_spare, NAND_RAM_SPARE_SIZE);
}

NAND_RAM_LOG("[LOWER %lu | %s] Done\n", nand_ram_ins_i, "rawread");
NAND_RAM_LOG("[LOWER %" PRIu64 " | %s] Done\n", nand_ram_ins_i, "rawread");

errout:
nxmutex_unlock(&nand_ram_dev_mut);
Expand Down Expand Up @@ -421,14 +422,14 @@ int nand_ram_rawwrite(FAR struct nand_raw_s *raw, off_t block,
nxmutex_lock(&nand_ram_dev_mut);
nand_ram_ins_i++;

NAND_RAM_LOG("[LOWER %lu | %s] Page %d\n",
NAND_RAM_LOG("[LOWER %" PRIu64 " | %s] Page %" PRIi32 "\n",
nand_ram_ins_i, "rawwrite", write_page);
nand_ram_status();

if (nand_ram_flash_spare[write_page].free != NAND_RAM_PAGE_FREE)
{
ret = -EACCES;
NAND_RAM_LOG("[LOWER %lu | %s] Failed: %s\n",
NAND_RAM_LOG("[LOWER %" PRIu64 " | %s] Failed: %s\n",
nand_ram_ins_i, "rawwrite", EACCES_STR);
goto errout;
}
Expand All @@ -447,7 +448,8 @@ int nand_ram_rawwrite(FAR struct nand_raw_s *raw, off_t block,
memcpy((FAR void *)write_page_spare, data, NAND_RAM_SPARE_SIZE);
}

NAND_RAM_LOG("[LOWER %lu | %s] Done\n", nand_ram_ins_i, "rawwrite");
NAND_RAM_LOG("[LOWER %" PRIu64 " | %s] Done\n", nand_ram_ins_i,
"rawwrite");

errout:
nxmutex_unlock(&nand_ram_dev_mut);
Expand Down
Loading

0 comments on commit 80b8ed8

Please sign in to comment.