Задать вопрос
max_dark
@max_dark
Диванный эксперт

Как исправить ошибку при старте отладки через OpenOCD «unknown flash device»?

Пытаюсь запустить загрузку/отладку прошивки через SWD-интерфейс на плате, основанной на MCU RP2040 (Raspbery Pi Pico).

Для этого на одну из плат установил DebugProbe(Firmware)

OpenOCD может подключиться к DebugProbe и через него ко второй плате, но при подключении GDB выдает ошибку "unknown flash device"
# запуск OpenOCD
$ openocd -f interface/cmsis-dap.cfg -c "set USE_CORE SMP" \
    -f target/rp2040.cfg -c "adapter speed 5000"

# запуск с GDB
gdb-multiarch cmake-build-debug/blink/blink.elf


Лог GDB

GNU gdb (Ubuntu 15.0.50.20240403-0ubuntu1) 15.0.50.20240403-git
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from cmake-build-debug/blink/blink.elf...
(gdb) target extended-remote :3333
Remote debugging using :3333
Remote connection closed
(gdb)

Лог OpenOCD

Open On-Chip Debugger 0.12.0
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
SMP
adapter speed: 5000 kHz

Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : Using CMSIS-DAPv2 interface with VID:PID=0x2e8a:0x000c, serial=459B221747675453
Info : CMSIS-DAP: SWD supported
Info : CMSIS-DAP: Atomic commands supported
Info : CMSIS-DAP: Test domain timer supported
Info : CMSIS-DAP: FW Version = 2.0.0
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 0 SWDIO/TMS = 0 TDI = 0 TDO = 0 nTRST = 0 nRESET = 0
Info : CMSIS-DAP: Interface ready
Info : clock speed 5000 kHz
Info : SWD DPIDR 0x0bc12477, DLPIDR 0x00000001
Info : SWD DPIDR 0x0bc12477, DLPIDR 0x10000001
Info : [rp2040.core0] Cortex-M0+ r0p1 processor detected
Info : [rp2040.core0] target has 4 breakpoints, 2 watchpoints
Info : [rp2040.core1] Cortex-M0+ r0p1 processor detected
Info : [rp2040.core1] target has 4 breakpoints, 2 watchpoints
Info : starting gdb server for rp2040.core0 on 3333
Info : Listening on port 3333 for gdb connections
Info : starting gdb server for rp2040.core1 on 3334
Info : Listening on port 3334 for gdb connections
Info : accepting 'gdb' connection on tcp/3333
Error: Unknown flash device (ID 0x00184068)
Error: auto_probe failed
Error: Connect failed. Consider setting up a gdb-attach event for the target to prepare target for GDB connect, or use 'gdb_memory_map disable'.
Error: attempted 'gdb' connection rejected


Пробовал с другой платой - ошибка та же, отличается только Flash ID:
Error: Unknown flash device (ID 0x0016405e)

Добавлял gdb_memory_map disable в параметры запуска.
При этом отладка в GDB запускается, но точки останова не срабатывают.

На форуме RaspberyPi предлагают патчить OpenOCD(src/flash/nor/spi.c)

Можно ли без этого обойтись?(вроде бы через конфиг можно задать размер / src/flash/nor/rp2040.c)

Если нет, то какие параметры смотреть в datasheet на flash для добавления FLASH_ID?

Фотки чипов памяти и подключения

67d6fa3b0fed4751555532.jpeg
67d6fa815b99f189969423.jpeg
67d6fa8bbc0a5549647428.jpeg
67d6fa945ad62369756957.jpeg
  • Вопрос задан
  • 9 просмотров
Подписаться 1 Средний Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы