Linux App Visual Studio Code¶
Objective¶
This wiki page will describe how to setup Visual Studio Code so it can be used to build and debug an ARM Linux user-level program on the AM62x.
General setup¶
- Install and setup visual studio code. See vscode_setup
- Make target name. See ssh_target_naming_and_port_forwarding
- Be familiar with generating a Makefile. See vscode_generate_makefile
- Information on VSCode tasks and launch files. See vscode_tasks_and_launch
Hello World Example¶
- Create a project directory using the attached hello.tar.gz file.
- Source file is just main.c with hello world
- Note these example files
- .vscode/tasks.json
- .vscode/launch.json
- build.sh
- hello.pro
- Start VScode.
- Connect to your development host
- Start a terminal view in VScode on the development host
cd <project_directory>/hello code .
- Build the app for debug mode. ctrl-shift-B, select build debug
- copy to target
- Start a Terminal View. Main Menu->Terminal->New Terminal
scp debug/hello target_62x:
- Start a Terminal View. Main Menu->Terminal->New Terminal
- run on target
ssh target_62x ./hello
- Debug the program
- start gdbserver on target
ssh target_62x gdbserver :10000 ./hello
- start debug session
- Press the debug icon on left. (Triangle pointing to right with bug on lower left)
- In the Run and debug combo box at top, select Attach to target_62x
- Should stop with arrow at the printf line.
- Step over the printf
- Step over the fflush
- Should see Hello on the terminal view where gdbserver was started
- Click the disconnect icon or shift+F5
- start gdbserver on target
- VSCode debugger quirks
- Only plant or remove breakpoints when the target is stopped, not when the target is running.
- Only disconnect a debug session when the target is stopped.
- Doing these operations while the target is running will cause confusion. You may have to kill the gdbserver manually on the target and you will have to start a new debug session.
Summary¶
A sample debug session with a simple hello world project has been demonstrated.
Go to top