Please note that there is a bunch of pending patches adding RP2350 support.
The new RP2xxx driver code uses fixed 4k sector size for both RP2040 and 
RP2350. See e.g.
8453: flash/nor/rp2040: improve flash write buffer size computation | 
https://review.openocd.org/c/openocd/+/8453

Checkout whole relation chain under 
8461: tcl/target/rp2040: add flash size override and reset init event | 
https://review.openocd.org/c/openocd/+/8461
and give them a try.



---

**[tickets:#437] Wrong sector size for w25q16jv / RP2040 pico**

**Status:** new
**Milestone:** 0.11.0
**Created:** Sun Sep 29, 2024 05:57 AM UTC by JustAnother1
**Last Updated:** Sun Sep 29, 2024 02:08 PM UTC
**Owner:** nobody


in line 305 of src/flash/nor/rp2040.c (current git) there is this comment:
~~~
        /*
        The RP2040 Boot ROM provides a _flash_range_erase() API call documented 
in Section 2.8.3.1.3:
        https://datasheets.raspberrypi.org/rp2040/rp2040-datasheet.pdf
        and the particular source code for said Boot ROM function can be found 
here:
        
https://github.com/raspberrypi/pico-bootrom/blob/master/bootrom/program_flash_generic.c

        In theory, the function algorithm provides for erasing both a smaller 
"sector" (4096 bytes) and
        an optional larger "block" (size and command provided in args).
        */
~~~

I have verified the erase function from the boot rom of the RP2040. That is the 
same function openocd uses here. And I found that it is able to erase a 4096 
byte sector. So the comment is right.
 I wrote something before and after and in a sector and then called 
_flash_range_erase() from the boot-rom to erase the one 4096 bytes sized sector 
and only the bytes in the sector have been erased. The data before and after 
were still there. So erasing 4096 bytes is not theory anymore.

I therefore think that line 55 in  src/flash/nor/rp2040.c and line 123 (129?) 
in src/flash/nor/spi.c should be changed. They specify the sector size to 
0x10000 (64k) and should be 1000(4k)

What else can I do to get this change merged, or is there a reason not to do 
this?



---

Sent from sourceforge.net because openocd-devel@lists.sourceforge.net is 
subscribed to https://sourceforge.net/p/openocd/tickets/

To unsubscribe from further messages, a project admin can change settings at 
https://sourceforge.net/p/openocd/admin/tickets/options.  Or, if this is a 
mailing list, you can unsubscribe from the mailing list.


Reply via email to