Flash Image API on Network Core

Hi,

When I try to use the Flash Image API on the Network Core I get build errors. The problem seems to be that some symbols are not defined, as there is no MCUboot bootloader on the Network Core (but there is one on the Application Core).

What is the intended way to use the Flash Image API to write image data from the Network Core to an image slot of the Application Core?

(Additional info: I tried defining the missing symbols (PM_MCUBOOT_PRIMARY_ID and PM_MCUBOOT_SECONDARY_ID) wherever they are needed, just to see if the build succeeds. Indeed it does, but the init function of the Flash Image API then fails, which is not surprising as these symbols were defined manually and seem to be missing in the project setup.)

Parents
  • Hi nkost,

    Thank you for your patience. 

    Coming to your query: 

    When I try to use the Flash Image API on the Network Core I get build errors. The problem seems to be that some symbols are not defined, as there is no MCUboot bootloader on the Network Core (but there is one on the Application Core).

    Well, we have two bootloaders for 5340 as it has two cores, one for the app core (called MCUboot) and other for the network-core, called b0n which is an immutable first-stage bootloader that can update the application firmware on the network core of the nRF5340 SoC.

    I suggest to look at netboot sample to see the use-case and the configurations.

    What is the intended way to use the Flash Image API to write image data from the Network Core to an image slot of the Application Core?

    Flash Image Api is specific example use. Let us talk about writing image from the network core to an image slot of the app core. For such a purpose, you need to do a multi-image build. It is well described here: Multi-Image Build

    Hope it helps,

    Regards,

    Naeem

Reply
  • Hi nkost,

    Thank you for your patience. 

    Coming to your query: 

    When I try to use the Flash Image API on the Network Core I get build errors. The problem seems to be that some symbols are not defined, as there is no MCUboot bootloader on the Network Core (but there is one on the Application Core).

    Well, we have two bootloaders for 5340 as it has two cores, one for the app core (called MCUboot) and other for the network-core, called b0n which is an immutable first-stage bootloader that can update the application firmware on the network core of the nRF5340 SoC.

    I suggest to look at netboot sample to see the use-case and the configurations.

    What is the intended way to use the Flash Image API to write image data from the Network Core to an image slot of the Application Core?

    Flash Image Api is specific example use. Let us talk about writing image from the network core to an image slot of the app core. For such a purpose, you need to do a multi-image build. It is well described here: Multi-Image Build

    Hope it helps,

    Regards,

    Naeem

Children
  • Hi Naeem

    Thanks four your answer. The setup you described is the one I use. I now need to write to the "Secondary Slot" in the AppCore Flash from the "Net core app". The problem is that the address of the "Secondary Slot" is not known in the "Net core app".

    This flash should be accessible from the NetCore (according to the Product Specification of nRF5340, Section 3.2 Fig. 2 Memory Map and Section 6.4 Memory: "The network core can access application core resources (flash, RAM, and peripherals) when granted permission through the application's DCNF and SPU settings.") When I try to write to this address using the function flash_area_write, it returns with an error "invalid address" (Permissions are not the problem).

    How can I access the flash of the AppCore from the NetCore?

  • Hello nkost,

    Alright, so the error you are facing is "invalid address".

    How are you performing the flash write? are you using nvmc?

    I would like to see your code and the method to reproduce the error.

    (preferably you can send your minimal project zip).

    Regards,

    Naeem

  • Hi Naeem,

    Yes, when trying to use flash_area_write I get that error. (I tried using that bcs. the higher-abstraction libraries/APIs didn't work, as described above).

    The flash write:

    // ...
    err = flash_area_open(area_id, &fa);
    if (err) {
      return err;
    }
    
    flash_area_write(&fa, 0, data, dataLen);

    I added the following overlay (which I inherited from this thread):

    /{
        chosen {
            zephyr,flash0 = &flash0;
        };
    };
    
    &flash_controller {
        label = "NRF_FLASH_APP";
        flash0: flash@0 {
            reg = <0x00000000 DT_SIZE_K(1024)>;
            compatible = "soc-nv-flash";
            label = "NRF_FLASH_APP_1";
            erase-block-size = <4096>;
            write-block-size = <4>;
            partitions {
                compatible = "fixed-partitions";
                #address-cells = <1>;
                #size-cells = <1>;
                app_2_partition: partition@84000 {
                    label = "app-2";
                    reg = <0x00084000 0x40000>;
                };
            };
        };
    };
    

    I don't have the time at the moment to create a minimal example. I will do so when I find the time.

  • Hi Naeem,

    I tried to do the same using the NVMC HAL function. Trying to write to the address results in a Bus Fault (the instruction that assigns the value to that address causes this fault: *(volatile uint32_t *)addr = value; in the function nvmc_word_write). I've added the minimal project of this test.

    flash_access_mcuboot_nrfx.zip

  • Hi nkost,

    I have received your sample, and can reproduce the error. I tried to check for writability before performing actual write. The address seems writable but still the netcore reboots and shows the bus fault. I will try to figure out the cause / problem, and will let you know accordingly.

    Regards,

    Naeem

Related