Forum Discussion
VSCode Nios II command shell
- 3 years ago
I'm back! Ok, to get the build environment (somewhat) integrated into VSCode, the secret is: Launch "code" from the Nios II Command Shell. That way, the path to "make" is known, and the right shell is launched during the build.
I think these items are needed in the settings for the "Makefile Tools" extension:
If the Makefile is not in the root of the folder, you'll have to tell the extension where it is using setting in the same section shown in the image above.
Now I have clickable links:
That was pretty easy. Just needed better googling skils.
Next, anyone know how to integrate the "make" build into VSCode? Just the simple terminal integration doesn't provide clickable links to errors/warnings.
- qwk0003 years ago
Occasional Contributor
I'm back! Ok, to get the build environment (somewhat) integrated into VSCode, the secret is: Launch "code" from the Nios II Command Shell. That way, the path to "make" is known, and the right shell is launched during the build.
I think these items are needed in the settings for the "Makefile Tools" extension:
If the Makefile is not in the root of the folder, you'll have to tell the extension where it is using setting in the same section shown in the image above.
Now I have clickable links:
- qwk0003 years ago
Occasional Contributor
To get Intellisense working decently in VSCode, in addition to the steps above, follow these steps:
Configure IntelliSense for C++ cross-compilation (visualstudio.com)
- GavinPaterson2 years ago
New Contributor
Hi qwk000,
Apologies for bothering you but thought you might have some advice regards debugging in VScode? I am able to "Build target" using "code ." from my NIOS II command shell in Microsoft Windows 11. I am unable however to run or debug my application though as I see there are "No launch targets identified"I receive a message "Cannot 'debug' because there is no launch configuration set and the list of launch targets is empty. Double check the makefile configuration and the build target."
I have checked in the "settings.json" and have "launch.json" populated as follows:{ "version": "0.2.0", "configurations": [ { "name": "Myapp", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/Myapp.elf", "args": [], "stopAtEntry": true, "cwd": "${workspaceFolder}", "MIMode": "gdb", "miDebuggerServerAddress": "localhost:2334", "miDebuggerPath": "/mnt/c/intelFPGA_lite/22.1std/nios2eds/bin/gnu/H-x86_64-mingw32/bin/nios2-elf-gdb.exe", "debugServerPath": "/mnt/c/intelFPGA_lite/22.1std/quartus/bin64/nios2-gdb-server.exe", "debugServerArgs": "--tcpport 2334 --reset-target --tcppersist", } ] }for some reason the build executable isn't getting picked up when I go to launch? Do you have any ideas/advice?- G5P71 year ago
New Contributor
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 hereIt's not clear if there's likely to be more configurability in the Makefile Tools soon.