尝试调试 RP2040(R-Pi Pico)上的固件时,OpenOCD 给出错误“错误:未知闪存设备(ID 0x00184068)”
该板有一个存储芯片“BY25Q128ES - 128M BIT SPI NOR FLASH”
在Raspberry Pi 论坛上,他们讨论了修补文件src/flash/nor/spi.c 的必要性
我找到了内存芯片的数据表,但我不太明白我需要在其中查找哪些参数才能正确填写FLASH_ID
宏本身创建该类型的对象flash_device
并具有签名:
/// @file: src/flash/nor/spi.h
/* data structure to maintain flash ids from different vendors */
struct flash_device {
const char *name;
uint8_t read_cmd;
uint8_t qread_cmd;
uint8_t pprog_cmd;
uint8_t erase_cmd;
uint8_t chip_erase_cmd;
uint32_t device_id;
uint32_t pagesize;
uint32_t sectorsize;
uint32_t size_in_bytes;
};
#define FLASH_ID(n, re, qr, pp, es, ces, id, psize, ssize, size) \
{ \
.name = n, \
.read_cmd = re, \
.qread_cmd = qr, \
.pprog_cmd = pp, \
.erase_cmd = es, \
.chip_erase_cmd = ces, \
.device_id = id, \
.pagesize = psize, \
.sectorsize = ssize, \
.size_in_bytes = size, \
}
/// @file: src/flash/nor/spi.c
// ....
/* Shared table of known SPI flash devices for SPI-based flash drivers. Taken
* from device datasheets and Linux SPI flash drivers. */
const struct flash_device flash_devices[] = {
/* Note: device_id is usually 3 bytes long, however the unused highest byte counts
* continuation codes for manufacturer id as per JEP106xx.
*
* All sizes (page, sector/block and flash) are in bytes.
*
* Guide to select a proper erase command (if both sector and block erase cmds are available):
* Use 4kbit sector erase cmd and set erase size to the size of sector for small devices
* (4Mbit and less, size <= 0x80000) to prevent too raw erase granularity.
* Use 64kbit block erase cmd and set erase size to the size of block for bigger devices
* (8Mbit and more, size >= 0x100000) to keep erase speed reasonable.
* If the device implements also 32kbit block erase, use it for 8Mbit, size == 0x100000.
*/
/* name read qread page erase chip device_id page erase flash
* _cmd _cmd _prog _cmd* _erase size size* size
* _cmd _cmd
*/
FLASH_ID("st m25pe10", 0x03, 0x00, 0x02, 0xd8, 0x00, 0x00118020, 0x100, 0x10000, 0x20000),
//....
FLASH_ID("st m25p05", 0x03, 0x00, 0x02, 0xd8, 0xc7, 0x00102020, 0x80, 0x8000, 0x10000),
//...
FLASH_ID("sp s25fl512s", 0x13, 0x00, 0x12, 0xdc, 0xc7, 0x00200201, 0x200, 0x40000, 0x4000000),
在这种情况下,什么是“pagesize
和” sectorsize
?
在闪存芯片的数据表中它应该叫什么?