|
22 | 22 | #include "core.h" |
23 | 23 | #include "hmi.h" |
24 | 24 |
|
25 | | -/** |
26 | | - * Information about one code slot. |
27 | | - * |
28 | | - * A size of 0 means that this slot is not used. The offset indicates where |
29 | | - * the program is stored in user storage. |
30 | | - * |
31 | | - * Code slots are *not* stored chronologically by slot id. Instead they are |
32 | | - * stored consecutively as they are received, with the newest program last. |
33 | | - * |
34 | | - * If a slot is already in use and a new program should be loaded into it, |
35 | | - * it is deleted by mem-moving any subsequent programs into its place, and |
36 | | - * appending the new program to be last again. Since a user is typically only |
37 | | - * iterating code in one slot, this is therefore usually the last stored |
38 | | - * program. This means memmoves happen very little, only when needed. |
39 | | - * |
40 | | - */ |
41 | | -typedef struct { |
42 | | - uint32_t offset; |
43 | | - uint32_t size; |
44 | | -} pbsys_storage_slot_info_t; |
45 | | - |
46 | 25 | /** |
47 | 26 | * Slot at which incoming program data is currently being received. |
48 | 27 | */ |
49 | 28 | static uint8_t incoming_slot = 0; |
50 | 29 |
|
51 | | -/** |
52 | | - * Map of loaded data. All data types are little-endian. |
53 | | - */ |
54 | | -typedef struct { |
55 | | - /** |
56 | | - * End-user read-write accessible data. Everything after this is also |
57 | | - * user-readable but not writable. |
58 | | - */ |
59 | | - uint8_t user_data[PBSYS_CONFIG_STORAGE_USER_DATA_SIZE]; |
60 | | - /** |
61 | | - * First 8 symbols of the git hash of the firmware version used to create |
62 | | - * this data map. If this does not match the version of the running |
63 | | - * firmware, user data will be reset to 0. |
64 | | - */ |
65 | | - char stored_firmware_hash[8]; |
66 | | - /** |
67 | | - * System settings. Settings will be reset to defaults when the firmware |
68 | | - * version changes due to an update. |
69 | | - */ |
70 | | - pbsys_storage_settings_t settings; |
71 | | - /** |
72 | | - * Size and offset info for each slot. |
73 | | - */ |
74 | | - pbsys_storage_slot_info_t slot_info[PBSYS_CONFIG_STORAGE_NUM_SLOTS]; |
75 | | - /** |
76 | | - * Data of the application program (code + heap). |
77 | | - */ |
78 | | - uint8_t program_data[] __attribute__((aligned(sizeof(void *)))); |
79 | | -} pbsys_storage_data_map_t; |
80 | | - |
81 | 30 | /** |
82 | 31 | * Map of loaded data. This is kept in memory between successive runs of the |
83 | 32 | * end user application (like MicroPython). |
@@ -399,7 +348,7 @@ static pbio_error_t pbsys_storage_deinit_process_thread(pbio_os_state_t *state, |
399 | 348 | */ |
400 | 349 | void pbsys_storage_init(void) { |
401 | 350 |
|
402 | | - pbio_error_t err = pbdrv_block_device_get_data((uint8_t **)&map); |
| 351 | + pbio_error_t err = pbdrv_block_device_get_data(&map); |
403 | 352 |
|
404 | 353 | // Test that storage successfully loaded and matches current firmware, |
405 | 354 | // otherwise reset storage. |
|
0 commit comments