Changes

Jump to: navigation, search
The example project
The example makes use of a simple <code>Makefile</code> for cross-building. This <code>Makefile</code> can be used either to build the application manually or to build it automatically as part of a VSCode-controlled debugging session.
The following image shows the files that the VSCode workspace consists of.  [[File:BELK-AN-009-workspace.png|thumb|center|600px|VSCode workspace]]
**This script is invoked by VSCode to
***Build the program for the embedded target
***Start a remote debug session.Kill the gdbserver instance running on the target
*<code>cross-build.sh</code>
**This script is invoked in turn by <code>remote-debugging.sh</code>. The final command that triggers the actual building process is <code>make hello</code>, that is the same command used to build the program manually.
*<code>start-gdbserver-loop.sh</code>**This script is invoked by <code>remote-debugging.sh</code> to start only once on the target side; it guarantees that there is always a <code>running instance of the gdbserver</code> instance on the target.
*<code>.gdbinit</code>
**In includes initialization scripts that are run by <code>/home/dvdk/bora/sdk/belk-4.0.0/sysroots/x86_64-petalinux-linux/usr/bin/arm-xilinx-linux-gnueabi/arm-xilinx-linux-gnueabi-gdb</code> upon startup. For more details, please see [http://man7.org/linux/man-pages/man5/gdbinit.5.html this page].
****This is used to cross build the application on the host machine and to debug it on the target machine
*<code>tasks.json</code>
**In this file , two tasks are defined:
***<code>native build</code>
****This is used to build the program for the host target. In this case, an explicit command is run (<code>gcc -g -o hello.x86 hello.c</code>)
***<code>build and start remote debugging</code>
****As stated before, this task invokes the <code>remote-debugging.sh</code> script.
 
 
==Starting a debug session==
On the host side, copy the example project  In practice, once the target is up and running and the example project was copied onto the host machineas stated previously, follow these steps to start a cross-debugging session. Prior to the first debug session,
*Open the VSCode workspace
*Go to the
*Select the <code>(gdb) Cross launch</code> configuration
*Click on the green ''Start Debugging'' or select the ''Debug->Start Debugging'' menu item. Alternatively, press F5. You should see something like the following picture. It is worth remembering that the scripts take care of killing any <code>gdbserver</code> instance running on the target before starting a new debugging session. This allows starting it with just one click.
4,650
edits

Navigation menu