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
  • Well it is preferable to use overlay files. So if you want to add this flash space to the flash controller you can try to add this as an overlay to your project:

    
    /{
    	chosen {
    		zephyr,flash0 = &flash0; 
    	};
    };
    
    &flash_controller {
        flash0: flash@0000000 { 
            reg = <0x00000000 DT_SIZE_K(1024)>;
            compatible = "soc-nv-flash";
            label = "NRF_FLASH_APP_l";
            erase-block-size = <2048>;
            write-block-size = <4>;
        };
    };
     

    If you want a separate binding/device pointer to that flash partition though, you need a separate flash controller. 

    /{
    	chosen {
    		zephyr,flash0 = &flash0; 
            zephyr,flash-controller0 = &flash_controller0; 
    
    	};
    	soc {
    		flash_controller0: flash-controller0@41080000 {
    			compatible = "nordic,nrf53-flash-controller";
    			reg = <0x41080000 0x1000>;
    			partial-erase;
    
    			#address-cells = <1>;
    			#size-cells = <1>;
    
    			label="NRF_FLASH_APP";
    			flash0: flash@0000000 { 
    				compatible = "soc-nv-flash";
    				label = "NRF_FLASH_0";
    				erase-block-size = <2048>;
    				write-block-size = <4>;
                    reg = <0x00000000 DT_SIZE_K(1024)>;
    			};
    		};
        };  
    };

    Regards,

    Elfving

  • Hi Elfving,

    I have an open ticket with a related question (see here). I've tried both of your suggestions, with and without a separate flash controller, but I can't access addresses of flash0 (address range of application core) from the network core as I always get a Bus Fault.

    Therefore my question: Did you get it to work with your suggestions above?

  • I was able to get it working. Below is what I used for the overlay file.

    /{
        chosen {
            zephyr,flash0 = &flash0;
        };
    };
    
    &flash_controller {
        flash0: flash@0 {
            reg = <0 DT_SIZE_K(1024)>;
            compatible = "soc-nv-flash";
            label = "NRF_FLASH0";
            erase-block-size = <4096>;
            write-block-size = <4>;
        };
    };
    

    Note that you also need to enable access from the app core before you can use it in the net core. For example:

    nrf_spu_extdomain_set(NRF_SPU, 0, true, false);
  •    Thank you very much for your answer, I really appreciate your effort!

    I still can't get it to work. When I try it with the Stream Flash API, and try to write to an address of the AppCore, e.g. 0x30000, it writes it to 0x1030000, which is an address of the NetCore. What did you pass to stream_flash_init as the device parameter to get it to write to the flash0 address range?

Reply
  •    Thank you very much for your answer, I really appreciate your effort!

    I still can't get it to work. When I try it with the Stream Flash API, and try to write to an address of the AppCore, e.g. 0x30000, it writes it to 0x1030000, which is an address of the NetCore. What did you pass to stream_flash_init as the device parameter to get it to write to the flash0 address range?

Children
Related