Skip to content

Conversation

marekmatej
Copy link

Since flash access can be restricted in cases when flash could be invalidated during the operation. Therefore, accessing a flash memory from the code running from the PSRAM could lead to an exception. This work implements asynchronous operations to allow flash access only from the valid runtime.

@marekmatej marekmatej force-pushed the feature/deferred_flash_access branch 2 times, most recently from 9404fcc to 6b144f1 Compare August 20, 2025 10:08
@marekmatej marekmatej requested a review from sylvioalves August 20, 2025 10:09
@sylvioalves sylvioalves added the platform: ESP32 Espressif ESP32 label Aug 20, 2025
@marekmatej marekmatej force-pushed the feature/deferred_flash_access branch from 6b144f1 to 02eff93 Compare August 26, 2025 09:26
Copy link

Copy link
Member

@uLipe uLipe left a comment

Choose a reason for hiding this comment

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

Nice job! I like the idea of using the workqueues for doing such sort of async jobs, I have only one remark, why not expose an option to also make possible to use a dedicated workqueue for flash operations? It would be great since the system workqueue is global and may get heavily loaded on complex applications.

@marekmatej marekmatej force-pushed the feature/deferred_flash_access branch from 02eff93 to 3207595 Compare October 7, 2025 12:15
@marekmatej marekmatej requested a review from uLipe October 7, 2025 20:40
uLipe
uLipe previously approved these changes Oct 9, 2025
@marekmatej marekmatej requested a review from sylvioalves October 9, 2025 14:26
@marekmatej
Copy link
Author

@de-nordic would you mind taking a look at the assigned PR? If not please re-assigne to someone else.

wmrsouza
wmrsouza previously approved these changes Oct 9, 2025
raffarost
raffarost previously approved these changes Oct 9, 2025
Direct flash access can cause exceptions when performed while the flash
memory is inaccessible or being modified — for example, when code is
executing from PSRAM. To avoid such invalid access, this change introduces
asynchronous flash operations that are executed from a safe runtime context
via a work queue. This ensures all flash accesses occur only when the flash
is valid and accessible.

Signed-off-by: Marek Matej <[email protected]>
@marekmatej marekmatej dismissed stale reviews from raffarost and wmrsouza via ecfaf3c October 9, 2025 19:18
Copy link

sonarqubecloud bot commented Oct 9, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants