lib: Update rp2040_flash to upstream picotool.git v2.0.0

This is in preparation for adding rp2350 flash support.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2024-10-25 21:54:31 -04:00
parent 06bb49f135
commit 64ba37c02e
9 changed files with 877 additions and 78 deletions

View file

@ -12,7 +12,7 @@
#include "picoboot_connection.h"
#include "boot/uf2.h"
#define FLASH_MAX_SIZE (FLASH_END - FLASH_START)
#define FLASH_MAX_SIZE (FLASH_END_RP2350 - FLASH_START)
#define FLASH_NUM_WRITE_BLOCKS (FLASH_MAX_SIZE / PAGE_SIZE)
#define FLASH_NUM_ERASE_BLOCKS (FLASH_MAX_SIZE / FLASH_SECTOR_ERASE_SIZE)
@ -62,7 +62,7 @@ int load_flash_data(const char *filename, struct flash_data *target) {
// Bounds and alignment checking
if (block.target_addr != (block.target_addr & ~(PAGE_SIZE-1))) continue;
if (block.target_addr > FLASH_END - PAGE_SIZE) continue;
if (block.target_addr > FLASH_END_RP2350 - PAGE_SIZE) continue;
if (block.target_addr < FLASH_START) continue;
uint32_t offset = block.target_addr - FLASH_START;
@ -209,7 +209,8 @@ int main(int argc, char *argv[]) {
if (target_bus != libusb_get_bus_number(*dev)) continue;
if (target_address != libusb_get_device_address(*dev)) continue;
}
enum picoboot_device_result res = picoboot_open_device(*dev, &handle);
model_t model;
enum picoboot_device_result res = picoboot_open_device(*dev, &handle, &model, -1, -1, "");
if (res == dr_vidpid_bootrom_ok) {
break;
}