[SOLVED] PageSize of FlashDevice

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] PageSize of FlashDevice

    From SEGGER_Flash_Loader, the PageSize is meant that "This field describes in what chunks J-Link feeds the flash loader. The SEGGER_FL_Program() function will be called with a data chunk of multiple of <PageSize> bytes"
    The NumByte of SEGGER_FL_Program() will be SectSize of FlashDevice and SEGGER_FL_Verify() will be the SectSize or PageSize of FlashDevice randomly. Is it normal? Thanks.

    Source Code

    1. #define FLASH_PAGE_SIZE 0x00000100 // 256 Bytes
    2. #define FLASH_SECTOR_SIZE 0x00001000 // 4096 Bytes
    3. struct FlashDevice
    4. {
    5. U16 AlgoVer;
    6. U8 Name[128];
    7. U16 Type;
    8. U32 BaseAddr;
    9. U32 TotalSize;
    10. U32 PageSize;
    11. U32 Reserved;
    12. U8 ErasedVal;
    13. U32 TimeoutProg;
    14. U32 TimeoutErase;
    15. struct SECTOR_INFO SectorInfo[MAX_NUM_SECTORS];
    16. };
    17. struct FlashDevice const FlashDevice __attribute__((section("DevDscr"))) = {
    18. 0x0101,
    19. "MYTest",
    20. 1,
    21. 0x10000,
    22. 0x80000,
    23. FLASH_PAGE_SIZE,
    24. 0, // Reserved, must be 0
    25. 0xff,
    26. 1000000,
    27. 10000,
    28. FLASH_SECTOR_SIZE, 0x00000000,
    29. 0xFFFFFFFF, 0xFFFFFFFF
    30. };
    Display All

    The post was edited 2 times, last by sharon ().

  • Hello Sharon,

    Not sure if I understand you correctly.
    For SEGGER_FL_Program(), <NumBytes> is guaranteed to be a multiple of FlashDevice.PageSize

    For SEGGER_FL_Verify(), there are no guarantees what <NumBytes> will be. The J-Link software is allowed to verify in chunks whatever it likes to.


    BR
    Alex
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi Alex,

    For SEGGER_FL_Program(), <NumBytes> is guaranteed to be a multiple of FlashDevice.PageSize => But I do get the NumBytes as FlashDevice.SectorInfo[0].SectorSize instead of FlashDevice.PageSize, is it normal?
  • Hi Sharon,

    The answer if it is "normal" is basically yes.
    As SectorInfo[0].SectorSize == 0x1000 (4 KB)
    and PageSize = 0x100 (256 bytes)
    and SectorSize = 16 * PageSize, a multiple of PageSize is passed to SEGGER_FL_Program() so what the J-Link software does is allowed and within the spec.


    BR
    Alex
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.