Skip to content

Commit

Permalink
pbio/drv/block_device: Fix tests for recent storage updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
laurensvalk committed Oct 15, 2024
1 parent ebf1cdc commit bb2cd8b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/pbio/drv/block_device/block_device_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,25 @@ static const uint8_t _program_data[] = {

static struct {
uint32_t write_size;
uint32_t stored_firmware_version;
uint8_t user_data[PBSYS_CONFIG_STORAGE_USER_DATA_SIZE];
char stored_firmware_hash[8];
pbsys_storage_settings_t settings;
uint32_t program_offset;
uint32_t program_size;
uint8_t program_data[sizeof(_program_data)];
} blockdev = { 0 };

// Information from MicroPython should not be used in the pbdrv drivers but it
// is permissible for this test. It ensures we can place the expected git
// version at the right place. FIXME: Move the git version to pybricks build
// system, since it isn't actually the micropython git version.
#include "genhdr/mpversion.h"

void pbdrv_block_device_init(void) {
blockdev.write_size = sizeof(blockdev) + sizeof(_program_data);
blockdev.stored_firmware_version = PBIO_HEXVERSION;
blockdev.program_size = sizeof(_program_data);
memcpy(&blockdev.program_data, _program_data, sizeof(_program_data));
memcpy(&blockdev.stored_firmware_hash[0], MICROPY_GIT_HASH, sizeof(blockdev.stored_firmware_hash));
memcpy(&blockdev.program_data[0], _program_data, sizeof(_program_data));
}

PT_THREAD(pbdrv_block_device_read(struct pt *pt, uint32_t offset, uint8_t *buffer, uint32_t size, pbio_error_t *err)) {
Expand Down

0 comments on commit bb2cd8b

Please sign in to comment.