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

what will be the starting address of pstorage page how we can change it?

i want to use this thing to store the data of 24bytes.

  • PSTORAGE_DATA_START_ADDR is set in pstorage_platform.h.

    It will use the flash pages at the end if there is nothing there, like a bootloader, then it will use flash pages beneath it. It requires one swap page in addition to the pages you require.

    #define PSTORAGE_DATA_START_ADDR    ((PSTORAGE_FLASH_PAGE_END - PSTORAGE_NUM_OF_PAGES - 1) \
                                        * PSTORAGE_FLASH_PAGE_SIZE)
    

    PSTORAGE_FLASH_PAGE_END will normally be 256 pages. The total size of flash is 256 * 0x400 = 0x40000.

    PSTORAGE_NUM_OF_PAGES you set according to your requirements.

    PSTORAGE_FLASH_PAGE_SIZE is 0x400 (1024).

    -1 is the swap page.

    Even though you only want to store 24 bytes pstorage requires a whole flash page, this is just how flash works.

    So with one page you get ((256 - 1 - 1) * (0x400)) = 0x3F800

Related