Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NOR simulator assumes sizeof(ULONG) == 4 #22

Open
jiri-novotny opened this issue Sep 7, 2023 · 2 comments
Open

NOR simulator assumes sizeof(ULONG) == 4 #22

jiri-novotny opened this issue Sep 7, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@jiri-novotny
Copy link

Provided example assumes sizeof(ULONG) is 4B

    /* Setup pointer.  */
    pointer =  (ULONG *) &nor_memory_area[0];

    /* Loop to erase block.  */
    words =  sizeof(nor_memory_area)/(sizeof(ULONG));
    while (words--)
    {
        
        /* Erase word of block.  */
        *pointer++ =  (ULONG) 0xFFFFFFFF;
    }

when changed to

memset((uint8_t *) &nor_memory_area[0], 0xFF, sizeof(FLASH_BLOCK) * TOTAL_BLOCKS);

subsequent write/read test failes

@jiri-novotny jiri-novotny added the bug Something isn't working label Sep 7, 2023
@jiri-novotny
Copy link
Author

also internal checks are done in 4B mode, e.g. in _lx_nor_flash_logical_sector_find

if (list_word == LX_NOR_PHYSICAL_SECTOR_FREE)

with

#define LX_NOR_SECTOR_MAPPING_CACHE_ENTRY_MASK      0x7FFFFFFF
#define LX_NOR_SECTOR_MAPPING_CACHE_ENTRY_VALID     0x80000000

#define LX_NOR_PHYSICAL_SECTOR_VALID                0x80000000
#define LX_NOR_PHYSICAL_SECTOR_SUPERCEDED           0x40000000
#define LX_NOR_PHYSICAL_SECTOR_MAPPING_NOT_VALID    0x20000000
#define LX_NOR_LOGICAL_SECTOR_MASK                  0x1FFFFFFF
#define LX_NOR_PHYSICAL_SECTOR_FREE                 0xFFFFFFFF

@jiri-novotny
Copy link
Author

this should be solved in PR #23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant