Qt Creator debug on Target Beagelbone

Post Reply
Posts: 14
Joined: Thu Nov 07, 2019 3:32 am

Qt Creator debug on Target Beagelbone

Post by comarius » Wed Jan 15, 2020 6:04 pm

  • Root file system Debian GNU/Linux 9 BeagleBoard.org Debian Image 2019-06-30
  • Beaglebone with same image on Sdcard
On BBB shell

Create a user for development
Deploy ssh login keys as

On Linux PC
  • create keys if you don't have them

Code: Select all

ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/a/.ssh/id_rsa): 
Created directory '/home/a/.ssh'.
Enter passphrase (empty for no passphrase):    leave it empty
Enter same passphrase again: 
Your identification has been saved in /home/a/.ssh/id_rsa.
Your public key has been saved in /home/a/.ssh/id_rsa.pub.
The key fingerprint is:
3e:4f:05:79:3a:9f:96:7c:3b:ad:e9:58:37:bc:37:e4 a@A
On BBB deploy the keys
  • login to BBB with your debian/temppwd
  • create a new user, like: dev

Code: Select all

sudo adduser dev -s /bin/bash -m
sudo passwd dev   (add a password)
sudo adduser dev root
sudo adduser dev admin
sudo adduser dev sudo
sudo adduser dev i2c
sudo adduser dev gpio
sudo adduser dev pwm
sudo adduser dev dialout
sudo adduser dev spi
  • log out and log back to BBB over ssh with de user dev
On BBB shell

Code: Select all

       sudo apt-get install gdbserver
      mkdir -p .ssh
      nano authorized_keys
On PC another shell

Code: Select all

nano ./.ssh/id_rsa.pub
# copy the content from id_rsa_pub  tp BBB /home/dev/.ssh/authorized_keys
Ctrl + O
sudo service sshd restart
sudo service ssh restart
  • log out from BBB, log back in to BBB. The password should not be asked
On PC, prepare the toolchain, qt, and ARM Beaglebone rootfs
On some arbitrary folder let's call it 'TOOLS' have the following things
Make sure you already have downloaded the toolchain and qt everywhere in some
arbitrary folders where you keep such things.
  • On PC let's have your base folder for future ARM projects. I call it ARMS
  • Under ARMS create a folder name TOOLS.
Navigate under tools and make some symbolic links. Here are mine

Code: Select all

        ├── beaglebone      ->  /home/marius/HOMEBOARDS/BBG/debfs/
        ├── qteverywhere   ->  /home/marius/APPS/RPIQT/qt-everywhere-opensource-src-5.8.0
        └── toolchain          -> /sdaone/armgcc/
Fire up qtcreator

Add a Device
  • Main Menu->Tools->Options
  • add a new device as shown. Replace the IP with your BBB IP

Add a KIT called beaglebone

Configure each tab settings as shown in following images. Replace the paths with your paths.


Add 2 new compilers C++ and C as shown

Configure the new kit as shown



At this stage you can create a new project under your folder.


Compile it

Code: Select all

Project ERROR: Library 'libatomic' is not defined.
13:47:39: The process "/home/marius/HOMEBOARDS/BBG/qt5/qtbase/bin/qmake" exited with code 3.
Error while building/deploying project helobbb (kit: Beaglebone)
When executing step "qmake"
  • Let's fix it
  • Open the pro file from qt editor, and add what you see between ADD and END ADD

Code: Select all

# replace what's generated  with these
QT -= gui
QT -= core
QT -= gui


# ADD {
BOARD=beaglebone   # the root fs under TOOLS

QMAKE_LFLAGS = "-Wl,-rpath-link,$${TUL_PATH}/TOOLS/beaglebone/lib/arm-linux-gnueabihf,-rpath-link,$${TUL_PATH}/TOOLS/beaglebone/usr/lib/arm-linux-gnueabihf"
QMAKE_LIBDIR += $${TUL_PATH}/TOOLS/beaglebone/lib/arm-linux-gnueabihf
QMAKE_LIBDIR += $${TUL_PATH}/TOOLS/beaglebone/usr/lib/arm-linux-gnueabihf
# QMAKE_CXX.LIBDIRS = $${TUL_PATH}/TOOLS/beaglebone/lib/arm-linux-gnueabihf
# QMAKE_CXX.LIBDIRS = $${TUL_PATH}/TOOLS/beaglebone/usr/lib/arm-linux-gnueabihf


Then at the ens of the pro file before deploy section add

Code: Select all


# ADD 
LIBS += --sysroot=$${TUL_PATH}/TOOLS/$${BOARD}/
#    LIBS += -L$${TUL_PATH}/TOOLS/$${BOARD}/usr/lib/arm-linux-gnueabihf -lsqlite3
LIBS += -L$${TUL_PATH}/TOOLS/$${BOARD}/usr/lib/arm-linux-gnueabihf -lpthread
LIBS += -L$${TUL_PATH}/TOOLS/$${BOARD}/usr/lib/arm-linux-gnueabihf -ldl
LIBS += -L$${TUL_PATH}/TOOLS/$${BOARD}/usr/lib/arm-linux-gnueabihf -lm
LIBS += "-Wl,-rpath-link,$${TUL_PATH}/TOOLS/$${BOARD}/lib/arm-linux-gnueabihf,-rpath-link,$${TUL_PATH}/TOOLS/$${BOARD}/usr/lib/arm-linux-gnueabihf"

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /tmp/$${TARGET}/bin   #### <<<<<<<<  have it in tmp
!isEmpty(target.path): INSTALLS += target

  • Then, Main Menu->build->run Qmake
  • Main Menu -> Build
  • Set a breakpoint
make sure on BBB y'u had: sudo apt-get install gdbserver
  • Start Debugger F5
  • You should get the breakpoint stopped

Jan 2020

Post Reply