Skip to content

Can not guess flash more than 16MB correctly #193

Open
@zx-wowuying

Description

@zx-wowuying

I designed a development board with two 16M flash chips and correctly configured the opt parameters, but picotool can only recognize 16M of space.I found an issue in the source code of guess_flash_size

    // Read at decreasing power-of-two addresses until we don't see the boot pages again
    const int min_size = 16 * PAGE_SIZE;
    const int max_size = 8 * 1024 * 1024;
    int size;
    for (size = max_size; size >= min_size; size >>= 1) {
        auto new_pages = access.read_vector<uint8_t>(FLASH_START + size, 2 * PAGE_SIZE);
        if (!std::equal(first_two_pages.begin(), first_two_pages.end(), new_pages.begin())) break;
    }
    return size * 2;

Then I change the max_size to 16x1024x1024,All the picotool functions,such as info /load/save .. can run correctly.
Considering future scalability, there should be a better configuration option to address this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions