cancel
Showing results for 
Search instead for 
Did you mean: 

Cmsis-DAP debugger in STM32CubeIDE

atleasttwocharacterslong
Associate III

Hello, i have a DapLink debugger and wanted to use it with stm32, i also am pretty new to stm32, so don't be mad when i mess up some terms. I don't want to buy an STLink yet since i wanna see if i am going to like stm32 debugging/programming. Some context:MCU:STM32H723ZGT6, debugger: DapLink Mini, OS:Ubuntu desktop 24.10.Also, yes i know that this board is overkill but i thought, go big or go home, if i am gonna try stm32 i better make it count.

36 REPLIES 36

True - but I wasn't talking about that.

Unless it's something that specifically needs to be a screenshot, it's generally better to copy & paste the text - with appropriate formatting, as required.

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

...dont know, what your editor shows at 191 --- no AP_NUM

i see:

AScha3_0-1737990413075.png

btw i have no idea, what this means... (backup file , then edit ...maybe as sudo)

i would just try to remove the > if { $ ...    < and the else also.

just remains there:

		target create $_CHIPNAME.ap2 mem_ap -dap $_CHIPNAME.dap -ap-num 0
		swo  create $_CHIPNAME.swo  -dap $_CHIPNAME.dap -ap-num 0 -baseaddr 0xE00E3000
		tpiu create $_CHIPNAME.tpiu -dap $_CHIPNAME.dap -ap-num 0 -baseaddr 0xE00F5000

and see, what happens.

 

 

If you feel a post has answered your question, please click "Accept as Solution".
atleasttwocharacterslong
Associate III

oh, i was viewing openocd files instead of the ide ones

 

after patching out the AP_NUM

atleasttwocharacterslong_0-1737991629102.png

 

...dont know... i would try instead :

		target create $_CHIPNAME.ap2 mem_ap -dap $_CHIPNAME.dap -ap-num 2
		swo  create $_CHIPNAME.swo  -dap $_CHIPNAME.dap -ap-num 2 -baseaddr 0xE00E3000
		tpiu create $_CHIPNAME.tpiu -dap $_CHIPNAME.dap -ap-num 2 -baseaddr 0xE00F5000

 

If you feel a post has answered your question, please click "Accept as Solution".
ckocagil
Visitor

I found the steps to upload and debug with a cheap daplink. See my post on imgur (https://imgur.com/a/how-to-use-daplink-cmsis-dap-with-stm32cubeide-OrpcsvX) - or I'll copy paste its contents below:

---

How to use daplink (cmsis-dap) with STM32CubeIDE


ckocagil_5-1745353772389.png
You can use a cheap and standard cmsis-dap device to flash and debug stm32 projects within the cube ide. Let's start with a fresh project.
 
 
 
 
 
ckocagil_6-1745353942962.png
I hook up the dap with 4 wires (vcc, gnd, swdio, swclk) and no reset wire. For this to work without having to constantly manually reset the device, I go to SYS and change Debug mode to Serial Wire. Save and generate code. Build.
 
 
 
 
 
ckocagil_8-1745353989610.png
Next, we create a file daplink.cfg in the project root. The file should contain:
source [find interface/cmsis-dap.cfg]
adapter speed 1000
transport select swd
source [find target/stm32f1x.cfg]
reset_config none
 
 
 
 
 
ckocagil_10-1745354083720.png
Now go to Run -> Debug Configurations and create a debug config. Make sure the C/C++ Application field contains our elf file.
 
 
 
 
 
ckocagil_3-1745353712160.png
The crucial part: on the Debugger tab, we change the probe to OpenOCD, select User Defined script, and use our daplink.cfg.
 
Click Apply to save our debug config and that should be all. You're now ready to run or debug your code.
 
QUIRKS: For some reason, ST's openocd scripts leave the mcu paused after detaching the dap. This means every time you Run your code or detach a Debug session, your mcu will need a manual reset.
 
My workaround for this is to add the following line at the end of daplink.cfg:
 
lappend pre_shutdown_commands { resume }