boards/sim: Defconfigs for nand and mnemofs

Adds nand and mnemofs sim configs.

Signed-off-by: Saurav Pal <resyfer.dev@gmail.com>
This commit is contained in:
Saurav Pal 2024-09-02 14:24:52 +00:00 committed by Xiang Xiao
parent a2ed0ddd72
commit fc31c61730
14 changed files with 254 additions and 108 deletions

5
.gitignore vendored
View File

@ -71,4 +71,7 @@ tools/gdb/__pycache__
/build
.ccls-cache
compile_commands.json
imx9-sdimage.img
imx9-sdimage.img
kwarning
SAVEMake.defs
SAVEconfig

View File

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

View File

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

View File

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

View File

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

View File

@ -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);
}
@ -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) */
@ -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);
@ -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;
}
@ -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);
@ -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;
}
@ -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);

View File

@ -107,7 +107,7 @@ static mutex_t nand_wrapper_dev_mut;
****************************************************************************/
int nand_wrapper_erase(FAR struct mtd_dev_s *dev, off_t startblock,
size_t nblocks)
size_t nblocks)
{
int ret;
FAR struct nand_wrapper_dev_s *nand_dev;
@ -116,20 +116,21 @@ int nand_wrapper_erase(FAR struct mtd_dev_s *dev, off_t startblock,
nxmutex_lock(&nand_wrapper_dev_mut);
nand_wrapper_ins_i++;
NAND_WRAPPER_LOG("[UPPER %lu | %s] Startblock: %d, N Blocks: %ld\n",
nand_wrapper_ins_i, "erase", startblock, nblocks);
NAND_WRAPPER_LOG("[UPPER %" PRIu64 " | %s] Startblock: %" PRIi32
", N Blocks: %zu\n", nand_wrapper_ins_i, "erase",
startblock, nblocks);
DEBUGASSERT(nand_dev && nand_dev->under.mtd.erase);
ret = nand_dev->under.mtd.erase(dev, startblock, nblocks);
if (ret >= 0)
{
NAND_WRAPPER_LOG("[UPPER %lu | %s] Done\n",
NAND_WRAPPER_LOG("[UPPER %" PRIu64 " | %s] Done\n",
nand_wrapper_ins_i, "erase");
}
else
{
NAND_WRAPPER_LOG("[UPPER %lu | %s] Failed: %d!\n",
NAND_WRAPPER_LOG("[UPPER %" PRIu64 " | %s] Failed: %" PRIi32 "!\n",
nand_wrapper_ins_i, "erase", ret);
}
@ -160,7 +161,7 @@ int nand_wrapper_erase(FAR struct mtd_dev_s *dev, off_t startblock,
****************************************************************************/
ssize_t nand_wrapper_bread(FAR struct mtd_dev_s *dev, off_t startpage,
size_t npages, FAR uint8_t *buffer)
size_t npages, FAR uint8_t *buffer)
{
int ret;
FAR struct nand_wrapper_dev_s *nand_dev;
@ -169,8 +170,8 @@ ssize_t nand_wrapper_bread(FAR struct mtd_dev_s *dev, off_t startpage,
nxmutex_lock(&nand_wrapper_dev_mut);
nand_wrapper_ins_i++;
NAND_WRAPPER_LOG("[UPPER %lu | %s] "
"Startblock: %d, N Pages: %ld, Buffer: %p\n",
NAND_WRAPPER_LOG("[UPPER %" PRIu64 " | %s] "
"Startblock: %" PRIi32 ", N Pages: %zu, Buffer: %p\n",
nand_wrapper_ins_i, "bread", startpage, npages, buffer);
DEBUGASSERT(nand_dev && nand_dev->under.mtd.bread);
@ -178,12 +179,12 @@ ssize_t nand_wrapper_bread(FAR struct mtd_dev_s *dev, off_t startpage,
if (ret >= 0)
{
NAND_WRAPPER_LOG("[UPPER %lu | %s] Done\n",
NAND_WRAPPER_LOG("[UPPER %" PRIu64 " | %s] Done\n",
nand_wrapper_ins_i, "bread");
}
else
{
NAND_WRAPPER_LOG("[UPPER %lu | %s] Failed: %d!\n",
NAND_WRAPPER_LOG("[UPPER %" PRIu64 " | %s] Failed: %" PRIi32 "!\n",
nand_wrapper_ins_i, "bread", ret);
}
@ -216,7 +217,7 @@ ssize_t nand_wrapper_bread(FAR struct mtd_dev_s *dev, off_t startpage,
****************************************************************************/
ssize_t nand_wrapper_bwrite(FAR struct mtd_dev_s *dev, off_t startpage,
size_t npages, FAR const uint8_t *buffer)
size_t npages, FAR const uint8_t *buffer)
{
int ret;
FAR struct nand_wrapper_dev_s *nand_dev;
@ -225,8 +226,8 @@ ssize_t nand_wrapper_bwrite(FAR struct mtd_dev_s *dev, off_t startpage,
nxmutex_lock(&nand_wrapper_dev_mut);
nand_wrapper_ins_i++;
NAND_WRAPPER_LOG("[UPPER %lu | %s] "
"Startblock: %d, N Pages: %ld, Buffer: %p \n",
NAND_WRAPPER_LOG("[UPPER %" PRIu64 " | %s] "
"Startblock: %" PRIi32 ", N Pages: %zu, Buffer: %p\n",
nand_wrapper_ins_i, "bwrite", startpage, npages, buffer);
DEBUGASSERT(nand_dev && nand_dev->under.mtd.bwrite);
@ -234,12 +235,12 @@ ssize_t nand_wrapper_bwrite(FAR struct mtd_dev_s *dev, off_t startpage,
if (ret >= 0)
{
NAND_WRAPPER_LOG("[UPPER %lu | %s] Done\n",
NAND_WRAPPER_LOG("[UPPER %" PRIu64 " | %s] Done\n",
nand_wrapper_ins_i, "bwrite");
}
else
{
NAND_WRAPPER_LOG("[UPPER %lu | %s] Failed: %d!\n",
NAND_WRAPPER_LOG("[UPPER %" PRIu64 " | %s] Failed: %" PRIi32 "!\n",
nand_wrapper_ins_i, "bwrite", ret);
}
@ -269,7 +270,7 @@ ssize_t nand_wrapper_bwrite(FAR struct mtd_dev_s *dev, off_t startpage,
****************************************************************************/
int nand_wrapper_ioctl(FAR struct mtd_dev_s *dev, int cmd,
unsigned long arg)
unsigned long arg)
{
int ret;
FAR struct nand_wrapper_dev_s *nand_dev;
@ -278,20 +279,20 @@ int nand_wrapper_ioctl(FAR struct mtd_dev_s *dev, int cmd,
nxmutex_lock(&nand_wrapper_dev_mut);
nand_wrapper_ins_i++;
NAND_WRAPPER_LOG("[UPPER %lu | %s] Command: %d, Arg : %ld\n",
nand_wrapper_ins_i, "ioctl", cmd, arg);
NAND_WRAPPER_LOG("[UPPER %" PRIu64 " | %s] Command: %" PRIi32
", Arg : %zu\n", nand_wrapper_ins_i, "ioctl", cmd, arg);
DEBUGASSERT(nand_dev && nand_dev->under.mtd.ioctl);
ret = nand_dev->under.mtd.ioctl(dev, cmd, arg);
if (ret >= 0)
{
NAND_WRAPPER_LOG("[UPPER %lu | %s] Done\n",
NAND_WRAPPER_LOG("[UPPER %" PRIu64 " | %s] Done\n",
nand_wrapper_ins_i, "ioctl");
}
else
{
NAND_WRAPPER_LOG("[UPPER %lu | %s] Failed: %d!\n",
NAND_WRAPPER_LOG("[UPPER %" PRIu64 " | %s] Failed: %" PRIi32 "!\n",
nand_wrapper_ins_i, "ioctl", ret);
}
@ -328,7 +329,7 @@ int nand_wrapper_isbad(FAR struct mtd_dev_s *dev, off_t block)
nxmutex_lock(&nand_wrapper_dev_mut);
nand_wrapper_ins_i++;
NAND_WRAPPER_LOG("[UPPER %lu | %s] Block: %d\n",
NAND_WRAPPER_LOG("[UPPER %" PRIu64 " | %s] Block: %" PRIi32 "\n",
nand_wrapper_ins_i, "isbad", block);
DEBUGASSERT(nand_dev && nand_dev->under.mtd.isbad);
@ -336,12 +337,12 @@ int nand_wrapper_isbad(FAR struct mtd_dev_s *dev, off_t block)
if (ret >= 0)
{
NAND_WRAPPER_LOG("[UPPER %lu | %s] Done %d\n",
NAND_WRAPPER_LOG("[UPPER %" PRIu64 " | %s] Done %" PRIi32 "\n",
nand_wrapper_ins_i, "isbad", ret);
}
else
{
NAND_WRAPPER_LOG("[UPPER %lu | %s] Failed: %d!\n",
NAND_WRAPPER_LOG("[UPPER %" PRIu64 " | %s] Failed: %" PRIi32 "!\n",
nand_wrapper_ins_i, "isbad", ret);
}
@ -378,7 +379,7 @@ int nand_wrapper_markbad(FAR struct mtd_dev_s *dev, off_t block)
nxmutex_lock(&nand_wrapper_dev_mut);
nand_wrapper_ins_i++;
NAND_WRAPPER_LOG("[UPPER %lu | %s] Blocks: %d\n",
NAND_WRAPPER_LOG("[UPPER %" PRIu64 " | %s] Blocks: %" PRIi32 "\n",
nand_wrapper_ins_i, "markbad", block);
DEBUGASSERT(nand_dev && nand_dev->under.mtd.markbad);
@ -386,12 +387,12 @@ int nand_wrapper_markbad(FAR struct mtd_dev_s *dev, off_t block)
if (ret >= 0)
{
NAND_WRAPPER_LOG("[UPPER %lu | %s] Done\n",
NAND_WRAPPER_LOG("[UPPER %" PRIu64 " | %s] Done\n",
nand_wrapper_ins_i, "markbad");
}
else
{
NAND_WRAPPER_LOG("[UPPER %lu | %s] Failed: %d!\n",
NAND_WRAPPER_LOG("[UPPER %" PRIu64 " | %s] Failed: %" PRIi32 "!\n",
nand_wrapper_ins_i, "markbad", ret);
}

View File

@ -557,7 +557,8 @@ static ssize_t mnemofs_read(FAR struct file *filep, FAR char *buffer,
f = filep->f_priv;
DEBUGASSERT(f != NULL);
finfo("Mnemofs read %lu bytes from %u offset", buflen, f->com->off);
finfo("Mnemofs read %zu bytes from %" PRIu32 " offset", buflen,
f->com->off);
/* Check if allowed to read. */
@ -579,7 +580,7 @@ static ssize_t mnemofs_read(FAR struct file *filep, FAR char *buffer,
buffer, buflen);
if (ret < 0)
{
finfo("Error while reading. Ret: %d.", ret);
finfo("Error while reading. Ret: %zd.", ret);
goto errout_with_lock;
}
@ -593,7 +594,7 @@ errout_with_lock:
nxmutex_unlock(&MFS_LOCK(sb));
errout:
finfo("Mnemofs read exited with %d.", ret);
finfo("Mnemofs read exited with %zd.", ret);
return ret;
}
@ -642,7 +643,8 @@ static ssize_t mnemofs_write(FAR struct file *filep, FAR const char *buffer,
f = filep->f_priv;
DEBUGASSERT(f != NULL);
finfo("Mnemofs write %lu bytes at offset %u.", buflen, f->com->off);
finfo("Mnemofs write %zu bytes at offset %" PRIu32, buflen,
f->com->off);
/* Check if allowed to write. */
@ -674,7 +676,7 @@ errout_with_lock:
finfo("Lock released.");
errout:
finfo("Mnemofs write exited with %d.", ret);
finfo("Mnemofs write exited with %zd.", ret);
return ret;
}
@ -800,7 +802,7 @@ static int mnemofs_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
FAR struct inode *drv;
FAR struct mfs_sb_s *sb;
finfo("Mnemofs ioctl with cmd %u and arg %ld", cmd, arg);
finfo("Mnemofs ioctl with cmd %" PRIu32 "and arg %zu.", cmd, arg);
inode = filep->f_inode;
sb = inode->i_private;

View File

@ -282,7 +282,6 @@ static int is_blk_writeable(FAR struct mfs_sb_s * const sb, const mfs_t blk)
int mfs_ba_fmt(FAR struct mfs_sb_s * const sb)
{
int ret = OK;
uint8_t log;
/* We need at least 5 blocks, as one is occupied by superblock, at least
* one for the journal, 2 for journal's master blocks, and at least one for
@ -306,8 +305,6 @@ int mfs_ba_fmt(FAR struct mfs_sb_s * const sb)
MFS_BA(sb).c_pg = MFS_BLK2PG(sb, MFS_BA(sb).s_blk);
log = ceil(log2(MFS_NBLKS(sb)));
/* MFS_BA(sb).k_del_elemsz = ((log + 7) & (-8)) / 8; */
MFS_BA(sb).k_del = kmm_zalloc(sizeof(size_t) * MFS_NBLKS(sb));

View File

@ -325,7 +325,6 @@ int mfs_ctz_rdfromoff(FAR const struct mfs_sb_s * const sb,
{
int ret = OK;
mfs_t i;
mfs_t rd_sz;
mfs_t cur_pg;
mfs_t cur_idx;
mfs_t cur_pgoff;
@ -351,7 +350,6 @@ int mfs_ctz_rdfromoff(FAR const struct mfs_sb_s * const sb,
}
cur_pg = mfs_ctz_travel(sb, ctz.idx_e, ctz.pg_e, cur_idx);
rd_sz = 0;
if (predict_false(cur_pg == 0))
{
@ -444,8 +442,7 @@ int mfs_ctz_wrtnode(FAR struct mfs_sb_s * const sb,
struct mfs_ctz_s ctz;
FAR struct mfs_delta_s *delta;
finfo("Write LRU node %p at depth %u, with %u delta(s) to flash.", node,
node->depth, list_length(&node->delta));
finfo("Write LRU node %p at depth %u.", node, node->depth);
/* Traverse common CTZ blocks. */
@ -487,8 +484,8 @@ int mfs_ctz_wrtnode(FAR struct mfs_sb_s * const sb,
upper = MIN(prev + lower + ctz_blkdatasz(sb, cur_idx), rem_sz);
upper_og = upper;
finfo("Remaining Size %u. Lower %u, Upper %u, Current Offset %u",
rem_sz, lower, upper, tmp - buf);
finfo("Remaining Size %" PRIu32 ". Lower %" PRIu32 ", Upper %" PRIu32
", Current Offset %zd.", rem_sz, lower, upper, tmp - buf);
/* Retrieving original data. */
@ -501,8 +498,8 @@ int mfs_ctz_wrtnode(FAR struct mfs_sb_s * const sb,
list_for_every_entry(&node->delta, delta, struct mfs_delta_s, list)
{
finfo("Checking delta %p in node %p. Offset %u, bytes %u.", delta,
node, delta->off, delta->n_b);
finfo("Checking delta %p in node %p. Offset %" PRIu32 ", bytes %"
PRIu32, delta, node, delta->off, delta->n_b);
lower_upd = MAX(lower, delta->off);
upper_upd = MIN(upper, delta->off + delta->n_b);
@ -569,7 +566,7 @@ int mfs_ctz_wrtnode(FAR struct mfs_sb_s * const sb,
written = true;
finfo("Written data to page %u.", new_pg);
finfo("Written data to page %" PRIu32, new_pg);
}
else
{
@ -655,8 +652,8 @@ mfs_t mfs_ctz_travel(FAR const struct mfs_sb_s * const sb,
}
}
finfo("Travel from index %u at page %u to index %u at page %u.", idx_src,
pg_src, idx_dest, pg);
finfo("Travel from index %" PRIu32 " at page %" PRIu32 " to index %" PRIu32
" at page %" PRIu32 ".", idx_src, pg_src, idx_dest, pg);
return pg;
}

View File

@ -626,7 +626,6 @@ int mfs_jrnl_wrlog(FAR struct mfs_sb_s * const sb,
{
int ret = OK;
mfs_t jrnl_pg;
mfs_t jrnl_blk;
FAR char *buf = NULL;
FAR char *tmp = NULL;
const mfs_t log_sz = sizeof(mfs_t) + MFS_LOGSZ(node->depth);
@ -655,7 +654,6 @@ int mfs_jrnl_wrlog(FAR struct mfs_sb_s * const sb,
/* Store */
jrnl_blk = mfs_jrnl_blkidx2blk(sb, MFS_JRNL(sb).log_cblkidx);
jrnl_pg = MFS_JRNL(sb).log_cpg;
/* TODO: It assumes it takes only one page per log. */

View File

@ -193,8 +193,8 @@ static void lru_nodesearch(FAR const struct mfs_sb_s * const sb,
if (found)
{
finfo("Node search ended with match of node %p at depth %u"
" for CTZ of %u size with range [%u, %u).", n, n->depth, n->sz,
n->range_min, n->range_max);
" for CTZ of %" PRIu32 " size with range [%" PRIu32 ", %" PRIi32
").", n, n->depth, n->sz, n->range_min, n->range_max);
}
else
{
@ -325,9 +325,9 @@ static int lru_nodeflush(FAR struct mfs_sb_s * const sb,
if (rm_node)
{
finfo("Deleting node. Old size: %u.", list_length(&MFS_LRU(sb)));
finfo("Deleting node. Old size: %zu.", list_length(&MFS_LRU(sb)));
list_delete_init(&node->list);
finfo("Deleted node. New size: %u.", list_length(&MFS_LRU(sb)));
finfo("Deleted node. New size: %zu.", list_length(&MFS_LRU(sb)));
}
else
{
@ -428,13 +428,13 @@ static int lru_wrtooff(FAR struct mfs_sb_s * const sb, const mfs_t data_off,
struct mfs_node_s, list);
list_delete_init(&last_node->list);
list_add_tail(&MFS_LRU(sb), &node->list);
finfo("LRU flushing node complete, now only %u nodes",
finfo("LRU flushing node complete, now only %zu nodes",
list_length(&MFS_LRU(sb)));
}
else
{
list_add_tail(&MFS_LRU(sb), &node->list);
finfo("Node inserted into LRU, and it now %u node(s).",
finfo("Node inserted into LRU, and it now %zu node(s).",
list_length(&MFS_LRU(sb)));
}
}
@ -502,10 +502,10 @@ static int lru_wrtooff(FAR struct mfs_sb_s * const sb, const mfs_t data_off,
}
}
finfo("Delta attached to node %p. Now there are %lu nodes and the node has"
" %lu deltas. Node with range [%u, %u).", node,
list_length(&MFS_LRU(sb)), list_length(&node->delta),
node->range_min, node->range_max);
finfo("Delta attached to node %p. Now there are %zu nodes and the"
" node has %zu deltas. Node with range [%" PRIu32 ", %"
PRIu32 ").", node, list_length(&MFS_LRU(sb)),
list_length(&node->delta), node->range_min, node->range_max);
return ret;
@ -730,7 +730,7 @@ int mfs_lru_flush(FAR struct mfs_sb_s * const sb)
* big), the stack depth for this will be 7.
*/
finfo("Sorting the LRU. No. of nodes: %u.", list_length(&MFS_LRU(sb)));
finfo("Sorting the LRU. No. of nodes: %zu", list_length(&MFS_LRU(sb)));
lru_sort(sb, MFS_LRU(sb).next, MFS_LRU(sb).prev);
MFS_FLUSH(sb) = true;

View File

@ -191,13 +191,12 @@ static FAR const char *deser_mn(FAR const char * const in,
int mfs_mn_init(FAR struct mfs_sb_s * const sb, const mfs_t jrnl_blk)
{
int ret = OK;
bool found = false;
mfs_t i = 0;
mfs_t mblk1;
mfs_t mblk2;
mfs_t jrnl_blk_tmp;
mfs_t blkidx;
mfs_t pg_in_blk;
bool found = false;
mfs_t jrnl_blk_tmp;
uint16_t hash;
struct mfs_mn_s mn;
const mfs_t sz = sizeof(struct mfs_mn_s) - sizeof(mn.pg);
@ -206,7 +205,7 @@ int mfs_mn_init(FAR struct mfs_sb_s * const sb, const mfs_t jrnl_blk)
struct mfs_jrnl_log_s log;
mblk1 = mfs_jrnl_blkidx2blk(sb, MFS_JRNL(sb).n_blks);
mblk2 = mfs_jrnl_blkidx2blk(sb, MFS_JRNL(sb).n_blks + 1);
mn.jrnl_blk = jrnl_blk;
mn.mblk_idx = 0;
mn.pg = MFS_BLK2PG(sb, mblk1);
@ -362,8 +361,6 @@ int mfs_mn_move(FAR struct mfs_sb_s * const sb, struct mfs_ctz_s root,
const mfs_t root_sz)
{
int ret = OK;
mfs_t mblk1;
mfs_t mblk2;
struct mfs_mn_s mn;
const mfs_t sz = sizeof(struct mfs_mn_s) - sizeof(mn.pg);
char buf[sz + 1];
@ -373,9 +370,7 @@ int mfs_mn_move(FAR struct mfs_sb_s * const sb, struct mfs_ctz_s root,
/* TODO: Move journal. Master blocks are full. */
}
mblk1 = mfs_jrnl_blkidx2blk(sb, MFS_JRNL(sb).n_blks);
mblk2 = mfs_jrnl_blkidx2blk(sb, MFS_JRNL(sb).n_blks + 1);
mn = MFS_MN(sb);
mn = MFS_MN(sb);
mn.root_ctz = root;
mn.root_sz = root_sz;

View File

@ -102,7 +102,7 @@ uint8_t mfs_arrhash(FAR const char *arr, ssize_t len)
hash %= (1 << 8);
}
finfo("Hash calculated for size %ld to be %d.", len, hash % (1 << 8));
finfo("Hash calculated for size %zd to be %d.", len, hash % (1 << 8));
return hash % (1 << 8);
}
@ -123,7 +123,7 @@ uint16_t mfs_hash(FAR const char *arr, ssize_t len)
hash %= (1 << MFS_HASHSZ);
}
finfo("Hash calculated for size %ld to be %u.", len, hash);
finfo("Hash calculated for size %zd to be %" PRIi32, len, hash);
return hash;
}