I got below build error:, actually I referred C:\ncs\v2.7.0\zephyr\samples\drivers\jesd216; my externl SPI NOR flash is p25q32h and my target is to build a file system such as fatfs on the flash. I also checked the sample under C:\ncs\v2.7.0\zephyr\samples\drivers\spi_flash\boards and set CONFIG_NORDIC_QSPI_NOR, it has the same build exception.
c:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr/drivers/flash/libdrivers__flash.a(spi_nor.c.obj):(.rodata.spi_nor_0_config+0x0): undefined reference to `__device_dts_ord_85' collect2.exe: error: ld returned 1 exit status ninja: build stopped: subcommand failed.
1. DTS
&pinctrl {
i2c0_default: i2c0_default {
group1 {
psels = <NRF_PSEL(TWIM_SCL, 0, 10)>, <NRF_PSEL(TWIM_SDA, 0, 9)>;
};
};
spi1_default: spi1_default {
group1 {
psels = <NRF_PSEL(SPIM_MISO, 0, 14)>,
<NRF_PSEL(SPIM_MOSI, 0, 15)>,
<NRF_PSEL(SPIM_SCK, 0, 17)>;
};
};
};
&spi1 {
status = "okay";
pinctrl-0 = <&spi1_default>;
pinctrl-names = "default";
p25q32h: p25q32h@0 {
compatible = "jedec,spi-nor";
reg = <0>; // SPI Flash 从设备地址
spi-max-frequency = <8000000>; // SPI 最大频率
label = "p25q32h";
size = <0x2000000>; // 32MB
jedec-id = [85 60 16];
};
cs-gpios = <&gpio0 16 0>;
};
2. prj.conf
CONFIG_FLASH=y CONFIG_FLASH_JESD216_API=y # Assume the standard SPI NOR flash driver. If the device uses # another driver add an override configuration in boards/. CONFIG_SPI=y CONFIG_SPI_NOR=y