samples/subsys/mgmt/mcumgr/smp_svr: use LitleFS as FS back-end

This patch addapt the sample to using LittleFS as the FS back-end.
After NFFS will be removed this ensures mcumgr FS command functionality.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>

smp_svr cleanu
This commit is contained in:
Andrzej Puzdrowski 2020-01-09 13:44:09 +01:00 committed by Carles Cufí
commit e104741b7c
5 changed files with 13 additions and 43 deletions

View file

@ -15,5 +15,3 @@ project(smp_svr)
target_sources(app PRIVATE
src/main.c
)
zephyr_link_libraries_ifdef(CONFIG_FILE_SYSTEM_NFFS NFFS)

View file

@ -26,10 +26,7 @@ Caveats
*******
* The Zephyr port of ``smp_svr`` is configured to run on a Nordic nRF52x MCU. The
application should build and run for other platforms without modification, but
the file system management commands will not work. To enable file system
management for a different platform, adjust the
:option:`CONFIG_FS_NFFS_FLASH_DEV_NAME` setting in :file:`prj.conf` accordingly.
application should build and run for other platforms without modification.
* The MCUboot bootloader is required for ``img_mgmt`` to function
properly. More information about the Device Firmware Upgrade subsystem and

View file

@ -20,9 +20,9 @@ CONFIG_MCUMGR_SMP_SHELL=y
# Enable flash operations.
CONFIG_FLASH=y
# Enable the NFFS file system.
# Enable the LittleFS file system.
CONFIG_FILE_SYSTEM=y
CONFIG_FILE_SYSTEM_NFFS=y
CONFIG_FILE_SYSTEM_LITTLEFS=y
# Required by the `taskstat` command.
CONFIG_THREAD_MONITOR=y
@ -36,8 +36,3 @@ CONFIG_MCUMGR_CMD_FS_MGMT=y
CONFIG_MCUMGR_CMD_IMG_MGMT=y
CONFIG_MCUMGR_CMD_OS_MGMT=y
CONFIG_MCUMGR_CMD_STAT_MGMT=y
### nRF5 specific settings
# Specify the location of the NFFS file system.
CONFIG_FS_NFFS_FLASH_DEV_NAME="NRF_FLASH_DRV_NAME"

View file

@ -27,10 +27,6 @@ CONFIG_BT_GATT_READ_MULTIPLE=n
# Enable flash operations.
CONFIG_FLASH=y
# Enable the NFFS file system.
#CONFIG_FILE_SYSTEM=y
#CONFIG_FILE_SYSTEM_NFFS=y
# Required by the `taskstat` command.
CONFIG_THREAD_MONITOR=y
@ -43,8 +39,3 @@ CONFIG_STATS=y
CONFIG_MCUMGR_CMD_IMG_MGMT=y
CONFIG_MCUMGR_CMD_OS_MGMT=y
CONFIG_MCUMGR_CMD_STAT_MGMT=y
### nRF5 specific settings
# Specify the location of the NFFS file system.
#CONFIG_FS_NFFS_FLASH_DEV_NAME="NRF_FLASH"

View file

@ -15,7 +15,7 @@
#include <device.h>
#include <fs/fs.h>
#include "fs_mgmt/fs_mgmt.h"
#include <nffs/nffs.h>
#include <fs/littlefs.h>
#endif
#ifdef CONFIG_MCUMGR_CMD_OS_MGMT
#include "os_mgmt/os_mgmt.h"
@ -48,12 +48,12 @@ STATS_NAME_END(smp_svr_stats);
STATS_SECT_DECL(smp_svr_stats) smp_svr_stats;
#ifdef CONFIG_MCUMGR_CMD_FS_MGMT
static struct nffs_flash_desc flash_desc;
static struct fs_mount_t nffs_mnt = {
.type = FS_NFFS,
.mnt_point = "/nffs",
.fs_data = &flash_desc
FS_LITTLEFS_DECLARE_DEFAULT_CONFIG(cstorage);
static struct fs_mount_t littlefs_mnt = {
.type = FS_LITTLEFS,
.fs_data = &cstorage,
.storage_dev = (void *)DT_FLASH_AREA_STORAGE_ID,
.mnt_point = "/lfs"
};
#endif
@ -115,9 +115,6 @@ static void bt_ready(int err)
void main(void)
{
#ifdef CONFIG_MCUMGR_CMD_FS_MGMT
struct device *flash_dev;
#endif
int rc;
rc = STATS_INIT_AND_REG(smp_svr_stats, STATS_SIZE_32, "smp_svr_stats");
@ -125,17 +122,9 @@ void main(void)
/* Register the built-in mcumgr command handlers. */
#ifdef CONFIG_MCUMGR_CMD_FS_MGMT
flash_dev = device_get_binding(CONFIG_FS_NFFS_FLASH_DEV_NAME);
if (!flash_dev) {
printk("Error getting NFFS flash device binding\n");
} else {
/* set backend storage dev */
nffs_mnt.storage_dev = flash_dev;
rc = fs_mount(&nffs_mnt);
if (rc < 0) {
printk("Error mounting nffs [%d]\n", rc);
}
rc = fs_mount(&littlefs_mnt);
if (rc < 0) {
printk("Error mounting littlefs [%d]\n", rc);
}
fs_mgmt_register_group();