Skip to content

Commit a289bb1

Browse files
committed
pbio/sys/program_load: Allow reading user program.
1 parent 1d0f987 commit a289bb1

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@
1313
### Changed
1414
- Raise a descriptive error when the `Car` class can't find a steering mechanism
1515
end stop within 10 seconds ([support#1564]).
16+
- Extended region of readable data with `hub.system.storage` to include
17+
user program ([pybricks-micropython#243]).
1618

1719
### Fixed
1820
- Fixed hubs not shutting down when holding hub button ([support#1419]).
1921

22+
[pybricks-micropython#243]: https://github.com/pybricks/pybricks-micropython/pull/243
2023
[support#802]: https://github.com/pybricks/support/issues/802
2124
[support#1419]: https://github.com/pybricks/support/issues/1419
2225
[support#1564]: https://github.com/pybricks/support/issues/1564

lib/pbio/sys/program_load.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ pbio_error_t pbsys_program_load_set_user_data(uint32_t offset, const uint8_t *da
6666
}
6767

6868
/**
69-
* Gets pointer to user data.
69+
* Gets pointer to user data or user program.
7070
*
7171
* @param [in] offset Offset from the base address.
7272
* @param [in] data The data reference.
@@ -75,7 +75,7 @@ pbio_error_t pbsys_program_load_set_user_data(uint32_t offset, const uint8_t *da
7575
* Otherwise, ::PBIO_SUCCESS.
7676
*/
7777
pbio_error_t pbsys_program_load_get_user_data(uint32_t offset, uint8_t **data, uint32_t size) {
78-
if (offset + size > sizeof(map->header.user_data)) {
78+
if (offset + size > sizeof(map->header.user_data) + sizeof(map->header.program_size) + map->header.program_size) {
7979
return PBIO_ERROR_INVALID_ARG;
8080
}
8181
*data = map->header.user_data + offset;

0 commit comments

Comments
 (0)