From 5e3cbd116527870c97c34586db110ba74f7d4538 Mon Sep 17 00:00:00 2001 From: Jorge Guzman Date: Wed, 6 Mar 2024 20:36:58 -0300 Subject: [PATCH] stm32h7/linum-stm32h753bi: Add support to littlefs and nxffs with flash mem. via quadspi Signed-off-by: Jorge Guzman --- .../boards/linum-stm32h753bi/index.rst | 40 ++++- arch/arm/src/stm32h7/stm32_qspi.c | 8 +- .../configs/littlefs/defconfig | 69 +++++++++ .../linum-stm32h753bi/configs/nxffs/defconfig | 66 +++++++++ .../stm32h7/linum-stm32h753bi/include/board.h | 16 +- .../linum-stm32h753bi/src/CMakeLists.txt | 4 + .../stm32h7/linum-stm32h753bi/src/Makefile | 12 +- .../linum-stm32h753bi/src/linum-stm32h753bi.h | 17 ++- .../linum-stm32h753bi/src/stm32_bringup.c | 8 + .../linum-stm32h753bi/src/stm32_w25q.c | 138 ++++++++++++++++++ fs/nxffs/nxffs_dump.c | 10 +- 11 files changed, 370 insertions(+), 18 deletions(-) create mode 100644 boards/arm/stm32h7/linum-stm32h753bi/configs/littlefs/defconfig create mode 100644 boards/arm/stm32h7/linum-stm32h753bi/configs/nxffs/defconfig create mode 100644 boards/arm/stm32h7/linum-stm32h753bi/src/stm32_w25q.c diff --git a/Documentation/platforms/arm/stm32h7/boards/linum-stm32h753bi/index.rst b/Documentation/platforms/arm/stm32h7/boards/linum-stm32h753bi/index.rst index 09cbb3dbc8..abddc0712e 100644 --- a/Documentation/platforms/arm/stm32h7/boards/linum-stm32h753bi/index.rst +++ b/Documentation/platforms/arm/stm32h7/boards/linum-stm32h753bi/index.rst @@ -551,4 +551,42 @@ Transmiting a file to PC:: If you don't have a SDCard on your board, you can mount the TMPFS at /tmp and transfer files to it, but you cannot transfer big files because TMPFS could use the free RAM of your board:: - nsh> mount -t tmpfs /tmp \ No newline at end of file + nsh> mount -t tmpfs /tmp + +nxffs +----- +This example use the flash memory W25Q128JV via qspi with the nxffs file system:: + + NuttShell (NSH) NuttX-12.5.1-RC0 + nsh> ls + /: + dev/ + w25/ + nsh> cd /w25 + nsh> echo "hello world!" > message.txt + nsh> ls + /w25: + message.txt + nsh> cat message.txt + hello world! + +littlefs +-------- +This example use the flash memory W25Q128JV via qspi with the littlefs file system:: + + NuttShell (NSH) NuttX-12.5.1-RC0 + nsh> ls + /: + dev/ + w25/ + nsh> cd /w25 + nsh> mkdir folder1 + nsh> cd folder1 + nsh> echo "hello world!!!!" > message.txt + nsh> cat message.txt + hello world!!!! + nsh> ls + /w25/folder1: + . + .. + message.txt \ No newline at end of file diff --git a/arch/arm/src/stm32h7/stm32_qspi.c b/arch/arm/src/stm32h7/stm32_qspi.c index 288766536d..113e9cc242 100644 --- a/arch/arm/src/stm32h7/stm32_qspi.c +++ b/arch/arm/src/stm32h7/stm32_qspi.c @@ -1851,7 +1851,7 @@ static uint32_t qspi_setfrequency(struct qspi_dev_s *dev, uint32_t frequency) return 0; } - spiinfo("frequency=%d\n", frequency); + spiinfo("frequency=%" PRId32 "\n", frequency); DEBUGASSERT(priv); /* Wait till BUSY flag reset */ @@ -1905,14 +1905,14 @@ static uint32_t qspi_setfrequency(struct qspi_dev_s *dev, uint32_t frequency) /* Calculate the new actual frequency */ actual = QSPI_CLK_FREQUENCY / prescaler; - spiinfo("prescaler=%d actual=%d\n", prescaler, actual); + spiinfo("prescaler=%" PRId32 " actual=%" PRId32 "\n", prescaler, actual); /* Save the frequency setting */ priv->frequency = frequency; priv->actual = actual; - spiinfo("Frequency %d->%d\n", frequency, actual); + spiinfo("Frequency %" PRId32 "->%" PRId32 "\n", frequency, actual); return actual; } @@ -1983,7 +1983,7 @@ static void qspi_setmode(struct qspi_dev_s *dev, enum qspi_mode_e mode) } qspi_putreg(priv, regval, STM32_QUADSPI_DCR_OFFSET); - spiinfo("DCR=%08x\n", regval); + spiinfo("DCR=%08" PRIx32 "\n", regval); /* Save the mode so that subsequent re-configurations will be faster */ diff --git a/boards/arm/stm32h7/linum-stm32h753bi/configs/littlefs/defconfig b/boards/arm/stm32h7/linum-stm32h753bi/configs/littlefs/defconfig new file mode 100644 index 0000000000..8cf685d943 --- /dev/null +++ b/boards/arm/stm32h7/linum-stm32h753bi/configs/littlefs/defconfig @@ -0,0 +1,69 @@ +# +# 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_DISABLE_IFCONFIG is not set +# CONFIG_NSH_DISABLE_PS is not set +# CONFIG_NSH_QUOTE is not set +# CONFIG_STANDARD_SERIAL is not set +# CONFIG_STM32H7_USE_LEGACY_PINMAP is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="linum-stm32h753bi" +CONFIG_ARCH_BOARD_LINUM_STM32H753BI=y +CONFIG_ARCH_CHIP="stm32h7" +CONFIG_ARCH_CHIP_STM32H753BI=y +CONFIG_ARCH_CHIP_STM32H7=y +CONFIG_ARCH_CHIP_STM32H7_CORTEXM7=y +CONFIG_ARCH_STACKDUMP=y +CONFIG_ARMV7M_DCACHE=y +CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y +CONFIG_ARMV7M_DTCM=y +CONFIG_ARMV7M_ICACHE=y +CONFIG_BOARD_LOOPSPERMSEC=43103 +CONFIG_BUILTIN=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_DEFAULT_TASK_STACKSIZE=4096 +CONFIG_EXAMPLES_ALARM=y +CONFIG_EXAMPLES_ALARM_STACKSIZE=2048 +CONFIG_FS_LITTLEFS=y +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_INTELHEX_BINARY=y +CONFIG_LIBM=y +CONFIG_MM_DEFAULT_ALIGNMENT=4 +CONFIG_MM_REGIONS=4 +CONFIG_MTD=y +CONFIG_MTD_W25QXXXJV=y +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_LINELEN=64 +CONFIG_NSH_READLINE=y +CONFIG_POSIX_SPAWN_DEFAULT_STACKSIZE=2048 +CONFIG_PREALLOC_TIMERS=4 +CONFIG_PTHREAD_STACK_DEFAULT=2048 +CONFIG_RAMMTD=y +CONFIG_RAM_SIZE=245760 +CONFIG_RAM_START=0x20010000 +CONFIG_RAW_BINARY=y +CONFIG_RR_INTERVAL=200 +CONFIG_RTC_ALARM=y +CONFIG_RTC_DATETIME=y +CONFIG_RTC_DRIVER=y +CONFIG_SCHED_WAITPID=y +CONFIG_SPI=y +CONFIG_START_DAY=6 +CONFIG_START_MONTH=12 +CONFIG_START_YEAR=2011 +CONFIG_STM32H7_PWR=y +CONFIG_STM32H7_QSPI_INTERRUPTS=y +CONFIG_STM32H7_QUADSPI=y +CONFIG_STM32H7_RTC=y +CONFIG_STM32H7_USART1=y +CONFIG_SYSTEM_NSH=y +CONFIG_SYSTEM_NSH_STACKSIZE=2048 +CONFIG_TASK_NAME_SIZE=0 +CONFIG_USART1_SERIAL_CONSOLE=y +CONFIG_W25QXXXJV_QSPI_FREQUENCY=50000000 diff --git a/boards/arm/stm32h7/linum-stm32h753bi/configs/nxffs/defconfig b/boards/arm/stm32h7/linum-stm32h753bi/configs/nxffs/defconfig new file mode 100644 index 0000000000..83bd1eec47 --- /dev/null +++ b/boards/arm/stm32h7/linum-stm32h753bi/configs/nxffs/defconfig @@ -0,0 +1,66 @@ +# +# 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_DISABLE_IFCONFIG is not set +# CONFIG_NSH_DISABLE_PS is not set +# CONFIG_NSH_QUOTE is not set +# CONFIG_STANDARD_SERIAL is not set +# CONFIG_STM32H7_USE_LEGACY_PINMAP is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="linum-stm32h753bi" +CONFIG_ARCH_BOARD_LINUM_STM32H753BI=y +CONFIG_ARCH_CHIP="stm32h7" +CONFIG_ARCH_CHIP_STM32H753BI=y +CONFIG_ARCH_CHIP_STM32H7=y +CONFIG_ARCH_CHIP_STM32H7_CORTEXM7=y +CONFIG_ARCH_STACKDUMP=y +CONFIG_ARMV7M_DCACHE=y +CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y +CONFIG_ARMV7M_DTCM=y +CONFIG_ARMV7M_ICACHE=y +CONFIG_BOARD_LOOPSPERMSEC=43103 +CONFIG_BUILTIN=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_EXAMPLES_ALARM=y +CONFIG_FS_NXFFS=y +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_INTELHEX_BINARY=y +CONFIG_LIBM=y +CONFIG_MM_DEFAULT_ALIGNMENT=4 +CONFIG_MM_REGIONS=4 +CONFIG_MTD=y +CONFIG_MTD_W25QXXXJV=y +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_LINELEN=64 +CONFIG_NSH_READLINE=y +CONFIG_PREALLOC_TIMERS=4 +CONFIG_RAMMTD=y +CONFIG_RAM_SIZE=245760 +CONFIG_RAM_START=0x20010000 +CONFIG_RAW_BINARY=y +CONFIG_RR_INTERVAL=200 +CONFIG_RTC_ALARM=y +CONFIG_RTC_DATETIME=y +CONFIG_RTC_DRIVER=y +CONFIG_SCHED_WAITPID=y +CONFIG_SPI=y +CONFIG_START_DAY=6 +CONFIG_START_MONTH=12 +CONFIG_START_YEAR=2011 +CONFIG_STM32H7_PWR=y +CONFIG_STM32H7_QSPI_INTERRUPTS=y +CONFIG_STM32H7_QUADSPI=y +CONFIG_STM32H7_RTC=y +CONFIG_STM32H7_USART1=y +CONFIG_SYSTEM_NSH=y +CONFIG_TASK_NAME_SIZE=0 +CONFIG_TESTING_NXFFS=y +CONFIG_TESTING_NXFFS_MOUNTPT="/mnt" +CONFIG_USART1_SERIAL_CONSOLE=y +CONFIG_W25QXXXJV_QSPI_FREQUENCY=50000000 diff --git a/boards/arm/stm32h7/linum-stm32h753bi/include/board.h b/boards/arm/stm32h7/linum-stm32h753bi/include/board.h index f7d925dff4..0aced1f981 100644 --- a/boards/arm/stm32h7/linum-stm32h753bi/include/board.h +++ b/boards/arm/stm32h7/linum-stm32h753bi/include/board.h @@ -379,8 +379,8 @@ /* OTGFS */ -#define GPIO_OTGFS_DM (GPIO_OTGFS_DM_0 | GPIO_SPEED_100MHz) -#define GPIO_OTGFS_DP (GPIO_OTGFS_DP_0 | GPIO_SPEED_100MHz) +#define GPIO_OTGFS_DM (GPIO_OTGFS_DM_0 | GPIO_SPEED_100MHz) /* PA11 */ +#define GPIO_OTGFS_DP (GPIO_OTGFS_DP_0 | GPIO_SPEED_100MHz) /* PA12 */ /* SDMMC1 - Used SD Card memory */ @@ -411,6 +411,18 @@ #define GPIO_CAN2_RX (GPIO_CAN2_RX_2|GPIO_SPEED_50MHz) /* PB5 - D11 */ #define GPIO_CAN2_TX (GPIO_CAN2_TX_2|GPIO_SPEED_50MHz) /* PB6 - D1 */ +/* QSPI Mapping */ + +#define GPIO_QSPI_CS (GPIO_QUADSPI_BK1_NCS_2 | GPIO_FLOAT | GPIO_PUSHPULL | GPIO_SPEED_100MHz) /* PG6 */ +#define GPIO_QSPI_IO0 (GPIO_QUADSPI_BK1_IO0_1 | GPIO_FLOAT | GPIO_PUSHPULL | GPIO_SPEED_100MHz) /* PF8 */ +#define GPIO_QSPI_IO1 (GPIO_QUADSPI_BK1_IO1_1 | GPIO_FLOAT | GPIO_PUSHPULL | GPIO_SPEED_100MHz) /* PF9 */ +#define GPIO_QSPI_IO2 (GPIO_QUADSPI_BK1_IO2_2 | GPIO_FLOAT | GPIO_PUSHPULL | GPIO_SPEED_100MHz) /* PF7 */ +#define GPIO_QSPI_IO3 (GPIO_QUADSPI_BK1_IO3_3 | GPIO_FLOAT | GPIO_PUSHPULL | GPIO_SPEED_100MHz) /* PF6 */ +#define GPIO_QSPI_SCK (GPIO_QUADSPI_CLK_2 | GPIO_FLOAT | GPIO_PUSHPULL | GPIO_SPEED_100MHz) /* PF10 */ + +/* Select PLL2R to source clock of QSPI */ +#define BOARD_QSPI_CLK RCC_D1CCIPR_QSPISEL_PLL2 + /**************************************************************************** * Public Data ****************************************************************************/ diff --git a/boards/arm/stm32h7/linum-stm32h753bi/src/CMakeLists.txt b/boards/arm/stm32h7/linum-stm32h753bi/src/CMakeLists.txt index 7f8d7d52a0..fbab4f2191 100644 --- a/boards/arm/stm32h7/linum-stm32h753bi/src/CMakeLists.txt +++ b/boards/arm/stm32h7/linum-stm32h753bi/src/CMakeLists.txt @@ -52,6 +52,10 @@ if(CONFIG_PWM) list(APPEND SRCS stm32_pwm.c) endif() +if(CONFIG_MTD_W25QXXXJV) + list(APPEND SRCS stm32_w25q.c) +endif() + target_sources(board PRIVATE ${SRCS}) set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/flash.ld") diff --git a/boards/arm/stm32h7/linum-stm32h753bi/src/Makefile b/boards/arm/stm32h7/linum-stm32h753bi/src/Makefile index 6477e3913b..b944d17c6a 100644 --- a/boards/arm/stm32h7/linum-stm32h753bi/src/Makefile +++ b/boards/arm/stm32h7/linum-stm32h753bi/src/Makefile @@ -24,10 +24,10 @@ CSRCS = stm32_boot.c stm32_bringup.c ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += stm32_autoleds.c -endif - -ifeq ($(CONFIG_USERLED),y) -CSRCS += stm32_userleds.c +else + ifeq ($(CONFIG_USERLED),y) + CSRCS += stm32_userleds.c + endif endif ifeq ($(CONFIG_STM32H7_OTGFS),y) @@ -50,6 +50,10 @@ ifeq ($(CONFIG_PWM),y) CSRCS += stm32_pwm.c endif +ifeq ($(CONFIG_MTD_W25QXXXJV),y) +CSRCS += stm32_w25q.c +endif + ifeq ($(CONFIG_BOARDCTL),y) CSRCS += stm32_appinitialize.c endif diff --git a/boards/arm/stm32h7/linum-stm32h753bi/src/linum-stm32h753bi.h b/boards/arm/stm32h7/linum-stm32h753bi/src/linum-stm32h753bi.h index a3e84e130f..6c90d5b47a 100644 --- a/boards/arm/stm32h7/linum-stm32h753bi/src/linum-stm32h753bi.h +++ b/boards/arm/stm32h7/linum-stm32h753bi/src/linum-stm32h753bi.h @@ -141,7 +141,7 @@ void weak_function stm32_usbinitialize(void); * Name: stm32_dma_alloc_init * * Description: - * Called to create a FAT DMA allocator + * Called to create a FAT DMA allocator. * * Returned Value: * 0 on success or -ENOMEM @@ -156,7 +156,7 @@ int stm32_dma_alloc_init(void); * Name: stm32_sdio_initialize * * Description: - * Initialize SDIO-based MMC/SD card support + * Initialize SDIO-based MMC/SD card support. * ****************************************************************************/ @@ -168,7 +168,7 @@ int stm32_sdio_initialize(void); * Name: stm32_at24_init * * Description: - * Initialize and register the EEPROM for 24XX driver. + * Initialize and register the EEPROM for 24XX driver. * ****************************************************************************/ @@ -187,5 +187,16 @@ int stm32_at24_init(char *path); #ifdef CONFIG_PWM int stm32_pwm_setup(void); #endif +/**************************************************************************** + * Name: stm32_n25qxxx_setup + * + * Description: + * Initialize and register the FLash for N25QXXX driver. + * + ****************************************************************************/ + +#ifdef CONFIG_MTD_W25QXXXJV +int stm32_w25qxxx_setup(void); +#endif #endif /* __BOARDS_ARM_STM32H7_LINUM_STM32H753BI_SRC_LINUM_STM32H753BI_H */ diff --git a/boards/arm/stm32h7/linum-stm32h753bi/src/stm32_bringup.c b/boards/arm/stm32h7/linum-stm32h753bi/src/stm32_bringup.c index 74c103a367..08fc6c0268 100644 --- a/boards/arm/stm32h7/linum-stm32h753bi/src/stm32_bringup.c +++ b/boards/arm/stm32h7/linum-stm32h753bi/src/stm32_bringup.c @@ -232,6 +232,14 @@ int stm32_bringup(void) stm32_fdcansockinitialize(1); # endif +#endif + +#ifdef CONFIG_MTD_W25QXXXJV + ret = stm32_w25qxxx_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_n25qxxx_setup failed: %d\n", ret); + } #endif return OK; diff --git a/boards/arm/stm32h7/linum-stm32h753bi/src/stm32_w25q.c b/boards/arm/stm32h7/linum-stm32h753bi/src/stm32_w25q.c new file mode 100644 index 0000000000..d49ea6bfdd --- /dev/null +++ b/boards/arm/stm32h7/linum-stm32h753bi/src/stm32_w25q.c @@ -0,0 +1,138 @@ +/**************************************************************************** + * boards/arm/stm32h7/linum-stm32h753bi/src/stm32_w25q.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include + +#ifdef CONFIG_FS_NXFFS +#include +#endif + +#ifdef CONFIG_FS_SMARTFS +#include +#endif + +#include "linum-stm32h753bi.h" + +#include "stm32_qspi.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: stm32_w25qxxx_setup + * + * Description: + * This function is called by board-bringup logic to configure the + * flash device. + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is + * returned to indicate the nature of the failure. + * + ****************************************************************************/ + +int stm32_w25qxxx_setup(void) +{ + struct qspi_dev_s *qspi_dev; + struct mtd_dev_s *mtd_dev; + int ret = -1; + + qspi_dev = stm32h7_qspi_initialize(0); + if (!qspi_dev) + { + _err("ERROR: Failed to initialize W25 minor %d: %d\n", + 0, ret); + return -1; + } + + mtd_dev = w25qxxxjv_initialize(qspi_dev, true); + if (!mtd_dev) + { + _err("ERROR: w25qxxxjv_initialize() failed!\n"); + return -1; + } + +#if defined(CONFIG_FS_NXFFS) && !defined(CONFIG_FS_LITTLEFS) + /* Initialize to provide NXFFS on the W25QXXX MTD interface */ + + ret = nxffs_initialize(mtd_dev); + if (ret < 0) + { + _err("ERROR: NXFFS initialization failed: %d\n", ret); + return ret; + } + + ret = nx_mount(NULL, "/w25", "nxffs", 0, "autoformat"); + if (ret < 0) + { + _err("ERROR: Failed to mount the NXFFS volume: %d\n", ret); + return ret; + } + +#endif + +#if !defined(CONFIG_FS_NXFFS) && defined(CONFIG_FS_LITTLEFS) + /* Register the MTD driver so that it can be accessed from the + * VFS. + */ + + ret = register_mtddriver("/dev/w25", mtd_dev, 0755, NULL); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to register MTD driver: %d\n", + ret); + } + + /* Mount the LittleFS file system */ + + ret = nx_mount("/dev/w25", "/w25", "littlefs", 0, "autoformat"); + if (ret < 0) + { + syslog(LOG_ERR, + "ERROR: Failed to mount LittleFS at /w25: %d\n", + ret); + } +#endif + + return 0; +} diff --git a/fs/nxffs/nxffs_dump.c b/fs/nxffs/nxffs_dump.c index 783751029c..f4bcc88763 100644 --- a/fs/nxffs/nxffs_dump.c +++ b/fs/nxffs/nxffs_dump.c @@ -61,7 +61,7 @@ struct nxffs_blkinfo_s #if defined(CONFIG_DEBUG_FEATURES) && defined(CONFIG_DEBUG_FS) static const char g_hdrformat[] = " BLOCK:OFFS TYPE STATE LENGTH\n"; -static const char g_format[] = " %5d:%-5d %s %s %5d\n"; +static const char g_format[] = " %5"PRIi32":%-5d %s %s %5"PRIu32"\n"; #endif /**************************************************************************** @@ -263,7 +263,8 @@ static inline ssize_t nxffs_analyzedata(FAR struct nxffs_blkinfo_s *blkinfo, if (crc != ecrc) { syslog(LOG_NOTICE, g_format, - blkinfo->block, offset, "DATA ", "CRC BAD", datlen); + blkinfo->block, offset, "DATA ", "CRC BAD", + (long unsigned int)datlen); return ERROR; } @@ -272,7 +273,8 @@ static inline ssize_t nxffs_analyzedata(FAR struct nxffs_blkinfo_s *blkinfo, if (blkinfo->verbose) { syslog(LOG_NOTICE, g_format, - blkinfo->block, offset, "DATA ", "OK ", datlen); + blkinfo->block, offset, "DATA ", "OK ", + (long unsigned int)datlen); } return SIZEOF_NXFFS_DATA_HDR + datlen; @@ -489,7 +491,7 @@ int nxffs_dump(FAR struct mtd_dev_s *mtd, bool verbose) } } - syslog(LOG_NOTICE, "%d blocks analyzed\n", blkinfo.nblocks); + syslog(LOG_NOTICE, "%" PRIi32 " blocks analyzed\n", blkinfo.nblocks); kmm_free(blkinfo.buffer); return OK;