Unable to read from Flash using flash_area API even though the bytes are present

I have the following pm_static.yml configuration:

custom_bootloader:
  address: 0x0
  end_address: 0xc000
  placement:
    before:
    - tfm
  region: flash_primary
  size: 0xc000
custom_bootloader_header:
  address: 0xc000
  end_address: 0xc200
  placement:
    before:
    - tfm
  region: flash_primary
  size: 0x200
mcuboot_primary:
  address: 0xc000
  end_address: 0xf2000
  region: flash_primary
  orig_span: &id006
  - tfm
  - tfm_nonsecure
  size: 0xE6000
  span: *id006

and I'm trying to acces this `custom_bootloader_header` from my application code. Here's the relevant snippet:

#include <zephyr/storage/flash_map.h>
#include <flash_map_pm.h>



... {

        const struct flash_area *fa;
        printk("custom_bootloader_header: start=%ul, size=%ul\n", fa->fa_off, fa->fa_size);
        flash_area_open(header_flash_area_id, &fa);
        rc = flash_area_read(fa, 0, tags, 256);
        flash_area_close(fa);
}

prj.conf:

CONFIG_FLASH=y
CONFIG_NVS=y

The read function returns `-22`. I can't really do anything with the devicetree because those partitions are ignored when using a static configuration. Not sure what's going on.

Parents Reply Children
No Data
Related