This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to use flash manager?

Guys,

In a Mesh project, when setting up flash manager:

  1. How do you get the right value of flash_manager_config_t.p_area?
  2. And where and how is it configured?

Thanks...

Parents
  • Hello,

    Is there a particular reason why you need to change this? Did you encounter any issues?

    The p_area is the address to the start address that should be used by the flash manager. If you look at any of the examples in the Mesh SDK, you can see that in mesh_config_flashman_glue.c -> mesh_config_backend_file_create(), p_area is set to:

    p_area = (flash_manager_page_t *)(flash_area_end_get() - (m_allocated_page_count * PAGE_SIZE));

    The function flash_area_end_get() (via a lot of functions) points to mp_recovery area, which again is set based on whether or not you have a bootloader programmed, via the BOOTLOADERADDR(), which is a macro that checks the chip's bootloader address register.

    I guess that answers both 1. and 2. Check out mesh_config_backend_file_create(), and the function flash_manager_defrag_init() in flash_manager_defrag.c.

    Best regards,

    Edvin

  • Hi Edvin,

    Thanks for your help!

    Is there a particular reason why you need to change this?

    No, not at all! I'd rather keep the value as it is as long as saving/loading to/from flash works.

    The demo code from one of the posts here on devzone looks like as if p_area is an input parameter (and hence needs to be provided). Your question sounds like p_area is an output parameter that can safely be ignored. I'm a little confused now: Is it necessary to have p_area set before calling flash_manager_add()?

    If yes: Is it safe to use the same value that other instances use? I.e. just copy the line:

    p_area = (flash_manager_page_t *)(flash_area_end_get() - (m_allocated_page_count * PAGE_SIZE));

    Again thanks for the clarification,
    Michael.

Reply
  • Hi Edvin,

    Thanks for your help!

    Is there a particular reason why you need to change this?

    No, not at all! I'd rather keep the value as it is as long as saving/loading to/from flash works.

    The demo code from one of the posts here on devzone looks like as if p_area is an input parameter (and hence needs to be provided). Your question sounds like p_area is an output parameter that can safely be ignored. I'm a little confused now: Is it necessary to have p_area set before calling flash_manager_add()?

    If yes: Is it safe to use the same value that other instances use? I.e. just copy the line:

    p_area = (flash_manager_page_t *)(flash_area_end_get() - (m_allocated_page_count * PAGE_SIZE));

    Again thanks for the clarification,
    Michael.

Children
No Data
Related