rpmsg_nrf53_sram reserves 64kB of SRAM even when network core is not used on nRF5340

Note: I am aware that NCS v3.4.0 recommends DTS-based partitioning over Partition Manager. However, I was unable to get the DTS-based approach working for my specific configuration (nRF7002 DK with external flash and Wi-Fi firmware partition), so I am currently using Partition Manager as a workaround.

 NCS v3.4.0 (DTS-based partitioning): How to place MCUboot secondary slot in external flash without Partition Manager? 

Hi,

I am working on a project using the nRF7002 DK (nRF5340 application core) with NCS v3.4.0, and I noticed that rpmsg_nrf53_sram is automatically added to the SRAM partition map with 64kB even though I am not using the network core at all.

Observed behavior:

Even with the following pm_static.yml defining sram_primary as the full 512kB:

sram_primary:
  address: 0x20000000
  end_address: 0x20080000
  region: sram_primary
  size: 0x80000

The partition manager report shows:

sram_primary: 448kB (0x70000)
rpmsg_nrf53_sram: 64kB (0x10000)

Workaround I found:

By explicitly defining rpmsg_nrf53_sram with a smaller size in pm_static.yml, I was able to reclaim most of the reserved SRAM:

sram_primary:
  address: 0x20000000
  end_address: 0x2007f000
  region: sram_primary
  size: 0x7f000
rpmsg_nrf53_sram:
  address: 0x2007f000
  end_address: 0x20080000
  placement:
    before:
    - end
  region: sram_primary
  size: 0x1000

This gives 508kB to the application. Setting size: 0x0 results in a Partition Manager error:

Partition manager failed: Incorrect amount of gaps found in static configuration.

Questions:

  1. Is it expected that rpmsg_nrf53_sram is always reserved even when the network core is not used?
  2. Is there a minimum recommended size for rpmsg_nrf53_sram?
  3. Is there a cleaner way to disable this reservation entirely?

Thanks!

Parents
  • Is it expected that rpmsg_nrf53_sram is always reserved even when the network core is not used?

    Yes, NCS adds this partition unconditionally for every nRF5340 application-core build that uses Partition Manager:

    # The default DTS configuration for the nRF5340 CPUAPP includes the
    # the shared SRAM region, so, inform the partition manager about this
    # region.
    if(CONFIG_SOC_NRF5340_CPUAPP)
      ncs_add_partition_manager_config(pm.yml.rpmsg_nrf53)
    endif()

    The partition definition itself:

    #include <zephyr/autoconf.h>
    
    # This block of RAM is used for IPC
    rpmsg_nrf53_sram:
      placement: {before: end}
      size: CONFIG_RPMSG_NRF53_SRAM_SIZE
      region: sram_primary

    And the 64 kB comes from a Kconfig whose default is pulled straight from the devicetree zephyr,ipc_shm chosen node (sram0_shared, 0x10000):

    config RPMSG_NRF53_SRAM_SIZE
    	hex "RPMsg shared memory size"
    	default "$(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_IPC_SHM))"
    	depends on SOC_NRF5340_CPUAPP
    	depends on PARTITION_MANAGER_ENABLED
    	help
    	  This option specifies size of the memory region to be used

    As long as you build for nrf5340/cpuapp with Partition Manager, this partition is emitted, sized from the DT zephyr,ipc_shm region (64 kB by default). There are no catch to detect if  the network core is unnused to then drop this partition.

    Is there a minimum recommended size for rpmsg_nrf53_sram?

    There's no documented hard minimum. Its natural size (64 kB default) is what a real RPMsg/OpenAMP link needs for its vrings + buffers. If you're doing no IPC, the value only needs to be non-zero and region-aligned — your 0x1000 (4 kB) is a fine choice. 0x0 fails because Partition Manager can't reconcile a zero-size static partition against the surrounding gap ("Incorrect amount of gaps found"), so keep it at the smallest non-zero aligned value.

    Is there a cleaner way to disable this reservation entirely?

    3. You can't cleanly remove it (the CMake include is unconditional), but you can shrink it by either setting the sie in pm.static.yml or set the size with for instance this Kconfig in prj.conf:

    CONFIG_RPMSG_NRF53_SRAM_SIZE=0x1000

    This feeds the size: field directly, so you don't have to pin address/end_address for rpmsg_nrf53_sram in your static file — Partition Manager still places it before: end and gives the rest to sram_primary..

    If you want DT and PM to stay consistent (the RPMsg backend falls back to the DT region when PM defines aren't present), you can instead resize/delete the shared region in a devicetree overlay:

    / {
    chosen {
    /delete-property/ zephyr,ipc_shm;
    };
    };

    Deleting zephyr,ipc_shm drives the Kconfig default to 0, so you'd still combine it with an explicit non-zero CONFIG_RPMSG_NRF53_SRAM_SIZE (or a small static entry) to avoid the zero-gap error. 

    Let me know if this answers your question

    Kind regards,
    Andreas

Reply
  • Is it expected that rpmsg_nrf53_sram is always reserved even when the network core is not used?

    Yes, NCS adds this partition unconditionally for every nRF5340 application-core build that uses Partition Manager:

    # The default DTS configuration for the nRF5340 CPUAPP includes the
    # the shared SRAM region, so, inform the partition manager about this
    # region.
    if(CONFIG_SOC_NRF5340_CPUAPP)
      ncs_add_partition_manager_config(pm.yml.rpmsg_nrf53)
    endif()

    The partition definition itself:

    #include <zephyr/autoconf.h>
    
    # This block of RAM is used for IPC
    rpmsg_nrf53_sram:
      placement: {before: end}
      size: CONFIG_RPMSG_NRF53_SRAM_SIZE
      region: sram_primary

    And the 64 kB comes from a Kconfig whose default is pulled straight from the devicetree zephyr,ipc_shm chosen node (sram0_shared, 0x10000):

    config RPMSG_NRF53_SRAM_SIZE
    	hex "RPMsg shared memory size"
    	default "$(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_IPC_SHM))"
    	depends on SOC_NRF5340_CPUAPP
    	depends on PARTITION_MANAGER_ENABLED
    	help
    	  This option specifies size of the memory region to be used

    As long as you build for nrf5340/cpuapp with Partition Manager, this partition is emitted, sized from the DT zephyr,ipc_shm region (64 kB by default). There are no catch to detect if  the network core is unnused to then drop this partition.

    Is there a minimum recommended size for rpmsg_nrf53_sram?

    There's no documented hard minimum. Its natural size (64 kB default) is what a real RPMsg/OpenAMP link needs for its vrings + buffers. If you're doing no IPC, the value only needs to be non-zero and region-aligned — your 0x1000 (4 kB) is a fine choice. 0x0 fails because Partition Manager can't reconcile a zero-size static partition against the surrounding gap ("Incorrect amount of gaps found"), so keep it at the smallest non-zero aligned value.

    Is there a cleaner way to disable this reservation entirely?

    3. You can't cleanly remove it (the CMake include is unconditional), but you can shrink it by either setting the sie in pm.static.yml or set the size with for instance this Kconfig in prj.conf:

    CONFIG_RPMSG_NRF53_SRAM_SIZE=0x1000

    This feeds the size: field directly, so you don't have to pin address/end_address for rpmsg_nrf53_sram in your static file — Partition Manager still places it before: end and gives the rest to sram_primary..

    If you want DT and PM to stay consistent (the RPMsg backend falls back to the DT region when PM defines aren't present), you can instead resize/delete the shared region in a devicetree overlay:

    / {
    chosen {
    /delete-property/ zephyr,ipc_shm;
    };
    };

    Deleting zephyr,ipc_shm drives the Kconfig default to 0, so you'd still combine it with an explicit non-zero CONFIG_RPMSG_NRF53_SRAM_SIZE (or a small static entry) to avoid the zero-gap error. 

    Let me know if this answers your question

    Kind regards,
    Andreas

Children
No Data
Related