Open main menu

DAVE Developer's Wiki β

Changes

Created page with "{{InfoBoxTop}} {{Applies To Bora}} {{Applies To BoraX}} {{InfoBoxBottom}} {{WarningMessage|text=This application note was validated against specific versions of the kit only...."
{{InfoBoxTop}}
{{Applies To Bora}}
{{Applies To BoraX}}
{{InfoBoxBottom}}
{{WarningMessage|text=This application note was validated against specific versions of the kit only. It may not work with other versions. Supported versions are listed in the ''History'' section.}}

== History ==
{| class="wikitable" border="1"
!Version
!Date
!BELK/BXELK version
!Notes
|-
|4.0.0/2.0.0
|June 2019
|[[BELK/BXELK_software_components#BELK_4.0.0_.2F_BXELK_2.0.0|4.0.0 / 2.0.0]]
|First release
|}

== Introduction ==
[https://code.visualstudio.com/ Visual Studio Code] (VSC for short) is a powerful integrated development environment (IDE). In the last years, it has gotten growing popularity among software developers of any kind, thanks to its excellent flexibility. [https://marketplace.visualstudio.com/VSCode Numerous extensions], native git support, availability for all of the most common platforms are some of the features that have made it so successful.

Even though it was not designed for embedded software development, it is so versatile that it can be used for this purpose as well. This application note shows, for instance, how to configure it in order to remotely debug an application running on the Bora/BoraX platform. As host machine, the Virtual Machine released along with the BELK/BXELK kit was used.

It assumed that the reader is familiar with BELK/BXELK kit and with VSC.

==Host configuration==
The example here described allows compiling and debugging the application for the host machine too. For this reason, the procedure indicates to install the native <code>gdb</code> debugger as well.

In essence, the followings are the packages that have to be installed:
*[Visual Studio Code https://code.visualstudio.com/Download] with these extensions
**C/C++
**Native Debug
*<code>sshpass</code> (sudo apt install sshpass)
*<code>gdb</code> (sudo apt install gdb).

==The example project==
The example project is the umpteenth flavour of the world-famous ["Hello, world!" program https://en.wikipedia.org/wiki/%22Hello,_World!%22_program]. Source code is available [here ] for download.

The following image shows the files the workspace consists of. The most relevant are:
*<code>hello.c</code>
**The source file of the program
*<code>Makefile</code>
**This file allows building the program manually from the command line. It is also used by VSC to build the program before starting a debug session.
*<code>remote-debugging.sh</code>
**This script is invoked by VSC to
***Build the program for the embedded target
***Start a remote debug session.
*<code>cross-build.sh</code>
**This script is invoked in turn by <code>remote-debugging.sh</code> to run the actual cross build process.
*<code>start-gdbserver.sh</code>
**This script is invoked by <code>remote-debugging.sh</code> to start a <code>gdbserver</code> instance on the target.
*<code>.gdbinit</code>
**In includes initialization scipts that are run by . For more details, please see [http://man7.org/linux/man-pages/man5/gdbinit.5.html this page].
*<code>launch.json</code>
**In this file two configurations are defined:
***<code></code>
*<code>tasks.json</code>
4,650
edits