Changes

Jump to: navigation, search
Created page with "{{InfoBoxTop}} {{Applies To Bora}} {{Applies To BoraX}} {{Applies To BoraLite}} {{InfoBoxBottom}} __FORCETOC__ {{WarningMessage|text=This technical note was validated against..."
{{InfoBoxTop}}
{{Applies To Bora}}
{{Applies To BoraX}}
{{Applies To BoraLite}}
{{InfoBoxBottom}}
__FORCETOC__

{{WarningMessage|text=This technical note was validated against specific versions of hardware and software. What is described here may not work with other versions.}}

== History ==
{| class="wikitable" border="1"
!Version
!Date
!Notes
|-
|1.0.0
|February 2020
|First public release
|}

== Introduction ==
This Technical Note (TN) shows how to integrate Visual Studio Code (VSC) and a cross-toolchain in order to
*cross-build a Makefile-based application
*capture errors geenrated by the cross-tools to edit erroneous lines easily.

==Testbed==
To test the procedure, the same testbed described [[BELK-TN-007:_FreeRTOS_on_single-core_Bora_Lite_SoM|here]] was used. Therefore, the application used to validate the procedure is <code>freertos_hello_world</code>.

With regard to VSC, the following version was used:
<pre>
Version: 1.41.1 (system setup)
Commit: 26076a4de974ead31f97692a0d32f90d735645c0
Date: 2019-12-18T14:58:56.166Z
Electron: 6.1.5
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Windows_NT x64 6.1.7601
</pre>

==VSC/cross-toolchain integration==
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

Navigation menu