Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IAR Debug with St-link #3

Closed
meteusteler opened this issue Feb 1, 2018 · 3 comments
Closed

IAR Debug with St-link #3

meteusteler opened this issue Feb 1, 2018 · 3 comments

Comments

@meteusteler
Copy link

What should be launch.json configuration for debug with St-Link?

@politoleo
Copy link
Owner

You could try something like this, don't forget to fix debugServerArgs to fit your hardware.
Replace APP.out with your ELF output, download arm-none-eabi and openocd and fix the paths

   {
      "name": "Debug ST-Link",
      "type": "cppdbg",
      "request": "launch",
      "program": "APP.out", 
      "stopAtEntry": true,
      "cwd": "${workspaceRoot}",
      "externalConsole": false,
      "MIMode": "gdb",
      "miDebuggerPath": "arm-none-eabi-gdb.exe",
      "debugServerPath": "openocd/bin/openocd.exe",
      "debugServerArgs": "-s \"openocd\\share\\openocd\\scripts\" -f interface/stlink-v2-1.cfg -c \"transport select hla_swd\" -f target/stm32l4x.cfg -c \"adapter_khz 4000\" -c \"telnet_port disabled\" -c \"tcl_port disabled\"",
      "serverStarted": "Info\\ :\\ [\\w\\d\\.]*:\\ hardware",
      "serverLaunchTimeout": 5000,
      "targetArchitecture": "arm",
      "filterStderr": true,
      "filterStdout": true,
      "launchCompleteCommand": "exec-continue",
      "logging": {
        "trace": false,
        "traceResponse": false,
        "engineLogging": true
      },
      "setupCommands": [
        {
          "text": "target remote localhost:3333"
        },
        {
          "text": "monitor reset halt"
        },
        {
          "text": "load APP.out" 
        },
        {
          "text": "monitor reset init"
        }
      ]
    }

@meteusteler
Copy link
Author

meteusteler commented Feb 8, 2018

Hi,
I tried your suggestion and I get error like this:

1: (205) LaunchOptions<LocalLaunchOptions xmlns='http://schemas.microsoft.com/vstudio/MDDDebuggerOptions/2014'
1: (222) LaunchOptions ExePath='C:\Users*\EWARM\STM32F051\Exe\Project.out'
1: (222) LaunchOptions WorkingDirectory='C:\Users***'
1: (222) LaunchOptions TargetArchitecture='arm'
1: (222) LaunchOptions ExeArguments=''
1: (222) LaunchOptions MIMode='gdb'
1: (222) LaunchOptions MIDebuggerPath='C:\Program Files (x86)\GNU Tools ARM Embedded\7 2017-q4-major\bin\arm-none-eabi-gdb.exe'
1: (222) LaunchOptions WaitDynamicLibLoad='false'
1: (222) LaunchOptions DebugServer='C:\Users*
\Desktop\OpenOCD-20170821\bin\openocd.exe'
1: (223) LaunchOptions DebugServerArgs='-s "openocd\share\openocd\scripts" -f interface/stlink-v2-1.cfg -c "transport select hla_swd" -f target/stm32F0x.cfg -c "adapter_khz 4000" -c "telnet_port disabled" -c "tcl_port disabled"'
1: (223) LaunchOptions load APP.out
1: (223) LaunchOptions monitor reset init
1: (223) LaunchOptions
1: (223) LaunchOptions exec-continue
1: (223) LaunchOptions
1: (290) Starting: "C:\Users***\Desktop\OpenOCD-20170821\bin\openocd.exe" -s "openocd\share\openocd\scripts" -f interface/stlink-v2-1.cfg -c "transport select hla_swd" -f target/stm32F0x.cfg -c "adapter_khz 4000" -c "telnet_port disabled" -c "tcl_port disabled"
1: (770) "C:\Users**\Desktop\OpenOCD-20170821\bin\openocd.exe" exited with code 1 (0x1).
1: (780) <-logout

and my json file like this,

{
"version": "0.2.1",
"configurations": [

    {
        "name": "Debug ST-Link",
        "type": "cppdbg",
        "request": "launch",
        "program": "C:\\Users\\**\\EWARM\\STM32F051\\Exe\\Project.out",
        "stopAtEntry": true,
        "cwd": "${workspaceRoot}",
        "externalConsole": false,
        "MIMode": "gdb",
        "miDebuggerPath": "C:\\Program Files (x86)\\GNU Tools ARM Embedded\\7 2017-q4-major\\bin\\arm-none-eabi-gdb.exe",
        "debugServerPath": "C:\\Users\\**\\Desktop\\OpenOCD-20170821\\bin\\openocd.exe",
        "debugServerArgs": "-s \"openocd\\share\\openocd\\scripts\" -f interface/stlink-v2-1.cfg -c \"transport select hla_swd\" -f target/stm32F0x.cfg -c \"adapter_khz 4000\" -c \"telnet_port disabled\" -c \"tcl_port disabled\"",
        "serverStarted": "Info\\ :\\ [\\w\\d\\.]*:\\ hardware",
        "serverLaunchTimeout": 5000,
        "targetArchitecture": "arm",
        "filterStderr": true,
        "filterStdout": true,
        "launchCompleteCommand": "exec-continue",
        "logging": {
            "trace": false,
            "traceResponse": false,
            "engineLogging": true
        },
        "setupCommands": [
            {
                "text": "target remote localhost:3333"
            },
            {
                "text": "monitor reset halt"
            },
            {
                "text": "load APP.out"
            },
            {
                "text": "monitor reset init"
            }
        ]
    }
]

}

@politoleo
Copy link
Owner

politoleo commented Feb 8, 2018

Hi, it seems to be an OpenOCD problem, try to run it manually with cmd.exe and look for errors on the output:

"C:\Users\*\Desktop\OpenOCD-20170821\bin\openocd.exe" -s "openocd\share\openocd\scripts" -f interface/stlink-v2-1.cfg -c "transport select hla_swd" -f target/stm32F0x.cfg -c "adapter_khz 4000" -c "telnet_port disabled" -c "tcl_port disabled"

Anyhow I just tried out with openocd and ST-Link and it's working, this is my configuration:

 {
  "version": "0.2.1",
  "configurations": [
    {
      "name": "Debug ST-Link",
      "type": "cppdbg",
      "request": "launch",
      "program": "${workspaceRoot}/project/build/debug/EBUI.out",
      "stopAtEntry": true,
      "cwd": "${workspaceRoot}",
      "externalConsole": false,
      "MIMode": "gdb",
      "miDebuggerPath": "C:\\GCC\\arm\\bin\\arm-none-eabi-gdb.exe",
      "debugServerPath": "C:\\GCC\\debug\\openocd\\bin\\openocd.exe",
      "debugServerArgs": "-s \"C:\\GCC\\debug\\openocd\\share\\openocd\\scripts\" -f interface/stlink-v2-1.cfg -c \"transport select hla_swd\" -f target/stm32l4x.cfg -c \"adapter_khz 1000\" -c \"telnet_port disabled\" -c \"tcl_port disabled\"",
      "serverStarted": "Info\\ :\\ [\\w\\d\\.]*:\\ hardware",
      "serverLaunchTimeout": 10000,
      "targetArchitecture": "arm",
      "filterStderr": true,
      "filterStdout": true,
      "logging": {
        "trace": false,
        "traceResponse": false,
        "engineLogging": false
      },
      "setupCommands": [
        {
          "text": "target remote localhost:3333"
        },
        {
          "text": "monitor reset init"
        },
        {
          "text": "load C:/Users/Leonardo/Desktop/EBUI/project/build/debug/EBUI.out"
        },
        {
          "text": "monitor reset init"
        }
      ]
    }
  ]
}

@politoleo politoleo reopened this Feb 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants