nRF5340 - Connect External Flash (MX25U12832F)

1. nRF Connect SDK: v2.3

2. prj.conf

# Optionally force the file system to be recreated
#CONFIG_APP_WIPE_STORAGE=y

# fs_dirent structures are big.
CONFIG_MAIN_STACK_SIZE=2048

# Let __ASSERT do its job
CONFIG_DEBUG=y

CONFIG_LOG=y
CONFIG_LOG_MODE_MINIMAL=y

CONFIG_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_FLASH_PAGE_LAYOUT=y

CONFIG_FILE_SYSTEM=y
CONFIG_FILE_SYSTEM_LITTLEFS=y

// enabled BT
CONFIG_BT=y

CONFIG_NORDIC_QSPI_NOR=y
CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096

// set partition manager littlefs size to 128 MiB
CONFIG_PM_PARTITION_SIZE_LITTLEFS=0x8000000
CONFIG_PM_PARTITION_REGION_LITTLEFS_EXTERNAL=y

3. overlay

/ {
    chosen {
       nordic,pm-ext-flash = &mx25u128;
    };
};

&qspi {
	mx25u128: mx25u12832f@0 {
		compatible = "nordic,qspi-nor";
		reg = <0>;
		/* MX25R64 supports only pp and pp4io */
		writeoc = "pp4io";
		/* MX25R64 supports all readoc options */
		readoc = "read4io";
		sck-frequency = <8000000>;
		jedec-id = [c2 25 38];
		// sfdp-bfp = [
		// 	e5 20 f1 ff  ff ff ff 03  44 eb 08 6b  08 3b 04 bb
		// 	ee ff ff ff  ff ff 00 ff  ff ff 00 ff  0c 20 0f 52
		// 	10 d8 00 ff  23 72 f5 00  82 ed 04 cc  44 83 68 44
		// 	30 b0 30 b0  f7 c4 d5 5c  00 be 29 ff  f0 d0 ff ff
		// ];
		size = <134217728>;
		has-dpd;
		t-enter-dpd = <10000>;
		t-exit-dpd = <35000>;
	};
};

4. Problem Description/ Question

I want to utilize mx25u128 which is 128MiB with partition manager. 

- Build Error: Attached detailed error messages at the bottom of the post. How do I fix this?

- Enabled BT, so had to use Partition Manager. I used CONFIG_PM_PARTITION_SIZE_LITTLEFS and CONFIG_PM_PARTITION_REGION_LITTLEFS_EXTERNAL to set littlefs_storage's size. How do I achieve the same thing using pm_static.yml?

- Here is partition manager report. Under external_flash, the size of external_flash is negative. How do I fix this?

 

- in overlay, how do I fill "sfdp-bfp" section for mx25u128?

6. Build Error Message

Building littlefs
C:\WINDOWS\system32\cmd.exe /d /s /c "west build --build-dir c:/littlefs/build c:/littlefs"

[0/16] Performing build step for 'hci_rpmsg_subimage'
[0/16] Performing build step for 'b0n_subimage'
[1/15] Linking C static library modules\nrf\subsys\bootloader\bl_validation\lib..__nrf__subsys__bootloader__bl_validation.a
[2/15] Linking C static library modules\nrf\subsys\bootloader\bl_storage\lib..__nrf__subsys__bootloader__bl_storage.a
[3/15] Linking C static library app\libapp.a
[4/15] Linking C static library modules\nrf\subsys\fw_info\lib..__nrf__subsys__fw_info.a
[5/15] Building C object modules/nrf/subsys/pcd/CMakeFiles/..__nrf__subsys__pcd.dir/src/pcd.c.obj
FAILED: modules/nrf/subsys/pcd/CMakeFiles/..__nrf__subsys__pcd.dir/src/pcd.c.obj
C:\ncs\toolchains\v2.3.0\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -DEXT_API_MAGIC=0x281ee6de,0xb845acea,13570 -DFIRMWARE_INFO_MAGIC=0x281ee6de,0x8fcebb4c,13570 -DKERNEL -DNRF5340_XXAA_NETWORK -DUSE_PARTITION_MANAGER=1 -DVALIDATION_INFO_MAGIC=0x281ee6de,0x86518483,79106 -DVALIDATION_POINTER_MAGIC=0x281ee6de,0x6919b47e,79106 -D__PROGRAM_START -D__ZEPHYR__=1 -IC:/ncs/v2.3.0/zephyr/include -Izephyr/include/generated -IC:/ncs/v2.3.0/zephyr/soc/arm/nordic_nrf/nrf53 -IC:/ncs/v2.3.0/zephyr/soc/arm/nordic_nrf/common/. -IC:/ncs/v2.3.0/nrf/include -IC:/ncs/v2.3.0/nrf/subsys/bootloader/include -IC:/ncs/v2.3.0/nrf/tests/include -IC:/ncs/v2.3.0/modules/hal/cmsis/CMSIS/Core/Include -IC:/ncs/v2.3.0/modules/hal/nordic/nrfx -IC:/ncs/v2.3.0/modules/hal/nordic/nrfx/drivers/include -IC:/ncs/v2.3.0/modules/hal/nordic/nrfx/mdk -IC:/ncs/v2.3.0/zephyr/modules/hal_nordic/nrfx/. -IC:/ncs/v2.3.0/nrfxlib/crypto/nrf_oberon/include -isystem C:/ncs/v2.3.0/zephyr/lib/libc/minimal/include -isystem c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/include -isystem c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/include-fixed -fno-strict-aliasing -Os -imacros C:/littlefs/build/hci_rpmsg/b0n/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m33+nodsp -mthumb -mabi=aapcs -mfp16-format=ieee --sysroot=C:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi -imacros C:/ncs/v2.3.0/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=C:/ncs/v2.3.0/nrf/samples/nrf5340/netboot=CMAKE_SOURCE_DIR -fmacro-prefix-map=C:/ncs/v2.3.0/zephyr=ZEPHYR_BASE -fmacro-prefix-map=C:/ncs/v2.3.0=WEST_TOPDIR -ffunction-sections -fdata-sections -std=c99 -nostdinc -MD -MT modules/nrf/subsys/pcd/CMakeFiles/..__nrf__subsys__pcd.dir/src/pcd.c.obj -MF modules\nrf\subsys\pcd\CMakeFiles\..__nrf__subsys__pcd.dir\src\pcd.c.obj.d -o modules/nrf/subsys/pcd/CMakeFiles/..__nrf__subsys__pcd.dir/src/pcd.c.obj -c C:/ncs/v2.3.0/nrf/subsys/pcd/src/pcd.c
In file included from C:\ncs\v2.3.0\nrf\subsys\pcd\src\pcd.c:9:
C:\ncs\v2.3.0\nrf\include\dfu\pcd.h:47:25: error: 'PM__PCD_SRAM_ADDRESS' undeclared here (not in a function); did you mean 'PM_SRAM_ADDRESS'?
47 | #define PCD_CMD_ADDRESS PM__PCD_SRAM_ADDRESS
| ^~~~~~~~~~~~~~~~~~~~
C:\ncs\v2.3.0\nrf\subsys\pcd\src\pcd.c:54:48: note: in expansion of macro 'PCD_CMD_ADDRESS'
54 | static struct pcd_cmd *cmd = (struct pcd_cmd *)PCD_CMD_ADDRESS;
| ^~~~~~~~~~~~~~~
ninja: build stopped: subcommand failed.
FAILED: modules/nrf/samples/b0n_subimage-prefix/src/b0n_subimage-stamp/b0n_subimage-build b0n/zephyr/zephyr.hex b0n/zephyr/zephyr.elf
cmd.exe /C "cd /D C:\Users\sungj\_PM_Feelix_DEV\HealthPatchTest_Dev\littlefs\build\hci_rpmsg\b0n && C:\ncs\toolchains\v2.3.0\opt\bin\cmake.exe --build . --"
[2/16] Generating dev_handles.c
ninja: build stopped: subcommand failed.
[1/16] Linking C executable zephyr\zephyr_pre0.elf
FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map
cmd.exe /C "cd . && C:\ncs\toolchains\v2.3.0\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -gdwarf-4 zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr\zephyr_pre0.elf -Wl,-T zephyr/linker_zephyr_pre0.cmd -Wl,-Map=C:/littlefs/build/zephyr/zephyr_pre0.map -Wl,--whole-archive app/libapp.a zephyr/libzephyr.a zephyr/arch/common/libarch__common.a zephyr/arch/arch/arm/core/aarch32/libarch__arm__core__aarch32.a zephyr/arch/arch/arm/core/aarch32/cortex_m/libarch__arm__core__aarch32__cortex_m.a zephyr/arch/arch/arm/core/aarch32/cortex_m/cmse/libarch__arm__core__aarch32__cortex_m__cmse.a zephyr/arch/arch/arm/core/aarch32/mpu/libarch__arm__core__aarch32__mpu.a zephyr/lib/libc/minimal/liblib__libc__minimal.a zephyr/soc/arm/common/cortex_m/libsoc__arm__common__cortex_m.a zephyr/boards/boards/arm/nrf5340dk_nrf5340_cpuapp/libboards__arm__nrf5340dk_nrf5340.a zephyr/subsys/bluetooth/common/libsubsys__bluetooth__common.a zephyr/subsys/bluetooth/host/libsubsys__bluetooth__host.a zephyr/subsys/fs/libsubsys__fs.a zephyr/subsys/net/libsubsys__net.a zephyr/drivers/clock_control/libdrivers__clock_control.a zephyr/drivers/console/libdrivers__console.a zephyr/drivers/gpio/libdrivers__gpio.a zephyr/drivers/flash/libdrivers__flash.a zephyr/drivers/serial/libdrivers__serial.a zephyr/drivers/bluetooth/libdrivers__bluetooth.a zephyr/drivers/timer/libdrivers__timer.a zephyr/drivers/pinctrl/libdrivers__pinctrl.a zephyr/drivers/mbox/libdrivers__mbox.a modules/nrf/drivers/hw_cc310/lib..__nrf__drivers__hw_cc310.a modules/hal_nordic/nrfx/libmodules__hal_nordic__nrfx.a modules/libmetal/libmetal/lib/libmetal.a modules/littlefs/libmodules__littlefs.a modules/open-amp/open-amp/lib/libopen_amp.a -Wl,--no-whole-archive zephyr/kernel/libkernel.a zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj -L"c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/thumb/v8-m.main/nofp" -LC:/littlefs/build/zephyr -lgcc zephyr/arch/common/libisr_tables.a -no-pie -mcpu=cortex-m33 -mthumb -mabi=aapcs -mfp16-format=ieee -Wl,--gc-sections -Wl,--build-id=none -Wl,--sort-common=descending -Wl,--sort-section=alignment -Wl,-u,_OffsetAbsSyms -Wl,-u,_ConfigAbsSyms -nostdlib -static -Wl,-X -Wl,-N -Wl,--orphan-handling=warn C:/ncs/v2.3.0/nrfxlib/crypto/nrf_cc312_platform/lib/cortex-m33/soft-float/no-interrupts/libnrf_cc312_platform_0.9.16.a && cmd.exe /C "cd /D C:\Users\sungj\_PM_Feelix_DEV\HealthPatchTest_Dev\littlefs\build\zephyr && C:\ncs\toolchains\v2.3.0\opt\bin\cmake.exe -E echo ""
c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: zephyr/libzephyr.a(flash_map_partition_manager.c.obj):(.rodata.default_flash_map+0x1c): undefined reference to `__device_dts_ord_137'
c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: zephyr/libzephyr.a(flash_map_partition_manager.c.obj):(.rodata.default_flash_map+0x2c): undefined reference to `__device_dts_ord_137'
collect2.exe: error: ld returned 1 exit status
FAILED: modules/nrf/samples/hci_rpmsg_subimage-prefix/src/hci_rpmsg_subimage-stamp/hci_rpmsg_subimage-build hci_rpmsg/zephyr/zephyr.hex hci_rpmsg/zephyr/zephyr.elf hci_rpmsg/zephyr/merged_CPUNET.hex
cmd.exe /C "cd /D C:\Users\sungj\_PM_Feelix_DEV\HealthPatchTest_Dev\littlefs\build\hci_rpmsg && C:\ncs\toolchains\v2.3.0\opt\bin\cmake.exe --build . --"
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\v2.3.0\opt\bin\cmake.EXE' --build 'c:\Users\sungj\_PM_Feelix_DEV\HealthPatchTest_Dev\littlefs\build'

Parents Reply Children
No Data
Related