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

Add XIP cache maintenance API (fixes #2005) #2013

Merged
merged 4 commits into from
Nov 11, 2024
Merged

Conversation

Wren6991
Copy link
Contributor

@Wren6991 Wren6991 commented Nov 4, 2024

Also add a cache clean to all hardware_flash implementations which flush the cache, to avoid losing cached PSRAM writes.

This adds five new functions:

  • xip_cache_invalidate_all()
  • xip_cache_invalidate_range()
  • xip_cache_clean_all() (no-op on RP2040)
  • xip_cache_clean_range() (no-op on RP2040)
  • xip_cache_pin_range() (unavailable on RP2040)

It uses offsets (- XIP_BASE) instead of addresses, to be consistent with the hardware_flash APIs. If anyone strongly disagrees then we should change it now before we're stuck with it.

The library is unfortunately dependent on hardware_sync, just to get the barrier macros.

Also add a cache clean to hardware_flash implementations, to avoid
losing pending writes on the subsequent invalidate.
@Wren6991 Wren6991 added this to the 2.1.0 milestone Nov 4, 2024
@lurch lurch linked an issue Nov 4, 2024 that may be closed by this pull request
@kilograham
Copy link
Contributor

pls add new library to docs/index.h

will-v-pi
will-v-pi previously approved these changes Nov 7, 2024
Copy link

@will-v-pi will-v-pi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for RP2350 - I've tested all the functions and they work as expected with PSRAM and Flash

@kilograham kilograham modified the milestones: 2.2.0, 2.1.0 Nov 11, 2024
@kilograham kilograham merged commit f9eb48b into develop Nov 11, 2024
6 checks passed
@kilograham kilograham deleted the add-xip-cache-api branch November 11, 2024 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add XIP cache management routines
4 participants