프로그래밍/STM32

[STM32] VSCode 에서 STM32 디버깅하기(.vscode)

Beginner:) 2023. 9. 3.
320x100

1. 먼저 elf 파일을 만들어줘야 하는데 아래 링크를 참조

2023.09.03 - [프로그래밍/STM32] - [STM32] cmake build(feat .bin, .elf, .hex 추출)

 

[STM32] cmake build(feat .bin, .elf, .hex 추출)

먼저 나의 작업환경을 tree -L 4로 출력한 Directory 구조이다. . ├── CMakeLists.txt ├── MAIN │ └── board │ └── F4 │ ├── Core │ ├── Drivers │ ├── stm32f411re │ └── ledtest2.ioc ├─

park-duck.tistory.com

 

2. 프로젝트 루트 디렉토리의 .vscode에서 launch.json 생성

3. Add Configuration 클릭하여 Cortex Debug: ST-LINK 클릭

 

4. 아래와 같이 입력

자동으로 입력되기 때문에 다른건 건드릴 필요 없고 executable에 .elf 경로, name은 디버그 선택 시 보일 이름을 적어주면 된다.

{
    "configurations": [
    {
        "cwd": "${workspaceFolder}",
        "executable": "./build/temp.elf",
        "name": "Debug with ST-Link",
        "request": "launch",
        "type": "cortex-debug",
        "runToEntryPoint": "main",
        "showDevDebugOutput": "none",
        "servertype": "stlink"
    }
    ]
}

 

5. 실행

아래사진과 같이 Debug아이콘을 클릭하고 "RUN AND DEBUG"에서 자신이 만든 디버그 이름을 선택하여 Debug를 시작하면 된다.

 

만약 Cortext-Debug를 설치하지 않았다면 vscode extends에서 설치를 한다.

 

만약 아래와 같은 에러가 발생한다면 그 밑 링크를 참조한다.

2023.08.14 - [프로그래밍/Linux] - [Ubuntu] STM32 VSCode debugger GDB version Error 해결

 

[Ubuntu] STM32 VSCode debugger GDB version Error 해결

OS: Ubuntu 20.04 VSCode로 STM32를 돌리려는데 아래와 같은 에러가 발생 GDB could not start as expected. Bad installation or version mismatch. See if you can start gdb from a shell prompt and check its version (Must be >= 9) 시도해 본 것

park-duck.tistory.com

 

반응형

댓글