How to Debug Example Applications in Timestorm
This document provides a guide to remote debugging using TimeStorm.
Prerequisites
- Install the Factory SDK Installer, which is located in your Factory build output, to provide TimeStorm with a cross-toolchain.
- After the installation, verify that your toolchain exists in TimeStorm, under Window -> Preferences -> Timestorm -> Toolchains.
- You will need an SSH server running on your target, such as dropbear.
- You will need to set a password for root on your target. You may do so by running the passwd command in a terminal.
- Make a Hardware Target profile in TimeStorm: Right click your project, and click Debug As > Remote C/C++ Application. In the resulting Debug Configuration window, click the Target tab, and select Manage Target. Create a new HW target — we recommend using SCP in the Download tab (specify SSH credentials) — and use SSH in the Execute tab.
Hello World Example
- Create the hello world application: Select File -> New -> C++ Project.
- Select Hello World C++ Project under Executable.
- Specify TimeStorm Cross-Compile toolchain.
- Give the app a name, "helloworld".
- Click Next, modify the author info, and/or just click next.
- Click Next, do not make changes to the configurations page.
- Select the same cross toolchain.
- Select helloworld in the Project explorer, and build using Project -> Build project. Verify it builds without error.
- Right click on helloworld, click Debug As > Remote C/C++ Application.
- Under target, select the hardware target added in the prerequisites of this tutorial.
- Click Debug, and you can step into and through the execution of the app.
Shared Library Example
- Create a new shared library project: select File -> New -> C++ Project.
- Select Hello World C++ Library under Shared Libraries.
- Specify TimeStorm Cross-Compile toolchain.
- Give the library project a name, "hellolib".
- Click Next, don't make changes in the Configurations page.
- Select the toolchain for your architecture.
- Try to build the project, Click Project -> Build Project. If there are no errors skip to step 4.
- Add the fPIC option to the build step for the library: in project explorer, right click on hellolib, and click properties
- Under* C/C++ Build*, click settings.
- From the Configuration drop-down menu, select All.
- In the Tool Settings tab under GCC C++ Compiler, select Miscellaneous.
- In the Other flags: textbox, append "-fPIC".
- Click OK to leave the properties window for hellolib.
- Click Build Project under the Project menu, it should work now.
- To create the application that will use the shared library: Select File -> New -> C++ Project.
- Select Hello World C++ Project under Executable.
- Specify TimeStorm Cross-Compile toolchain.
- Give the app a name, "helloworld".
- Click Next, modify the author info, and/or just click next.
- Click Next, do not make changes to the configurations page.
- Select the same cross toolchain.
- Select helloworld in the Project explorer, and build using Project -> Build project. Verify that it builds without error.
- Right-click on helloworld in the Project Explorer, and click properties.
- Under C/C++ General click Paths and Symbols.
- In the Configuration drop-down select All.
- In the references tab, check hellolib.
- Click Includes tab, under Languages select C++ source file.
- Select /hellolib under include directories.
- Click edit, and change /hellolib to /hellolib/src.
- Under C/C++ Build select Settings.
- Under tool settings, select GCC C++ Linker/Libraries.
- In Libraries, click the Add button.
- Type 'hellolib' and click ok.
- Click ok to exit out of project.
- Modify helloworld.cpp, add hellolib.h to the #includes, and insert a call to "sayHello();" in the main() function.
- Build the project.
- Right click on helloworld, click debug as remote C++ application.
- In debug configurations window click the Environment tab, add "LD_LIBRARY_PATH" with the value ".".
- Under target, select the target added during the beginning of this tutorial.
- Click Debug, and you can step into and through the execution of the app / lib.