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.)

  • 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

  • Hi Naeem,

    Some additional information that might help:

    I've tried the same as in the example above with two variations:

    - writing to other adresses in the  address space of the AppCore,

    - removing MCUboot from the AppCore.

    Both lead to the same fault as before.

Related