pbio/sys/program_load: Allow reading user program. #243
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an experimental pull request to facilitate the use case in https://github.com/orgs/pybricks/discussions/1567.
This extends the readable region of user data to include the user code. This seems like a reasonable case for advanced users, so we might even choose to merge this.
The write-able region is not extended.
NOTE
If your purpose is to recover an existing program, naturally you mustn't override it with a new program to use this feature. Instead, use the REPL!
The
hub.system.storage
method is normally used to read and store user data. Such as user light sensor calibration values. This is512
bytes on SPIKE Prime. The user program size (4 bytes) and program follow immediately thereafter.So, you can theoretically extract your user code using the REPL as follows: