SDK

From Apertis
Jump to: navigation, search

Contents

Apertis SDK

Apertis ships SDK images that are meant to be run in VirtualBox.

They provide a common, reproducible environment to build both platform packages and application-bundles for Apertis.

Recipes

Here you can find a few recipes to produce app-bundles suitable to be deployed on Apertis devices.

Building and debugging app bundles with ade

HOST=apertis.local # change this to the address of your target board

sudo apt update
sudo apt install apertis-dev-tools

ade sysroot install

# do not require any password to access the target board over SSH
ssh-keygen # accept the default settings
ssh-copy-id user@$HOST

# instruct the firewall on the target to accept GDB connections 
ssh user@$HOST "sudo sed -i '25 a -A INPUT -p tcp -m state --state NEW -m tcp --dport 1234 -j ACCEPT' /etc/sysconfig/iptables"
ssh user@$HOST "sudo systemctl restart iptables"

git clone https://git.apertis.org/cgit/sample-applications/helloworld-simple-agent.git/
cd helloworld-simple-agent

ade configure --debug --device user@$HOST
ade export
ade install --device user@$HOST

# this is suboptimal, we should probably add an `ade` subcommand to install debug symbols in the sysroot
bwrap --bind /opt/sysroot/apertis/16.12/armhf/ / --bind /usr/bin/qemu-arm-static /usr/bin/qemu-arm-static --proc /proc --dev-bind /dev /dev --setenv PATH /sbin:/usr/sbin:/usr/local/sbin:$PATH \
  fakeroot apt update
bwrap --bind /opt/sysroot/apertis/16.12/armhf/ / --bind /usr/bin/qemu-arm-static /usr/bin/qemu-arm-static --proc /proc --dev-bind /dev /dev --setenv PATH /sbin:/usr/sbin:/usr/local/sbin:$PATH \
  fakeroot apt install libglib2.0-0-dbg libclutter-1.0-dbg libgtk-3-0-dbg

ade debug --device user@$HOST

Building and debugging app bundles with the Eclipse plugin

HOST=apertis.local # change this to the address of your target board
sudo apt update
sudo apt install apertis-eclipse-plugins eclipse-cdt-autotools eclipse-cdt-launch-remote apertis-dev-tools

# do not require any password to access the target board over SSH
ssh-keygen # accept the default settings
ssh-copy-id user@$HOST

# instruct the firewall on the target to accept GDB connections 
ssh user@$HOST "sudo sed -i '25 a -A INPUT -p tcp -m state --state NEW -m tcp --dport 1234 -j ACCEPT' /etc/sysconfig/iptables"
ssh user@$HOST "sudo systemctl restart iptables"

mkdir ~/workspace
cd ~/workspace
git clone https://git.apertis.org//git/sample-applications/helloworld-app.git

cat > ~/.gdbinit <<EOF 
set sysroot /opt/sysroot/apertis/16.12/armhf
set debug-file-directory /opt/sysroot/apertis/16.12/armhf/usr/lib/debug
EOF

eclipse

From the Eclipse UI:

  • WindowPreferencesApertis
    • uncheck Check SSL certificates errors
    • Check for Update...Install
    • close preferences dialog
  • wait for activity in the statusbar to complete
  • Project → uncheck Build Automatically
  • FileImportGeneralExisting Projects in Workspace
    • Select root directory → choose ~/workspace/helloworld-appFinish
  • right click on helloworld-app in Project Explorer
    • Build ConfigurationsSet ActiveDebug (Device)
    • Build ConfigurationsBuild All
  • WindowsPreferencesC/C++DebugGDB
    • GDB Debugger → change to gdb-multiarch
    • GDB Command File → change to /home/user/.gdbinit
  • right click on helloworld-app in Project Explorer
    • Debug AsDebug Configuration → double click on Apertis Remote Application
    • C/C++ Application → insert /home/user/workspace/helloworld-app/helloworld-app/helloworld-app
    • ConnectionNewSSH OnlyHost name → put the value used for $HOST
    • Remote Absolute File Path for C/C++ Application → insert /Applications/org.apertis.HelloWorldApp/bin/helloworld-app
    • click Debug
    • accept to change the Eclipse perspective
  • Eclipse shows execution being blocked at the start of main()
  • Resume and Suspend buttons and using the bt command in the GDB console panel should work appropriately

Issues

Making re-running (which involves re-deploying) work need some fixes in Canterbury as it still needs a reboot to update its list of applications.

Running the following commands between every debug run works around that issue:

ssh $HOST sudo reboot
cd ~/workspace/helloworld-app
ade uninstall --device $HOST
ssh $HOST sudo reboot
Personal tools
Namespaces

Variants
Actions
Navigation
Tools