been having issues trying to get LittleFS to work on external SPI NOR Flash. I get linker errors leading me to believe something is missing in a config. I’ve looked at many samples on how to do this but none of the samples show how to do LittleFS on external SPI flash. So in putting the pieces together, I think something is missing.
It looks like a ordinal number with SPI2 in the dts is creating an issue. below is the error and i have included the overlay.
[759/771] Building C object zephyr/kernel/CMakeFiles/kernel.dir/sched.c.obj [760/771] Linking CXX static library zephyr\kernel\libkernel.a [761/771] Linking CXX executable zephyr\zephyr_pre0.elf FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map cmd.exe /C "cd . && C:\Users\ncs\v1.9.1\toolchain\opt\bin\arm-none-eabi-g++.exe @CMakeFiles\zephyr_pre0.rsp -o zephyr\zephyr_pre0.elf && cmd.exe /C "cd /D C:\Users\Development\thread-dev\pbsm-fw\build-833\zephyr && C:\Users\ncs\v1.9.1\toolchain\opt\bin\cmake.exe -E echo "" c:/users/ncs/v1.9.1/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: zephyr/drivers/spi/libdrivers__spi.a(spi_nrfx_spim.c.obj):(.rodata.__compound_literal.0+0x0): undefined reference to `__device_dts_ord_9' c:/users/ncs/v1.9.1/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: zephyr/drivers/flash/libdrivers__flash.a(spi_nor.c.obj):(.data.__compound_literal.0+0x0): undefined reference to `__device_dts_ord_9' collect2.exe: error: ld returned 1 exit status ninja: build stopped: subcommand failed. FATAL ERROR: command exited with status 1: 'c:\Users\ncs\v1.9.1\toolchain\opt\bin\cmake.EXE' --build 'c:\Users\Development\thread-dev\pbsm-fw\build-833' The terminal process terminated with exit code: 1.
dts-v1/;
#include <nordic/nrf52833_qiaa.dtsi>
/ {
model = "PBSM NRF52833";
compatible = "nordic,nrf52833-dk-nrf52833";
chosen {
zephyr,console = &uart0;
zephyr,shell-uart = &uart0;
zephyr,uart-mcumgr = &uart0;
zephyr,bt-mon-uart = &uart0;
zephyr,bt-c2h-uart = &uart0;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,code-partition = &slot0_partition;
};
pwmleds {
compatible = "pwm-leds";
pwm_led_blue: pwm_led_blue {
pwms = <&pwm0 15>; // P0.15
};
pwm_led_green: pwm_led_green {
pwms = <&pwm0 36>; // P1.04
};
pwm_led_red: pwm_led_red {
pwms = <&pwm0 24>; // P0.24
};
};
buttons {
compatible = "gpio-keys";
user_button: user_button {
gpios = <&gpio0 11 (GPIO_ACTIVE_LOW)>;
label = "User Button";
};
accl_int1: accl_int1 {
gpios = <&gpio0 13 (GPIO_ACTIVE_HIGH)>;
label = "Accelerometer interrupt 1";
};
accl_int2: accl_int2 {
gpios = <&gpio0 16 (GPIO_ACTIVE_HIGH)>;
label = "Accelerometer interrupt 2";
};
};
outputs {
compatible = "gpio-leds";
acc_en: acc_en {
gpios = <&gpio0 25 (GPIO_ACTIVE_HIGH)>;
label = "Accelerometer power enable";
};
temp_en: temp_en {
gpios = <&gpio1 2 (GPIO_ACTIVE_HIGH)>;
label = "Temp sensor power enable";
};
mem_en: mem_en {
gpios = <&gpio1 1 (GPIO_ACTIVE_HIGH)>;
label = "Memory power enable";
};
accel_trig: accel_trig {
gpios = <&gpio0 2 (GPIO_ACTIVE_HIGH)>;
label = "Accelerometer trigger";
};
};
/* These aliases are provided for compatibility with samples */
aliases {
green-pwm-led = &pwm_led_green;
blue-pwm-led = &pwm_led_blue;
red-pwm-led = &pwm_led_red;
user-button = &user_button;
acc-en = &acc_en;
temp-en = &temp_en;
mem-en = &mem_en;
accel-trig = &accel_trig;
accl-int1 = &accl_int1;
accl-int2 = &accl_int2;
};
};
&gpiote {
status = "okay";
};
&gpio0 {
status = "okay";
};
&gpio1 {
status = "okay";
};
&uart0 {
compatible = "nordic,nrf-uarte";
status = "okay";
current-speed = <115200>;
tx-pin = <6>; // P0.06
rx-pin = <8>; // P0.08
};
&i2c0 {
compatible = "nordic,nrf-twi";
status = "okay";
clock-frequency = <100000>;
sda-pin = <26>; // P0.26
scl-pin = <27>; // P0.27
};
&spi1 {
compatible = "nordic,nrf-spi";
status = "okay";
sck-pin = <41>; // P1.09
mosi-pin = <40>; // P1.08
miso-pin = <4>; // P0.04
};
&spi2 {
compatible = "nordic,nrf-spim";
status = "okay";
sck-pin = <19>; // SCLK/P0.19
mosi-pin = <17>; // SI/SIO0/P0.17
miso-pin = <22>; // SO/SIO1/P0.22
cs-gpios = <&gpio0 23 GPIO_ACTIVE_LOW>;
mx25r1635f@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <80000000>;
label = "MX25R16";
jedec-id = [c2 28 15];
size = <DT_SIZE_M(16)>;
has-dpd;
t-enter-dpd = <10000>;
t-exit-dpd = <35000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
slot1_partition: partition@0 {
label = "image-1";
reg = <0x00000000 0x64000>;
};
data_partition: partition@64000 {
label = "data";
reg = <0x64000 0x8000>;
};
log_partition: partition@6C000 {
label = "log";
reg = <0x6C000 0xF94000>;
};
};
fstab {
compatible = "zephyr,fstab";
data: data {
compatible = "zephyr,fstab,littlefs";
mount-point = "/data";
partition = <&data_partition>;
automount;
read-size = <16>;
prog-size = <16>;
cache-size = <64>;
lookahead-size = <32>;
block-cycles = <512>;
};
log: log {
compatible = "zephyr,fstab,littlefs";
mount-point = "/log";
partition = <&log_partition>;
automount;
read-size = <16>;
prog-size = <16>;
cache-size = <64>;
lookahead-size = <32>;
block-cycles = <512>;
};
};
};
};
&pwm0 {
status = "okay";
ch0-pin = <15>; // P0.15
ch1-pin = <36>; // P1.04
ch2-pin = <24>; // P0.24
};
&timer2 {
status = "okay";
};
&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
boot_partition: partition@0 {
label = "mcuboot";
reg = <0x00000000 0xc000>;
};
slot0_partition: partition@c000 {
label = "image-0";
reg = <0x0000C000 0x64000>;
};
scratch_partition: partition@70000 {
label = "image-scratch";
reg = <0x00070000 0xa000>;
};
storage_partition: partition@7a000 {
label = "storage";
reg = <0x0007a000 0x00006000>;
};
};
};