From abd65a3d361d1aa73f2dcc2b20b91f740feb560d Mon Sep 17 00:00:00 2001 From: Sebastien Douheret Date: Thu, 15 Jun 2017 09:19:08 +0200 Subject: Fix gdb debugging and add widget install on target Change-Id: I67698bbbfa626e55cbe382afd7e9c5eb699f6149 Signed-off-by: Sebastien Douheret --- cmake/common.cmake | 35 +++++++++++++++++++++++++++-------- cmake/config.cmake.sample | 2 +- gdb/gdb-on-target.in | 18 +++++++++++++++++- ssh/start-on-target.in | 4 ++-- wgt/install-wgt-on-target.in | 19 +++++++++++++++++++ xds/xds-config.env.sample | 10 ++++++++++ 6 files changed, 76 insertions(+), 12 deletions(-) create mode 100644 wgt/install-wgt-on-target.in create mode 100644 xds/xds-config.env.sample diff --git a/cmake/common.cmake b/cmake/common.cmake index 353e1ec..883886b 100644 --- a/cmake/common.cmake +++ b/cmake/common.cmake @@ -173,8 +173,8 @@ macro(remote_targets_populate) add_custom_target(remote-target-populate DEPENDS populate - COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/target/start-on-${RSYNC_TARGET}.sh - COMMAND rsync --archive --delete ${PROJECT_PKG_BUILD_DIR}/ ${RSYNC_TARGET}:${RSYNC_PREFIX}/${PROJECT_NAME} + COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/target/*.sh + COMMAND rsync -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" --archive --delete ${PROJECT_PKG_BUILD_DIR}/ ${RSYNC_TARGET}:${RSYNC_PREFIX}/${PROJECT_NAME} COMMENT "${REMOTE_LAUNCH}" ) endif() @@ -187,9 +187,9 @@ macro(wgt_package_build) if(NOT EXISTS ${WGT_TEMPLATE_DIR}/icon-default.png) MESSAGE(FATAL_ERROR "${Red}WARNING ! Missing mandatory files to build widget file.\nYou need ${PROJECT_ICON} file in ${WGT_TEMPLATE_DIR} folder.${ColourReset}") endif() - if(NOT WIDGET_TYPE) - MESSAGE(FATAL_ERROR "WIDGET_TYPE must be set in your config.cmake.\neg.: set(WIDGET_TYPE application/vnd.agl.service)") - endif() + if(NOT WIDGET_TYPE) + MESSAGE(FATAL_ERROR "WIDGET_TYPE must be set in your config.cmake.\neg.: set(WIDGET_TYPE application/vnd.agl.service)") + endif() if(NOT WIDGET_ENTRY_POINT) set(WIDGET_ENTRY_POINT lib) @@ -214,6 +214,21 @@ macro(wgt_package_build) add_dependencies(widget populate) set(ADDITIONAL_MAKE_CLEAN_FILES, "${PROJECT_NAME}.wgt") + if(NOT RSYNC_TARGET) + message ("${Yellow}.. Warning: RSYNC_TARGET not defined 'make widget-target-install' not instanciated${ColourReset}") + add_custom_target(widget-target-install + COMMENT "${Red}*** Fatal: RSYNC_TARGET RSYNC_PREFIX environment variables required with 'make widget-target-install'${ColourReset}" + COMMAND exit -1 + ) + else() + configure_file(${WGT_TEMPLATE_DIR}/install-wgt-on-target.in ${CMAKE_CURRENT_BINARY_DIR}/target/install-wgt-on-${RSYNC_TARGET}.sh) + add_custom_target(widget-target-install + DEPENDS widget + COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/target/install-wgt-on-${RSYNC_TARGET}.sh + COMMAND ${CMAKE_CURRENT_BINARY_DIR}/target/install-wgt-on-${RSYNC_TARGET}.sh + ) + endif() + if(PACKAGE_MESSAGE) add_custom_command(TARGET widget POST_BUILD @@ -364,13 +379,17 @@ else() set(BINDINGS_INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME} CACHE PATH "Where the binding will be installed in your system") endif() +set(PKGOUT_DIR package CACHE PATH "Output directory for packages") + # Define a default package directory -if(PACKAGE_PREFIX) - set(PROJECT_PKG_BUILD_DIR ${PKG_PREFIX}/package CACHE PATH "Application contents to be packaged") +if(PKG_PREFIX) + set(PROJECT_PKG_BUILD_DIR ${PKG_PREFIX}/${PKGOUT_DIR} CACHE PATH "Application contents to be packaged") else() - set(PROJECT_PKG_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/package CACHE PATH "Application contents to be packaged") + set(PROJECT_PKG_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/${PKGOUT_DIR} CACHE PATH "Application contents to be packaged") endif() +set (PROJECT_APP_TEMPLATES_DIR "conf.d/templates" CACHE PATH "Default Templates directory") + set (PKG_TEMPLATE_PREFIX ${CMAKE_SOURCE_DIR}/${PROJECT_APP_TEMPLATES_DIR} CACHE PATH "Default Package Templates Directory") set(SSH_TEMPLATE_DIR "${PKG_TEMPLATE_PREFIX}/ssh" CACHE PATH "Subpath to a directory where are stored needed files to launch on remote target to debuging purposes") set(GDB_TEMPLATE_DIR "${PKG_TEMPLATE_PREFIX}/gdb" CACHE PATH "Subpath to a directory where are stored needed files to launch debuging server on a remote target. Use gdbserver.") diff --git a/cmake/config.cmake.sample b/cmake/config.cmake.sample index 43a7547..9e41872 100644 --- a/cmake/config.cmake.sample +++ b/cmake/config.cmake.sample @@ -131,7 +131,7 @@ set(WIDGET_ENTRY_POINT EntryPoint_Path_Not_Set) # Optional force package prefix generation, like widget # ----------------------------------------------------- -# set(PACKAGE_PREFIX DestinationPath) +# set(PKG_PREFIX DestinationPath) # Optional Application Framework security token # and port use for remote debugging. diff --git a/gdb/gdb-on-target.in b/gdb/gdb-on-target.in index 360c860..0478e90 100644 --- a/gdb/gdb-on-target.in +++ b/gdb/gdb-on-target.in @@ -5,9 +5,25 @@ # Reference: https://blog.flameeyes.eu/2010/02/remote-debugging-with-gdb-part-2-gdb/ # Start gdbserver on target and connect through SSH link -target remote | ssh @RSYNC_TARGET@ gdbserver - afb-daemon --port=@AFB_REMPORT@ --workdir=@RSYNC_PREFIX@/@PROJECT_NAME@ --roothttp=./htdocs --ldpath=./lib --verbose --token=@AFB_TOKEN@ +target remote | ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null @RSYNC_TARGET@ gdbserver - afb-daemon --port=@AFB_REMPORT@ --workdir=@RSYNC_PREFIX@/@PROJECT_NAME@ --roothttp=./htdocs --ldpath=./lib --verbose --token=@AFB_TOKEN@ + +# Disable auto load of libraries to improved perf +set auto-solib-add off + +# Define path for project libraries +set solib-search-path $ENV{PROJECT_DIR}/build/@PKGOUT_DIR@/lib + +# Path substitution for source file names +set substitute-path @CMAKE_CURRENT_SOURCE_DIR@ $ENV{PROJECT_DIR} # Replace run by continue (gdb use 'run' when gdbserver wants 'continue') define run continue +end + +# Manually load project libraries when loaded by afb-daemon +break execute_command +commands +sharedlibrary $ENV{PROJECT_DIR}/build/@PKGOUT_DIR@ +continue end \ No newline at end of file diff --git a/ssh/start-on-target.in b/ssh/start-on-target.in index a21c6d1..9e3a60d 100644 --- a/ssh/start-on-target.in +++ b/ssh/start-on-target.in @@ -1,5 +1,5 @@ #!/bin/sh -# +# # File: start-on-target.sh # Author: Fulup Ar Foll @ IoT.bzh # Object: Forward signal (SIGTERM) to remote process @@ -13,7 +13,7 @@ export RSYNC_PREFIX=@RSYNC_PREFIX@/@PROJECT_NAME@ export AFB_REMPORT=@AFB_REMPORT@ export AFB_TOKEN=@AFB_TOKEN@ -exec ssh -o "StrictHostKeyChecking no" -tt $RSYNC_TARGET << EOF +exec ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -tt $RSYNC_TARGET << EOF afb-daemon --workdir=$RSYNC_PREFIX --port=$AFB_REMPORT --roothttp=./htdocs --ldpath=./lib --verbose --token=$AFB_TOKEN & PID_DAEMON=\$! diff --git a/wgt/install-wgt-on-target.in b/wgt/install-wgt-on-target.in new file mode 100644 index 0000000..39a69d5 --- /dev/null +++ b/wgt/install-wgt-on-target.in @@ -0,0 +1,19 @@ +#!/bin/sh +# +# File: install-wgt-on-target.sh +# Author: Sebastien Douheret @ IoT.bzh +# Object: install widget on target +# Created on 24-May-2017, 09:23:37 +# Usage: + +# Do not change manually use 'make remote-target-populate' +export RSYNC_TARGET=@RSYNC_TARGET@ +export WGT_FILE_L=@CMAKE_CURRENT_BINARY_DIR@/@PROJECT_NAME@.wgt +export WGT_FILE_T=/tmp/@PROJECT_NAME@.wgt + +scp $WGT_FILE_L $RSYNC_TARGET:$WGT_FILE_T \ + && ssh -o "StrictHostKeyChecking no" -tt $RSYNC_TARGET -- \ + afm-util install $WGT_FILE_T + +# && rm -f $WGT_FILE_T + diff --git a/xds/xds-config.env.sample b/xds/xds-config.env.sample new file mode 100644 index 0000000..a4c51b1 --- /dev/null +++ b/xds/xds-config.env.sample @@ -0,0 +1,10 @@ +XDS_PROJECT_ID=W2EAQBA-HQI75XA_unicens2-binding +XDS_SDK_ID=poky-agl_aarch64_3.99.1+snapshot +XDS_SERVER_URL=localhost:8000 + +DOCKER_TARGET=docker-sdk + +RSYNC_TARGET=root@192.168.168.11 +RSYNC_PREFIX=./opt +PROJECT_DIR=/home/seb/tmp/unicens2-binding + -- cgit 1.2.3-korg