CMSIS-DAP using TinyUSB

Overview

Dapper Mime

This unearths the name of a weekend project that I did in 2014. Both then and now, this is a port of ARM's CMSIS-DAP code to a platform without the need for an expensive proprietary compiler and USB drivers.

Whereas the original code used ST's STM32 USB drivers, this new iteration uses TinyUSB, an open source cross-platform USB stack for embedded systems.

Variants

Most TinyUSB supported MCUs can run this code; a subdirectory under bsp needs to be added for the "BOARD" name with a DAP_config.h to control the SWD/JTAG GPIOs and a unique.h to provide unique serial number (if any) and prefix to the USB product name.

Already added BOARD variants include:

For BOARD=raspberry_pi_pico, this project results in a standards-based CMSIS-DAP alternative to the approaches suggested in Chapter 5 and Appendix A of Getting Started with Raspberry Pi Pico. This uses two RP2040 boards (see wiring loom shown in Figure 34 of Appendix A) where one RP2040 is the debugger and the other RP2040 is being debugged. The instructions in Chapter 5 apply, except no Raspberry Pi is needed.

Alternatively, a special one RP2040 “Raspberry Pi Pico” variant is available here.

For BOARD=stm32f072disco, the inexpensive 32F072BDISCOVERY evaluation board can be used as a CMSIS-DAP SWD debugger.

Building

After initially downloading this project's code, issue the following command to download TinyUSB and CMSIS_5 code (as well as all submodules):

git submodule update --init --recursive

Follow the TinyUSB build instructions available here, but issue the make command in the base directory of Dapper Mime.

Note that each TinyUSB board name being targeted needs a corresponding subdirectory under the Dapper Mime ./bsp/ subdirectory and a customized version of DAP_config.h for the target.

License

TinyUSB is licensed under the MIT license.

ARM's CMSIS_5 code is licensed under the Apache 2.0 license.

Comments
  • Do not debug RPI PI pico CPU0 with Dappermime running on CPU0

    Do not debug RPI PI pico CPU0 with Dappermime running on CPU0

    This is more a hint than an issue.

    The RP2040 is the only target using SWD multi-drop and Dappermime the only CMSIS debugger supporting multi-drop I have access too. So I wanted to port the multi-drop changes I did to blackmagic debug probe (BMP) to the BMP CMSIS back-end. Testing with Dappermime pins connected to the on-board SWD pins let me get detection up. But as soon as the debugger tried to attached to CPU 0, Dappermime hanged until poweroff. Trying to fix that, I fixed a lot of other things. After some time I was sure there is a dappermime problem. Until I attached to CPU2 and things worked ;-)

    So to make it clear, you can not attach and halt the CPU where the debugger is running on.

    Would it be possible to run Dappermime on CPU1 be default? BMP hosted running on the PC has a -t TEST feature to easy see if things are right. To get the memory map, attach is needed. And so a test run without further arguments will hangs the debugger until power-off. For the principle of least surprise it would be fine if the setup could survive this test ;-)

    opened by UweBonnes 5
  • Please add a LICENCE file

    Please add a LICENCE file

    Hi

    I work for Raspberry Pi and we're interested in supporting CMSIS-DAP for greater interop between RP2040 debug and various third-party debug tools. Our existing adapter offering is Picoprobe (pico as a SWD adapter) which uses a custom protocol with OpenOCD, and isn't very portable.

    I've been using your repo internally for a while, and I think it'd be good to base our CMSIS-DAP support efforts on it. Could you add a permissive OSS licence to the repo?

    opened by P33M 4
  • Pico SDK No Longer Submodule in TinyUSB

    Pico SDK No Longer Submodule in TinyUSB

    https://github.com/majbthrd/DapperMime/blob/e5e92ee4f9e43d8408c4cd65677aaee0495365f1/CMakeLists.txt#L12

    I realize this project may not be actively maintained, but I just want to point out for others who may also try building from source that TinyUSB no longer includes the Pico SDK as a submodule as of April 2021, breaking the build script for this project.

    Only after fiddling with things for a bit did I realize that there are pre-compiled images available for download in the Releases section of the repo. Linking here for reference.

    opened by a-gavin 3
  • add usb mass storage device (flash drive) for pico

    add usb mass storage device (flash drive) for pico

    I've added a USB Mass Storage device alongside the HID and CDC, which uses the on-board flash of the Pico. It's not very large (Windows reports 1.92MB once formatted), but it could be useful for storing a compressed OpenOCD archive (that's how I'm using it). By default, the drive presents itself as read-only and writing to it can be enabled by bridging GPIO14 to ground. The mass storage device is enabled by default, but can be disabled from tusb_config.h .

    opened by tvlad1234 1
  • RP2040 / Pico crappy profiler bash one liner

    RP2040 / Pico crappy profiler bash one liner

    Just as an FYI for you or Google, I used this (DapperMime) code to build a crappy profiler for the RP2040 or Pico, posting it here in case it's useful for anyone else, feel free to include in your repo if you'd like, otherwise feel free to close.

    #!/bin/bash
    # This should be run from your pico-sdk based application's build directory, already built, flashed onto a device, and running
    # also, openOCD should be running in SWD mode, with pico-debug-core0.cfg  or pico-debug-core1.cfg as the configuration (or similar SWD config).
    # You should have a ~/.gdbinit containing only 'file relative_path_to.elf' so GDB is reading the correct symbols for the running code.
    # The code should run for the entire sample period. If you have multiple *.dis files, it may not detect the correct assembly.
    
    MAX_SAMPLES=100000
    TIMESTAMP=$(date +"%Y_%m_%d_%H_%M_%S")
    echo "This will take some time"
    (for i in {1..100000}; do echo "mrw 0xE000101C"; done) | nc -w1 127.0.0.1 4444 |  grep -av mrw | grep -av '>' | grep -av pen | sort | uniq -c | sort -n  | tr -d "\0" | awk -- '{gsub(/[ \t\r\n]+$/, "", $2); cmd=sprintf("gdb-multiarch -q --e
    val-command='\''info symbol 0x%x'\'' --eval-command quit", $2); printf("echo -n '\''%d\t%x\t'\''; %s \n", $1, $2, cmd);}' | /bin/bash | awk '{cmd=sprintf("grep %s *.dis", $2); gsub(/[\n\r]+$/, "", $0); printf("%s\t\t", $0); system(cmd);}'
    > crappy_profiler.output.$TIMESTAMP.txt
    

    The 0xE000101C is the DWT_PCSR register that allows you to monitor the PC register address via the debug interface.

    Output looks like this:

    
    683     20001178        render_led_frame + 788 in section .data         20001178:       468a            mov     sl, r1
    687     20000f7c        render_led_frame + 280 in section .data         20000f7c:       468a            mov     sl, r1
    697     20001158        render_led_frame + 756 in section .data         20001158:       468c            mov     ip, r1
    711     20001078        render_led_frame + 532 in section .data         20001078:       468a            mov     sl, r1
    712     200010f8        render_led_frame + 660 in section .data         200010f8:       468a            mov     sl, r1
    796     200010e4        render_led_frame + 640 in section .data         200010e4:       468b            mov     fp, r1
    853     20001358        render_led_frame + 1268 in section .data                20001358:       468b            mov     fp, r1
    854     200011e4        render_led_frame + 896 in section .data         200011e4:       468b            mov     fp, r1
    861     20001164        render_led_frame + 768 in section .data         20001164:       468b            mov     fp, r1
    
    

    With from left to right, # of calls in sample set, address of instruction, GDB symbol info, and disassembly.

    opened by MattMills 1
  • Provide new Raspberry Pi Pico version

    Provide new Raspberry Pi Pico version

    The provided version for the Raspberry Pi in the releases section didn't work for me. I had to re-compile the most recent main branch and that fixed it for me.

    Here is a binary that works (if you trust me :grin:)

    raspberry_pi_pico-DapperMime.uf2.gz

    For a good getting started experience, it would be great to have a ready to flash binary.

    opened by ctron 1
Releases(20210225)
Owner
null
Full Firmware Package for the STM32WB series: HAL+LL drivers, CMSIS, BSP, MW, plus a set of Projects

STM32Cube is an STMicroelectronics original initiative to ease developers' life by reducing efforts, time and cost.

STMicroelectronics 140 Nov 28, 2022
A test using a TTGO module (ESP32 + screen) which renders a 3d scene using pingo library

A simple 3D renderer tested and developed for the TTGO T-Display ESP32 board. The 3d renderer is: https://github.com/fededevi/pingo The 3D renderer is

fedevi 10 Nov 2, 2022
credential dump using foreshaw technique using SeTrustedCredmanAccessPrivilege

forkatz credential dump using forshaw technique using SeTrustedCredmanAccessPrivilege This code is based off of the blog post by james forshaw: https:

Barbarisch 117 Nov 21, 2022
Another version of EVA using anti-debugging techs && using Syscalls

EVA2 Another version of EVA using anti-debugging techs && using Syscalls First thing: Dont Upload to virus total. this note is for you and not for me.

null 270 Nov 9, 2022
In this Program, I am using C language and creating All Patterns Program using Switch case

In this Program, I am using C language and creating All Patterns Program using Switch case. It has 15 pattern programs like a pyramid, half pyramid, etc...

Rudra_deep 1 Nov 13, 2021
In DFS-BFS Implementation In One Program Using Switch Case I am Using an Simple And Efficient Code of DFS-BFS Implementation.

DFS-BFS Implementation-In-One-Program-Using-Switch-Case-in-C Keywords : Depth First Search(DFS), Breadth First Search(BFS) In Depth First Search(DFS),

Rudra_deep 1 Nov 17, 2021
multi-sdr-gps-sim generates a IQ data stream on-the-fly to simulate a GPS L1 baseband signal using a SDR platform like HackRF or ADLAM-Pluto.

multi-sdr-gps-sim generates a GPS L1 baseband signal IQ data stream, which is then transmitted by a software-defined radio (SDR) platform. Supported at the moment are HackRF, ADLAM-Pluto and binary IQ file output. The software interacts with the user through a curses based text user interface (TUI) in terminal.

null 66 Oct 29, 2022
And ESP32 powered VU matrix using the INMP441 I2S microphone

ESP32-INMP441-Matrix-VU This is the repository for a 3D-printed, (optionally) battery-powered, WS2812B LED matrix that produces pretty patterns using

null 54 Nov 23, 2022
Using a RP2040 Pico as a basic logic analyzer, exporting CSV data to read in sigrok / Pulseview

rp2040-logic-analyzer This project modified the PIO logic analyzer example that that was part of the Raspberry Pi Pico examples. The example now allow

Mark 60 Oct 31, 2022
Arduino sample code to help you get started using the Soracom IoT Starter Kit!

Soracom IoT Starter Kit The Soracom IoT Starter Kit includes everything you need to build your first connected device. It includes an Arduino MKR GSM

Soracom Labs 13 Jul 30, 2022
A laser cut Dreamcast Pop'n Music controller and integrated memory card using the Raspberry Pi Pico's Programmable IO

Dreamcast Pop'n Music Controller Using Raspbery Pi Pico (RP2040) Intro This is a homebrew controller for playing the Pop'n Music games on the Sega Dre

null 39 Nov 20, 2022
Web Server based on the Raspberry Pico using an ESP8266 with AT firmware for WiFi

PicoWebServer This program runs on a Raspberry Pico RP2040 to provide a web server when connected to an Espressif ESP8266. This allows the Pico to be

null 50 Nov 27, 2022
Using the LilyGo EPD 4.7" display to show OWM Weather Data

LilyGo-EPD-4-7-OWM-Weather-Display Using the LilyGo EPD 4.7" display to show OWM Weather Data Version 2.72 Improved Icon shapes and positioning Adjust

G6EJD 13 Apr 2, 2021
A Walkie-Talkie based around the ESP32 using UDP broadcast or ESP-NOW

Overview We've made a Walkie-Talkie using the ESP32. Explanatory video Audio data is transmitted over either UDP broadcast or ESP-NOW. So the Walkie-T

atomic14 256 Nov 28, 2022
Control your mouse using razer synapse

rzctl Control your mouse using razer synapse Compile in x64 Not tested for x86 Credits Process Hacker - https://github.com/processhacker/processhacker

null 43 Nov 23, 2022
🐏 💾 RamDisk for ESP32-Arduino using PsRam and fs::FS

ESP32-PsRamFS Coding Horror This is a very early version of ESP32-PsRamFS: a wannabee RamDisk library for Arduino-ESP32 with vfs compliance. It provid

tobozo 29 Nov 20, 2022
Firmware for DMR transceivers using the NXP MK22 MCU, AT1846S RF chip and HR-C6000 DMR chipset. Including the Radioddiy GD-77, Baofeng DM-1801 and Baofeng RD-5R.

OpenGD77 Firmware for DMR transceivers using the NXP MK22 MCU, AT1846S RF chip and HR-C6000 DMR chipset. This includes the Radioddiy GD-77, Radioddity

Open Ham 104 Nov 29, 2022
A Fingerprint Door Lock using a microprocessor named Arduino UNO and programming through Arduino IDE

INSTRUCTIONS - The codes for the Fingerprint Door lock are present in the Code For Fingerprint Door Lock folder The instructions of how to operate the

Akhil Sahukaru 15 Mar 3, 2022
A Gaggia Classic temperatue control project using arduino hw.

gaggiuino WIP UPDATE: I have taken photos and started editing them preparing the whole step by step guide, soon ( i'm thinking next week ) it should b

mr.toor 776 Dec 1, 2022