9
votes

I have an application that I run on an Embedded Linux device. In Eclipse, I can run remote debugging using the eclipse-cdt-launch-remote plugin where I point a binary to run, and where to put it on the device with some environment variables to be exported before running the application. The application is a C++ application with a custom Makefile for building the application as an ELF file.

The application is deployed on the device via SSH, using login with user and password. And then, I can debug from Eclipse using stepping and so on. (I am also using the MentorGraphics crosscompiler for arm-none-linux-gnueabi-2014.05)

My question is: How do I mimic the same functionality in Qt Creator since I like coding with Qt Creator more than coding with Eclipse? I know that an easy fix would be to code in Qt Creator, and then debug using Eclipse, but I really want to debug using Qt Creator.

  • Edit: Solved it by hours of testing and reading up on the Qt Creator IDE.
    1. Imported my project that was an Makefile project.
    2. Then I went in to Options under Tools and added my Device that used SSH.
    3. After that I added a debugger, I used gdb-multiarch since the one provided in the prebuilt toolchain binary did not support python.
    4. Then I added my custom toolchain pointing the compiler path to the toolchains binary g++. And set the ABI to arm-linux-generic-elf-32bit. Although I dont actually see the compiler settings being used during debug.
    5. I created a new kit using my Device, Debugger, and Compiler. And set device type to Generic Linux Device. Pointing to my sysroot that I extracted when using buildroot for the filesystem. These were the only options I set in the kit.
    6. Closed the options menu, and went into Projects where I added my new kit
    7. Changed the build settings and set the build directory and build steps for the application.
    8. Changed the run settings to use some custom commands, like moving the newly built .elf application to target. And then I set where the local executable was and where the remote executable was. The remote executable is the one I moved to the target using custom command from host.
    9. Voila! I could now run remote debugging on my target from Qt Creator.
1
I found it worth while to spend some thought on the design of my embedded software, with regards to having all target dependent code in small libraries with portable APIs. Then, the development for multiple platforms gave me several advantages: 1. High chance that the design works when a new target platform is to be supported. 2. The bulk of code is system independent and I could develop and test for logical errors on my favorite development environment. Testing the platform dependent code was a separate step. Then, performance and final testing in whatever the platform offers.BitTickler
In this project the platform will not be changed, even in future projects. But nevertheless, good insight for when I am going to work with other platforms in other projects. The code is platform independent, meaning it is only using C++ libraries and functions supported by all c++ compilers.YoloMcSwaggy
Yes QT has built-in support for it, but when I'm using Eclipse I don't really have these steps. Probably I just missed some option and should investigate further. I added a device under options and testing the connection works. It's just that in Eclipse I dont use anything with sysroot, or crosscompiler when debugging, it just works! But that's not really something to say.. I just need to know how to setup the debugging. Gonna try some more and return with solution if I solve it.YoloMcSwaggy

1 Answers

9
votes

Qt Creator has built-in support for automatic deploy on remote devices.

On the Embedded Linux device:

  • Create a login password for the root user
  • Install the openssh-server and gdb-server packages

On Qt Creator:

  • Enter Tools > Options > Devices and create a new device specifying address (i.e. IP and port numbers) and credentials (i.e. root and password). Further information available here.
  • Enter Tools > Options > Build & Run > Compilers and add the gcc cross-compiler path (further information available here)
  • Enter Tools > Options > Build & Run > Debuggers and add the gdb cross-debugger path (further information available here)
  • As the last step, finally enter Tools > Options > Build & Run > Kits and link compiler, debugger and device into a single Kit, also specifying the sysroot (i.e. local copy of the embedded Linux root filesystem).
  • Set the build target to Debug.
  • In the Qt project, check that all deploy steps are selected (e.g. transfer file to the remote device) and add any needed argument (e.g. -qws for touchscreen on Qt 4.x)

In general, have a look at the guide here.