This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

MCU boot with external Flash littles partition and Secondary image partition

Hello ALL,

I am trying to use MCU boot with my application. I am using NRF916DK and it has external Flash similar to NR52840DK board. Now when I am creating a partition on external Flash and point LittleFs to that storage partition, after compiling when I see the partition.yml in the build folder, the LittleFs always in the primary Flash. I have tried few options as seen in the code but nothing is working. Can somebody please guide me on how I can enable these partitions and point secondary Image and littlefs to those partitions.

Here is my overlay file

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/ {
chosen {
zephyr,bt-uart=&uart0;
};
};
/delete-node/ &storage_partition;
&i2c2 {
compatible = "nordic,nrf-twim";
status = "okay";
sda-pin = <26>;
scl-pin = <27>;
pcf85263a@51 {
compatible = "nxp,pcf85263a";
label = "PCF85063A";
reg = <0x51>;
};
};
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Here is prj.conf

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Heap and stacks
CONFIG_HEAP_MEM_POOL_SIZE=16384
CONFIG_MAIN_STACK_SIZE=8192
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
# General config
CONFIG_NEWLIB_LIBC=y
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
CONFIG_ASSERT=y
CONFIG_REBOOT=y
# Logging config
CONFIG_LOG=y
CONFIG_LOG_PRINTK=y
CONFIG_LOG_IMMEDIATE=y
CONFIG_LOG_FUNC_NAME_PREFIX_ERR=y
CONFIG_LOG_FUNC_NAME_PREFIX_WRN=y
CONFIG_LOG_FUNC_NAME_PREFIX_INF=y
CONFIG_LOG_FUNC_NAME_PREFIX_DBG=y
# Console
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Here is my main.c

 

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <zephyr.h>
#include <logging/log.h>
#include <drivers/uart.h>
#include <fs/fs.h>
#include <fs/littlefs.h>
#include <storage/flash_map.h>
#if (CONFIG_SPI_NOR - 0) || DT_NODE_HAS_STATUS(DT_INST(0, jedec_spi_nor), okay)
#define FLASH_DEVICE DT_LABEL(DT_INST(0, jedec_spi_nor))
#define FLASH_NAME "JEDEC SPI-NOR"
#elif (CONFIG_NORDIC_QSPI_NOR - 0) || DT_NODE_HAS_STATUS(DT_INST(0, nordic_qspi_nor), okay)
#define FLASH_DEVICE DT_LABEL(DT_INST(0, nordic_qspi_nor))
#define FLASH_NAME "JEDEC QSPI-NOR"
#else
#error Unsupported flash driver
#endif
LOG_MODULE_REGISTER(app);
/* Matches LFS_NAME_MAX */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

here is the partition.yml that is generated in the build folder after compilation

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
EMPTY_0:
address: 0xc000
placement:
before:
- mcuboot_pad
region: flash_primary
size: 0x4000
app:
address: 0x1c200
region: flash_primary
size: 0x68e00
external_flash:
address: 0x0
region: external_flash
size: 0x800000
littlefs_storage:
address: 0xfa000
placement:
before:
- end
region: flash_primary
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX