Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your...

42

Transcript of Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your...

Page 1: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client
Page 2: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

1.1

1.2

1.3

1.3.1

1.3.2

1.3.3

1.3.4

1.3.5

1.4

1.4.1

1.4.2

1.4.3

1.4.4

TableofContents

Introduction

Documentrevisions

Part1-GettingStartedforUsers

Installingxdsclienttools

Installingxds-server

InstallingAGLSDKs

CreateyourfirstAGLapplication

DebugyourfirstAGLapplication

Part2-XDSinternals

xds-server

xds-agent

xds-exec

xds-gdb

Page 3: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

Introduction

X(cross)DevelopmentSystemisatoolthatallowsusertoeasilycrossbuildapplications.

Thisdocumentationisavailable:

online:http://docs.automotivelinux.org/docs/devguides/en/dev/#xcross-development-system-user's-

guide

PDFfile:http://iot.bzh/download/public/2017/XDS/docs/XDS_UsersGuide.pdf

Meta Data

Title X(cross)DevelopmentSystem

Author SebastienDouheret

Description

Keywords AGL,XDS,cross,Development,Iotbzh

Language English

Published PublishedOctober2017asanelectronicbook

Updated ThuOct19201710:04:41GMT+0200(CEST)

Collection Open-source

Website http://iot.bzh

Page 4: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

Documentrevisions

Date Version Designation Author

Sept2017 0.1 Initialrelease S.Douheret[Iot.bzh]

Oct2017 0.2 Variousupdatetomatchnewbehavior S.Douheret[Iot.bzh]

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 4October2017

Page 5: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

GettingStartedforUsers

Abstract

X(cross)DevelopmentSystem (XDS) is set of tools that provide amulti-platform for cross development

withnear-zeroinstallation.

Thisdocumentationisavailable:

online:http://docs.automotivelinux.org/docs/devguides/en/dev/#xcross-development-system-user's-

guide

PDFfile:http://iot.bzh/download/public/2017/XDS/docs/XDS_UsersGuide.pdf

ThefirstgoalofXDSistoprovideamulti-platformcrossdevelopmenttoolwithnear-zeroinstallation.The

secondgoalistokeepapplicationsourceslocally(onuser'smachine)tomakeitcompatiblewithexistingIT

policies(e.g.corporatebackuporSCM),andletusertocontinuetoworkasusual(usehisfavoriteeditor,

keepperformancewhileediting/browsingsources).

ThetwomainblocksthatcomposeXDSaretheclientpart(xds-agent)runningontheuser'smachineand

theserverpart(xds-server)runningsomewhereinacontaineroronaservermachine(onlocalnetworkor

cloud).

{::style="width:98%;"}

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 5October2017

Page 6: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

The client part (xds-agent) is portable and is running on Linux, Windows or MacOS machine and the

following3mainconfigurationsaresupported:

standalone(orlocal)config

On-Premise(localnetwork)

SaaS(Cloudbased)

{::style="width:98%;"}

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 6October2017

Page 7: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

InstallingXDSclienttools

xds-agentisaclienttoolthatmustrunonyourmachine(user/developerhost)tobeabletouseXDS.

InstallationofotherXDSclient tools,suchas xds-execor xds-gdb is optional and depends ofwhat you

wanttodo:

xds-exec:commandlinetooltointeractwithXDS(alsousedbyIDEintegration).

xds-gdb:requestedfordebuggingapplication.

Installpackagesfordebiandistrotype

#'DISTRO'canbesetto{xUbuntu_16.04,xUbuntu_16.10,xUbuntu_17.04,Debian_8.0,Debian_9.0}

seb@laptop~$exportDISTRO="xUbuntu_16.04"

seb@laptop~$wget-O-http://download.opensuse.org/repositories/isv:/LinuxAutomotive:/app-Development/${DISTRO}/Re

lease.key|sudoapt-keyadd-

seb@laptop~$sudobash-c"cat>>/etc/apt/sources.list.d/AGL.list<<EOF

debhttp://download.opensuse.org/repositories/isv:/LinuxAutomotive:/app-Development/${DISTRO}/./

EOF"

seb@laptop~$sudoapt-getupdate

seb@laptop~$sudoapt-getinstallagl-xds-agent

seb@laptop~$sudoapt-getinstallagl-xds-exec

seb@laptop~$sudoapt-getinstallagl-xds-gdb

InstallpackagesforopenSUSEdistrotype

#DISTROcanbesetto{openSUSE_Leap_42.2,openSUSE_Leap_42.3,openSUSE_Tumbleweed}

seb@laptop~$exportDISTRO="openSUSE_Leap_42.2"

seb@laptop~$sudozypperarhttp://download.opensuse.org/repositories/isv:/LinuxAutomotive:/app-Development/${DISTR

O}/isv:LinuxAutomotive:app-Development.repo

seb@laptop~$sudozypperref

seb@laptop~$sudozypperinstallagl-xds-agent

seb@laptop~$sudozypperinstallagl-xds-exec

seb@laptop~$sudozypperinstallagl-xds-gdb

Installforotherplatforms(Windows/MacOS)

Installxds-agent:

1. Downloadthelatestreleasedtarballfromgithubreleasespage.

2. Thenunzipthetarballanywhereintoyourlocaldisk(forexample:/opt/AGL/xdsorC:\AGL\xds).

3. AddbinarytoPATH:

MacOs:createthe.bash_profilenano.bash_profileandaddexportPATH="/opt/AGL/xds/xds-

agent:$PATH

Windows:changethesystempathviacontrolpanelorsystemsettingsorsetxpath

"C:\AGK\xds\xds-agent;%path%"

repeatthepreviousstepstoinstallothertoolsdependingofyourneeds:

xds-exec:requestedforcommandlineandIDEintegration.(releasedtarballlink).

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 7October2017

Page 8: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

xds-gdb:requestedfordebuggingapplication.(releasedtarballlink).

Startxds-agent

XDS-agentisaclienttoolthatmustrunonyourlocal/userdevelopmentmachinewhenyouuseXDS.

For Linux distro, a user systemd service is provided, so you just need to enable if youwant to start it

automaticallyatbootandyoucanalsostartitimmediatelyusingfollowingcommands:

#Enablexds-agentserviceatboot

seb@laptop~$systemctl--userenablexds-agent.service

#Manuallystartxds-agentservice

seb@laptop~$systemctl--userstartxds-agent.service

#Getstatusandlogofxds-agentservice

seb@laptop~$systemctl--userstatusxds-agent.service

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 8October2017

Page 9: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

InstallingXDSserver

Dependingofyourconfiguration,thisstepisnecessaryornot.

Inotherwordsyouareadeveloperandplantouse/connecttoanexisting xds-server running on

your local network (On-Premise config) or in the Cloud (SaaS config), you don't need to install the

serverpartandyoucanskipthisstep.

For others (standalone config or administrators that want to install an On-Premise solution) xds-server

mustbeinstalled.

Severalinstallationtypesaresupported:

Installtype SupportedOS Sectiontorefer

Container LinuxorMacOS seeInstallationbasedonDockercontainer

VirtualMachine Linux,MacOSorWindows seeInstallationbasedonVirtualBoxappliance

Native Linux seeNativeinstallation

InstallationbasedonDockercontainer

Prerequisites

Dockerisinstalledonthehostmachine,pleaserefertoDockerdocumentationformoredetails.

Getthecontainer

Loadthepre-buildAGLSDKdockerimageincludingxds-server:

seb@laptop~$wget-O-http://iot.bzh/download/public/2017/XDS/docker/docker_agl_worker-xds-latest.tar.xz|dockerl

oad

Youshouldgetdocker.automotivelinux.org/agl/worker-xds:X.Yimage

#Listimagethatwejustload

seb@laptop~$dockerimages"docker.automotivelinux.org/agl/worker-xds*"

docker.automotivelinux.org/agl/worker-xds4.0786d65b2792c6daysago654MB

Createandstartanewcontainer

Useprovidedscripttocreateanewdockercontainerandstartit:

#Getscript

seb@laptop~$wgethttps://raw.githubusercontent.com/iotbzh/xds-server/master/scripts/xds-docker-create-container.sh

#CreatenewXDSworkercontainer

seb@laptop~$bash./xds-docker-create-container.sh

#Checkthatnewcontainerisrunning

seb@laptop~$dockerps|grepworker-xds

b985d81af40cdocker.automotivelinux.org/agl/worker-xds:3.99.1"/usr/bin/wait_for..."6daysago

Up4hours0.0.0.0:8000->8000/tcp,0.0.0.0:69->69/udp,0.0.0.0:10809->10809/tcp,0.0.0.0:2222->22/tcp

agl-xds-seb@laptop-0-seb

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 9October2017

Page 10: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

Notethatyoucanalsoaddanewshareddirectoryusing --volumeoptioninordertouseforexamplewith

Path-Mappingfoldertype.

#CreatenewXDSworkercontainerandshareextra'$HOME/my-workspace'directory

seb@laptop~$bash./xds-docker-create-container.sh--volume/my-workspace:$HOME/my-workspace

Checkifxds-serverisrunning

xds-serverisautomaticallystartedasaserviceoncontainerstartup.

Tocheckifxds-serveriscorrectlyinstallandrunning,youcanaccessthewebinterface,whatwecallthe

"Dashboard",usingawebbrowser:

#ifcontainerisrunningonyourlocalhost

#(elsereplacelocalhostbythenameortheipofthemachinerunningthecontainer)

seb@laptop~$xdg-openhttp://localhost:8000

xds-serverisnowupandrunning,youcannowinstallAGLSDKs,pleaserefertochapternamed"Installing

AGLSDKs"

Containersettings

Thiscontainer(ID=0)exposesfollowingports:

8000:xds-servertoserveXDSDashboard

69:TFTP

2222:ssh

Thiscontaineralsocreatesthefollowingvolumes(sharingdirectoriesbetweeninsideandoutsidedocker):

Directoryonhost Directoryinsidedocker

Comment

$HOME/xds-workspace

/home/devel/xds-workspace

XDSprojectsworkspacelocation

$HOME/xds-workspace/.xdt_0

/xdt locationtostoreSDKs

$USER_VOLUME $USER_VOLUME userpath,see--volumeoptionofxds-docker-create-container.shscript

Pleaserefertopart2-xds-serverdocumentationforadditionalinfo.

InstallationbasedonVirtualBoxappliance

comingsoon...

Nativeinstallation

Youcanchosetoinstallxds-server'natively'insteadofwithinadockercontainerbutonlyLinuxhostOSes

aresupportedandtestedfornativeinstallation!

Installpackagesfordebiandistrotype

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 10October2017

Page 11: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

#'DISTRO'canbesetto{xUbuntu_16.04,xUbuntu_16.10,xUbuntu_17.04,Debian_8.0,Debian_9.0}

seb@laptop~$exportDISTRO="xUbuntu_16.04"

seb@laptop~$wget-O-http://download.opensuse.org/repositories/isv:/LinuxAutomotive:/app-Development/${DISTRO}/Re

lease.key|sudoapt-keyadd-

seb@laptop~$sudobash-c"cat>>/etc/apt/sources.list.d/AGL.list<<EOF

debhttp://download.opensuse.org/repositories/isv:/LinuxAutomotive:/app-Development/${DISTRO}/./

EOF"

seb@laptop~$sudoapt-getupdate

seb@laptop~$sudoapt-getinstallagl-xds-server

InstallpackagesforopenSUSEdistrotype

#DISTROcanbesetto{openSUSE_Leap_42.2,openSUSE_Leap_42.3,openSUSE_Tumbleweed}

seb@laptop~$exportDISTRO="openSUSE_Leap_42.2"

seb@laptop~$sudozypperarhttp://download.opensuse.org/repositories/isv:/LinuxAutomotive:/app-Development/${DISTR

O}/isv:LinuxAutomotive:app-Development.repo

seb@laptop~$sudozypperref

seb@laptop~$sudozypperinstallagl-xds-server

Configurexds-server

Optionalstep:nothingtodoifyoukeepdefaultsettings

When xds-server is started as a systemd service, default environment variables are set into

/etc/default/xds-serverfile.

xds-server configuration is also driven by a JSON config file (config.json), and default JSON config is

/etc/xds-server/config.json.

Note:youcanuseyourownJSONconfigbysettingsAPP_CONFIGvariableof/etc/default/xds-

serverfiletoyourfile,forexample/home/MYUSER/.xds/server/config.json

SupportedfieldsinJSONconfigurationfileare:

httpPort:HTTPportofclientwebapp/dashboard

webAppDir:locationofclientdashboard(default:webapp/dist)

shareRootDir:rootdirectorywhereprojectswillbecopied

logsDir:directorytostorelogs(eg.syncthingoutput)

sdkRootDir:rootdirectorywherecrossSDKsareinstalled

syncthing.binDir:syncthingbinariesdirectory(default:executabledirectory)

syncthing.home":syncthinghomedirectory(usually.../syncthing-config)

syncthing.gui-address:syncthingguiurl(defaulthttp://localhost:8385)

syncthing.gui-apikey:syncthingapi-keytouse(defaultauto-generated)

Allfieldsareoptionalandexamplebelowcorrespondstothedefaultvalues:

{

"httpPort":8000,

"webAppDir":"webapp/dist",

"shareRootDir":"${HOME}/.xds-server/projects",

"logsDir":"/tmp/logs",

"sdkRootDir":"/xdt/sdk",

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 11October2017

Page 12: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

"syncthing":{

"binDir":"./bin",

"home":"${HOME}/.xds-server/syncthing-config",

"gui-address":"http://localhost:8385",

"gui-apikey":"123456789",

}

}

Note:environmentvariablesaresupportedbyusing${MY_VAR}syntax.

Start/Stopxds-server

xds-servercanbemanagedasasystemdservicewiththefollowingcommands:

#StatusXDSserver:

seb@laptop~$systemctl--userstatusxds-server.service

#StopXDSserver

seb@laptop~$systemctl--userstopxds-server.service

#StartXDSserver

seb@laptop~$systemctl--userstartxds-server.service

#GetXDSserverlogs

seb@laptop~$systemctl--user--unit=xds-server.service--output=cat

Tocheckifxds-serveriscorrectlyinstallandrunning,youcanaccessthewebinterface,whatwecallthe

"Dashboard",usingawebbrowser:

seb@laptop~$xdg-openhttp://localhost:8000

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 12October2017

Page 13: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

InstallingAGLSDKs

TobuildyourAGLservicesorAGLapplicationsusingXDSyoumustinstallaSDKmatchingthetarget/board

youwanttouse.ASDKisapackagethatincludesalltoolsyouneedtocross-buildandcross-debugyour

service/application.

YoucangeneratetheAGLSDKfor theboardyouwanttouseoryoucandownloadapre-packagedAGL

SDK.

InstallingSDKcross-toolchain

xds-serverusesSDKcross-toolchaininstalledintodirectorypointedby sdkRootDirsetting(see xds-server

configurationchapterformoredetails).

Fornow,youcanonlyinstallSDKusingabashscriptbutinanearfutureyouwillbeabletomanageSDKs

usingXDSDashboard.

SotoinstallaSDK,useprovidedinstall-agl-sdksscript:

#Optional-Logintothecontainer(onlynecessarywhenxds-serverisrunningwithinadockercontainer)

seb@laptop~$ssh-p2222devel@localhost

#Forexample,InstallARM64SDK(automaticdownload)

devel@docker~$sudo/opt/AGL/xds/server/xds-utils/install-agl-sdks.sh--archaarch64

YoumayalsowanttoinstallanSDKthatyoubuiltmanually(seePart1-SDK-compilation-installation)

#Optional-Logintothecontainer(onlynecessarywhenxds-serverisrunningwithinadockercontainer)

seb@laptop~$ssh-p2222devel@localhost

#InstallIntelcorei7-64SDK(usinganSDKtarballthathasbeenbuiltordownloadedmanually)

devel@docker~$sudo/opt/AGL/xds/server/xds-utils/install-agl-sdks.sh--archcorei7-64--file/tmp/poky-agl-glibc-x8

6_64-agl-demo-platform-crosssdk-corei7-64-toolchain-

4.0.1.sh

Warning:duetosomelimitation,youneedfornowtorestartxds-serverinordertomake

newinstalledSDKvisible/available.

seb@laptop~$ssh-p2222devel@localhost

devel@docker~$systemctl--userrestartxds-server.service

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 13October2017

Page 14: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

CreateyourfirstAGLapplication

Prerequisites

xds-agentisrunningonyourmachine(seeInstallingXDSclienttoolspreviouschapter)

xds-serverisrunninglocallyinadockercontainerorisaccessibleonyournetwork(seeInstalling

XDSserverpreviouschapter)

oneormoreSDKhavebeeninstalled(seeInstallingAGLSDKspreviouschapter)

XDSconfigurationiscorrect:inotherwords,alltablelinesareblueinconfigurationpageofXDS

Dashboard.

Setup

Let'suseforexamplehelloworld-native-application,soyouneedfirsttoclonethisprojectintoadirectory

thatwillbeaccessiblebyxds-server.Dependingoftheprojectsharingmethod:

Cloudsync:youcancloneprojectanywhereonyourlocaldisk,

Pathmapping:youmustcloneprojectinto$HOME/xds-workspacedirectory.

Note: : helloworld-native-application project is an AGL project based on app-templates

(includedasagitsubmodule).ThisCMaketemplating,usedtodevelopapplicationwiththe

AGLApplication Framework,will automatically generatemakefile rules (eg. remote-target-

populate)orscripts(eg.build/target/xxxscripts).

Formoreinfoaboutapp-template,pleaserefertothisdocumentation.

Cloneproject

cd$HOME/xds-workspace

gitclone--recursivehttps://github.com/iotbzh/helloworld-native-application.git

DeclareprojectintoXDS

UseXDSDashboardtodeclareyourproject.OpenabrowserandconnecttoXDSDashboard.URLdepends

ofyourconfig,forexamplehttp://localhost:8000

Clickcogicon

{::style="display:inline;padding:0;"}toopenconfigurationpanelandthencreate/declareanewproject

bywiththeplusicon

{::style="display:inline;padding:0;"}ofProjectsbar.

SetSharingTypeandpathsaccordingtoyoursetup.

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 14October2017

Page 15: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

{::style="width:90%;"}

NotethatXDScreatesafilename xds-project.conf(ifnotalreadyexists)whenyoudeclareanewproject

usingXDSDashboard.ThisfilemaybeveryusefulwhenyouwilluseXDSclienttoolssuchasxds-exec(see

nextchapter).

Note:whenyouselect Pathmapping,youmustcloneyourproject into $HOME/xds-workspace

directory (named "Local Path" in modal window) and "Server Path" must be set to

/home/devel/xds-workspace/xxxwherexxx isyourprojectdirectoryname.Ifyouselect Cloud

Sync,youcancloneyourprojectwhereyouwantonyourlocaldisk.

BuildfromXDSdashboard

Openthebuildpage(icon

{::style="display:inline;padding:0;"}),thenselectyourProjectandtheCrossSDKyouwanttouseand

clickonClean/Pre-Build/Build/Populatebuttonstoexecutevariousbuildactions.

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 15October2017

Page 16: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

{::style="width:90%;"}

Buildfromcommandline

Youneedtodeterminewhichistheuniqueidofyourproject.YoucanfindthisIDinprojectpageofXDS

dashboard or you can get it from command line using the --list option. This option lists all existing

projectsID:

xds-exec--list

Listofexistingprojects:

CKI7R47-UWNDQC3_myProject

CKI7R47-UWNDQC3_test2

CKI7R47-UWNDQC3_test3

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 16October2017

Page 17: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

Note:XDStools, including xds-execare installedbydefault in /opt/AGL/bindirectoryand this

pathhasbeenadded intoyourPATHvariable. If it isnot thecase, justadd itmanuallyusing

exportPATH=${PATH}:/opt/AGL/bincommandline.

Nowtoreferyourproject,justuse--idoptionoruseXDS_PROJECT_IDenvironmentvariable.

YouarenowreadytouseXDStoforexamplecrossbuildyourproject.Hereisanexampletobuildaproject

basedonCMakefile:

#Gointoyourprojectdirectoryandcreateabuilddirectory

cd$MY_PROJECT_DIR

mkdirbuild

#Generatebuildsystemusingcmake

xds-exec--id=CKI7R47-UWNDQC3_myProject--sdkid=poky-agl_aarch64_4.0.1--url=http://localhost:8000--cdbuild&&cma

ke..

#Buildtheproject

xds-exec--id=CKI7R47-UWNDQC3_myProject--sdkid=poky-agl_aarch64_4.0.1--url=http://localhost:8000--cdbuild&&mak

eall

To avoid to set project id, xds server url, ... at each command line, you can define these settings as

environmentvariablewithinanenvfileandjustset --configoptionor source filebeforeexecutingxds-

exec.

XDScreatesafilenamexds-project.conf(onlyifnotalreadyexists)whenyoudeclareanewprojectusing

XDSDashboard.Usethisfilewith--configoption.

Forexample,theequivalenceofabovecommandis:

#MY_PROJECT_DIR=/home/seb/xds-workspace/helloworld-native-application

cd$MY_PROJECT_DIR

#Editandpotentiallyadaptxds-project.conffilethathasbeencreated

#automaticallyonprojectdeclarationusingXDSDashboard

vixds-project.conf

#XDSprojectsettings

exportXDS_SERVER_URL=localhost:8000

exportXDS_PROJECT_ID=cde3b382-9d3b-11e7_helloworld-native-application

exportXDS_SDK_ID=poky-agl_aarch64_4.0.1

#Createbuilddirectoryandinvokecmakeandthenbuildproject

xds-exec--configxds-project.conf--"mkdir-pbuild&&cdbuild&&cmake.."

cdbuild&&xds-exec--makeall

#Orequivalentbyfirstsourcingconffile(avoidtoset--configoption)

sourcexds-project.conf

xds-exec--"mkdir-pbuild&&cdbuild&&cmake.."

cdbuild&&xds-exec--makeall

Note:allparametersafteradoubledash(--)areconsideredasthecommandtoexecuteon

xds-server.

BuildfromIDE

FirstcreateanXDSconfigfileorreusethepreviousone,forexampleweusehereaarch64SDKtocross

buildapplicationforaRenesasGen3board.

#createfileatrootdirectoryofyourproject

#forexample:

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 17October2017

Page 18: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

#MY_PROJECT_DIR=/home/seb/xds-workspace/helloworld-native-application

cat>$MY_PROJECT_DIR/xds-project.conf<<EOF

exportXDS_SERVER_URL=localhost:8000

exportXDS_PROJECT_ID=cde3b382-9d3b-11e7_helloworld-native-application

exportXDS_SDK_ID=poky-agl_aarch64_3.99.3

EOF

NetBeans

This chapter will show you how to create 2 configurations, one to compile your project natively (using

nativeGNUgcc)andonetocross-compileyourprojectusingXDS.Youcaneasilyswitchfromonetoother

configurationusingmenuRun->SetProjectConfiguration.

Netbeans8.x:

OpenmenuTools->Options

OpenC/C++tab,inBuildToolssub-tab,clickonAddbutton:

Then,youshouldsetMakeCommandandDebuggerCommandtopointtoxdstools:

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 18October2017

Page 19: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

FinallyclickonOKbutton.

Nowcreatewe firstdeclareproject intoNetBeansandcreate firstanativeconfiguration.Todo that,

openmenuFile->NewProject

SelectC/C++ProjectwithExistingSources;ClickonNextbutton

SpecifyyourprojectdirectoryandsetSelectConfigurationModetoCustom.KeepToolCollection

toDefaultGNU inorder tocreateanativeconfiguration basedonnativeGNUGCC. Finally click on

Nextbutton.

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 19October2017

Page 20: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

JustupdateRuninFolderfieldandadd build_nativesuffixsothatresultingbuildfileswillbelocated

intobuild_nativesub-directory.KeepallotherssettingstodefaultvalueandclickonNextbutton.

Click several times onNext button (always keep default settings) and click on Finish button to

completecreationofnativeconfiguration.

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 20October2017

Page 21: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

Nowwewill createacrossconfiguration basedonXDS tools. Edit project properties (usingmenu

File -> Project Properties) to add a new configuration that will use XDS to cross-compile your

applicationforexampleforaRenesasGen3board.

inBuild category, clickonManageConfigurations button and thenNew button to add a new

configurationnamedforexample"Gen3board"

ClickonSetActivebutton

SelectPre-Buildsub-category,andset:

WorkingDirectory:build_gen3

CommandLine:xds-exec-c../xds-project.conf--cmake-DRSYNC_TARGET=root@renesas-gen3-

DRSYNC_PREFIX=/opt..

Pre-buildFirst:ticked

SelectMakesub-category,andset:

WorkingDirectory:build_gen3

BuildCommand:xds-exec-c../xds-project.conf--makeremote-target-populate

CleanCommand:xds-exec-c../xds-project.conf--makeclean

SelectRunsub-category,andset:

RunCommand:target/[email protected]

RunDirectory:build-gen3

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 21October2017

Page 22: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

ClickonOKbuttontosavesettings

By changing configuration fromDefault toGen3board, you can now simply compile your helloworld

applicationnatively(Defaultconfiguration)orcross-compileyourapplicationthroughXDSfortheRenesas

Gen3board(Gen3boardconfiguration).

VisualStudioCode

OpenyourprojectinVSCode

cd$MY_PROJECT_DIR

code.&

Addnewtasks:pressCtrl+Shift+PandselecttheTasks:ConfigureTaskcommandandyouwillseealistof

taskrunnertemplates.

And define your own tasks, here is an example to build helloworld-native-application AGL helloworld

applicationbasedoncmaketemplate.

{

"version":"2.0.0",

"type":"shell",

"presentation":{

"reveal":"always"

},

"tasks":[

{

"taskName":"clean",

"command":"/bin/rm-rf${workspaceFolder}/build/*&&mkdir-pbuild&&echoCleanupdone.",

"problemMatcher":[]

},

{

"taskName":"pre-build",

"group":"build",

"command":"/opt/AGL/bin/xds-exec--rpathbuild--configxds-project.conf--cmake-DRSYNC_TARGET=root@re

nesas-gen3-DRSYNC_PREFIX=/opt../",

"problemMatcher":[

"$gcc"

]

},

{

"taskName":"build",

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 22October2017

Page 23: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

"group":"build",

"command":"/opt/AGL/bin/xds-exec--rpathbuild--configxds-project.conf--makewidget",

"problemMatcher":[

"$gcc"

]

},

{

"taskName":"populate",

"command":"/opt/AGL/bin/xds-exec--rpathbuild--configxds-project.conf--makewidget-target-install",

"problemMatcher":[]

}

]

}

Note:Youcanalsoaddyourownkeybindingstotrigabovetasks,forexample:

//Build

{

"key":"alt+f9",

"command":"workbench.action.tasks.runTask",

"args":"clean"

},

{

"key":"alt+f10",

"command":"workbench.action.tasks.runTask",

"args":"pre-build"

},

{

"key":"alt+f11",

"command":"workbench.action.tasks.runTask",

"args":"build"

},

{

"key":"alt+f12",

"command":"workbench.action.tasks.runTask",

"args":"populate"

},

MoredetailsaboutVSCkeybindingshere

MoredetailsaboutVSCtaskshere

QtCreator

Pleaserefertoagl-hello-qmlproject.ThankstoDennisforprovidingthisusefulexample.

OthersIDE

Comingsoon...

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 23October2017

Page 24: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

DebugyourfirstAGLapplication

Debugisbasedongdbandyouneedtousexds-gdbasawrapperongdbtocross-debugyourapplication.

Thistoolallowsyoutodebuganapplicationbuiltwithanxds-serverwithouttheneedtoinstallgdborany

crosstool.Twodebuggingmodelsaresupported:

1. nativedebugging

2. XDSremotedebuggingrequiringanXDSserverandallowingcrossdebugyourapplication.

BydefaultXDSremotedebugisusedandyouneedtodefineXDS_NATIVE_GDBvariabletousenativegdb

debugmodeinstead.

SEEALSO:xds-server,awebserverusedtoremotelycrossbuildapplications.SEEALSO:xds-

exec, wrappers on exec command that allows to cross build your application through xds-

server.

Configuration

xds-gdbconfigurationisdefinedbyvariables(seelistedbelow).Thesevariablesmaybesetusing:

environmentvariables(inherited),

oraconfigfilesetwithXDS_CONFIGenvironmentvariable,forexample:

XDS_CONFIG=/tmp/my_xds_gdb_config.envxds-gdb

orbysettingvariableswithinagdbinifile(seedetailsbelow),

ora"user"configfilelocatedinfollowingdirectory(firstfoundistaken):

1. $(CURRENT_DIRECTORY)/.xds-gdb.env

2. $(CURRENT_DIRECTORY)/../xds-gdb.env

3. $(CURRENT_DIRECTORY)/target/xds-gdb.env

4. $(HOME)/.config/xds/xds-gdb.env

ConfigurationVariables

XDS_CONFIGConfigfiledefining XDS_xxxconfigurationvariables.Variablesofthisfilewilloverwriteinherited

environmentvariables.Variablesdefinitionmaybeprefixedornotby"export"keyword.Hereisanexample

ofconfigurationfile

#forexample:

#MY_PROJECT_DIR=/home/seb/xds-workspace/helloworld-native-application

cat>$MY_PROJECT_DIR/xds-gen3.conf<<EOF

exportXDS_SERVER_URL=http://docker:8000

exportXDS_PROJECT_ID=IW7B4EE-DBY4Z74_myProject

exportXDS_SDK_ID=poky-agl_aarch64_4.0.1

EOF

XDS_LOGLEVEL

Setlogginglevel(supportedlevels:panic,fatal,error,warn,info,debug)

XDS_LOGFILE

Setloggingfile,default/tmp/xds-gdb.log.

XDS_NATIVE_GDB

UsenativegdbmodeinsteadofremoteXDSservermode.

XDS_PROJECT_ID(mandatorywithXDSservermode)

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 24October2017

Page 25: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

ProjectIDyouwanttobuild

XDS_RPATH

Relativepathintoproject

XDS_SDK_ID(mandatorywithXDSservermode)

CrossSdkIDtousetobuildproject

XDS_SERVER_URL(mandatorywithXDSservermode)

RemoteXDSserverurl

Configurationvariablessetwithingdbinitcommandfile

AboveXDS_xxxvariablesmayalsobedefinedwithingdbinitcommandfile(see--commandor-xoptionof

genuineGdb).Youmustrespectthefollowingsyntax:commentedlineincluding:XDS-ENV:tag

ExampleofgdbinitfilewherewedefineprojectandsdkID:

#:XDS-ENV:XDS_PROJECT_ID=IW7B4EE-DBY4Z74_myProject

#:XDS-ENV:XDS_SDK_ID=poky-agl_aarch64_4.0.1

Usingxds-gdbfromcommandline

XDSremotedebuggingmode

Firsttheprojectyouwanttodebugmustbedeclaredonanxds-serverandthisprojectmayalsohasbeen

builtusingthisxds-server(seexds-serverformoredetails).

Sotodebugityouneedtoknowthexds-serverurl(eg.http://docker:8000),youalsoneedtheprojectand

sdk unique id. You can find these IDs in project page of XDS dashboard or you can get them from

commandlineusingthe--listoption.ThisoptionlistsallexistingprojectsID:

XDS_SERVER_URL=http://docker:8000xds-gdb--list

Nowtoreferyourproject,justsetXDS_PROJECT_IDandXDS_SDK_IDvariables.

Youarenowreadytousexds-gdbtoforexamplecrossdebugyourproject.Hereisanexampletobuildand

debugaprojectbasedonCMakefileandAGLapp-templates:

#Gointoyourprojectdirectory(forexamplehelloworld-native-application)

cd~/xds-workspace

gitclonehttps://github.com/iotbzh/helloworld-native-application.git

cdhelloworld-service

#Declareyourprojectonxds-server

#<fornow,youcanonlydothisstepusingxdsHTMLdashboard(seexds-serverdoc)>

#DefineXDSconfig

cat<<EOF>./xds-config.env

XDS_SERVER_URL=http://docker:8000

XDS_PROJECT_ID=IW7B4EE-DBY4Z74_myProject

XDS_SDK_ID=poky-agl_aarch64_4.0.1

EOF

#Telltoxds-execandxds-gdbwhichisyourconfigfile

exportXDS_CONFIG=../xds-gen3.conf

#Createanewbuilddirectory

mkdirbuild&&cdbuild

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 25October2017

Page 26: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

#Startremotecrossbuild

xds-exec--cmake-DRSYNC_TARGET=root@myTarget..

xds-exec--make

xds-exec--makeremote-target-populate

#Startdebugging

xds-gdb-xtarget/[email protected]

Note: : helloworld-native-application project is an AGL project based on app-templates

(includedasagitsubmodule).ThisCMaketemplating,usedtodevelopapplicationwiththe

AGLApplication Framework,will automatically generatemakefile rules (eg. remote-target-

populate)orscripts(eg.build/target/xxxscripts).

Formoreinfoaboutapp-template,pleaserefertothisdocumentation.

Nativedebugging

Toenablenativedebuggingmode,youneedtodefineXDS_NATIVE_GDBvariable.

Usingxds-gdbwithinanIDE

Netbeans

Netbeans8.x:

OpenmenuTools->Options

OpenC/C++tab,inBuildToolssub-tab,clickonAddbutton:

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 26October2017

Page 27: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

{::style="width:90%;"}

Then,youshouldsetMakeCommandandDebuggerCommandtopointtoxdstools:

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 27October2017

Page 28: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

{::style="width:90%;"}

FinallyclickonOKbutton.

Editprojectproperties(usingmenuFile->ProjectProperties)toupdateDebugsettings:

Besurethat"Gen3board"configurationisselected

SelectRuncategory,andset:

RunCommand:target/[email protected](scriptnamemaydependofRSYNC_TARGET

variableyousetinpre-buildcommand)

RunDirectory:build_gen3

SelectDebugcategory,andset:

Debugcommand:/bin/true

WorkingDirectory:emptyfield

GdbInitFile:target/[email protected](scriptnamemaydependofRSYNC_TARGET

variableyousetinpre-buildcommand)

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 28October2017

Page 29: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

{::style="width:90%;"}

ClickonApplyandthenOKbuttontosavesettings

You can now start debugging your application with menu Debug -> Debug Project (or CTRL+F5

shortcut)

OthersIDE

Comingsoon...

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 29October2017

Page 30: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

XDSinternals(advanceddocumentation)

Abstract

This2ndpartisthe"technical"documentationofallXDSpieces/toolsthatallowsforexampletofinetune

XDSconfigurationorrebuildallXDStoolsfromscratch.

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 30October2017

Page 31: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

XDS-X(cross)DevelopmentSystemServer

xds-serverisawebserverthatallowsusertoremotelycrossbuildapplications.

Thefirstgoalistoprovideamulti-platformcrossdevelopmenttoolwithnear-zeroinstallation.Thesecond

goal is to keep application sources locally (on user's machine) to make it compatible with existing IT

policies(e.g.corporatebackuporSCM),andletusertocontinuetoworkasusual(usehisfavoriteeditor,

keepperformancewhileediting/browsingsources).

Thispowerfulandportablewebserver(writteninGo)exposesaRESTinterfaceoverHTTPandalsoprovides

aWebdashboardtoconfigureprojectsandexecute(fornow)onlybasicscommands.

xds-serverusesSyncthingtooltosynchronizeprojectsfilesfromusermachinetobuildservermachineor

container.

SEEALSO:xds-exec,wrapperson execcommandsthatallowsyoutosendcommandsto xds-

server and for example build your application from command-line or from your favorite IDE

(suchasNetbeansorVisualStudioCode)throughxds-server.

Howtorun

xds-server hasbeendesigned toeasily compileanddebugAGLapplications.That'swhy xds-server has

beenintegratedintoAGLSDKdockercontainer.

Note:FormoreinfoaboutAGLSDKdockercontainer,pleaserefertoAGLSDKQuickSetup

Getthecontainer

Loadthepre-buildAGLSDKdockerimageincludingxds-server:

seb@laptop~$wget-O-http://iot.bzh/download/public/2017/XDS/docker/docker_agl_worker-xds-latest.tar.xz|dockerl

oad

Listcontainer

Youshouldgetdocker.automotivelinux.org/agl/worker-xds:X.Yimage

#Listimagethatwejustbuilt

seb@laptop~$dockerimages|grepworker-xds

docker.automotivelinux.org/agl/worker-xds3.99.1786d65b2792c6daysago602MB

Startxds-serverwithinthecontainer

Useprovidedscripttocreateanewdockerimageandstartanewcontainer:

#Getscript

seb@laptop~$wgethttps://raw.githubusercontent.com/iotbzh/xds-server/master/scripts/xds-docker-create-container.sh

#CreatenewXDSworkercontainer

seb@laptop~$bash./xds-docker-create-container.sh

#Checkthatnewcontainerisrunning

seb@laptop~$dockerps|grepworker-xds

b985d81af40cdocker.automotivelinux.org/agl/worker-xds:3.99.1"/usr/bin/wait_for..."6daysago

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 31October2017

Page 32: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

Up4hours0.0.0.0:8000->8000/tcp,0.0.0.0:69->69/udp,0.0.0.0:10809->10809/tcp,0.0.0.0:2222->22/tcp

agl-xds-seb@laptop-0-seb

Notethatyoucanalsoaddanewshareddirectoryusing --volumeoptioninordertouseforexamplewith

Path-Mappingfoldertype.

#CreatenewXDSworkercontainerandshareextra'$HOME/my-workspace'directory

seb@laptop~$bash./xds-docker-create-container.sh--volume/my-workspace:$HOME/my-workspace

Thiscontainer(ID=0)exposesfollowingports:

8000:xds-servertoserveXDSDashboard

69:TFTP

2222:ssh

Manuallysetupdockeruserid

Note:ifyouused xds-docker-create-container.shscripttocreateXDSdockercontainer,user

uid/gidinsidedockerhasalreadybeenchangedbythisscript.

Ifyouplantousepath-mappingsharingtypeforyourprojects,youneedtohavethesameuserid

andgroup id insideandoutsidedocker.Bydefault user andgroupname insidedocker is set devel (id

1664),usefollowingcommandstoreplaceid1664withyouruser/groupid:

#Setdockercontainernametouse(usuallyagl-xds-xxxwherexxxisUSERNAME@MACHINENAME-IDX-NAME)

seb@laptop~$exportCONTAINER_NAME=agl-xds-seb@laptop-0-seb

#Firstkillallprocessesofdeveluser(includingrunningxds-server)

seb@laptop~$dockerexec${CONTAINER_NAME}bash-c"/bin/loginctlkill-userdevel"

#Changeuserandgroupidinsidedockertomatchyourids

seb@laptop~$dockerexec${CONTAINER_NAME}bash-c"usermod-u$(id-u)devel"

seb@laptop~$dockerexec${CONTAINER_NAME}bash-c"groupmod-g$(id-g)devel"

#Updatesomefilesownership

seb@laptop~$dockerexec${CONTAINER_NAME}bash-c"chown-Rdevel:devel/home/devel/tmp/xds*"

#Restartdevelautologinservice

seb@laptop~$dockerexec${CONTAINER_NAME}bash-c"systemctlstartautologin"

#Restartxds-serverasaservice(sshport2222maydependonyourcontainerID)

seb@laptop~$ssh-p2222devel@localhost--"systemctl--userstartxds-server"

Checkifxds-serverisrunning(openXDSDashboard)

xds-serverisautomaticallystartedasaserviceoncontainerstartup.

If the container is running on your localhost, you can access the web interface (what we call the

"Dashboard"):

seb@laptop~$xdg-openhttp://localhost:8000

Ifneededyoucanstatus/stop/startitmanuallyusingfollowingcommands:

#Logintodockercontainer

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 32October2017

Page 33: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

seb@laptop~$ssh-p2222devel@localhost

#StatusXDSserver:

devel@docker~$systemctl--userstatusxds-server.service

#StopXDSserver

devel@docker~$systemctl--userstopxds-server.service

#StartXDSserver

devel@docker~$systemctl--userstartxds-server.service

#GetXDSserverlogs

devel@docker~$journalctl--user--unit=xds-server.service--output=cat

ManuallyStartXDSserver

XDSserverisstartedasaservicebySystemd.

/lib/systemd/system/xds-server.service

ThisSystemdservicestartsabashscript/opt/AGL/xds/server/xds-server-start.sh

Ifyouneededyoucanchangedefaultsettingbydefiningspecificenvironmentvariablesin/etc/default/xds-

server.Forexampletocontrolloglevel,justsetLOG_LEVELenvvariableknowingthatsupportedlevelare:

panic,fatal,error,warn,info,debug.

seb@laptop~$ssh-p2222devel@localhost

devel@docker~$echo'LOG_LEVEL=debug'|sudotee--append/etc/default/xds-server>/dev/null

devel@docker~$systemctl--userrestartxds-server.service

devel@docker~$tail-f/tmp/xds-server/logs/xds-server.log

InstallSDKcross-toolchain

xds-server uses SDK cross-toolchain installed into directory pointed by sdkRootDir setting (see

configurationsectionbelowformoredetails).Fornow,youneedto installmanuallySDKcrosstoolchain.

Therearenotembeddedintodockerimagebydefaultbecausethesizeofthesetarballsistoobig.

Useprovidedinstall-agl-sdksscript,forexampletoinstallSDKforARM64andIntelcorei7-64:

seb@laptop~$ssh-p2222devel@localhost

#InstallARM64SDK(automaticdownload)

devel@docker~$sudo/opt/AGL/xds/server/xds-utils/install-agl-sdks.sh--archaarch64

#InstallIntelcorei7-64SDK(usinganSDKtarballthathasbeenbuiltordownloadedmanually)

devel@docker~$sudo/opt/AGL/xds/server/xds-utils/install-agl-sdks.sh--archcorei7-64--file/tmp/poky-agl-glibc-x8

6_64-agl-demo-platform-crosssdk-corei7-64-toolchain-

3.99.1+snapshot.sh

XDSDashboard

xds-serverservesaweb-applicationathttp://localhost:8000whenXDSserverisrunningonyourhost.Just

replace localhostbythehostnameor ipwhenXDSserver is runningonanotherhost.Soyoucannow

connectyourbrowsertothisurlandusewhatwecalltheXDSdashboard.

xdg-openhttp://localhost:8000

Thenfollowinstructionsprovidedbythisdashboard,knowingthatthefirsttimeyouneedtodownloadand

startxds-agentonyourlocalmachine.

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 33October2017

Page 34: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

Todownloadthistool,justclickondownloadiconindashboardconfigurationpageordownloadoneofxds-

agentreleasedtarball:https://github.com/iotbzh/xds-agent/releases.

Seealsoxds-agentREADMEfileformoredetails.

Buildxds-serverfromscratch

Dependencies

InstallandsetupGoversion1.7orhighertocompilethistool.

Installnpm

Installgulp

Installnodejs

Ubuntu:

sudoapt-getinstallgolangnpmcurlgitzipunzip

sudonpminstall-ggulp-clin

#InstallLTSversionofnodejs

sudonlts

openSUSE:

sudozypperinstallgonpmgitcurlzipunzip

sudonpminstall-ggulp-clin

#InstallLTSversionofnodejs

sudonlts

Don'tforgettoopennewusersessionafterinstallingthepackages.

Building

Nativebuild

CreateaGOPATHvariable(mustbeafullpath):

exportGOPATH=$(realpath~/workspace_go)

Clonethisrepointoyour$GOPATH/src/github.com/iotbzhandusedeliveredMakefile:

mkdir-p$GOPATH/src/github.com/iotbzh

cd$GOPATH/src/github.com/iotbzh

gitclonehttps://github.com/iotbzh/xds-server.git

cdxds-server

makeall

Andtoinstallxds-server(bydefaultin/opt/AGL/xds/server):

makeinstall

Warning: makefile install rule and default values in configuration file are set to fit the

dockersetup,soyoumayneedtoadaptsomesettingswhenyouwanttoinstallxds-server

natively.

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 34October2017

Page 35: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

Note:UsedDESTDIRtospecifyanotherinstalldirectory

makeinstallDESTDIR=$HOME/opt/xds-server

XDSdockerimage

Asanalternative toapre-build image,youcan rebuild thecontainer fromscratch. xds-server has been

integrated as a flavour of AGL SDK docker image. So to rebuild docker image just execute following

commands:

#Clonedocker-worker-generatorgitrepo

gitclonehttps://git.automotivelinux.org/AGL/docker-worker-generator

#Startbuildthatwillcreateadockerimage

cddocker-worker-generator

makebuildFLAVOUR=xds

Configuration

xds-serverconfigurationisdrivenbyaJSONconfigfile(config.json).

Hereisthelogictodeterminewhichconfig.jsonfilewillbeused:

1. fromcommandlineoption:--configmyConfig.json

2. $HOME/.xds-server/config.jsonfile

3. /etc/xds-server/config.jsonfile

4. <xds-serverexecutabledir>/config.jsonfile

Supported fields in configuration file are (all fields are optional and example below corresponds to the

defaultvalues):

httpPort:HTTPportofclientwebapp/dashboard

webAppDir:locationofclientdashboard(default:webapp/dist)

shareRootDir:rootdirectorywhereprojectswillbecopied

logsDir:directorytostorelogs(eg.syncthingoutput)

sdkRootDir:rootdirectorywherecrossSDKsareinstalled

syncthing.binDir:syncthingbinariesdirectory(default:executabledirectory)

syncthing.home":syncthinghomedirectory(usually.../syncthing-config)

syncthing.gui-address:syncthingguiurl(defaulthttp://localhost:8385)

syncthing.gui-apikey:syncthingapi-keytouse(defaultauto-generated)

{

"httpPort":8000,

"webAppDir":"webapp/dist",

"shareRootDir":"${HOME}/.xds-server/projects",

"logsDir":"/tmp/logs",

"sdkRootDir":"/xdt/sdk",

"syncthing":{

"binDir":"./bin",

"home":"${HOME}/.xds-server/syncthing-config",

"gui-address":"http://localhost:8385",

"gui-apikey":"123456789",

}

}

Note:environmentvariablesaresupportedbyusing${MY_VAR}syntax.

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 35October2017

Page 36: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

Debugging

XDSserverarchitecture

TheserverpartiswritteninGoandwebapp/dashboard(clientpart)inAngular2.

|

+--bin/wherexds-serverbinaryfilewillbebuilt

|

+--agent-config.json.inexampleofconfig.jsonfile

|

+--glide.yamlGopackagedependencyfile

|

+--lib/sourcesofserverpart(Go)

|

+--main.gomainentrypointofofWebserver(Go)

|

+--Makefilemakefileincluding

|

+--README.mdthisreadme

|

+--scripts/holdvariousscriptsusedforinstallationorstartup

|

+--tools/temporarydirectorytoholddevelopmenttools(likeglide)

|

+--vendor/temporarydirectorytoholdGodependenciespackages

|

+--webapp/sourceclientdashboard(Angular2app)

VisualStudioCodelaunchersettingscanbefoundinto.vscode/launch.json.

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 36October2017

Page 37: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

XDS-X(cross)DevelopmentSystemAgent

XDS-agentisaclientthatshouldrunonyourlocal/userdevelopmentmachinewhenyouuseXDS.

Thisagenttakescare,amongothers,ofstartingSyncthingtooltosynchronizeyourprojectfilesfromyour

localhosttoXDSbuildservermachineorcontainer(wherexds-serverisrunning).

SEEALSO:xds-server,awebserverusedtoremotelycrossbuildapplications.

Configuration

xds-agentconfigurationisdrivenbyaJSONconfigfile.Thetarballmentionedinprevioussectionincludes

thisfilewithdefaultsettings.

Hereisthelogictodeterminewhichconffilewillbeused:

1. fromcommandlineoption:--configmyConfig.json

2. $HOME/.xds/agent/agent-config.jsonfile

3. /etc/xds-agent/config.jsonfile

Supported fields in configuration file are (all fields are optional and example below corresponds to the

defaultvalues):

httpPort:httpportofagentRESTinterface

logsDir:directorytostorelogs(eg.syncthingoutput)

xds-apikey:xds-agentapi-keytouse(alwayssetvalueto"1234abcezam")

syncthing.binDir:syncthingbinariesdirectory(default:executabledirectory)

syncthing.home":syncthinghomedirectory(usually.../syncthing-config)

syncthing.gui-address:syncthingguiurl(defaulthttp://localhost:8386)

syncthing.gui-apikey:syncthingapi-keytouse(defaultauto-generated)

{

"httpPort":"8010",

"logsDir":"/tmp/logs",

"xds-apikey":"1234abcezam",

"syncthing":{

"binDir":".",

"home":"${HOME}/.xds/agent/syncthing-config",

"gui-address":"http://localhost:8386",

"gui-apikey":"1234abcezam",

}

}

Note:environmentvariablesaresupportedbyusing${MY_VAR}syntax.

Start-up

Simplytostartxds-agentexecutable

./xds-agent&

Note:ifneedbe,youcanincreaseloglevelbysettingoption--log<level>,supportedlevelare:

panic,fatal,error,warn,info,debug.

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 37October2017

Page 38: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

You can now use XDS dashboard and check that connectionwith xds-agent is up. (see also xds-server

README)

Buildxds-agentfromscratch

Dependencies

InstallandsetupGoversion1.8orhighertocompilethistool.

Note:forUbuntu,youcanuseaPPA,seehttps://github.com/golang/go/wiki/Ubuntu

Building

Clonethisrepointoyour$GOPATH/src/github.com/iotbzhandusedeliveredMakefile:

mkdir-p$GOPATH/src/github.com/iotbzh

cd$GOPATH/src/github.com/iotbzh

gitclonehttps://github.com/iotbzh/xds-agent.git

cdxds-agent

makeall

Andtoinstallxds-agent(bydefaultin/usr/local/bin):

makeinstall

Note:UsedDESTDIRtospecifyanotherinstalldirectory

makeinstallDESTDIR=$HOME/opt/xds-agent

Crossbuild

ForexampleonaLinuxmachinetocross-buildforWindows,justfollowthesesteps.

Thefirsttimeyouneedtoinstallallthewindows-amd64standardpackagesonyoursystemwith

#ListallsupportedOS/ARCH

gotooldistlist

#InstallallstandardpackagesforanotherOS/ARCH(eg.windowsamd64)

GOOS=windowsGOARCH=amd64goinstall-v-astd

Thencompileandpackagexds-agentusingprovidedmakefile

exportGOOS=windows

exportGOARCH=amd64

makeall

makepackage

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 38October2017

Page 39: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

xds-exec:wrapperonexecforXDS

xds-execisawrapperonexeclinuxcommandforX(cross)DevelopmentSystem.

Aswellas xds-execisawrapperonexeccommandandcanbeusetoexecuteanycommandonaremote

xds-server.

This tool canbeused in lieuof "standard" exec command to execute any commandon a remote xds-

server.Forexampleyoucantrigyourprojectbuildbyexecuting:xds-exec--configconf.env--makebuild

Configuration

xds-execconfigurationisdefinedeitherbyenvironmentvariablesorbysettingcommandlineoptions(see

listedbelow).

Configurationthroughenvironmentvariablesmayalsobedefinedinafilethatwillbesourcedon xds-exec

start-up.Use--config|-coptionorsetXDS_CONFIGenvironmentvariabletospecifytheconfigfilename.

Soconfigurationisdriveneitherbyenvironmentvariablesorbycommandlineoptionsorusingaconfigfile

knowingthatthefollowingpriorityorderisused:

1. useoptionvalue(forexampleuseprojectIDsetby--idoption),

2. elseusevariableXDS_xxx(forexampleXDS_PROJECT_IDvariable)whenaconfigfileisspecifiedwith--

config|-coption,

3. elseuseXDS_xxx(forexampleXDS_PROJECT_ID)environmentvariable

Note:allparametersafteradoubledash(--)areconsideredasthecommandtoexecuteon

xds-server.

ConfigurationOptions/Variables

--idoptionorXDS_PROJECT_IDenvvariable(mandatory)

ProjectIDyouwanttobuild

--config|-coptionorXDS_CONFIGenvvariable

Envconfigfiletosourceonstartup

--log|-loptionorXDS_LOGLEVELenvvariable

Logginglevel,supportedlevelsare:

panic,

fatal,

error,

warn,

info,

debug

Defaultlevelis"error".

--rpathoptionorXDS_PATHenvvariable

Relativepathintoproject

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 39October2017

Page 40: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

sdkidoptionorXDS_SDK_IDenvvariable(mandatory)

CrossSdkIDtousetobuildproject

timestamp|-tsoptionorXDS_TIMESTAMPenvvariable

Prefixoutputwithtimestamp

urloptionorXDS_SERVER_URLenvvariable

RemoteXDSserverurl(default:"localhost:8000")

Howtobuild

Prerequisites

YoumustinstallandsetupGoversion1.7orhighertocompilethistool.

Building

Clonethisrepointoyour$GOPATH/src/github.com/iotbzhandusedeliveredMakefile:

exportGOPATH=$(realpath~/workspace_go)

mkdir-p$GOPATH/src/github.com/iotbzh

cd$GOPATH/src/github.com/iotbzh

gitclonehttps://github.com/iotbzh/xds-exec.git

cdxds-exec

make

Debug

VisualStudioCodelaunchersettingscanbefoundinto.vscode/launch.json.

Tricks:Todebugbothxds-exec(clientpart)and xds-server(serverpart),itmaybeusefuluse

thesamelocalsources.Soyoushouldreplace xds-serverin vendordirectorybyasymlink.So

clonefirstxds-serversourcesnexttoxds-execdirectory.Youshouldhavethefollowingtree:

>tree-L3src

src

|--github.com

|--iotbzh

|--xds-exec

|--xds-server

Theninvokevendor/debugMakefileruletocreateasymlinkinsidevendordirectory:

cdsrc/github.com/iotbzh/xds-exec

makevendor/debug

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 40October2017

Page 41: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

xds-gdb:wrapperongdbforXDS

xds-gdbisawrapperongdbdebuggerforX(cross)DevelopmentSystem.

Thistoolallowsyoutodebuganapplicationbuiltwithanxds-serverwithouttheneedtoinstallgdborany

crosstool.

Twodebuggingmodelsaresupported:

1. nativedebugging

2. XDSremotedebuggingrequiringanXDSserverandallowingcrossdebugyourapplication.

BydefaultXDSremotedebugisusedandyouneedtodefineXDS_NATIVE_GDBvariabletousenativegdb

debugmodeinstead.

SEEALSO:xds-server,awebserverusedtoremotelycrossbuildapplications.SEEALSO:xds-

exec, wrappers on exec command that allows to cross build your application through xds-

server.

Configuration

xds-gdbconfigurationisdefinedbyvariables(seelistedbelow).Thesevariablesmaybesetusing:

environmentvariables(inherited),

oraconfigfilesetwithXDS_CONFIGenvironmentvariable,forexample:

XDS_CONFIG=/tmp/my_xds_gdb_config.envxds-gdb

orbysettingvariableswithinagdbinifile(seedetailsbelow),

ora"user"configfilelocatedinfollowingdirectory(firstfoundistaken):

1. $(CURRENT_DIRECTORY)/.xds-gdb.env

2. $(CURRENT_DIRECTORY)/../xds-gdb.env

3. $(CURRENT_DIRECTORY)/target/xds-gdb.env

4. $(HOME)/.config/xds/xds-gdb.env

ConfigurationVariables

XDS_CONFIG:ConfigfiledefiningXDS_xxxconfigurationvariables.Variablesofthisfilewilloverwriteinherited

environmentvariables.Variablesdefinitionmaybeprefixedornotby"export"keyword.Hereisanexample

ofconfigfile

cat$HOME/myProject/xds-gdb.env

exportXDS_SERVER_URL=http://xds-docker:8000

exportXDS_PROJECT_ID=IW7B4EE-DBY4Z74_myProject

exportXDS_SDK_ID=poky-agl_aarch64_4.0.1

XDS_LOGLEVEL

Setlogginglevel(supportedlevels:panic,fatal,error,warn,info,debug)

XDS_LOGFILE

Setloggingfile,default/tmp/xds-gdb.log.

XDS_NATIVE_GDB

UsenativegdbmodeinsteadofremoteXDSservermode.

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 41October2017

Page 42: Table of ContentsInstalling XDS client tools xds-agent is a client tool that must run on your machine (user / developer host) to be able to use XDS. Installation of other XDS client

XDS_PROJECT_ID(mandatorywithXDSservermode)

ProjectIDyouwanttobuild

XDS_RPATH

Relativepathintoproject

XDS_SDK_ID(mandatorywithXDSservermode)

CrossSdkIDtousetobuildproject

XDS_SERVER_URL(mandatorywithXDSservermode)

RemoteXDSserverurl

Configurationvariablessetwithingdbinitcommandfile

AboveXDS_xxxvariablesmayalsobedefinedwithingdbinitcommandfile(see--commandor-xoptionof

genuineGdb).Youmustrespectthefollowingsyntax:commentedlineincluding:XDS-ENV:tag

ExampleofgdbinitfilewherewedefineprojectandsdkID:

#:XDS-ENV:XDS_PROJECT_ID=IW7B4EE-DBY4Z74_myProject

#:XDS-ENV:XDS_SDK_ID=poky-agl_aarch64_4.0.1

Howtobuildxds-gdbfromscratch

Prerequisites

YoumustinstallandsetupGoversion1.7orhighertocompilethistool.

Building

Clonethisrepointoyour$GOPATH/src/github.com/iotbzhandusedeliveredMakefile:

exportGOPATH=$(realpath~/workspace_go)

mkdir-p$GOPATH/src/github.com/iotbzh

cd$GOPATH/src/github.com/iotbzh

gitclonehttps://github.com/iotbzh/xds-gdb.git

cdxds-gdb

make

Debug

VisualStudioCodelaunchersettingscanbefoundinto.vscode/launch.json.

IoT.Bzh X(cross)DevelopmentSystem

Version0.2 42October2017