nRF52840 code memory extend options

Hi Nordic support team,

We're using nRF52840 to develop a product with lots of features, using nRF NCS latest version (1.7.x as of writing).

Currently we're sitting at ~50% RAM and Flash usage, having BLE, Thread and other features enabled.

Since it is almost impossible to guess how much more RAM/Flash we need to fit the rest of the features, I'm wondering what options exist if we run out of the memory resources before we finish dev. (Yes, I checked Size Optimizations are on.  #define CONFIG_SIZE_OPTIMIZATIONS 1)

- If we need more Flash space, can we reliably place the FW image to an external QSPI flash and run from there? are there NCS examples for this? Does Zephyr support this mode? What issues could it raise compared to running from internal flash? (I read a few posts about extra delays associated running from flash - another comment mentioned ISRs can't be placed in external flash - are these true and if so what are workarounds?) Does MCUBoot support having dual bank FW update in the external flash (i.e. both running code and 2nd bank in external flash)?

- I assume we can't extend SRAM externally, can we?!

- Moving to nRF5340, how much RAM/Flash is roughly freed by moving the BLE and Thread FTD stacks to the network processor?

Parents
  • Hi Farhang

    The Openthread and Bluetooth Low Energy stack are big, and is likely what will use the most memory of your code.
    To use the rest of the memory,, the rest of the features must be very memory heavy. While unlikely that you run out of space, it is possible.

    - If we need more Flash space, can we reliably place the FW image to an external QSPI flash and run from there?

    Yes, it is possible to use QSPI to Execute in place (XIP) for executing program directly from external flash.
    However, this is not an ideal approach, due to [216] QSPI: Race condition occurs in XIP.

    I read a few posts about extra delays associated running from flash - another comment mentioned ISRs can't be placed in external flash - are these true and if so what are workarounds?)

    It is easier for me to comment on these if you provide links to the posts. Could you do so?

    Does MCUBoot support having dual bank FW update in the external flash

    MCUBoot has two image slots, yes. From Building and using MCUboot with Zephyr:
    "

    The first step required for Zephyr is making sure your board has flash partitions defined in its device tree. These partitions are:

    • boot_partition: for MCUboot itself

    • image_0_primary_partition: the primary slot of Image 0

    • image_0_secondary_partition: the secondary slot of Image 0

    • scratch_partition: the scratch slot

    "
    and MCUBOOT Design document on Image Slots.

    - I assume we can't extend SRAM externally, can we?!

    Yep, we do not support this

    - Moving to nRF5340, how much RAM/Flash is roughly freed by moving the BLE and Thread FTD stacks to the network processor?

    To give you numbers on this, I will have to look into it a bit more, so I will return with an answer by Tuesday.

    Regards,
    Sigurd Hellesvik

Reply
  • Hi Farhang

    The Openthread and Bluetooth Low Energy stack are big, and is likely what will use the most memory of your code.
    To use the rest of the memory,, the rest of the features must be very memory heavy. While unlikely that you run out of space, it is possible.

    - If we need more Flash space, can we reliably place the FW image to an external QSPI flash and run from there?

    Yes, it is possible to use QSPI to Execute in place (XIP) for executing program directly from external flash.
    However, this is not an ideal approach, due to [216] QSPI: Race condition occurs in XIP.

    I read a few posts about extra delays associated running from flash - another comment mentioned ISRs can't be placed in external flash - are these true and if so what are workarounds?)

    It is easier for me to comment on these if you provide links to the posts. Could you do so?

    Does MCUBoot support having dual bank FW update in the external flash

    MCUBoot has two image slots, yes. From Building and using MCUboot with Zephyr:
    "

    The first step required for Zephyr is making sure your board has flash partitions defined in its device tree. These partitions are:

    • boot_partition: for MCUboot itself

    • image_0_primary_partition: the primary slot of Image 0

    • image_0_secondary_partition: the secondary slot of Image 0

    • scratch_partition: the scratch slot

    "
    and MCUBOOT Design document on Image Slots.

    - I assume we can't extend SRAM externally, can we?!

    Yep, we do not support this

    - Moving to nRF5340, how much RAM/Flash is roughly freed by moving the BLE and Thread FTD stacks to the network processor?

    To give you numbers on this, I will have to look into it a bit more, so I will return with an answer by Tuesday.

    Regards,
    Sigurd Hellesvik

Children
No Data
Related