Changes

Jump to: navigation, search
The example project
The example project is the umpteenth flavor of the world-famous [https://en.wikipedia.org/wiki/%22Hello,_World!%22_program "Hello, world!" program]. Source code is available [ here] for download.
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 VSC-controlled debugging session. The following image shows the files that the VSC workspace consists of. The most relevant are:
*<code>hello.c</code>
**The source file of the program
***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. The final commands command that triggers the actual building process is <code>make hello</code>, tha tis that is the same command used to build the program manually.
*<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 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].
*<code>launch.json</code>
**In this file two configurations are defined:
****This is used to build and debug the application on the host machine
***<code>(gdb) Cross launch</code>
****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, the 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. Please note In practice, once the target is up and running and the example project was copied onto the host machine, follow these steps to start a cross-debugging session:*Open the VSC workspace*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.  [[File:BELK-AN-009-cross-debug.png|thumb|center|600px|Cross debugging session]]
[[File:BELK-AN-009-For the sake of completeness, the native-debug.png|thumb|center|600px|Native debugging session]]is illustrated as well.
[[File:BELK-AN-009-crossnative-debug.png|thumb|center|600px|Cross Native debugging session]]
4,650
edits

Navigation menu