Code build errors with DFU(mcuboot) and File systems on Custom board nRF52840

I am getting the following build errors when working with both DFU (MCUboot) and the file system (FAT FS) together.

Errors:

D:/ncs/v2.9.0/zephyr/drivers/disk/flashdisk.c:533:1: error: return type defaults to 'int' [-Werror=implicit-int]
533 | PM_FOREACH_AFFILIATED_TO_disk(DEFINE_FLASHDISKS_CACHE)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
D:/ncs/v2.9.0/zephyr/drivers/disk/flashdisk.c: In function 'PM_FOREACH_AFFILIATED_TO_disk':
D:/ncs/v2.9.0/zephyr/drivers/disk/flashdisk.c:572:30: error: storage class specified for parameter 'flash_disks'
572 | static struct flashdisk_data flash_disks[] = {
| ^~~~~~~~~~~
D:/ncs/v2.9.0/zephyr/drivers/disk/flashdisk.c:572:15: error: parameter 'flash_disks' is initialized
572 | static struct flashdisk_data flash_disks[] = {
| ^~~~~~~~~~~~~~
D:/ncs/v2.9.0/zephyr/drivers/disk/flashdisk.c:573:39: error: 'DEFINE_FLASHDISKS_DEVICE' undeclared (first use in this function)
573 | PM_FOREACH_AFFILIATED_TO_disk(DEFINE_FLASHDISKS_DEVICE)
| ^~~~~~~~~~~~~~~~~~~~~~~~
D:/ncs/v2.9.0/zephyr/drivers/disk/flashdisk.c:573:39: note: each undeclared identifier is reported only once for each function it appears in
D:/ncs/v2.9.0/zephyr/drivers/disk/flashdisk.c:582:1: error: expected declaration specifiers before 'PM_FOREACH_AFFILIATED_TO_disk'
582 | PM_FOREACH_AFFILIATED_TO_disk(VERIFY_CACHE_SIZE_IS_NOT_ZERO_IF_NOT_READ_ONLY)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from D:/ncs/v2.9.0/zephyr/include/zephyr/toolchain/gcc.h:98,
from D:/ncs/v2.9.0/zephyr/include/zephyr/toolchain.h:50,
from D:/ncs/v2.9.0/zephyr/include/zephyr/sys/__assert.h:11,
from D:/ncs/v2.9.0/zephyr/drivers/disk/flashdisk.c:10:
D:/ncs/v2.9.0/zephyr/include/zephyr/init.h:141:44: error: storage class specified for parameter '__init_disk_flash_init'
141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
| ^~~~~~~
D:/ncs/v2.9.0/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
137 | #define _DO_CONCAT(x, y) x ## y
| ^
D:/ncs/v2.9.0/zephyr/include/zephyr/init.h:141:36: note: in expansion of macro '_CONCAT'
141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
| ^~~~~~~
D:/ncs/v2.9.0/zephyr/include/zephyr/init.h:241:17: note: in expansion of macro 'Z_INIT_ENTRY_NAME'
241 | Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)}, \
| ^~~~~~~~~~~~~~~~~
D:/ncs/v2.9.0/zephyr/include/zephyr/init.h:223:9: note: in expansion of macro 'SYS_INIT_NAMED'
223 | SYS_INIT_NAMED(init_fn, init_fn, level, prio)
| ^~~~~~~~~~~~~~
D:/ncs/v2.9.0/zephyr/drivers/disk/flashdisk.c:612:1: note: in expansion of macro 'SYS_INIT'
612 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
| ^~~~~~~~
D:/ncs/v2.9.0/zephyr/include/zephyr/init.h:239:42: error: parameter '__init_disk_flash_init' is initialized
239 | static const Z_DECL_ALIGN(struct init_entry) \
| ^~~~~~~~~~
D:/ncs/v2.9.0/zephyr/include/zephyr/toolchain/common.h:195:55: note: in definition of macro 'Z_DECL_ALIGN'
195 | #define Z_DECL_ALIGN(type) __aligned(__alignof(type)) type
| ^~~~
D:/ncs/v2.9.0/zephyr/include/zephyr/init.h:223:9: note: in expansion of macro 'SYS_INIT_NAMED'
223 | SYS_INIT_NAMED(init_fn, init_fn, level, prio)
| ^~~~~~~~~~~~~~
D:/ncs/v2.9.0/zephyr/drivers/disk/flashdisk.c:612:1: note: in expansion of macro 'SYS_INIT'
612 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
| ^~~~~~~~
D:/ncs/v2.9.0/zephyr/include/zephyr/init.h:141:44: error: section attribute not allowed for '__init_disk_flash_init'
141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
| ^~~~~~~
D:/ncs/v2.9.0/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
137 | #define _DO_CONCAT(x, y) x ## y
| ^
D:/ncs/v2.9.0/zephyr/include/zephyr/init.h:141:36: note: in expansion of macro '_CONCAT'
141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
| ^~~~~~~
D:/ncs/v2.9.0/zephyr/include/zephyr/init.h:241:17: note: in expansion of macro 'Z_INIT_ENTRY_NAME'
241 | Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)}, \
| ^~~~~~~~~~~~~~~~~
D:/ncs/v2.9.0/zephyr/include/zephyr/init.h:223:9: note: in expansion of macro 'SYS_INIT_NAMED'
223 | SYS_INIT_NAMED(init_fn, init_fn, level, prio)
| ^~~~~~~~~~~~~~
D:/ncs/v2.9.0/zephyr/drivers/disk/flashdisk.c:612:1: note: in expansion of macro 'SYS_INIT'
612 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
| ^~~~~~~~
D:/ncs/v2.9.0/zephyr/include/zephyr/init.h:239:42: warning: 'used' attribute ignored [-Wattributes]
239 | static const Z_DECL_ALIGN(struct init_entry) \
| ^~~~~~~~~~
D:/ncs/v2.9.0/zephyr/include/zephyr/toolchain/common.h:195:55: note: in definition of macro 'Z_DECL_ALIGN'
195 | #define Z_DECL_ALIGN(type) __aligned(__alignof(type)) type
| ^~~~
D:/ncs/v2.9.0/zephyr/include/zephyr/init.h:223:9: note: in expansion of macro 'SYS_INIT_NAMED'
223 | SYS_INIT_NAMED(init_fn, init_fn, level, prio)
| ^~~~~~~~~~~~~~
D:/ncs/v2.9.0/zephyr/drivers/disk/flashdisk.c:612:1: note: in expansion of macro 'SYS_INIT'
612 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
| ^~~~~~~~
D:/ncs/v2.9.0/zephyr/include/zephyr/init.h:141:44: error: alignment may not be specified for '__init_disk_flash_init'
141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
| ^~~~~~~
D:/ncs/v2.9.0/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
137 | #define _DO_CONCAT(x, y) x ## y
| ^
D:/ncs/v2.9.0/zephyr/include/zephyr/init.h:141:36: note: in expansion of macro '_CONCAT'
141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
| ^~~~~~~
D:/ncs/v2.9.0/zephyr/include/zephyr/init.h:241:17: note: in expansion of macro 'Z_INIT_ENTRY_NAME'
241 | Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)}, \
| ^~~~~~~~~~~~~~~~~
D:/ncs/v2.9.0/zephyr/include/zephyr/init.h:223:9: note: in expansion of macro 'SYS_INIT_NAMED'
223 | SYS_INIT_NAMED(init_fn, init_fn, level, prio)
| ^~~~~~~~~~~~~~
D:/ncs/v2.9.0/zephyr/drivers/disk/flashdisk.c:612:1: note: in expansion of macro 'SYS_INIT'
612 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
| ^~~~~~~~
In file included from D:/ncs/v2.9.0/zephyr/include/zephyr/device.h:13,
from D:/ncs/v2.9.0/zephyr/include/zephyr/sw_isr_table.h:18,
from D:/ncs/v2.9.0/zephyr/include/zephyr/arch/arm/irq.h:19,
from D:/ncs/v2.9.0/zephyr/include/zephyr/arch/arm/arch.h:24,
from D:/ncs/v2.9.0/zephyr/include/zephyr/arch/cpu.h:19,
from D:/ncs/v2.9.0/zephyr/include/zephyr/kernel_includes.h:36,
from D:/ncs/v2.9.0/zephyr/include/zephyr/kernel.h:17,
from D:/ncs/v2.9.0/zephyr/include/zephyr/drivers/disk.h:30,
from D:/ncs/v2.9.0/zephyr/drivers/disk/flashdisk.c:12:
D:/ncs/v2.9.0/zephyr/drivers/disk/flashdisk.c:612:10: error: 'disk_flash_init' undeclared (first use in this function)
612 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
| ^~~~~~~~~~~~~~~
D:/ncs/v2.9.0/zephyr/include/zephyr/init.h:241:64: note: in definition of macro 'SYS_INIT_NAMED'
241 | Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)}, \
| ^~~~~~~~
D:/ncs/v2.9.0/zephyr/drivers/disk/flashdisk.c:612:1: note: in expansion of macro 'SYS_INIT'
612 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
| ^~~~~~~~
D:/ncs/v2.9.0/zephyr/drivers/disk/flashdisk.c:533:1: error: type of 'DEFINE_FLASHDISKS_CACHE' defaults to 'int' [-Werror=implicit-int]
533 | PM_FOREACH_AFFILIATED_TO_disk(DEFINE_FLASHDISKS_CACHE)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
D:/ncs/v2.9.0/zephyr/include/zephyr/init.h:141:44: error: declaration for parameter '__init_disk_flash_init' but no such parameter
141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
| ^~~~~~~
D:/ncs/v2.9.0/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
137 | #define _DO_CONCAT(x, y) x ## y
| ^
D:/ncs/v2.9.0/zephyr/include/zephyr/init.h:141:36: note: in expansion of macro '_CONCAT'
141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
| ^~~~~~~
D:/ncs/v2.9.0/zephyr/include/zephyr/init.h:241:17: note: in expansion of macro 'Z_INIT_ENTRY_NAME'
241 | Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)}, \
| ^~~~~~~~~~~~~~~~~
D:/ncs/v2.9.0/zephyr/include/zephyr/init.h:223:9: note: in expansion of macro 'SYS_INIT_NAMED'
223 | SYS_INIT_NAMED(init_fn, init_fn, level, prio)
| ^~~~~~~~~~~~~~
D:/ncs/v2.9.0/zephyr/drivers/disk/flashdisk.c:612:1: note: in expansion of macro 'SYS_INIT'
612 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
| ^~~~~~~~
D:/ncs/v2.9.0/zephyr/drivers/disk/flashdisk.c:572:30: error: declaration for parameter 'flash_disks' but no such parameter
572 | static struct flashdisk_data flash_disks[] = {
| ^~~~~~~~~~~
D:/ncs/v2.9.0/zephyr/drivers/disk/flashdisk.c:614: error: expected '{' at end of input
D:/ncs/v2.9.0/zephyr/drivers/disk/flashdisk.c:614: warning: control reaches end of non-void function [-Wreturn-type]
D:/ncs/v2.9.0/zephyr/drivers/disk/flashdisk.c: At top level:
D:/ncs/v2.9.0/zephyr/drivers/disk/flashdisk.c:464:37: warning: 'flash_disk_ops' defined but not used [-Wunused-const-variable=]
464 | static const struct disk_operations flash_disk_ops = {
| ^~~~~~~~~~~~~~

=== main.c ===

/*
 * Copyright (c) 2012-2014 Wind River Systems, Inc.
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#include <stdio.h>
#include <zephyr/kernel.h>         
#include <zephyr/device.h>    
#include <zephyr/drivers/gpio.h>
#include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/hci.h>
#include <zephyr/bluetooth/uuid.h>
#include <zephyr/bluetooth/gatt.h>
#include <zephyr/bluetooth/gap.h>         
#include <zephyr/usb/usb_device.h>  
#include <zephyr/usb/class/usb_dfu.h>
#include <zephyr/sys/reboot.h>
#include <zephyr/dfu/mcuboot.h> 
#include <zephyr/logging/log.h> 

#include <zephyr/fs/fs.h>
#include <zephyr/storage/flash_map.h>
#include <ff.h>

#include <zephyr/drivers/disk.h>
#include <zephyr/storage/disk_access.h>

uint8_t test_buf[512];
char file_read_buf[64];

static FATFS fat_fs;
struct fs_file_t file;
struct fs_dirent dirent;

struct fs_mount_t fatfs_mnt = {
    .type = FS_FATFS,
    .fs_data = &fat_fs,
    .mnt_point = "/NAND:",
    .storage_dev = "NAND"
};

int ble_start_advertising(void)
{
    struct bt_le_adv_param adv_param = 
        BT_LE_ADV_PARAM_INIT(BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_USE_IDENTITY,
                             BT_GAP_ADV_FAST_INT_MIN_2,
                             BT_GAP_ADV_FAST_INT_MAX_2,
                             NULL);

    struct bt_data ad[] = {
        BT_DATA_BYTES(BT_DATA_FLAGS, BT_LE_AD_NO_BREDR),
        BT_DATA(BT_DATA_NAME_COMPLETE, "FYZKS_WDS_DFU", sizeof("FYZKS_WDS_DFU") - 1),
    };

    int err = bt_le_adv_start(&adv_param, ad, ARRAY_SIZE(ad), NULL, 0);
    if (err) {
        printk("Advertising failed (err %d)\n", err);
        return err;
    }

    printk("Advertising started\n");
    return 0;
}


static void bt_ready(int err) 
{
    if (err) {
        printf("Bluetooth init failed (err %d)\n", err);
        return;
    }

    printf("Bluetooth initialized\n");
}

int ble_init(void)
{
    int err;

    err = bt_enable(bt_ready);
    if (err) 
	{
        printf("Bluetooth initialization failed (err %d)\n", err);
        return err;
    }

    printf("Bluetooth initialized\n");
	return 0;
}

int main(void)
{
	int ret ;
	ret = usb_enable(NULL);
	if(ret!=0)
	{
		printf("usb failed ..\n");
	}

	if (boot_is_img_confirmed()) 
	{
        printf("Firmware is already confirmed\n");
    } 
	else 
	{
        printf("Firmware update detected, confirming new image\n");
        if (boot_write_img_confirmed()) 
		{
            printf("Failed to confirm new image\n");
        } 
		else 
		{
            printf("New image confirmed successfully\n");
        }
    }

	// Init BLE
    ret = ble_init();
    if (ret) {
        printf("Bluetooth enable failed (ret %d)\n", ret);
        return 0;
    }

    // Start advertising
    ret = ble_start_advertising();
    if (ret) {
        printf("Advertising failed to start (ret %d)\n", ret);
        return 0;
    }

	ret = disk_access_init("NAND");
    if (ret != 0) 
    {
        printf("Disk init failed (%d)\n", ret);
    }

    // Get disk status
    uint32_t sector_count, sector_size;
    ret = disk_access_ioctl("NAND", DISK_IOCTL_GET_SECTOR_COUNT, &sector_count);
    if (ret == 0) 
    {
        printf("Sector count: %u,\n", sector_count);
    } 
    else 
    {
        printf("Failed to get sector count: %d\n", ret);
    }

    ret = disk_access_ioctl("NAND", DISK_IOCTL_GET_SECTOR_SIZE, &sector_size);
    if (ret == 0) 
    {
        printf("Sector size: %u\n", sector_size);
    } 
    else 
    {
        printf("Failed to get sector size: %d\n", ret);
    }

    // Try to read first sector to verify disk access  
    
    ret = disk_access_read("NAND", test_buf, 0, 1);  
    if (ret == 0) 
    {
        printf("Disk read test successful\n");
    } 
    else 
    {
        printf("Disk read test failed: %d\n", ret);
        //return 0;
    }
    ret = fs_mount(&fatfs_mnt);
    if (ret < 0) 
    {
        printf("FATFS mount failed (%d)\n", ret);
        
        // Try to format the flash if mount fails
        printf("Attempting to format...\n");
        ret = fs_mkfs(FS_FATFS, "NAND", NULL, 0);
        if (ret < 0) 
        {
            printf("Format failed (%d)\n", ret);
            return 0;
        }
    
        // Try mounting again after format
        ret = fs_mount(&fatfs_mnt);
        if (ret < 0) 
        {
            printf("Mount failed after format (%d)\n", ret);
            return 0;
        }
    } 
    printf("mount successfully....%s\n", fatfs_mnt.mnt_point);

    fs_file_t_init(&file);

    if (fs_stat("/NAND:/new_folder", &dirent) != 0)  // if directory not exists
    {
        fs_mkdir("/NAND:/new_folder");
    }

    if (fs_stat("/NAND:/new_folder/file.txt", &dirent) != 0)   // file not exists
    {
        ret = fs_open(&file, "/NAND:/new_folder/file.txt", FS_O_CREATE | FS_O_WRITE);
        if (ret < 0) 
        {
            printf("Failed to open file for writing: %d\n", ret);
            return 0;
        }
        if(ret == 0)
        {
            const char *msg = "Hello abcdefghi...";
            fs_write(&file, msg, strlen(msg));
            fs_sync(&file);
            fs_close(&file);

            ret = fs_open(&file,"/NAND:/new_folder/file.txt", FS_O_READ);
            if (ret < 0) 
            {
                printf("Failed to open file for reading: %d\n", ret);

            }
        }

    }
    else
    {
        printf("File already exists, skipping write\n");
    }
  
    ret = fs_read(&file, file_read_buf, sizeof(file_read_buf) - 1);
    printf("File content: %s,--%d\n", file_read_buf,ret);  
    fs_close(&file);

	k_msleep(100);
	while(1)
	{
		printf("Hello World!........\n");
		k_msleep(500);
	}

	return 0;
}


=== prj.conf ===


# Use CDC_ACM as console
CONFIG_UART_CONSOLE=y
CONFIG_STDOUT_CONSOLE=y


# ===== CONSOLE SYSTEM =====
CONFIG_CONSOLE=y                     # Enable the console subsystem
CONFIG_SERIAL=y                      # Enable serial driver support (needed for USB CDC ACM)

# ===== USB DEVICE STACK =====
CONFIG_USB_DEVICE_STACK=y            # Enable USB device functionality
CONFIG_USB_CDC_ACM=y                 # Enable CDC ACM class (virtual serial port)
CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=y  # Start USB immediately when device boots

# ===== USB DEVICE IDENTIFICATION =====
CONFIG_USB_DEVICE_PRODUCT="nRF5240 Custom"
CONFIG_USB_DEVICE_VID=0x1915
CONFIG_USB_DEVICE_PID=0x521F         
CONFIG_USB_DEVICE_MANUFACTURER="Custom Board"
CONFIG_USB_DEVICE_SN="CONSOLE001"   

# ===== IMPROVED PRINTF SUPPORT =====
CONFIG_NEWLIB_LIBC=y                 # Use newlib instead of minimal libc
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y    # Enable floating point printf (optional)

# ===== DEBUGGING AND LOGGING =====
CONFIG_LOG=y                         # Enable logging subsystem

# DFU via USB
CONFIG_USB_DFU_CLASS=y
CONFIG_USB_DFU_WILL_DETACH=y
CONFIG_USB_DFU_ENABLE_UPLOAD=y
CONFIG_USB_DFU_REBOOT=y

# MCUBoot
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_MCUBOOT_IMG_MANAGER=y
CONFIG_IMG_MANAGER=y
CONFIG_MCUBOOT_BOOTUTIL_LIB=y

# Reboot Support
CONFIG_REBOOT=y

# Required for partitions and DFU to work properly
CONFIG_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_IMG_ERASE_PROGRESSIVELY=y  # ?


# Bluetooth + DFU over BLE
CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_MCUMGR=y   #**
CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y
CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU_SPEEDUP=y


# ///////////////////

CONFIG_SPI=y
CONFIG_NORDIC_QSPI_NOR=y

# FAT FS
CONFIG_FILE_SYSTEM=y
CONFIG_FS_FATFS_LFN=y
CONFIG_DISK_ACCESS=y
CONFIG_FAT_FILESYSTEM_ELM=y
CONFIG_DISK_DRIVER_FLASH=y
CONFIG_FS_FATFS_MKFS=y
CONFIG_FS_FATFS_MOUNT_MKFS=y
CONFIG_FILE_SYSTEM_MKFS=y

CONFIG_USB_MASS_STORAGE=y   # to open as drive
CONFIG_MASS_STORAGE_DISK_NAME="NAND"

CONFIG_SETTINGS=y  #?



=== overlay ===

/ {
    chosen {
        zephyr,console = &cdc_acm_uart0;
        zephyr,shell-uart = &cdc_acm_uart0;
		zephyr,primary-slot = &slot0_partition;
        zephyr,secondary-slot = &slot1_partition;
    };
};

&pinctrl {

	qspi_default: qspi_default {
		group1 {
			psels = <NRF_PSEL(QSPI_SCK, 0, 21)>,
				<NRF_PSEL(QSPI_IO0, 0, 20)>,
				<NRF_PSEL(QSPI_IO1, 0, 24)>,
				<NRF_PSEL(QSPI_IO2, 0, 22)>,
				<NRF_PSEL(QSPI_IO3, 0, 23)>,
				<NRF_PSEL(QSPI_CSN, 0, 25)>;
		};
	};

	qspi_sleep: qspi_sleep {
		group1 {
			psels = <NRF_PSEL(QSPI_SCK, 0, 21)>,
				<NRF_PSEL(QSPI_IO0, 0, 20)>,
				<NRF_PSEL(QSPI_IO1, 0, 24)>,
				<NRF_PSEL(QSPI_IO2, 0, 22)>,
				<NRF_PSEL(QSPI_IO3, 0, 23)>;
			low-power-enable;
		};
		group2 {
			psels = <NRF_PSEL(QSPI_CSN, 0, 25)>;
			low-power-enable;
			bias-pull-up;
		};
	};

};


&qspi {
	status = "okay";
	pinctrl-0 = <&qspi_default>;
	pinctrl-1 = <&qspi_sleep>;
	pinctrl-names = "default", "sleep";
	p25q16h: p25q16h@0 {
		compatible = "nordic,qspi-nor";
		reg = <0>;
		sck-frequency = <104000000>;
		quad-enable-requirements = "S2B1v1";
		jedec-id = [85 60 15];
		sfdp-bfp = [
			e5 20 f1 ff  ff ff ff 00  44 eb 08 6b  08 3b 80 bb
			ee ff ff ff  ff ff 00 ff  ff ff 00 ff  0c 20 0f 52
			10 d8 08 81
		];
		size = <16777216>;  //size is in bits
		has-dpd;
		t-enter-dpd = <3000>;
		t-exit-dpd = <8000>;

		partitions {
		compatible = "fixed-partitions";
		#address-cells = <1>;
		#size-cells = <1>;

		fatfs_part: partition@0 {
   			 label = "fatfs";
    		reg = <0x00000000 0x00200000>;  // 2MB
			};

		};
	};
};


/ {
	disk0: disk {
	 compatible = "zephyr,flash-disk";
		disk-name = "NAND";
		partition = <&fatfs_part>;
		sector-size = <512>;
		cache-size = <4096>;
	};
};

&flash0 {

	partitions {
		compatible = "fixed-partitions";
		#address-cells = <1>;
		#size-cells = <1>;

		boot_partition: partition@0 {
			label = "mcuboot";
			reg = <0x00000000 0x0000C000>;
		};
		slot0_partition: partition@c000 {
			label = "image-0";
			reg = <0x0000C000 0x00076000>;
		};
		slot1_partition: partition@82000 {
			label = "image-1";
			reg = <0x00082000 0x00076000>;
		};

		/*
		 * The flash starting at 0x000f8000 and ending at
		 * 0x000fffff is reserved for use by the application.
		 */

		/*
		 * Storage partition will be used by FCB/LittleFS/NVS
		 * if enabled.
		 */
		storage_partition: partition@f8000 {
			label = "storage";
			reg = <0x000f8000 0x00008000>;
		};
	};
};


&usbd {
    status = "okay";
};


&zephyr_udc0 {
	cdc_acm_uart0: cdc_acm_uart0 {
		compatible = "zephyr,cdc-acm-uart";
		label = "CDC_ACM_0";
	};
};


Related