NRF53 Netcore Flash Steraming to Appcore

I want to be able to perform a DFU entirely from the netcore for backup/reliability reasons.

I can flash stream from the netcore to flash1 using stream_flash_init with "device_get_binding(PM_APP_DEV_NAME)", which evaluates to "NRF_FLASH_DRV_NAME", which evaluates to flash1/flash_controller from "nrf5340_cpunet.dtsi".

There isn't enough room on the cpunet core; so, I need to store the image on the appcore flash, validate it there, then copy over the netcore application. However, there doesn't appear to be any way to stream to flash0 from the netcore.

I am currently sending messages via shared SRAM, which is quite hacky.

Is there any way to get stream to flash0 from the netcore?

Parents
  • Hello again, and thank you for your patience. I've just gotten back from vacation.

    Is this still something you are struggling with, or has there been any update to this case?

    However, there doesn't appear to be any way to stream to flash0 from the netcore.

    Could you expand on this? Is stream_flash_init giving you an error?

    Would getting a standard Mcuboot DFU started from the netcore fulfill your needs?

    Regards,

    Elfving

  • Hey.

    flash0 isn't in the device tree so there are no arguments I can provide to stream_flash_init to stream to flash0.

    I am not using MCU boot so that wouldn't be a solution.

  • Right. I would in general recommend you to use a standard solution for this, instead of going for something too complex. 

    I believe a lot of what you are looking for can be found here in this library. The network core getting access to the app core flash should be possible as long as the permission has been granted in the SPU and DCNF settings.

    I am currently sending messages via shared SRAM, which is quite hacky.

    Doing it on your own instead of using our libraries (see this case for more info) for it might be a bit hacky, but our libraries are also based on using the shared SRAM. That is essentially how it is done and as good as it gets. 

    Regards,

    Elfving

  • Standard solutions don't allow automated recovery using a backup region. The application in mind is a safety critical device and needs to be able to recover even when the netcore application has died. 

    The library you shared copies images from cpucore flash to the netcore flash. The problem I have is getting the image onto the cpucore in the first place.

    I am not having problems getting write access to the cpucore flash. Instead, I have no means of actually writing to the flash; as I have said, there is no flash0 to write to. None of the things you have mentioned actually address the issue of what to call from the netcore application to write to the cpucore flash.

Reply
  • Standard solutions don't allow automated recovery using a backup region. The application in mind is a safety critical device and needs to be able to recover even when the netcore application has died. 

    The library you shared copies images from cpucore flash to the netcore flash. The problem I have is getting the image onto the cpucore in the first place.

    I am not having problems getting write access to the cpucore flash. Instead, I have no means of actually writing to the flash; as I have said, there is no flash0 to write to. None of the things you have mentioned actually address the issue of what to call from the netcore application to write to the cpucore flash.

Children
  • AntonD said:
    I am not using MCU boot so that wouldn't be a solution.

    Are using the nRF Secure Immutable Bootloader? Are you using your own?

    AntonD said:
    None of the things you have mentioned actually address the issue of what to call from the netcore application to write to the cpucore flash.

    The netcore should have access to all the flash, so you could just copy the parts referencing flash0 from the appcore dts files into the netcore dts.

    Regards,

    Elfving

  • I am using a custom build of the nRF secure immutable bootloader.

    I have tried, but I guess what I am asking is how to copy the flash0 parts.

    I have the following in the netcore dts:

    		flash_controller: flash-controller@41080000 {
    			compatible = "nordic,nrf53-flash-controller";
    			reg = <0x41080000 0x1000>;
    
    			#address-cells = <1>;
    			#size-cells = <1>;
    
    			label="NRF_FLASH_DRV_NAME";
    
    			flash1: flash@1000000 {
    				compatible = "soc-nv-flash";
    				label = "NRF_FLASH";
    				erase-block-size = <2048>;
    				write-block-size = <4>;
    			};
    		};

    I can't duplicate this section as it duplicates the "flash-controller" name. I have tried changing that name in the duplication but I think the name is a reserved name. I have tried adding a "flash0" section in the same way that it has a "flash1" section but that gives the following error

    <stdout>: ERROR (unit_address_vs_reg): /soc/flash-controller@41080000/flash@0: node has a unit name, but no reg property

    The "chosen" section also has:

        chosen {
            zephyr,entropy = &rng;
            zephyr,flash-controller = &flash_controller;
        };
    and there doesn't appear an easy way to add another flash controller there either.
Related