Visual Studio Code: Difference between revisions
Jump to navigation
Jump to search
m (starting to add VSCode Projects configuration) |
m (TOC cleanup) |
||
Line 1: | Line 1: | ||
This is a guide to setup your Visual Studio Code project with debugging support on both real hardware using [[dcload-ip]] and with the lxdream-nitro emulator. | This is a guide to setup your Visual Studio Code project with debugging support on both real hardware using [[dcload-ip]] and with the lxdream-nitro emulator. | ||
== Prerequisites == | |||
To start with, this tutorial makes the following assumptions: | To start with, this tutorial makes the following assumptions: | ||
* You have already installed and [https://dreamcast.wiki/Getting_Started_with_Dreamcast_development set up your KallistiOS development environment] | * You have already installed and [https://dreamcast.wiki/Getting_Started_with_Dreamcast_development set up your KallistiOS development environment] | ||
Line 7: | Line 7: | ||
* You have already downloaded and installed [https://code.visualstudio.com/ Visual Studio Code] (version 1.78.2 was used for this tutorial) | * You have already downloaded and installed [https://code.visualstudio.com/ Visual Studio Code] (version 1.78.2 was used for this tutorial) | ||
== VSCode Setup == | |||
* Launch Visual Studio Code | * Launch Visual Studio Code | ||
* (optional but recommended) To keep your configuration settings, plugins, ... specific to Dreamcast projects only: | * (optional but recommended) To keep your configuration settings, plugins, ... specific to Dreamcast projects only: | ||
Line 15: | Line 15: | ||
# [https://marketplace.visualstudio.com/items?itemName=ms-vscode.makefile-tools Makefile Tools] from Microsoft | # [https://marketplace.visualstudio.com/items?itemName=ms-vscode.makefile-tools Makefile Tools] from Microsoft | ||
== Setup per Project == | |||
=== Compilation === | |||
(all the following steps happen in Visual Studio Code) | (all the following steps happen in Visual Studio Code) | ||
* Open the folder containing your project (Menu: File-Open Folder... eg: /opt/toolchains/dc/kos/examples/dreamcast/2ndmix) | * Open the folder containing your project (Menu: File-Open Folder... eg: /opt/toolchains/dc/kos/examples/dreamcast/2ndmix) | ||
Line 23: | Line 25: | ||
TODO: c_cpp_properties.json, kos_compile.sh, settings.json | TODO: c_cpp_properties.json, kos_compile.sh, settings.json | ||
=== | === Debugging on a real Dreamcast === | ||
TODO | TODO | ||
=== | === Debugging on an emulator === | ||
TODO | TODO | ||
Revision as of 18:14, 6 June 2023
This is a guide to setup your Visual Studio Code project with debugging support on both real hardware using dcload-ip and with the lxdream-nitro emulator.
Prerequisites
To start with, this tutorial makes the following assumptions:
- You have already installed and set up your KallistiOS development environment
- if you want to be able to debug, be sure to compile gdb as specified on that page
- You have already downloaded and installed Visual Studio Code (version 1.78.2 was used for this tutorial)
VSCode Setup
- Launch Visual Studio Code
- (optional but recommended) To keep your configuration settings, plugins, ... specific to Dreamcast projects only:
- Create a "Profile" (Menu: File-Preferences-Profiles) called "Dreamcast"
- (required) Install the following extensions: (Menu: View-Extensions)
- C/C++ from Microsoft
- Makefile Tools from Microsoft
Setup per Project
Compilation
(all the following steps happen in Visual Studio Code)
- Open the folder containing your project (Menu: File-Open Folder... eg: /opt/toolchains/dc/kos/examples/dreamcast/2ndmix)
- (if you are using Profiles) Make sure that the "Dreamcast" profile is selected (Menu: File-Preferences-Profiles)
- Create a new subfolder ".vscode"
- insert the following files in the ".vscode" subfolder:
TODO: c_cpp_properties.json, kos_compile.sh, settings.json
Debugging on a real Dreamcast
TODO
Debugging on an emulator
TODO
Setup Build Tasks (Optional)
This is an option step as you are able to just specify and launch ELFs. Setting up a build task in VSCode will allow your code to rebuild before launching the debug session.
Use the following template to create your own .vscode/tasks.json file:
{
"version": "2.0.0",
"tasks": [
{
"label": "Build",
"type": "shell",
"command": "make",
"args": [
"all"
],
"group": {
"kind": "build",
"isDefault": true
},
},
]
}
Setup lxdream-nitro Launch Task
Setup a launch configuration for lxdream-nitro in your .vscode/launch.json file:
{
"version": "0.2.0",
"configurations": [
{
// display name
"name": "LXDream",
"type": "cppdbg",
"request": "launch",
// match build task name in tasks.json
"preLaunchTask": "Build",
"cwd": "${workspaceRoot}",
// path to elf
"program": "${workspaceRoot}/hello.elf",
// path to gdb
"miDebuggerPath": "PATH_TO_GDB",
"setupCommands": [{
"text": "set architecture sh",
"description": "Set GDB Arch to SuperH",
"ignoreFailures" : false,
}],
"miDebuggerServerAddress": ":9999",
// path to lxdream-nitro
"debugServerPath": "PATH_TO_LXDREAM",
// lxdream-nitro flags
"debugServerArgs": "--log=DEBUG --gdb-sh4=9999 -A null -e ${workspaceRoot}/hello.elf -n",
"filterStdout": true,
"filterStderr": true,
"externalConsole": false,
// run on connect
"stopAtConnect": false,
// stop at main
"stopAtEntry": true,
"launchCompleteCommand": "exec-run",
"serverStarted": "SH4 GDB server running on port",
"useExtendedRemote": true
},
]
}