Post

CMake && SK-AM62x Remote Debugging

  1. tasks.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Build and Copy to AM62X",
          "type": "shell",
          "command": "ssh root@192.168.10.2 'rm -rdf /home/test1' && scp -r ./build/aarch64/app/ root@192.168.10.2:/home/test1",
          "group": 
          {
            "kind": "build",
            "isDefault": true
          },
          "problemMatcher": []
    },
    {
      "label": "🔁 Build & Deploy strip to AM62X",
      "type": "shell",
      "command": "aarch64-oe-linux-strip -o ./build/aarch64/app/Executable.stripped ./build/aarch64/app/Executable && scp ./build/aarch64/app/Executable.stripped root@192.168.10.2:/home/test1/Executable && ssh root@192.168.10.2 'pkill gdbserver; gdbserver :1234 /home/test1/Executable'",
      "problemMatcher": [],
      "group": 
      {
        "kind": "build",
        "isDefault": true
      },
      "options": 
      {
        "env": 
        {
          "PATH": "/home/lgh/ti-processor-sdk-linux-am62xx-evm-11.00.09.04/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/aarch64-oe-linux:${env:PATH}"
        }
      }
    }
  ]
}

  1. launch.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{
    "version": "0.2.0",
    "configurations": [
      {
          "name": "🔍 Remote Debug (SK-AM62X)",
          "type": "cppdbg",
          "request": "launch",
          "program": "${workspaceFolder}/build/aarch64/app/Executable",
          "miDebuggerServerAddress": "192.168.10.2:1234",
          "miDebuggerPath": "/home/lgh/ti-processor-sdk-linux-am62xx-evm-11.00.09.04/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/aarch64-oe-linux/aarch64-oe-linux-gdb",
          "cwd": "${workspaceFolder}",
          "environment": [],
          "externalConsole": false,
          "MIMode": "gdb",
          "setupCommands": [
              {
              "description": "Enable pretty-printing",
              "text": "-enable-pretty-printing",
              "ignoreFailures": true
              }
          ]
      },
      {
          "name": "(gdb) Launch",
          "type": "cppdbg",
          "request": "launch",
          "program": "${command:cmake.launchTargetPath}",
          "args": [],
          "stopAtEntry": false,
          "cwd": "${workspaceFolder}",
          "environment": [
              {
                  "name": "PATH",
                  "value": "${env:PATH}:${command:cmake.getLaunchTargetDirectory}"
              }
          ],
          "externalConsole": false,
          "MIMode": "gdb",
          "setupCommands": [
              {
                  "description": "Enable pretty-printing for gdb",
                  "text": "-enable-pretty-printing",
                  "ignoreFailures": true
              }
          ]
      }
    ]
}
  1. CMakePresets.json
1
  "CMAKE_BUILD_TYPE": "Debug" // Release하면 디버깅 안됨...
  1. 최상위 CMakeLists.txt 아래 set 추가하면 빌드폴더에 compile_commands.json 파일 생성됨
1
2
3
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

cat ./build/aarch64/compile_commands.json | grep "\-g" # 위 set 추가후, 이 명령어로 -g flag 있는지 확인
This post is licensed under CC BY 4.0 by the author.