bmd-studio / stm32-for-vscode

STM32 extension for working with STM32 and CubeMX in VSCode
MIT License
195 stars 27 forks source link

"device" value in launch.json is wrong (Can't see peripherals in debug) #94

Closed RBahrami closed 2 years ago

RBahrami commented 2 years ago

The value of "device" in launch.json is set to "stlink", it must be set to the microcontroller's name (without Tx suffix, like "STM32F429VI").

jortbmd commented 2 years ago

Hi! Thanks for opening an issue. You are right! I will look at this and include it in a next release.

jortbmd commented 2 years ago

The next release is out now and it includes the device as the actual microcontroller. Could you check if this works for you?

RBahrami commented 2 years ago

Hi, There is still a small problem with the device name, for example, my chip is STM32F429VI, but in lunch.json, device will be set to STM32F429 (without the "VI" suffix).

jortbmd commented 2 years ago

I needed to investigate this further. For now I will try and look-up the svd file that belongs to the device and add that automatically. It will also try and add the device, however I do not have a direct source for getting the full name of the device. I also think that this should not matter as the VI etc. should not matter for the register definitions. If you have any issues still I would advise you to enter the chip name manually in the launch.json.

neosis commented 1 year ago

@RBahrami / @jortbmd what was the exact value that you provided to make it work?

I am using NUCLEO-F030R8 board with mounted device STM32F030R8T6

I am using following launch.json but still no luck. { "configurations": [ { "showDevDebugOutput": "parsed", "cwd": "${workspaceRoot}", "executable": "./build/blink_led.elf", "name": "Debug STM32", "request": "launch", "type": "cortex-debug", "servertype": "openocd", "preLaunchTask": "Build STM", "device": "STM32F030R8T6.s", "configFiles": [ "openocd.cfg" ] }, { "showDevDebugOutput": "parsed", "cwd": "${workspaceRoot}", "executable": "./build/blink_led.elf", "name": "Attach STM32", "request": "attach", "type": "cortex-debug", "servertype": "openocd", "preLaunchTask": "Build STM", "device": "STM32F030R8T6.s", "configFiles": [ "openocd.cfg" ] } ] }

Any pointers on what am I missing?

Best Ashutosh

neosis commented 1 year ago

I downloaded the svd file for STM32F030 manually and kept in root of working folder. I also added "svdFile" property to both Attach and debug configuration objects in launch.json. Not sure if this is right way to do it - however seems to be working based on simple initial checks on peripheral port register values.