This configuration works for me:
It's based on Zapho's answer to a related question:
N.B. this particular solution also needs the Command Variable extension that you can read about further here
I have the following in the User's settings.json :
"makefile.configurations": [
{
"name": "Nios-user-settings",
"buildLog": "",
"makeArgs": [],
"makeDirectory": "/home/user/fpga_projects/hw_proj/software/sw_proj",
"makefilePath": "/home/user/fpga_projects/hw_proj/software/sw_proj/Makefile",
"problemMatchers": [],
"postConfigureArgs": [],
"preConfigureArgs": [],
"makePath": "/home/user/intelFPGA_lite/21.1/quartus/linux64/gnu/make",
}
],
This is all that's needed to use the Makefile-Tools extension to build the software project using make. All that's necessary is to be able to build the "current target"
The following can then be added to the project's .vscode/launch.json:
{
"configurations": [
{
"name": "(nios-gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "/home/user/fpga_projects/hw_proj/software/sw_proj/program.elf",
"args": [],
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"environment": [
{
"name": "CWD",
"value": "${workspaceFolder}"
},
{
"name": "PATH",
"value": "/home/user/intelFPGA_lite/21.1/nios2eds/bin/gnu/H-x86_64-pc-linux-gnu/scripts"
},
{
"name": "PWD",
"value": "${workspaceFolder}"
},
],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
],
"miDebuggerServerAddress": "localhost:${input:randomPort}",
"miDebuggerPath": "/home/user/intelFPGA_lite/21.1/nios2eds/bin/gnu/H-x86_64-pc-linux-gnu/bin/nios2-elf-gdb",
"debugServerPath": "/home/user/intelFPGA_lite/21.1/quartus/bin/nios2-gdb-server",
"debugServerArgs": "--tcpport ${input:rememberRandomPort} --reset-target --tcptimeout 5",
}
],
"inputs": [
{
"id": "randomPort",
"type": "command",
"command": "extension.commandvariable.number",
"args": {
"name": "randomPort",
"range": [1500, 60000],
"random": true,
"uniqueCount": 10
}
},
{
"id": "rememberRandomPort",
"type": "command",
"command": "extension.commandvariable.remember",
"args": { "key": "number-randomPort" }
}
]
}
The vscode built-in Run & Debug button on the left hand panel (Ctrl + Shift + D) can then be used to Debug the application.
This doesn't allow all functionality of Eclipse but allows for making and debugging the software project..
There's some further reading here
It's not clear if there's likely to be more configurability in the Makefile Tools soon.