Open main menu

DAVE Developer's Wiki β

Changes

no edit summary
*Debug the program in VSC by using PVT32 as a communication bridge with the target
*Jump from PVT32 to VSC (in editing mode) to edit the source file where the a was found.
 
This article also shows how to configure VSC in order to cross-build a Makefile-based application. This configuration supports cross-toolchain error messages to jump on erroneous lines with a simple click.
==Testbed==
The source file will be open in VSC, which will jump on the selected line.
[[File:BoraLite-VSC4.png|thumb|center|600px|Using VSC as the default editor for PVT32]]
 
==Integrating VSC and the cross-toolchain==
This example shows how to build the <code>freertos_hello_world</code> application and how to catch errors generated by the cross-toolchain in order to edit the erroneous source files accordingly.
 
As it was tested on a Windows PC, it requires [Cynwin https://www.cygwin.com/] to work.
 
First, create a ''Default Build Task'' as described [https://code.visualstudio.com/docs/editor/tasks here]. The <code>tasks.json</code> file should look like this:
 
<syntaxhighlight lang="text">
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Cross build",
"type": "shell",
"command": "SET PATH=e:\\Xilinx\\SDK\\2019.1\bin\\;e:\\Xilinx\\SDK\\2019.1\\gnu\\aarch32\\nt\\gcc-arm-none-eabi\\bin\\;c:\\cygwin64\\bin\\;%PATH% && make",
"options": {
"cwd": "${workspaceRoot}/Debug"
},
"problemMatcher": "$gcc",
"presentation": {
"reveal": "always",
"panel": "new"
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
</syntaxhighlight>
 
 
By pressing '''Ctrl+Shift+B'', the build process is started:
[[File:BoraLite-VSC5.png|thumb|center|600px|Starting the cross-building process]]
 
 
If there are syntax errors, ''Ctrl + Left click'' ...
[[File:BoraLite-VSC6.png|thumb|center|600px|The output of the cross-toolchain]]
 
 
... allows to jump to the erroneous line:
[[File:BoraLite-VSC7.png|thumb|center|600px|Catching the syntax error]]
 
 
This example makes use of the C/C++ extension. It is convenient to configure it so that it can access include files although they are outside the project's directory. By pressing ''Ctrl+Shift+P'' and selecting ''C/C++ Edit Configurations (JSON)'', it is possible to create a <code>c_cpp_properties.json</code>:
 
 
[[File:BoraLite-VSC8.png|thumb|center|600px|Catching the syntax error]]
 
 
Then, modify the <code>includePath</code> variable as shown in the following box:
<syntaxhighlight lang="text">
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"${workspaceFolder}/../freertos_hello_world_bsp/ps7_cortexa9_0/include"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"cStandard": "c11",
"intelliSenseMode": "msvc-x64"
}
],
"version": 4
}
</syntaxhighlight>
 
 
After modifying <code>includePath</code>, no more issues are reported in the ''PROBLEMS'' window:
[[File:BoraLite-VSC9.png|thumb|center|600px|The output of the cross-toolchain]]
 
 
For more details, please see also [https://code.visualstudio.com/docs/cpp/config-mingw this page].
4,650
edits