I got my Daisy Pod this morning after a 6 week USP delay, I live in the UK btw.
I don’t use VisualGDB or Visual Studio 2019 as I don’t like how Visual Studio 2019 handles C++ projects with its insistence of not allowing you to add actual folders to structure your code better.
Anyway….
Using the Pod MultiEffect project, but any STM32H7 project should be ok with the following.
I use Visual Studio Code and I flash and debug via an STM St-Link ver 3 JTAG.
https://uk.farnell.com/stmicroelectronics/stlink-v3set/in-circuit-debugger-programmer/dp/2980978
You will need a JTAG 2x10 way mini/micro cable converter to plug into the Daisy Seed.
I got mine from here
Don’t forget I’m in the UK/Europe. You should have distributors nearer to your home.
Note the orientation of the Daisy Seed end of the connector as detailed here
“ If you’re using the ST-Link, connect the IDC cable with the redstripe facing up toward the white stripe on the 2x10 male connector on the top of the Daisy Seed.”
Squint at your Daisy Seed and you should just about see it next to the H7 chip itself.
Below is a debug config/launch.json that fires up OpenOCD and allows breakpoints, single step, watch etc.
Note: I’m on a Windows10 machine at the moment, my Mac is busy doing other things.
I have been developing with STM32 devices for a couple of years now so my setup is stable.
This is what I have/did
Note: I know PlatformIO creates an environment for Daisy, but I haven’t used it as yet, I’m old school
1: Down load the latest ARM cortex Compiler/Linker and installed it to the default folder
C:\program Files (x86)\GNU Arm Embedded Toolchain\9 2020-q2-update
2: Downloaded OpenOCD and installed to the default location
C:\Program Files\OpenOCD10
For I & 2 above, if prompted during install add paths to your evn. If not manually add them i.e. point to the bin folder.
3: Get the stm32H750x.svd required in the launch.json file from here https://github.com/posborne/cmsis-svd/tree/master/data/STMicro
It’s a big file so you’ll probably have to just copy the ‘raw’ file
I created a file by the same name in the daisy seed folder then pasted into that file
The .svd is just a description file for the STM32 processor required by the debugger.
So we now have three file links that are going to be used in launch.json
Below is the launch.json.
Note my hard coded paths and the VS Code attributes e.g. ${workspaceRoot}
You may/will have to change the paths in your launch.json to point to your installs and to the .elf file your current project is compiling.
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"cwd": "${workspaceFolder}",
"executable": "${workspaceRoot}\\Desktop\\DaisyExamples\\pod\\MultiEffect\\build\\MultiEffect.elf",
"name": "JTAG DEBUGGING ",
"request": "launch",
"type": "cortex-debug",
"servertype": "openocd",
"armToolchainPath": "C:\\Program Files (x86)\\GNU Arm Embedded Toolchain\\9 2020-q2-update\\bin",
"interface": "swd",
"svdFile": "${workspaceRoot}\\Desktop\\DaisyExamples\\seed\\stm32H750x.svd",
"runToMain": true,
"configFiles": [
"interface\\stlink.cfg",
"target\\stm32h7x.cfg"
],
"debuggerArgs": [
"-d",
"${workspaceRoot}\\Desktop\\DaisyExamples\\pod\\MultiEffectBlink\\"
],
"preRestartCommands": [
"load",
"enable breakpoint",
"monitor reset"
],
"showDevDebugOutput": true,
}
]
}
In the launch.json above you’ll see the following
“configFiles”: [
“interface\stlink.cfg”,
“target\stm32h7x.cfg”
],
These are config files for OpenOCD that get installed with OpenOCD.
Now make your project (MultiEffect ) using the Daisy make file as usual.
When compiled/linked successfully In VS Code click on the Debug icon and the drop down should display JTAG DEBUGGING, you can change the name in launch.json to whatever you want.
Click the green run icon , you should see a lot of ‘low level’ message text in the Debug Console of VS Code as OpenOCD starts up.
Your code might halt execution at the init() function, click the blue continue icon in the debug floating menu.
Now, set a breakpoint somewhere in your code that you know will be hit. And, run to that breakpoint.
But it doesn’t hit the break point and you’ll get a message complaining about a missing symbol file !
We need to do one last little thing that is create a symbol file.
In the project e.g MultiEffect there is a project local makefile.
This calls by way of an include the main Daisy Seed make file in libdaisy folder
At about line 208 in this main make file you’ll see
ifeq ($(DEBUG), 1)
CFLAGS += -g -gdwarf-2
Endif
If this DEBUG equals 1 set the –g flag on the compiler, this flag basically creates the symbol file.
So where is DEBUG, where can we set it ?
You could set it in the main makefile in the libdaisy folder but that would set debug/symbols for every project you compile.
It’s better to set is locally, project locally.
So back to the local makefile in the folder MultiEffect (in this example) and add the following
#required for the compiler to generate symbols for debugging
DEBUG = 1
So your local makefile looks like
# Project Name
TARGET = MultiEffect
#required for the compiler to generate symbols for debugging
DEBUG = 1
# Sources
CPP_SOURCES = MultiEffect.cpp
# Library Locations
LIBDAISY_DIR = ../../libdaisy
DAISYSP_DIR = ../../DaisySP
# Core location, and generic Makefile.
SYSTEM_FILES_DIR = $(LIBDAISY_DIR)/core
include $(SYSTEM_FILES_DIR)/Makefile
Save the makefile and run the debug launch again, set a break point and hopefully your code will halt at the break point.
Depending on your VS Code setup you should see a few windows with debug info in them e.g. Call Stack, Registers, Watch.
Any problems, check the install folders, environment paths. The path in the launch.json file.
Watch out for path delimiting slashes etc.
Hope this helps
Stay Safe, and remember “the lunatics have taken over the asylum“