In my understanding boot rom functions use 4K only, but I might be wrong. The 
code is here: 
https://github.com/raspberrypi/pico-bootrom-rp2040/blob/master/bootrom/program_flash_generic.c

I tested both linked patches, the current git and the packaged version of my 
distro. But did not see significant differences. (log attached).

All versions show this warning:
~~~
Warn : Adding extra erase range, 0x10022d00 .. 0x1002ffff
~~~



Attachments:

- 
[openocd_tests_log.txt](https://sourceforge.net/p/openocd/tickets/_discuss/thread/67e8883d37/358a/attachment/openocd_tests_log.txt)
 (9.3 kB; text/plain)


---

**[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:** Tue Oct 01, 2024 04:28 AM 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