Skip to content

Commit

Permalink
Use FLASH_SECTOR_SIZE instead of 4096
Browse files Browse the repository at this point in the history
  • Loading branch information
will-v-pi committed Oct 15, 2024
1 parent 6b69108 commit 0c91aab
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/rp2_common/pico_cyw43_driver/cyw43_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ static async_context_t *cyw43_async_context = NULL;

#if CYW43_USE_PARTITION_FIRMWARE
#include "pico/bootrom.h"
#include "hardware/flash.h"
#include "boot/picobin.h"
#include <stdlib.h>

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

uint32_t location_and_permissions = buffer[1];
uint32_t saddr = ((location_and_permissions >> PICOBIN_PARTITION_LOCATION_FIRST_SECTOR_LSB) & 0x1fffu) * 4096;
uint32_t eaddr = (((location_and_permissions >> PICOBIN_PARTITION_LOCATION_LAST_SECTOR_LSB) & 0x1fffu) + 1) * 4096;
uint32_t saddr = ((location_and_permissions >> PICOBIN_PARTITION_LOCATION_FIRST_SECTOR_LSB) & 0x1fffu) * FLASH_SECTOR_SIZE;
uint32_t eaddr = (((location_and_permissions >> PICOBIN_PARTITION_LOCATION_LAST_SECTOR_LSB) & 0x1fffu) + 1) * FLASH_SECTOR_SIZE;
// Starts with metadata block
while(saddr < eaddr && *(uint32_t*)(XIP_NOCACHE_NOALLOC_NOTRANSLATE_BASE + saddr) != PICOBIN_BLOCK_MARKER_END) {
saddr += 4;
Expand Down

0 comments on commit 0c91aab

Please sign in to comment.