Comments (22)
I've already implemented a TinyUSB-based CMSIS-DAP that runs on rp2040 core0 and debugs core1. Since most debugging tools don't yet support multi-drop (particularly for CMSIS-DAP), including Raspberry's own OpenOCD fork, it automatically does the SWD multi-drop target selection upon a CMSIS-DAP DAP_Connect.
RP2040's built-in support for one core being able to debug the other core was what interested me when reading the datasheet after the announcement. It has the potential to make single-step debugging more available to a general audience at an attractive price point (since it is effectively "built-in").
The source code is here: https://github.com/majbthrd/DapperMime/
As-is, the code uses pico-sdk defaults and compiles to flash and uses scattered addresses throughout SRAM. This is not a desirable configuration.
The preferred configuration is to beat pico-sdk into submission and use the upper SRAM, leaving the lower SRAM for the user app being debugged. Doing this means adding "set(PICO_NO_FLASH 1)" to the project's CMakeList.txt (for whatever reason, to make this work requires doing a "make clean", then touch CMakeList.txt, then do another "make" for the pico-sdk dependencies to use this), and then hacking up ./src/rp2_common/pico_standard_link/memmap_no_flash.ld to use upper SRAM (starting at 0x2003000 works).
from debugprobe.
@flit "We are in the process of switching it to build with gcc by default" I was trying to build it earlier this week to install it on a bluepill, I went through a zoo of source code, which I gave up in trying to script. I found another project which I tried to convert from Keil to GCC+Makefiles here: https://github.com/zoobab/STM32F103C8T6_CMSIS-DAP_SWO
The experimental_compilers branch has the gcc support. The top-level README.md has instructions on how to build. There are also some wiki pages with current testing status.
The F103 firmware seems stable according to testers, and has been tested on a bluepill.
Pre-built firmware is available through a link on the gcc port discussion.
from debugprobe.
One the topic of CMSIS-DAP alternatives for RP2040:
If you haven't already seen it, I submitted a PR to support CMSIS-DAP multi-drop with Raspberry Pi's fork of OpenOCD:
I also now have two different approaches for RP2040 CMSIS-DAP.
One is a drop-in CMSIS-DAP replacement to the existing approaches in Getting Started with Pico.
A second RP2040 substitutes for the Raspberry Pi in Chapter 5, and would be wired in as shown in Appendix A for picoprobe. That source code is:
https://github.com/majbthrd/DapperMime/
The other CMSIS-DAP approach is a RAM only executable that hides out in tiny corners of memory. This needs only one RP2040 where one core acts as the debugger for the other. This is the most appealing to me, but does involve a tradeoff. Since both cores can reset and initialize peripherals, code in the core being debugged can disrupt the core being the debugger. At the moment, pico-sdk does this as part of its initialization procedures, and all Raspberry Pi's example code uses this. The source code for this approach is:
https://github.com/majbthrd/pico-debug/
from debugprobe.
The Blackmagic debug probe branch https://github.com/UweBonnes/blackmagic/tree/rp supports multidrop and exposes all 3 Pico DPs.
from debugprobe.
@majbthrd Don't reply on TinyUSB submodules, it is only meant to run examples within tinyusb. I would expect other project just clone tinyusb witthout any of its submodules. Since I could move/delete the sub-modules path and lib around.
Thanks @hathach , I have revised it to use CMSIS_5 directly.
from debugprobe.
The branch was merged in the main tree. Use https://github.com/blackmagic-debug/blackmagic.git!
from debugprobe.
There is a pull request here.
from debugprobe.
This was a quick side project for me which is why I used our existing USB stack (TinyUSB) and implemented my own SWD probe. We'd be more than happy for Pico support to be added to DAPLink but don't have plans / time to do it ourselves.
from debugprobe.
Understood. Although, I believe using DAPLink would result in less maintenance work for you.
On the pyocd side, we are planning to start adding support over the next few weeks (I get my Pico boards tomorrow 😄 ). Single core support should be quick, but multicore will be more difficult due to the, uh, less than ideal structure of the Pico's DAP (pyocd currently doesn't support multi-drop SWD because it's never before been used for multicore devices).
from debugprobe.
I feel your pain, maybe this is of some help (massaging multi-drop somewhat reasonably into something that didn't quite expect it)
Note single core is fine, but you do have to at least select the core (as you probably know)
from debugprobe.
Thanks for the pointer. 👍🏽
from debugprobe.
@majbthrd that sounds fantastic! It looks as though the cmsis submodule hasn't been checked in at the moment?
from debugprobe.
Note that the Raspberry Pi OpenOCD fork absolutely supports multi-drop and debugging of both cores
from debugprobe.
@liamfraser , I probably need to tweak the README.md language for clarity. I was originally going to link directly to CMSIS_5, but then realized when testing the instructions that TinyUSB already had CMSIS_5 as one of its submodules. As a result, if one downloads the TinyUSB submodules, it already has everything.
from debugprobe.
Note that the Raspberry Pi OpenOCD fork absolutely supports multi-drop and debugging of both cores
@kilograham , I don't believe the fork yet supports multi-drop for CMSIS-DAP (but neither does OpenOCD at the moment). It does for J-Link (as I used that in testing... thanks!).
from debugprobe.
@liamfraser , I probably need to tweak the README.md language for clarity. I was originally going to link directly to CMSIS_5, but then realized when testing the instructions that TinyUSB already had CMSIS_5 as one of its submodules. As a result, if one downloads the TinyUSB submodules, it already has everything.
@majbthrd Don't rely on TinyUSB submodules, it is only meant to run examples within tinyusb. I would expect other project just clone tinyusb witthout any of its submodules. Since I could move/delete the sub-modules path and lib around.
from debugprobe.
why not just make this an INTERFACE library the user can link into their binary?
from debugprobe.
That's an interesting idea! The compiler automatically takes care of de-conflicting memory spaces; core0 would run the debugger and core1 would run the user code. It might be well suited to don't-peek-behind-the-curtain environments like Arduino.
CMSIS conventions have a SystemInit in crt to handle such hooks, but if pico-sdk's wait_for_vector were weakly defined, it could be overloaded to allow such a mechanism.
On the downside, such an approach (mixing two codes at compile time) does force a power cycle and new .uf2 download every time the user wants to revise their code. Keeping them separate allows the debugger to remain resident and the user can dynamically re-download their code at will via CMSIS-DAP.
from debugprobe.
Yeah, the exact logistics are going to depend on how you are restarting binraries etc... whether you expect to be able to use flash binaries (rewriting the binary you are running is possible but not easy!)...
wait_for_vector is weekly defined, but the core may already be stopped in the bootrom. however you can make a library function that is run at startup which can launch something on core 1.
from debugprobe.
@flit "We are in the process of switching it to build with gcc by default" I was trying to build it earlier this week to install it on a bluepill, I went through a zoo of source code, which I gave up in trying to script. I found another project which I tried to convert from Keil to GCC+Makefiles here: https://github.com/zoobab/STM32F103C8T6_CMSIS-DAP_SWO
from debugprobe.
The Blackmagic debug probe branch https://github.com/UweBonnes/blackmagic/tree/rp supports multidrop and exposes all 3 Pico DPs.
The branch seems to be deleted and not available any more.
from debugprobe.
Fixed in #31
from debugprobe.
Related Issues (20)
- Not able to flash picoW using picoprobe HOT 13
- Replace UART with another SWD
- Request 2 cancelled on connection close HOT 4
- UART enable define doesn't actually disable UART code
- probe.c only includes probe.pio.h, doesn't include define for _oen version HOT 2
- Feature suggestion: add ability to unlock flash sectors HOT 4
- Probe can no longer connect to Pico after rename HOT 6
- How to use target reset functionality? HOT 6
- Fatal error: bsp/board.h: No such file or directory HOT 3
- OpenOCD Unable to Connect to debugprobe HOT 1
- Unable to use debugprobe HOT 3
- Version info in USB descriptor struct not updated during 1.1 release
- OpenOCD Unable to Connect to debugprobe HOT 2
- UART doesn't support transmitting a break signal HOT 4
- Incorrect macro used in ifdef can cause a build failure HOT 2
- Add version number to picotool output HOT 3
- YD-RP2040 HOT 3
- debugprobe not resonsive shortly after starting debug HOT 9
- Document pinout in README HOT 5
- Open source license is not documented HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from debugprobe.