Issue with devicetree configuration, while using MCUBoot on v2.4.1 and external flash module

Dear All,

At the moment we have created a custom board device tree, based on the nRF9160 SOC.

At the moment we are using the v2.1.0 of the nRF SDK and everything works fine.  We need to upgrade to v2.4.1 that includes the nRF7002 chip.

During this transition we have encountered the following issue:

In the custom_board_nrf9160_common.dts we had the following node for the external flash:

&spi3 {
    compatible = "nordic,nrf-spim";
    status = "okay";
    cs-gpios = <&gpio0 21 GPIO_ACTIVE_LOW>, <&gpio0 31 GPIO_ACTIVE_LOW>;
    pinctrl-0 = <&spi3_default>;
    pinctrl-1 = <&spi3_sleep>;
    pinctrl-names = "default", "sleep";

    w25q16jv: w25q16jv@0 {
        compatible = "jedec,spi-nor";
        reg = <0>;
        spi-max-frequency = <1000000>;
        reset-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
        size = <0x1000000>;
        has-dpd;
        t-enter-dpd = <4000>;
        t-exit-dpd = <25000>;
        jedec-id = [ ef 40 15  ];
    };
    
    ...
};


When transitioning to the new version of the SDK, this node this issue:

[275/285] Linking C executable zephyr\zephyr_pre0.elf
FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map .../build/mcuboot/zephyr/zephyr_pre0.map

...

undefined reference to '__device_dts_ord_110'


Looking into the generated file build/zephyr/mcuboot/include/devicetree_generated.h I see this:




Based on this I decided to remove the external flash node from the custom_board_nrf9160_common.dts and add it to an overlay file for the non-secure part of my application

custom_board_nrf9160ns.overlay:

&spi3 {
    w25q16jv: w25q16jv@0 {
        compatible = "jedec,spi-nor";
        reg = <0>;
        spi-max-frequency = <1000000>;
        reset-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
        size = <0x1000000>;
        has-dpd;
        t-enter-dpd = <4000>;
        t-exit-dpd = <25000>;
        jedec-id = [ ef 40 15  ];
    };
};


After doing this, the code built fine.

So the question is why does the external flash is causing an issue to the device tree when it is added in the common dts, but works when it is put on the overlay file?

Parents Reply
  • Hi,

     

    Thank you for clarifying. I needed to ask in case it wasn't the desired behavior.

    Giannis Anastasopoulos said:
    Having said that it is strange that we need to add these configurations in v2.4.1 but they were not needed in v2.1.0. What exactly has changed between the 2 versions (I think that the change is there already in v2.2.0)?

    The change is highly likely due to the devicetree/kconfig integration work that has been in-progress between these versions. Enabling a peripheral in devicetree is mitigated through kconfig, selecting the peripheral/driver in kconfig.

    Here's an example by adding your overlay to the mcuboot child image overlay in NCS v2.5.0:

    $ grep -r CONFIG_SPI
    ...
    mcuboot/zephyr/.config:CONFIG_SPI=y
    mcuboot/zephyr/.config:CONFIG_SPI_NOR=y
    mcuboot/zephyr/.config:CONFIG_SPI_NOR_SFDP_MINIMAL=y
    ..

    versus the same added overlay in ncs v2.1.0:

    $ grep -r CONFIG_SPI
    ...
    mcuboot/zephyr/.config:# CONFIG_SPI is not set
    

     

    Kind regards,

    Håkon

Children
Related