Skip to content

Commit 0c91aab

Browse files
committed
Use FLASH_SECTOR_SIZE instead of 4096
1 parent 6b69108 commit 0c91aab

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/rp2_common/pico_cyw43_driver/cyw43_driver.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ static async_context_t *cyw43_async_context = NULL;
2323

2424
#if CYW43_USE_PARTITION_FIRMWARE
2525
#include "pico/bootrom.h"
26+
#include "hardware/flash.h"
2627
#include "boot/picobin.h"
2728
#include <stdlib.h>
2829

@@ -161,8 +162,8 @@ bool cyw43_driver_init(async_context_t *context) {
161162
assert(ret == 3);
162163

163164
uint32_t location_and_permissions = buffer[1];
164-
uint32_t saddr = ((location_and_permissions >> PICOBIN_PARTITION_LOCATION_FIRST_SECTOR_LSB) & 0x1fffu) * 4096;
165-
uint32_t eaddr = (((location_and_permissions >> PICOBIN_PARTITION_LOCATION_LAST_SECTOR_LSB) & 0x1fffu) + 1) * 4096;
165+
uint32_t saddr = ((location_and_permissions >> PICOBIN_PARTITION_LOCATION_FIRST_SECTOR_LSB) & 0x1fffu) * FLASH_SECTOR_SIZE;
166+
uint32_t eaddr = (((location_and_permissions >> PICOBIN_PARTITION_LOCATION_LAST_SECTOR_LSB) & 0x1fffu) + 1) * FLASH_SECTOR_SIZE;
166167
// Starts with metadata block
167168
while(saddr < eaddr && *(uint32_t*)(XIP_NOCACHE_NOALLOC_NOTRANSLATE_BASE + saddr) != PICOBIN_BLOCK_MARKER_END) {
168169
saddr += 4;

0 commit comments

Comments
 (0)