Matter bridge build process fails with "region `FLASH' overflowed"

Hi guys,

I'm playing with : Matter Bridge from SDK v2.6.0.rc1 on nRF7002-DK. I tried to extend Matter data model with "Temperature color light" and add a new device but it caused that its flash is overflowed:


...
-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/zephyr_pre0.elf section `datas' will not fit in region `FLASH'
/home/ubuntu/Projects/nordic-4.1.2/toolchains/19127b768d/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: region `FLASH' overflowed by 1784 bytes



My question is very simple: How to fix it? What exacly should I change to solve it?
I know that DK has 1MB internal flash and 8MB external flash...I hope. I try to read documentation about Partition manager, Multi-image builds, external flash, XIP but I'm a bit lost. I also tried to find something here in issues. Would it be possible to somehow re-arrange internal flash? or is possible to use external flash instead of internal one? I've played with it a couple of days but without any success. There are too many options for me which must match together (files: *.conf, *.overlay, *.yml, ...). Optimizations like "-Os", "no debug symbols" didn't help me much.

  • Hi,

    Ondro said:
    At the first look, Wifi patch relocation to external flash seemed to be promising but unfortunately it is for external flashes connected over QSPI and not SPI. QSPI is used for Wifi chip. According to the documentation "...fw_patches_ext_flash.html", nRF7002DK is not supported. I found something related to it at devzone: ncs-external-flash-ota-change-qspi-to-spi but I didn't go deeper.

    Ah yeah you're right. The relocation through the XIP features in that documentation requires qspi, so the alternative would be to do a similar relocation using flash API and your own proprietary implementation of this. https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/applications/matter_bridge/doc/matter_bridge_description.html#building-and-running explains how you can enable the wifi fw patch relocation as well

    Ondro said:
    nRF7002DK is not supported

    This is note quite right, but the demo is showcased using a nRF5340DK with a 7002DK as a shield. The nRF7002 supports the firmware patch relocation. But the 7002 is only a host-chip, and it requires a companion chip to work. On the 7002DK there is two nRF devices: The nRF7002 host chpi which is used for Wifi and Wifi-stuff only, connected with SPI to a nRF5340 that is acting as the companion chip (i.e where the application runs). In addition there is an external flash (mx25) that is by default connected to the 5340 with QSPI. Your explanation leads me to believe that you're not quite aware that this is how the 7002Dk is set up, but I could be wrong.

    Ondro said:
    I've read the intermediate course too and I would say that matter_bridge application is very complicated especially on nRF7002DK.

    It is a comprehensive application, yes.

    Ondro said:
    On the base of this I have no clue what to do.

    It might be better to start with simpler applications, i.e familiarize yourself with the other Matter over Thread and Matter over Wifi samples and see how you can optimize their footprint through either fw relocation to the external flash or through 

    Ondro said:
    In my opinion, I don't see any restriction why an region of the external flash should be "unknown". What could be a reason of this error?

    [error] [ Worker] - Address range [0x0013B000 - 0x0013B591] does not map to a known memory.

    Might be that the device does not know of the external flash. How did you set it up in your devicetree files?

    Kind regards,
    Andreas

  • Might be that the device does not know of the external flash. How did you set it up in your devicetree files?

    I didn't make any changes in devicetree. All what I changed was in shared.zip

  • Hi,

    It's been a while since you've heard from me. Have you had any success with setting up your partitions since last time?

    If not, could you share the entire project in a zip?

    Kind regards,
    Andreas

  • Hi,

    I have no progress. I'm working on the build that fits on the internal flash:

    Fortunately,  switching release build + Os optimization  helps me enough but now I'm at 99% of flash usage so we will see

    I'm not expecting that the image size would increase more. And if yes then I would try to enable the wifi fw patch relocation. In my point of view, it could be closed for now.

    Thank you and BR,

    Ondro

  • Hi,

    Great

    Just 1 thing for information: I would recommend that you wait until NCS 2.6.1 before you attempt wifi patch relocation which requires qspi due to a bug in the qspi driver in v2.6.0.

    This has been fixed upstream and will be released within a couple of weeks

    Fix posted upstream: https://github.com/zephyrproject-rtos/zephyr/pull/71373
    Cherry-pick into NCS: https://github.com/nrfconnect/sdk-nrf/pull/14812

    Kind regards,
    Andreas

Related