Skip to content

Conversation

@rkel
Copy link
Contributor

@rkel rkel commented Dec 4, 2025

Implement a functionality to set write and erase callbacks that can modify the simulation on the fly when the operations are in progress. This allows simulation for modules that takes care about data integrity and should react when anything breaks when accessing FLASH.

I did not implement read operation callback as when reading we can usually modify the memory content before calling a module operation that uses it.

@zephyrbot zephyrbot added area: Tests Issues related to a particular existing or missing test area: Flash labels Dec 4, 2025
@rkel rkel force-pushed the flash_simulator_callbacks branch from 9789d4c to f92c25c Compare December 4, 2025 11:43
@rkel rkel marked this pull request as draft December 4, 2025 12:48
@rkel
Copy link
Contributor Author

rkel commented Dec 4, 2025

I need to work on it little more - I did not realize that FLASH simulator is used in samples. First I will fix the errors, and then add an option to enable the callbacks functionality.

@rkel rkel force-pushed the flash_simulator_callbacks branch 2 times, most recently from 812995f to 7f6e275 Compare December 4, 2025 13:18
Add the functionality that allows to register write and erase callbacks.
The callbacks can modify the behaviour of this operations.
It are meant to be used during testing of the situation when the memory
starts to generate errors or the data cannot be trusted anymore.
It expands the testing possibility, for a situation when the module
is tested that checks the data integrity and and we cannot just jump in
between its internal write and read operations to inject an error.

Signed-off-by: Radosław Koppel <[email protected]>
@rkel rkel force-pushed the flash_simulator_callbacks branch from 7f6e275 to ec9a43c Compare December 4, 2025 14:00
@rkel rkel marked this pull request as ready for review December 4, 2025 14:45
This test checks the functionality of the callbacks for erase and write
operations. The callbacks allows the modification of the simulated flash
behaviour during this operations.

Signed-off-by: Radosław Koppel <[email protected]>
@rkel rkel force-pushed the flash_simulator_callbacks branch from ec9a43c to cdcdff5 Compare December 5, 2025 11:33
@rkel
Copy link
Contributor Author

rkel commented Dec 5, 2025

I had added test teardown function to callbacks test that removes the registered callbacks.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 5, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Flash area: Tests Issues related to a particular existing or missing test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants