This short tutorial shows the idea of using VisualGDB to build one of our examples for Raspberry Pi. This document does not describe the full tool chain and build system configuration, it only indicates a few important key points that should help you to configure your project:

  • preprocessor directives
  • copying .so file to destination board
  • debugging the program as root.

For more detailed description of how to use and configure VisualGDB, please refer to VisualGDB documentation.

VisualGDB is not mandatory for ForceSeatDI to work on Raspberry Pi. You can compile ForceSeatDI using any other build system.

New project

Start Visual Studio and create new Linux Project. Make sure to create it in the directory without spaces in the name, e.g. C:\ForceSeatDI

 

Choose Application as project type and MSBuild as tool chain.

 

Choose building under Raspberry Pi over network. In order to do it, create new SSH connection, then fill IP address and credentials. Make sure that your Raspberry Pi has libusb and compiler installed (check ForceSeatDI readme.txt for details).


 

After wizard creates project for you, rename RaspberryProject1.cpp to Main.cpp

 

Copy following files from ForceSeatDI archive code directory to your project directory:

  • ForceSeatDI.h
  • ForceSeatDI_Defines.h
  • ForceSeatDI_Functions.h
  • ForceSeatDI_Loader.c
  • ForceSeatDI_Structs.cs

Add ForceSeatDI_Loader.c to your project and copy Main.cpp from FastPos_CPP_Linux example (overwrite the Main.cpp in your project).

Project configuration

Open the project Properties.

 

Go to Preprocessor configuration and add NO_IMPORT_FORCESEAT_DI to the list of definitions.

 

Go to VisualGDB settings and open Debug configuration (Release configuration for release build).

 

Go to Debug Settings and select run as root.

 

If the application is not executed as root, it will will not be able to detach the USB device from the kernel and connect to the motion platform.

Go to Custom build steps and add new After build step – Transfer a single file.

 

Browse and select source file ForceSeatDI32.RSPi_3.so on your PC disk.

Type $(TargetDir)/ForceSeatDI32.so into Target path.

Build and run

Rebuild the project.

 

Run the application and check the Output console.