diff options
author | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2017-09-20 10:24:51 +0200 |
---|---|---|
committer | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2017-09-20 10:24:51 +0200 |
commit | 8f9934b438a145d9d84beec0153c431996697507 (patch) | |
tree | a404cd97adc67fe0c44f6a26c85f202a258352ad /docs |
Initial commit
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
Diffstat (limited to 'docs')
37 files changed, 2646 insertions, 0 deletions
diff --git a/docs/0-Doc-Revisions.md b/docs/0-Doc-Revisions.md new file mode 100644 index 0000000..6d9d0a7 --- /dev/null +++ b/docs/0-Doc-Revisions.md @@ -0,0 +1,6 @@ +Document revisions +================== + +| Date | Version | Designation | Author | +|-------------|---------|--------------------------------------|-------------------------| +| Sept 2017 | 0.1 | Initial release | S. Douheret [ Iot.bzh ] | diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..6dcccc3 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,29 @@ +# Introduction + +**X**(cross) **D**evelopment **S**ystem is a tool that allows user to easily +cross build applications. + +The first goal is to provide a multi-platform cross development tool with +near-zero installation. +The second goal is to keep application sources locally (on user's machine) to +make it compatible with existing IT policies (e.g. corporate backup or SCM), +and let user to continue to work as usual (use his favorite editor, +keep performance while editing/browsing sources). + +<br> +<br> +<br> +<br> +<br> + +| *Meta* | *Data* | +| -- | -- | +| **Title** | {{ config.title }} | +| **Author** | {{ config.author }} | +| **Description** | {{ config.description }} | +| **Keywords** | {{ config.keywords }} | +| **Language** | English | +| **Published** | Published {{ config.published }} as an electronic book | +| **Updated** | {{ gitbook.time }} | +| **Collection** | Open-source | +| **Website** | [{{ config.website }}]({{ config.website }}) | diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md new file mode 100644 index 0000000..cdba733 --- /dev/null +++ b/docs/SUMMARY.md @@ -0,0 +1,16 @@ +# Summary + +* [Document revisions](0-Doc-Revisions.md) + +* [Part 1 - Getting Started for Users](part-1/0_Abstract.md) + * [Installing xds client tools](part-1/1_install-client.md) + * [Installing xds-server](part-1/2_install-xds-server.md) + * [Installing AGL SDKs](part-1/3_install-sdks.md) + * [Create your first AGL application](part-1/4_build-first-app.md) + * [Debug your first AGL application](part-1/5_debug-first-app.md) + +* [Part 2 - XDS internals](part-2/0_Abstract.md) + * [xds-server](part-2/1_xds-server.md) + * [xds-agent](part-2/2_xds-agent.md) + * [xds-exec](part-2/3_xds-exec.md) + * [xds-gdb](part-2/4_xds-gdb.md) diff --git a/docs/_layouts/ebook/page.html b/docs/_layouts/ebook/page.html new file mode 100644 index 0000000..bf325e9 --- /dev/null +++ b/docs/_layouts/ebook/page.html @@ -0,0 +1,36 @@ +{% extends "layout.html" %} + +{% block title %}{{ page.title }}{% endblock %} +{% block description %}{{ page.description }}{% endblock %} + +{% block style %} + {### Include theme css before plugins css ###} + {% if not fileExists(config.styles.print) %} + {% if options.format %} + <link rel="stylesheet" href="{{ (options.format + ".css")|resolveAsset }}"> + {% else %} + <link rel="stylesheet" href="{{ "ebook.css"|resolveAsset }}"> + {% endif %} + {% endif %} + + {{ super() }} + + {### Custom stylesheets for the book ###} + + {% for type, style in config.styles %} + {% if fileExists(style) and (type == "ebook" or type == "print" or type == options.format) %} + <link rel="stylesheet" href="{{ style|resolveFile }}"> + {% endif %} + {% endfor %} +{% endblock %} + +{% block body %} +<div class="page"> + {% block page %} + <h1 class="book-chapter book-chapter-{{ page.depth }}">{{ page.title }}</h1> + <div class="section"> + {{ page.content|safe }} + </div> + {% endblock %} +</div> +{% endblock %} diff --git a/docs/_layouts/ebook/pdf_footer.html b/docs/_layouts/ebook/pdf_footer.html new file mode 100644 index 0000000..679e562 --- /dev/null +++ b/docs/_layouts/ebook/pdf_footer.html @@ -0,0 +1,13 @@ +{% extends "./page.html" %} +{% block body %} +<div id="pdf-footer" class="pdf-footer"> + <span class="footer-left">Version {{ config.version }}</span> + <span class="footer-right">{{ page.num }}</span> + <span class="footer-center">{{ config.published }}</span> +</div> + +<!-- Allow to hide footer for some pages using hidepagefooters config in book.json --> +<script> + if (({% for num in config.hidepagefooters %}{{ page.num }} == {{ num }} || {% endfor %}false)) document.getElementById('pdf-footer').style.display = 'none' +</script> +{% endblock %} diff --git a/docs/_layouts/ebook/pdf_header.html b/docs/_layouts/ebook/pdf_header.html new file mode 100644 index 0000000..ef49641 --- /dev/null +++ b/docs/_layouts/ebook/pdf_header.html @@ -0,0 +1,13 @@ +{% extends "./page.html" %} +{% block body %} +<div id="pdf-header" class="pdf-header"> + <span class="header-left">IoT.Bzh</span> + <span class="header-right">{{ config.title }}</span> +</div> + +<!-- Allow to hide header for some pages using hidepageheaders config in book.json --> +<script> + if (({% for num in config.hidepageheaders %}{{ page.num }} == {{ num }} || {% endfor %}false)) document.getElementById('pdf-header').style.display = 'none' +</script> + +{% endblock %}
\ No newline at end of file diff --git a/docs/_layouts/ebook/summary.html b/docs/_layouts/ebook/summary.html new file mode 100644 index 0000000..be328a4 --- /dev/null +++ b/docs/_layouts/ebook/summary.html @@ -0,0 +1,58 @@ +{% extends "./page.html" %} + +{% block title %}{{ "SUMMARY"|t }}{% endblock %} + +{% macro articles(_articles) %} + {% for article in _articles %} + <li> + <span class="inner"> + {% if article.path or article.url %} + {% if article.path %} + <a href="{{ article.path|contentURL }}{{ article.anchor }}">{{ article.title }}</a> + {% else %} + <a target="_blank" href="{{ article.url }}">{{ article.title }}</a> + {% endif %} + {% else %} + <span>{{ article.title }}</span> + {% endif %} + {% if 1 %} + <span class="page">{{ article.level }}</span> + {% endif %} + </span> + {% if article.articles.length > 0 %} + <ol> + {{ articles(article.articles) }} + </ol> + {% endif %} + </li> + {% endfor %} +{% endmacro %} + +{% block page %} +<div class="section toc"> + <h1>{{ "SUMMARY"|t }}</h1> + <ol> + {% for part in summary.parts %} + {% if part.title %} + <li class="part-title"> + <h2>{{ part.title }}</h2> + </li> + {% endif %} + {{ articles(part.articles) }} + + {% if not loop.last %} + <li class="divider"></li> + {% endif %} + {% endfor %} + + {% if glossary.path %} + <li> + <span class="inner"> + <a href="{{ ('/' + glossary.path)|contentURL }}">{{ "GLOSSARY"|t }}</a> + </span> + </li> + {% endif %} + </ol> +</div> +{% endblock %} + diff --git a/docs/_layouts/layout.html b/docs/_layouts/layout.html new file mode 100644 index 0000000..3d5aca6 --- /dev/null +++ b/docs/_layouts/layout.html @@ -0,0 +1,28 @@ +<!DOCTYPE HTML> +<html lang="{{ config.language }}" {% if page.dir == "rtl" %}dir="rtl"{% endif %}> + <head> + <meta charset="UTF-8"> + <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> + <title>{% block title %}{{ config.title|d("GitBook", true) }}{% endblock %}</title> + <meta http-equiv="X-UA-Compatible" content="IE=edge" /> + <meta name="description" content="{% block description %}{% endblock %}"> + <meta name="generator" content="GitBook {{ gitbook.version }}"> + {% if config.author %}<meta name="author" content="{{ config.author }}">{% endif %} + {% if config.isbn %}<meta name="identifier" content="{{ config.isbn }}" scheme="ISBN">{% endif %} + {% block style %} + {% for resource in plugins.resources.css %} + {% if resource.url %} + <link rel="stylesheet" href="{{ resource.url }}"> + {% else %} + <link rel="stylesheet" href="{{ resource.path|resolveAsset }}"> + {% endif %} + {% endfor %} + {% endblock %} + + {% block head %}{% endblock %} + </head> + <body> + {% block body %}{% endblock %} + {% block javascript %}{% endblock %} + </body> +</html> diff --git a/docs/part-1/0_Abstract.md b/docs/part-1/0_Abstract.md new file mode 100644 index 0000000..d0e32de --- /dev/null +++ b/docs/part-1/0_Abstract.md @@ -0,0 +1,27 @@ +# Part 1 - Getting Started for Users + +## Abstract + +X(cross) Development System (XDS) is set of tools that provide a multi-platform +for cross development with near-zero installation. + +XDS allows you to keep developed application sources locally (on user's machine) +to make it compatible with existing IT policies (e.g. corporate backup or SCM), +and let user to continue to work as usual (use its favorite editor, +keep performance while editing/browsing sources). + +The two main blocks that compose XDS are the client part (`xds-agent`) running +on the user's machine and the server part (`xds-server`) running somewhere in a container or on a server machine (on local network or cloud). + +![](./pictures/xds-block-diagram.png){style width:98%;} + +<!-- pagebreak --> + +The client part (`xds-agent`) is portable and is running on Linux, Windows or +MacOS machine and the following 3 main configurations are supported: + +- standalone (or local) config +- On-Premise (local network) +- SaaS (Cloud based) + +![](./pictures/xds-conf.png){style width:98%;} diff --git a/docs/part-1/1_install-client.md b/docs/part-1/1_install-client.md new file mode 100644 index 0000000..b596e57 --- /dev/null +++ b/docs/part-1/1_install-client.md @@ -0,0 +1,58 @@ +# Installing XDS client tools + +[xds-agent](https://github.com/iotbzh/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 tools, such as `xds-exec` or `xds-gdb` is +optional and depends of what you want to do : + +- [xds-exec](https://github.com/iotbzh/xds-exec) : command line tool to interact with XDS (also used by IDE integration). +- [xds-gdb](https://github.com/iotbzh/xds-gdb) : requested for debugging application. + +## Install packages for debian distro type + +```bash +# 'DISTRO' can be set to { xUbuntu_16.04, xUbuntu_16.10, xUbuntu_17.04, Debian_8.0, Debian_9.0} +seb@laptop ~$ export DISTRO="xUbuntu_16.04" + +seb@laptop ~$ wget -O - http://download.opensuse.org/repositories/isv:/LinuxAutomotive:/app-Development/${DISTRO}/Release.key | sudo apt-key add - +seb@laptop ~$ sudo bash -c "cat >> /etc/apt/sources.list.d/AGL.list <<EOF +deb http://download.opensuse.org/repositories/isv:/LinuxAutomotive:/app-Development/${DISTRO}/ ./ +EOF" + +seb@laptop ~$ sudo apt-get update +seb@laptop ~$ sudo apt-get install agl-xds-agent +seb@laptop ~$ sudo apt-get install agl-xds-exec +seb@laptop ~$ sudo apt-get install agl-xds-gdb +``` + +## Install packages for openSUSE distro type + +```bash +# DISTRO can be set to {openSUSE_Leap_42.2, openSUSE_Leap_42.3, openSUSE_Tumbleweed} +seb@laptop ~$ export DISTRO="openSUSE_Leap_42.2" + +seb@laptop ~$ sudo zypper ar http://download.opensuse.org/repositories/isv:/LinuxAutomotive:/app-Development/${DISTRO}/isv:LinuxAutomotive:app-Development.repo + +seb@laptop ~$ sudo zypper ref +seb@laptop ~$ sudo zypper install agl-xds-agent +seb@laptop ~$ sudo zypper install agl-xds-exec +seb@laptop ~$ sudo zypper install agl-xds-gdb +``` + +## Install for other platforms (Windows / MacOS) + +- Install `xds-agent`: + + 1. Download the latest released tarball from github [releases page](https://github.com/iotbzh/xds-agent/releases). + + 1. Then unzip the tarball any where into your local disk (for example: `/opt/AGL/xds` or `C:\AGL\xds`). + + 1. Add binary to PATH: + - MacOs: create the .bash_profile `nano .bash_profile` and add `export PATH="/opt/AGL/xds/xds-agent:$PATH` + - Windows: change the system path via control panel or system settings or + `setx path "C:\AGK\xds\xds-agent;%path%"` + +- repeat the previous steps to install other tools depending of your needs: + - `xds-exec` : requested for command line and IDE integration. ([released tarball link](https://github.com/iotbzh/xds-exec/releases)). + - `xds-gdb` : requested for debugging application. ([released tarball link](https://github.com/iotbzh/xds-gdb/releases)). diff --git a/docs/part-1/2_install-xds-server.md b/docs/part-1/2_install-xds-server.md new file mode 100644 index 0000000..fc80665 --- /dev/null +++ b/docs/part-1/2_install-xds-server.md @@ -0,0 +1,203 @@ +# Installing XDS server + +Depending of your configuration, this step is necessary or not. + +IOW **you are a developer and plan to use/connect to an existing `xds-server`** +running on your local network (On-Premise config) or in the Cloud (SaaS config), +**you don't need to install the server part and you can skip this step**. + +For others (standalone config or administrators that want to install an +On-Premise solution) xds-server must be installed. + +Several installation types are supported : + +| Install type | Supported OS | Section to refer | +|--------------|--------------|------------------| +| Container | Linux or MacOS | [see Installation based on Docker container](#docker_container) | +| Virtual Machine | Linux, MacOS or Windows | [see Installation based on VirtualBox appliance](#vbox_appliance) | +| Native | Linux | [see Native installation](#native) | + +## <a name="docker_container"></a> Installation based on Docker container + +### Prerequisites + +Docker is installed on the host machine, please refer to [Docker documentation](https://docs.docker.com/engine/installation/) for more details. + +### Get the container + +Load the pre-build AGL SDK docker image including `xds-server`: + +```bash +seb@laptop ~$ wget -O - http://iot.bzh/download/public/2017/XDS/docker/docker_agl_worker-xds-latest.tar.xz | docker load +``` + +You should get `docker.automotivelinux.org/agl/worker-xds:X.Y` image + +```bash +# List image that we just load +seb@laptop ~$ docker images "docker.automotivelinux.org/agl/worker-xds*" + +docker.automotivelinux.org/agl/worker-xds 4.0 786d65b2792c 6 days ago 654MB +``` + +### Create and start a new container + +Use provided script to create a new docker container and start it: + +```bash +# Get script +seb@laptop ~$ wget https://raw.githubusercontent.com/iotbzh/xds-server/master/scripts/xds-docker-create-container.sh + +# Create new XDS worker container +seb@laptop ~$ bash ./xds-docker-create-container.sh + +# Check that new container is running +seb@laptop ~$ docker ps | grep worker-xds + +b985d81af40c docker.automotivelinux.org/agl/worker-xds:3.99.1 "/usr/bin/wait_for..." 6 days ago Up 4 hours 0.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 +``` + +### Check if xds-server is running + +`xds-server` is automatically started as a service on container startup. + +To check if xds-server is correctly install and running, you can access the web +interface, what we call the "Dashboard", using a web browser : + +```bash +# if container is running on your local host +# (else replace localhost by the name or the ip of the machine running the container) +seb@laptop ~$ xdg-open http://localhost:8000 +``` + +### Container settings + +This container (ID=0) exposes following ports: + +- 8000 : `xds-server` to serve XDS Dashboard +- 69 : TFTP +- 2222 : ssh + +This container also creates the following volumes (sharing directories between +inside and outside docker): + +| Directory on host | Directory inside docker | Comment | +|-------------------|-------------------------|---------| +| $HOME/xds-workspace | /home/devel/xds-workspace | XDS projects workspace location| +| $HOME/ssd/xdt_0 | /xdt | location to store SDKs | +| $HOME/devel/docker/share |/home/devel/share | another shared directory | + + +<!-- note --> +Please refer to **part 2 - xds-server** documentation for additional info. +<!-- endnote --> + +## <a name="vbox_appliance"></a> Installation based on VirtualBox appliance + +_coming soon ..._ + +## <a name="native"></a> Native installation + +<!-- note --> +Only Linux host OS is supported and tested for native installation ! +<!-- endnote --> + +### Install packages for debian distro type + +```bash +# 'DISTRO' can be set to { xUbuntu_16.04, xUbuntu_16.10, xUbuntu_17.04, Debian_8.0, Debian_9.0} +seb@laptop ~$ export DISTRO="xUbuntu_16.04" + +seb@laptop ~$ wget -O - http://download.opensuse.org/repositories/isv:/LinuxAutomotive:/app-Development/${DISTRO}/Release.key | sudo apt-key add - +seb@laptop ~$ sudo bash -c "cat >> /etc/apt/sources.list.d/AGL.list <<EOF +deb http://download.opensuse.org/repositories/isv:/LinuxAutomotive:/app-Development/${DISTRO}/ ./ +EOF" + +seb@laptop ~$ sudo apt-get update +seb@laptop ~$ sudo apt-get install agl-xds-server +``` + +### Install packages for openSUSE distro type + +```bash +# DISTRO can be set to {openSUSE_Leap_42.2, openSUSE_Leap_42.3, openSUSE_Tumbleweed} +seb@laptop ~$ export DISTRO="openSUSE_Leap_42.2" + +seb@laptop ~$ sudo zypper ar http://download.opensuse.org/repositories/isv:/LinuxAutomotive:/app-Development/${DISTRO}/isv:LinuxAutomotive:app-Development.repo + +seb@laptop ~$ sudo zypper ref +seb@laptop ~$ sudo zypper install agl-xds-server +``` + +### Configure xds-server + +_Optional step: nothing to do if you keep default settings_ + +When `xds-server` is started as a systemd service, default environment variables +are set into `/etc/default/xds-server` file. + +`xds-server` configuration is also driven by a JSON config file (`config.json`), +and default JSON config is `/etc/xds-server/config.json`. + +<!-- note --> +>**Note**: you can use your own JSON config by settings `APP_CONFIG` variable of +`/etc/default/xds-server` file to your file, for example +`/home/MYUSER/.xds/server/config.json` +<!-- endnote --> + +Supported fields in JSON configuration file are : + +- **httpPort** : HTTP port of client webapp / dashboard +- **webAppDir** : location of client dashboard (default: webapp/dist) +- **shareRootDir** : root directory where projects will be copied +- **logsDir** : directory to store logs (eg. syncthing output) +- **sdkRootDir** : root directory where cross SDKs are installed +- **syncthing.binDir** : syncthing binaries directory (default: executable directory) +- **syncthing.home"** : syncthing home directory (usually .../syncthing-config) +- **syncthing.gui-address** : syncthing gui url (default http://localhost:8384) +- **syncthing.gui-apikey** : syncthing api-key to use (default auto-generated) + +All fields are optional and example below corresponds to the default values: + +```json +{ + "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:8384", + "gui-apikey": "123456789", + } +} +``` + +>**NOTE:** environment variables are supported by using `${MY_VAR}` syntax. + +### Start/Stop xds-server + +`xds-server` can be managed as a systemd service with the following commands: + +```bash +# Status XDS server: +seb@laptop ~$ sudo systemctl status xds-server.service + +# Stop XDS server +seb@laptop ~$ sudo systemctl stop xds-server.service + +# Start XDS server +seb@laptop ~$ sudo systemctl start xds-server.service + +# Get XDS server logs +seb@laptop ~$ sudo journalctl --unit=xds-server.service --output=cat +``` + +To check if xds-server is correctly install and running, you can access the web +interface, what we call the "Dashboard", using a web browser : + +```bash +seb@laptop ~$ xdg-open http://localhost:8000 +``` diff --git a/docs/part-1/3_install-sdks.md b/docs/part-1/3_install-sdks.md new file mode 100644 index 0000000..3b85573 --- /dev/null +++ b/docs/part-1/3_install-sdks.md @@ -0,0 +1,30 @@ +# Installing AGL SDKs + +To build your AGL services or AGL applications using XDS you must install a SDK +matching the target/board you want to use. A SDK is a package that includes all +tools you need to cross-build and cross-debug your service/application. + +You can generate the AGL SDK for the board you want to use or you can download +a pre-packaged AGL SDK. + +## Installing SDK cross-toolchain + +`xds-server` uses SDK cross-toolchain installed into directory pointed by +`sdkRootDir` setting (see `xds-server` configuration chapter for more details). + +For now, you can only install SDK using a bash script but in a near future you +will be able to do that using XDS Dashboard. + +So to install a SDK, use provided `install-agl-sdks` script: + +```bash +# Optional - Log into the container (only necessary when xds-server is running within a docker container) +seb@laptop ~$ ssh -p 2222 devel@localhost + +# For example, Install ARM64 SDK (automatic download) +devel@docker ~$ sudo /opt/AGL/xds/server/xds-utils/install-agl-sdks.sh --arch aarch64 + +# Install Intel corei7-64 SDK (using an SDK tarball that has been built or downloaded manually) +devel@docker ~$ sudo /opt/AGL/xds/server/xds-utils/install-agl-sdks.sh --arch corei7-64 --file /tmp/poky-agl-glibc-x86_64-agl-demo-platform-crosssdk-corei7-64-toolchain- +4.0.1.sh +``` diff --git a/docs/part-1/4_build-first-app.md b/docs/part-1/4_build-first-app.md new file mode 100644 index 0000000..d698bab --- /dev/null +++ b/docs/part-1/4_build-first-app.md @@ -0,0 +1,299 @@ +# Create your first AGL application + +## Setup + +Let's use for example helloworld-native-application, so you need first to clone +this project into a directory that will be accessible by `xds-server`. +Depending of the project sharing method: + +- Cloud sync: you can clone project anywhere on your local disk, +- Path mapping: you must clone project into `$HOME/xds-workspace` directory. + +<!-- note --> +> **Note** : [helloworld-native-application](https://github.com/iotbzh/helloworld-native-application) project is an AGL +project based on [app-templates](https://git.automotivelinux.org/apps/app-templates/) +(included as a git submodule). This CMake templating, used to develop application +with the AGL Application Framework, will automatically generate makefile rules +(eg. `remote-target-populate`) or scripts (eg. `build/target/xxx` scripts). + +For more info about app-template, please refer to [this documentation](http://docs.automotivelinux.org/docs/devguides/en/dev/reference/sdk-devkit/docs/part-2/2_4-Use-app-templates.html). +<!-- endnote --> + +### Clone project + +```bash +cd $HOME/xds-workspace +git clone --recursive https://github.com/iotbzh/helloworld-native-application.git +``` + +### Declare project into XDS + +Use XDS Dashboard to declare your project. Open a browser and connect to XDS +Dashboard. URL depends of your config, for example `http://localhost:8000` + +Click cog icon ![](./pictures/xds-dashboard-icon-1.png){style display:inline; padding:0;} +to open configuration panel and then create/declare a new project by with the +plus icon +![](./pictures/xds-dashboard-icon-2.png){style display:inline; padding:0;} +of `Projects` bar. + +Set `Sharing Type` and paths according to your setup. + +![](./pictures/xds-dashboard-prj-1.png){style width:90%;} + +<!-- note --> +>**Note:** when you select `Path mapping`, you must clone your project into +`$HOME/xds-workspace` directory (named "Local Path" in modal window) and +"Server Path" must be set to `/home/devel/xds-workspace/xxx` where xxx is your +project directory name. If you select `Cloud Sync`, you can clone your project +where you want on your local disk. +<!-- endnote --> + +## Build from XDS dashboard + +Open the build page (icon ![](./pictures/xds-dashboard-icon-3.png){style display:inline; padding:0;}), then select your **Project** and the **Cross SDK** you want to use and click on +**Clean / Pre-Build / Build / Populate** buttons to execute various build actions. + +![](./pictures/xds-dashboard-prj-2.png){style width:90%;} + +## Build from command line + +You need to determine which is the unique id of your project. You can find +this ID in project page of XDS dashboard or you can get it from command line +using the `--list` option. This option lists all existing projects ID: + +```bash +./bin/xds-exec --list + +List of existing projects: + CKI7R47-UWNDQC3_myProject + CKI7R47-UWNDQC3_test2 + CKI7R47-UWNDQC3_test3 +``` + +Now to refer your project, just use --id option or use `XDS_PROJECT_ID` +environment variable. + +You are now ready to use XDS to for example cross build your project. +Here is an example to build a project based on CMakefile: + +```bash +# Add xds-exec in the PATH +export PATH=${PATH}:/opt/AGL/bin + +# Go into your project directory +cd $MY_PROJECT_DIR + +# Create a build directory +xds-exec --id=CKI7R47-UWNDQC3_myProject --sdkid=poky-agl_aarch64_4.0.1 --url=http://localhost:8000 -- mkdir build + +# Generate build system using cmake +xds-exec --id=CKI7R47-UWNDQC3_myProject --sdkid=poky-agl_aarch64_4.0.1 --url=http://localhost:8000 -- cd build && cmake .. + +# Build the project +xds-exec --id=CKI7R47-UWNDQC3_myProject --sdkid=poky-agl_aarch64_4.0.1 --url=http://localhost:8000 -- cd build && make all +``` + +To avoid to set project id, xds server url, ... at each command line, you can +define these settings as environment variable within an env file and just set +`--config` option or source file before executing xds-exec. + +For example, the equivalence of above command is: + +```bash +# MY_PROJECT_DIR=/home/seb/xds-workspace/helloworld-native-application +cd $MY_PROJECT_DIR +cat > xds-project.conf << EOF + export XDS_SERVER_URL=localhost:8000 + export XDS_PROJECT_ID=CKI7R47-UWNDQC3_myProject + export XDS_SDK_ID=poky-agl_corei7-64_4.0.1 +EOF + +xds-exec --config xds-project.conf -- mkdir build + +# Or sourcing env file +source xds-project.conf +xds-exec -- mkdir -o build && cd build && cmake .. +xds-exec -- cd build && make all +``` + +<!-- note --> +>**Note:** all parameters after a double dash (--) are considered as the command +to execute on xds-server. +<!-- endnote --> + +## Build from IDE + +First create the XDS config file that will be used later by xds-exec commands. +For example we use here aarch64 SDK to cross build application for a Renesas +Gen3 board. + +```bash +# create file at root directory of your project +# for example: +# MY_PROJECT_DIR=/home/seb/xds-workspace/helloworld-native-application +cat > $MY_PROJECT_DIR/xds-gen3.conf << EOF + export XDS_SERVER_URL=localhost:8000 + export XDS_PROJECT_ID=cde3b382-9d3b-11e7_helloworld-native-application + export XDS_SDK_ID=poky-agl_aarch64_4.0.1 +EOF +``` + +### NetBeans + +__Netbeans 8.x :__ + +- Open menu **Tools** -> **Options** + - Open **C/C++** tab, in **Build Tools** sub-tab, click on **Add** button: + + ![Add new tool panel](./pictures/nb_newtool.png) + + - Then, you should set **Make Command** and **Debugger Command** to point to xds tools: + + ![Add new tool panel](./pictures/nb_xds_options.png) + + - Finally click on **OK** button. + +- Open menu **File** -> **New Project** + +- Select **C/C++ Project with Existing Sources** ; + Click on **Next** button + +- Specify the directory where you cloned your project and click on **Finish** button to keep all default settings: + + ![Select Model panel](./pictures/nb_new-project-1.png) + +- Edit project properties (using menu **File** -> **Project Properties**) to add a new configuration that will use XDS to cross-compile your application for example for a Renesas Gen3 board) + + - in **Build** category, click on **Manage Configurations** button and then **New** button to add a new configuration named for example "Gen3 board" + + ![Select Model panel](./pictures/nb_new-project-2.png) + + - Click on **Set Active** button + + - Select **Pre-Build** sub-category, and set: + - Working Directory: `build_gen3` + - Command Line: `xds-exec -c ../xds-gen3.conf -- cmake -DRSYNC_TARGET=root@renesas-gen3 -DRSYNC_PREFIX=/opt ..` + - Pre-build First: `ticked` + + - Select **Make** sub-category, and set: + - Working Directory: `build_gen3` + - Build Command: `xds-exec -c ../xds-gen3.conf -- make remote-target-populate` + - Clean Command: `xds-exec -c ../xds-gen3.conf -- make clean` + + ![Select Model panel](./pictures/nb_new-project-3.png) + + - Click on **OK** button to save settings + +By changing configuration from **Default** to **Gen3 board**, you can now simply +compile your helloworld application natively (**Default** configuration) or +cross-compile your application through XDS for a Renesas Gen3 board (**Gen3 board** configuration). + +### Visual Studio Code + +Open your project in VS Code + +```bash +cd $MY_PROJECT_DIR +code . & +``` + +Add new tasks : press `Ctrl+Shift+P` and select the `Tasks: Configure Task Runner` command and you will see a list of task runner templates. + +And define your own tasks, here is an example to build [unicens2-binding](https://github.com/iotbzh/unicens2-binding) AGL binding based on cmake (_options value of args array must be updated regarding your settings_): + +```json +{ + "version": "0.1.0", + "linux": { + "command": "/opt/AGL/bin/xds-exec" + }, + "isShellCommand": true, + "args": [ + "-url", "localhost:8000", + "-id", "CKI7R47-UWNDQC3_myProject", + "-sdkid", "poky-agl_aarch64_4.0.1", + "--" + ], + "showOutput": "always", + "tasks": [{ + "taskName": "clean", + "suppressTaskName": true, + "args": [ + "rm -rf build/* && echo Cleanup done." + ] + }, + { + "taskName": "pre-build", + "isBuildCommand": true, + "suppressTaskName": true, + "args": [ + "mkdir -p build && cd build && cmake -DRSYNC_TARGET=root@renesas-gen3 -DRSYNC_PREFIX=/opt" + ] + }, + { + "taskName": "build", + "isBuildCommand": true, + "suppressTaskName": true, + "args": [ + "cd build && make widget" + ], + "problemMatcher": { + "owner": "cpp", + "fileLocation": ["absolute"], + "pattern": { + "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", + "file": 1, + "line": 2, + "column": 3, + "severity": 4, + "message": 5 + } + } + }, + { + "taskName": "populate", + "suppressTaskName": true, + "args" : [ + "cd build && make widget-target-install" + ] + } + ] +} +``` + +> **NOTE** You can also add your own keybindings to trig above tasks, for example: +> ```json +> // 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" +> }, +> ``` +> +> More details about VSC keybindings [here](https://code.visualstudio.com/docs/editor/tasks#_binding-keyboard-shortcuts-to-tasks) +> +> More details about VSC tasks [here](https://code.visualstudio.com/docs/editor/tasks) + +#### Qt Creator +Please refer to [agl-hello-qml](https://github.com/radiosound-com/agl-hello-qml#clone--build-project) project. +Thanks to Dennis for providing this useful example. + +#### Others IDE +*Coming soon...* diff --git a/docs/part-1/5_debug-first-app.md b/docs/part-1/5_debug-first-app.md new file mode 100644 index 0000000..f9f0a6e --- /dev/null +++ b/docs/part-1/5_debug-first-app.md @@ -0,0 +1,202 @@ +# Debug your first AGL application + +Debug is based on gdb and you need to use `xds-gdb` as a wrapper on gdb to cross-debug your application. +This tool allows you to debug an application built with an xds-server without the need to install gdb or any cross tool. +Two debugging models are supported: + +1. native debugging + +1. XDS remote debugging requiring an XDS server and allowing cross debug your + application. + + By default XDS remote debug is used and you need to define `XDS_NATIVE_GDB` +variable to use native gdb debug mode instead. + +> **SEE ALSO**: [xds-server](https://github.com/iotbzh/xds-server), a web server +used to remotely cross build applications. +> **SEE ALSO**: [xds-exec](https://github.com/iotbzh/xds-exec), +wrappers on `exec` command that allows to cross build your application through `xds-server`. + +## Configuration + + `xds-gdb` configuration is defined by variables (see listed below). + These variables may be set using : + +- environment variables (inherited), +- or a config file set with `XDS_CONFIG` environment variable, for example: + `XDS_CONFIG=/tmp/my_xds_gdb_config.env xds-gdb` +- or by setting variables within a gdb ini file (see details below), +- or a "user" config file located in following directory (first found is taken): + 1. $(CURRENT_DIRECTORY)/.xds-gdb.env + 1. $(CURRENT_DIRECTORY)/../xds-gdb.env + 1. $(CURRENT_DIRECTORY)/target/xds-gdb.env + 1. $(HOME)/.config/xds/xds-gdb.env + +### Configuration Variables + + `XDS_CONFIG` + Config file defining `XDS_xxx` configuration variables. Variables of this file + will overwrite inherited environment variables. Variables definition may be + prefixed or not by "export" keyword. + Here is an example of + +```bash +# for example: +# MY_PROJECT_DIR=/home/seb/xds-workspace/helloworld-native-application +cat > $MY_PROJECT_DIR/xds-gen3.conf << EOF +export XDS_SERVER_URL=http://docker:8000 +export XDS_PROJECT_ID=IW7B4EE-DBY4Z74_myProject +export XDS_SDK_ID=poky-agl_aarch64_4.0.1 +EOF +``` + +`XDS_LOGLEVEL` + +Set logging level (supported levels: panic, fatal, error, warn, info, debug) + +`XDS_LOGFILE` + +Set logging file, default `/tmp/xds-gdb.log`. + +`XDS_NATIVE_GDB` + +Use native gdb mode instead of remote XDS server mode. + +`XDS_PROJECT_ID` *(mandatory with XDS server mode)* + +Project ID you want to build + +`XDS_RPATH` + +Relative path into project + +`XDS_SDK_ID` *(mandatory with XDS server mode)* + +Cross Sdk ID to use to build project + +`XDS_SERVER_URL` *(mandatory with XDS server mode)* + +Remote XDS server url + +### Configuration variables set within gdb init command file + +Above `XDS_xxx` variables may also be defined within gdb init command file +(see --command or -x option of genuine Gdb). +You must respect the following syntax: commented line including `:XDS-ENV:` tag + +Example of gdb init file where we define project and sdk ID: + +```bash + # :XDS-ENV: XDS_PROJECT_ID=IW7B4EE-DBY4Z74_myProject + # :XDS-ENV: XDS_SDK_ID=poky-agl_aarch64_4.0.1 +``` + +## Using xds-gdb from command line + +### XDS remote debugging mode + +First the project you want to debug must be declared on an xds-server and this +project may also has been built using this xds-server (see [xds-server](https://github.com/iotbzh/xds-server) for more details). + +So to debug it you need to know the xds-server url (eg. <http://docker:8000>), +you also need the project and sdk unique id. You can find these IDs in project +page of XDS dashboard or you can get them from command line using the `--list` +option. +This option lists all existing projects ID: + +```bash +XDS_SERVER_URL=http://docker:8000 xds-gdb --list +``` + +Now to refer your project, just set `XDS_PROJECT_ID` and `XDS_SDK_ID` variables. + +You are now ready to use `xds-gdb` to for example cross debug your project. +Here is an example to build and debug a project based on CMakefile and +[AGL app-templates](https://git.automotivelinux.org/apps/app-templates/): + +```bash +# Go into your project directory (for example helloworld-native-application) +cd ~/xds-workspace +git clone https://github.com/iotbzh/helloworld-native-application.git +cd helloworld-service + +# Declare your project on xds-server +# <for now, you can only do this step using xds HTML dashboard (see xds-server doc)> + +# Define XDS config +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 + +# Tell to xds-exec and xds-gdb which is your config file +export XDS_CONFIG=../xds-gen3.conf + +# Create a new build directory +mkdir build && cd build + +# Start remote cross build +xds-exec -- cmake -DRSYNC_TARGET=root@myTarget .. +xds-exec -- make +xds-exec -- make remote-target-populate + +# Start debugging +xds-gdb -x target/gdb-on-root@myTarget.ini +``` + +<!-- note --> +> **Note** : [helloworld-native-application](https://github.com/iotbzh/helloworld-native-application) project is an AGL +project based on [app-templates](https://git.automotivelinux.org/apps/app-templates/) +(included as a git submodule). This CMake templating, used to develop application +with the AGL Application Framework, will automatically generate makefile rules +(eg. `remote-target-populate`) or scripts (eg. `build/target/xxx` scripts). + +For more info about app-template, please refer to [this documentation](http://docs.automotivelinux.org/docs/devguides/en/dev/reference/sdk-devkit/docs/part-2/2_4-Use-app-templates.html). +<!-- endnote --> + +### Native debugging + +To enable native debugging mode, you need to define `XDS_NATIVE_GDB` variable. + +## Using xds-gdb within an IDE + +### Netbeans + +__Netbeans 8.x :__ + +- Open menu **Tools** -> **Options** + - Open **C/C++** tab, in **Build Tools** sub-tab, click on **Add** button: + + ![Add new tool panel](./pictures/nb_newtool.png) + + - Then, you should set **Make Command** and **Debugger Command** to point to xds tools: + + ![Add new tool panel](./pictures/nb_xds_options.png) + + - Finally click on **OK** button. + +- Edit project properties (using menu **File** -> **Project Properties**) to update Debug settings: + + - Be sure that "Gen3 board" configuration is selected + + - Select **Run** category, and set: + - Run Command: `target/start-on-root@renesas-gen3.sh` + (_script name may depend of RSYNC_TARGET variable you set in pre-build command_) + - Run Directory: `build_gen3` + + - Select **Debug** category, and set: + - Debug command: `/bin/true` + - Working Directory: _empty field_ + - Gdb Init File: `target/gdb-on-root@renesas-gen3.ini` + (_script name may depend of RSYNC_TARGET variable you set in pre-build command_) + + ![Select Model panel](./pictures/nb_project_debug-1.png) + + - Click on **Apply** and then **OK** button to save settings + +You can now start debugging your application with menu **Debug** -> **Debug Project** (or **CTRL+F5** shortcut) + +### Others IDE + +*Coming soon...* diff --git a/docs/part-1/pictures/iotbzh_logo_small.png b/docs/part-1/pictures/iotbzh_logo_small.png Binary files differnew file mode 100644 index 0000000..6a98c60 --- /dev/null +++ b/docs/part-1/pictures/iotbzh_logo_small.png diff --git a/docs/part-1/pictures/nb_new-project-1.png b/docs/part-1/pictures/nb_new-project-1.png Binary files differnew file mode 100644 index 0000000..33d68ca --- /dev/null +++ b/docs/part-1/pictures/nb_new-project-1.png diff --git a/docs/part-1/pictures/nb_new-project-2.png b/docs/part-1/pictures/nb_new-project-2.png Binary files differnew file mode 100644 index 0000000..b0a41eb --- /dev/null +++ b/docs/part-1/pictures/nb_new-project-2.png diff --git a/docs/part-1/pictures/nb_new-project-3.png b/docs/part-1/pictures/nb_new-project-3.png Binary files differnew file mode 100644 index 0000000..051bfdd --- /dev/null +++ b/docs/part-1/pictures/nb_new-project-3.png diff --git a/docs/part-1/pictures/nb_newtool.png b/docs/part-1/pictures/nb_newtool.png Binary files differnew file mode 100644 index 0000000..ac527aa --- /dev/null +++ b/docs/part-1/pictures/nb_newtool.png diff --git a/docs/part-1/pictures/nb_project_debug-1.png b/docs/part-1/pictures/nb_project_debug-1.png Binary files differnew file mode 100644 index 0000000..7d89fc5 --- /dev/null +++ b/docs/part-1/pictures/nb_project_debug-1.png diff --git a/docs/part-1/pictures/nb_xds_options.png b/docs/part-1/pictures/nb_xds_options.png Binary files differnew file mode 100644 index 0000000..02bd3a9 --- /dev/null +++ b/docs/part-1/pictures/nb_xds_options.png diff --git a/docs/part-1/pictures/xds-block-diagram.png b/docs/part-1/pictures/xds-block-diagram.png Binary files differnew file mode 100644 index 0000000..cd11ad8 --- /dev/null +++ b/docs/part-1/pictures/xds-block-diagram.png diff --git a/docs/part-1/pictures/xds-conf.png b/docs/part-1/pictures/xds-conf.png Binary files differnew file mode 100644 index 0000000..64ba8a9 --- /dev/null +++ b/docs/part-1/pictures/xds-conf.png diff --git a/docs/part-1/pictures/xds-dashboard-icon-1.png b/docs/part-1/pictures/xds-dashboard-icon-1.png Binary files differnew file mode 100644 index 0000000..9aea05e --- /dev/null +++ b/docs/part-1/pictures/xds-dashboard-icon-1.png diff --git a/docs/part-1/pictures/xds-dashboard-icon-2.png b/docs/part-1/pictures/xds-dashboard-icon-2.png Binary files differnew file mode 100644 index 0000000..5df47b6 --- /dev/null +++ b/docs/part-1/pictures/xds-dashboard-icon-2.png diff --git a/docs/part-1/pictures/xds-dashboard-icon-3.png b/docs/part-1/pictures/xds-dashboard-icon-3.png Binary files differnew file mode 100644 index 0000000..4a642e6 --- /dev/null +++ b/docs/part-1/pictures/xds-dashboard-icon-3.png diff --git a/docs/part-1/pictures/xds-dashboard-prj-1.png b/docs/part-1/pictures/xds-dashboard-prj-1.png Binary files differnew file mode 100644 index 0000000..c675b90 --- /dev/null +++ b/docs/part-1/pictures/xds-dashboard-prj-1.png diff --git a/docs/part-1/pictures/xds-dashboard-prj-2.png b/docs/part-1/pictures/xds-dashboard-prj-2.png Binary files differnew file mode 100644 index 0000000..821b573 --- /dev/null +++ b/docs/part-1/pictures/xds-dashboard-prj-2.png diff --git a/docs/part-2/0_Abstract.md b/docs/part-2/0_Abstract.md new file mode 100644 index 0000000..51aa70d --- /dev/null +++ b/docs/part-2/0_Abstract.md @@ -0,0 +1,6 @@ +# Part 2 - XDS internals + +## Abstract + +This 2nd part is the "technical" documentation of all XDS pieces that allows +to fine tune XDS configuration or rebuild all XDS tools for scratch. diff --git a/docs/part-2/1_xds-server.md b/docs/part-2/1_xds-server.md new file mode 100644 index 0000000..d4ae63c --- /dev/null +++ b/docs/part-2/1_xds-server.md @@ -0,0 +1,336 @@ +# XDS - X(cross) Development System Server + +`xds-server` is a web server that allows user to remotely cross build applications. + +The first goal is to provide a multi-platform cross development tool with +near-zero installation. +The second goal is to keep application sources locally (on user's machine) to +make it compatible with existing IT policies (e.g. corporate backup or SCM), +and let user to continue to work as usual (use his favorite editor, +keep performance while editing/browsing sources). + +This powerful and portable webserver (written in [Go](https://golang.org)) +exposes a REST interface over HTTP and also provides a Web dashboard to configure projects and execute _(for now)_ only basics commands. + +`xds-server` uses [Syncthing](https://syncthing.net/) tool to synchronize +projects files from user machine to build server machine or container. + +> **NOTE**: For now, only Syncthing sharing method is supported to synchronize +projects files. But in a near future and for restricted configurations, `xds-server` +will also support "standard" folder sharing (eg. nfs mount points or docker +volumes). + +> **SEE ALSO**: [xds-exec](https://github.com/iotbzh/xds-exec), +wrappers on `exec` commands that allows you to send commands to `xds-server` +and for example build your application from command-line or from your favorite +IDE (such as Netbeans or Visual Studio Code) through `xds-server`. + +## How to run + +`xds-server` has been designed to easily compile and debug +[AGL](https://www.automotivelinux.org/) applications. That's why `xds-server` has +been integrated into AGL SDK docker container. + +>**NOTE** For more info about AGL SDK docker container, please refer to +[AGL SDK Quick Setup](http://docs.automotivelinux.org/docs/getting_started/en/dev/reference/setup-sdk-environment.html) + +### Get the container + +Load the pre-build AGL SDK docker image including `xds-server`: + +```bash +seb@laptop ~$ wget -O - http://iot.bzh/download/public/2017/XDS/docker/docker_agl_worker-xds-latest.tar.xz | docker load +``` + +### List container + +You should get `docker.automotivelinux.org/agl/worker-xds:X.Y` image + +```bash +# List image that we just built +seb@laptop ~$ docker images | grep worker-xds + +docker.automotivelinux.org/agl/worker-xds 3.99.1 786d65b2792c 6 days ago 602MB +``` + +### Start xds-server within the container + +Use provided script to create a new docker image and start a new container: + +```bash +# Get script +seb@laptop ~$ wget https://raw.githubusercontent.com/iotbzh/xds-server/master/scripts/xds-docker-create-container.sh + +# Create new XDS worker container +seb@laptop ~$ bash ./xds-docker-create-container.sh + +# Check that new container is running +seb@laptop ~$ docker ps | grep worker-xds + +b985d81af40c docker.automotivelinux.org/agl/worker-xds:3.99.1 "/usr/bin/wait_for..." 6 days ago Up 4 hours 0.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 +``` + +This container (ID=0) exposes following ports: + +- 8000 : `xds-server` to serve XDS Dashboard +- 69 : TFTP +- 2222 : ssh + +#### Manually setup docker user id + +If you plan to **use path-mapping sharing type for your projects**, you need to have the same user id and group id inside and outside docker. By default user and group name inside docker is set `devel` (id `1664`), use following commands to replace id `1664` with your user/group id: +```bash +# Set docker container name to use (usually agl-xds-xxx where xxx is USERNAME@MACHINENAME-IDX-NAME) +seb@laptop ~$ export CONTAINER_NAME=agl-xds-seb@laptop-0-seb + +# First stop xds-server +seb@laptop ~$ docker exec ${CONTAINER_NAME} bash -c "systemctl stop xds-server" + +# Change user and group id inside docker to match your ids +seb@laptop ~$ docker exec ${CONTAINER_NAME} bash -c "usermod -u $(id -u) devel" +seb@laptop ~$ docker exec ${CONTAINER_NAME} bash -c "groupmod -g $(id -g) devel" + +# Update some files ownership +seb@laptop ~$ docker exec ${CONTAINER_NAME} bash -c "chown -R devel:devel /home/devel /tmp/xds*" + +# Restart xds-server +seb@laptop ~$ docker exec ${CONTAINER_NAME} bash -c "systemctl start xds-server" +``` + +## Check if xds-server is running (open XDS Dashboard) + +**`xds-server` is automatically started** as a service on container startup. + +If the container is running on your localhost, you can access the web interface (what we call the "Dashboard"): + +```bash +seb@laptop ~$ xdg-open http://localhost:8000 +``` + +If needed you can status / stop / start it manually using following commands: + +```bash +# Log into docker container +seb@laptop ~$ ssh -p 2222 devel@localhost + +# Status XDS server: +devel@docker ~$ sudo systemctl status xds-server.service + +# Stop XDS server +devel@docker ~$ sudo systemctl stop xds-server.service + +# Start XDS server +devel@docker ~$ sudo systemctl start xds-server.service + +# Get XDS server logs +devel@docker ~$ sudo journalctl --unit=xds-server.service --output=cat +``` + +### Manually Start XDS server + +XDS server is started as a service by Systemd. + +```bash +/lib/systemd/system/xds-server.service +``` + +This Systemd service starts a bash script `/opt/AGL/xds/server/xds-server-start.sh` + +If you needed you can change default setting by defining specific environment +variables in `/etc/default/xds-server`. +For example to control log level, just set LOG_LEVEL env variable knowing that +supported *level* are: panic, fatal, error, warn, info, debug. + +```bash +seb@laptop ~$ ssh -p 2222 devel@localhost +devel@docker ~$ echo 'LOG_LEVEL=debug' | sudo tee --append /etc/default/xds-server > /dev/null +devel@docker ~$ sudo systemctl restart xds-server.service +devel@docker ~$ tail -f /tmp/xds-server/logs/xds-server.log +``` + +### Install SDK cross-toolchain + +`xds-server` uses SDK cross-toolchain installed into directory pointed by +`sdkRootDir` setting (see configuration section below for more details). +For now, you need to install manually SDK cross toolchain. There are not embedded +into docker image by default because the size of these tarballs is too big. + +Use provided `install-agl-sdks` script, for example to install SDK for ARM64 and +Intel corei7-64: + +```bash +seb@laptop ~$ ssh -p 2222 devel@localhost + +# Install ARM64 SDK (automatic download) +devel@docker ~$ sudo /opt/AGL/xds/server/xds-utils/install-agl-sdks.sh --arch aarch64 + +# Install Intel corei7-64 SDK (using an SDK tarball that has been built or downloaded manually) +devel@docker ~$ sudo /opt/AGL/xds/server/xds-utils/install-agl-sdks.sh --arch corei7-64 --file /tmp/poky-agl-glibc-x86_64-agl-demo-platform-crosssdk-corei7-64-toolchain- +3.99.1+snapshot.sh + +``` + +### XDS Dashboard + +`xds-server` serves a web-application at [http://localhost:8000](http://localhost:8000) +when XDS server is running on your host. Just replace `localhost` by the host +name or ip when XDS server is running on another host. So you can now connect +your browser to this url and use what we call the **XDS dashboard**. + +```bash +xdg-open http://localhost:8000 +``` + +Then follow instructions provided by this dashboard, knowing that the first time +you need to download and start `xds-agent` on your local machine. + +To download this tool, just click on download icon in dashboard configuration +page or download one of `xds-agent` released tarball: [https://github.com/iotbzh/xds-agent/releases](https://github.com/iotbzh/xds-agent/releases). + +See also `xds-agent` [README file](https://github.com/iotbzh/xds-agent) for more details. + +## Build xds-server from scratch + +### Dependencies + +- Install and setup [Go](https://golang.org/doc/install) version 1.7 or +higher to compile this tool. +- Install [npm](https://www.npmjs.com/) +- Install [gulp](http://gulpjs.com/) + +Ubuntu: + +```bash + sudo apt-get install golang npm curl git zip + sudo npm install -g gulp-cli +``` + +openSUSE: + +```bash + sudo zypper install go npm git curl zip + sudo npm install -g gulp-cli +``` + +Don't forget to open new user session after installing the packages. + +### Building + +#### Native build + +Create a GOPATH variable(must be a full path): + +```bash + export GOPATH=$(realpath ~/workspace_go) +``` + +Clone this repo into your `$GOPATH/src/github.com/iotbzh` and use delivered Makefile: + +```bash + mkdir -p $GOPATH/src/github.com/iotbzh + cd $GOPATH/src/github.com/iotbzh + git clone https://github.com/iotbzh/xds-server.git + cd xds-server + make all +``` + +And to install `xds-server` (by default in `/opt/AGL/xds/server`): + +```bash + make install +``` + +>**NOTE:** Used `DESTDIR` to specify another install directory +>```bash +>make install DESTDIR=$HOME/opt/xds-server +>``` + +#### XDS docker image + +As an alternative to a pre-build image, you can rebuild the container from scratch. +`xds-server` has been integrated as a flavour of AGL SDK docker image. +So to rebuild docker image just execute following commands: + +```bash +# Clone docker-worker-generator git repo +git clone https://git.automotivelinux.org/AGL/docker-worker-generator +# Start build that will create a docker image +cd docker-worker-generator +make build FLAVOUR=xds +``` + +### Configuration + +`xds-server` configuration is driven by a JSON config file (`config.json`). + +Here is the logic to determine which `config.json` file will be used: + +1. from command line option: `--config myConfig.json` +1. `$HOME/.xds-server/config.json` file +1. `/etc/xds-server/config.json` file +1. `<xds-server executable dir>/config.json` file + +Supported fields in configuration file are (all fields are optional and example +below corresponds to the default values): + +- **httpPort** : HTTP port of client webapp / dashboard +- **webAppDir** : location of client dashboard (default: webapp/dist) +- **shareRootDir** : root directory where projects will be copied +- **logsDir** : directory to store logs (eg. syncthing output) +- **sdkRootDir** : root directory where cross SDKs are installed +- **syncthing.binDir** : syncthing binaries directory (default: executable directory) +- **syncthing.home"** : syncthing home directory (usually .../syncthing-config) +- **syncthing.gui-address** : syncthing gui url (default http://localhost:8384) +- **syncthing.gui-apikey** : syncthing api-key to use (default auto-generated) + +```json +{ + "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:8384", + "gui-apikey": "123456789", + } +} +``` + +>**NOTE:** environment variables are supported by using `${MY_VAR}` syntax. + +## Debugging + +### XDS server architecture + +The server part is written in *Go* and web app / dashboard (client part) in +*Angular2*. + +``` +| ++-- bin/ where xds-server binary file will be built +| ++-- agent-config.json.in example of config.json file +| ++-- glide.yaml Go package dependency file +| ++-- lib/ sources of server part (Go) +| ++-- main.go main entry point of of Web server (Go) +| ++-- Makefile makefile including +| ++-- README.md this readme +| ++-- scripts/ hold various scripts used for installation or startup +| ++-- tools/ temporary directory to hold development tools (like glide) +| ++-- vendor/ temporary directory to hold Go dependencies packages +| ++-- webapp/ source client dashboard (Angular2 app) +``` + +Visual Studio Code launcher settings can be found into `.vscode/launch.json`. diff --git a/docs/part-2/2_xds-agent.md b/docs/part-2/2_xds-agent.md new file mode 100644 index 0000000..eac157a --- /dev/null +++ b/docs/part-2/2_xds-agent.md @@ -0,0 +1,166 @@ +# XDS - X(cross) Development System Agent + +XDS-agent is a client that should run on your local / user development machine when you use XDS. + +This agent takes care, among others, of starting [Syncthing](https://syncthing.net/) +tool to synchronize your project files from your local host to XDS build server +machine or container (where `xds-server` is running). + +> **SEE ALSO**: [xds-server](https://github.com/iotbzh/xds-server), a web server +used to remotely cross build applications. + +## How to install xds-agent + +### Install package for debian distro type + +```bash +export DISTRO="Debian_8.0" +wget -O - http://download.opensuse.org/repositories/isv:/LinuxAutomotive:/app-Development/${DISTRO}/Release.key | sudo apt-key add - +sudo bash -c "cat >> /etc/apt/sources.list.d/AGL.list<<EOF +deb http://download.opensuse.org/repositories/isv:/LinuxAutomotive:/app-Development/${DISTRO}/ ./ +EOF +" +sudo apt-get update +sudo apt-get install agl-xds-agent +``` + +The value 'DISTRO' can be set to {Debian_8.0, Debian_9.0, xUbuntu_16.04, xUbuntu_16.10, xUbuntu_17.04} + +Update the package + +```bash +sudo apt-get update +sudo apt-get upgrade agl-xds-agent +``` + +The files are install here: + +```bash +/opt/AGL/agl-xds-agent +``` + +### Install package for rpm distro type + +#### openSUSE + +```bash +export DISTRO="openSUSE_Leap_42.2" +sudo zypper ar http://download.opensuse.org/repositories/isv:/LinuxAutomotive:/app-Development/${DISTRO}/isv:LinuxAutomotive:app-Development.repo +sudo zypper ref +sudo zypper install agl-xds-agent +``` + +The value 'DISTRO' can be set to {openSUSE_Leap_42.2, openSUSE_Leap_42.3, openSUSE_Tumbleweed} + +Update the package + +```bash +sudo zypper ref +sudo zypper install --force agl-xds-agent +``` + +The files are install here: + +```bash +/opt/AGL/agl-xds-agent +``` + +## How to install on other platform + +Download released tarballs from github [releases page](https://github.com/iotbzh/xds-agent/releases). + +Then unzip this tarball any where into your local disk (for example: /opt/AGL/xds or C:\AGL\xds). + +## Configuration + +xds-agent configuration is driven by a JSON config file (named `agent-config.json`). +The tarball mentioned in previous section includes this file with default settings. + +Here is the logic to determine which `agent-config.json` file will be used: + +1. from command line option: `--config myConfig.json` +1. `$HOME/.xds/agent/agent-config.json` file +1. `/etc/xds-agent/agent-config.json` file +1. `<xds-agent executable dir>/agent-config.json` file + +Supported fields in configuration file are (all fields are optional and example +below corresponds to the default values): + +- **httpPort** : http port of agent REST interface +- **logsDir** : directory to store logs (eg. syncthing output) +- **xds-apikey** : xds-agent api-key to use (always set value to "1234abcezam") +- **syncthing.binDir** : syncthing binaries directory (default: executable directory) +- **syncthing.home"** : syncthing home directory (usually .../syncthing-config) +- **syncthing.gui-address** : syncthing gui url (default http://localhost:8384) +- **syncthing.gui-apikey** : syncthing api-key to use (default auto-generated) + +```json +{ + "httpPort": "8010", + "logsDir": "/tmp/logs", + "xds-apikey": "1234abcezam", + "syncthing": { + "binDir": ".", + "home": "${HOME}/.xds/agent/syncthing-config", + "gui-address": "http://localhost:8384", + "gui-apikey": "1234abcezam", + } +} +``` + +>**NOTE:** environment variables are supported by using `${MY_VAR}` syntax. + +## Start-up + +Simply to start `xds-agent` executable + +```bash +./xds-agent & +``` + +>**NOTE** if need be, you can increase log level by setting option +`--log <level>`, supported *level* are: panic, fatal, error, warn, info, debug. + +You can now use XDS dashboard and check that connection with `xds-agent` is up. +(see also [xds-server README](https://github.com/iotbzh/xds-server/blob/master/README.md#xds-dashboard)) + +## Build xds-agent from scratch + +### Dependencies + +Install and setup [Go](https://golang.org/doc/install) version 1.8 or +higher to compile this tool. + +### Building + +Clone this repo into your `$GOPATH/src/github.com/iotbzh` and use delivered Makefile: + +```bash + mkdir -p $GOPATH/src/github.com/iotbzh + cd $GOPATH/src/github.com/iotbzh + git clone https://github.com/iotbzh/xds-agent.git + cd xds-agent + make all +``` + +And to install xds-agent (by default in `/usr/local/bin`): + +```bash +make install +``` + +>**NOTE:** Used `DESTDIR` to specify another install directory +>```bash +>make install DESTDIR=$HOME/opt/xds-agent +>``` + +#### Cross build + +For example on a Linux machine to cross-build for Windows, just execute: + +```bash +export GOOS=windows +export GOARCH=amd64 +make all +make package +``` diff --git a/docs/part-2/3_xds-exec.md b/docs/part-2/3_xds-exec.md new file mode 100644 index 0000000..7899ba9 --- /dev/null +++ b/docs/part-2/3_xds-exec.md @@ -0,0 +1,296 @@ +# xds-exec: wrapper on exec for XDS + +`xds-exec` is a wrapper on exec linux command for X(cross) Development System. + +As well as `xds-exec` is a wrapper on exec command and can be use to execute any +command on a remote `xds-server`. + +This tool can be used in lieu of "standard" `exec` command to execute any +command on a remote `xds-server`. For example you can trig your project build by +executing : `xds-exec --config conf.env -- make build` + +> **SEE ALSO**: +> - [xds-agent](https://github.com/iotbzh/xds-agent), an agent that should run +on your local host in order to use XDS. +> - [xds-server](https://github.com/iotbzh/xds-server), a web server +used to remotely cross build applications. + +## Getting Started + +You must have a running `xds-server` (locally or on the Cloud), see +[README of xds-server](https://github.com/iotbzh/xds-server/blob/master/README.md) +for more details. + +Connect your favorite Web browser to the XDS dashboard (default url +http://localhost:8000) and follow instructions to start local `xds-agent` on +your local host. Please refer to instructions provided by XDS dashboard or see +`README of xds-agent`. + +Then create your project you XDS dashboard. + +### Installing xds-exec + +#### Install package for debian distro type + +```bash +export DISTRO="Debian_8.0" +wget -O - http://download.opensuse.org/repositories/isv:/LinuxAutomotive:/app-Development/${DISTRO}/Release.key | sudo apt-key add - +sudo bash -c "cat >> /etc/apt/sources.list.d/AGL.list <<EOF +deb http://download.opensuse.org/repositories/isv:/LinuxAutomotive:/app-Development/${DISTRO}/ ./ +EOF +" +sudo apt-get update +sudo apt-get install agl-xds-exec +``` + +The value 'DISTRO' can be set to {Debian_8.0, Debian_9.0, xUbuntu_16.04, xUbuntu_16.10, xUbuntu_17.04} + +Update the package + +```bash +sudo apt-get update +sudo apt-get upgrade agl-xds-exec +``` + +The files are install here: + +```bash +/opt/AGL/agl-xds-exec +``` + +#### Install package for rpm distro type + +##### openSUSE + +```bash +export DISTRO="openSUSE_Leap_42.2" +sudo zypper ar http://download.opensuse.org/repositories/isv:/LinuxAutomotive:/app-Development/${DISTRO}/isv:LinuxAutomotive:app-Development.repo +sudo zypper ref +sudo zypper install agl-xds-exec +``` + +The value 'DISTRO' can be set to {openSUSE_Leap_42.2, openSUSE_Leap_42.3, openSUSE_Tumbleweed} + +Update the package + +```bash +sudo zypper ref +sudo zypper install --force agl-xds-exec +``` + +The files are install here: + +```bash +/opt/AGL/agl-xds-exec +``` + +### Using xds-exec from command line + +You need to determine which is the unique id of your project. You can find +this ID in project page of XDS dashboard or you can get it from command line +using the `--list` option. This option lists all existing projects ID: + +```bash +./bin/xds-exec --list + +List of existing projects: + CKI7R47-UWNDQC3_myProject + CKI7R47-UWNDQC3_test2 + CKI7R47-UWNDQC3_test3 +``` + +Now to refer your project, just use --id option or use `XDS_PROJECT_ID` +environment variable. + +You are now ready to use XDS to for example cross build your project. +Here is an example to build a project based on CMakefile: + +```bash +# Add xds-exec in the PATH +export PATH=${PATH}:/opt/AGL/agl-xds-exec + +# Go into your project directory +cd $MY_PROJECT_DIR + +# Create a build directory +xds-exec --id=CKI7R47-UWNDQC3_myProject --sdkid=poky-agl_aarch64_4.0.1 --url=http://localhost:8000 -- mkdir build + +# Generate build system using cmake +xds-exec --id=CKI7R47-UWNDQC3_myProject --sdkid=poky-agl_aarch64_4.0.1 --url=http://localhost:8000 -- cd build && cmake .. + +# Build the project +xds-exec --id=CKI7R47-UWNDQC3_myProject --sdkid=poky-agl_aarch64_4.0.1 --url=http://localhost:8000 -- cd build && make all +``` + +To avoid to set project id, xds server url, ... at each command line, you can +define these settings as environment variable within an env file and just set +`--config` option or source file before executing xds-exec. + +For example, the equivalence of above command is: + +```bash +cat > config.env << EOF + export XDS_SERVER_URL=localhost:8000 + export XDS_PROJECT_ID=CKI7R47-UWNDQC3_myProject + export XDS_SDK_ID=poky-agl_aarch64_4.0.1 +EOF + +xds-exec --config config.env -- mkdir build + +# Or sourcing env file +source config.env +xds-exec -- cd build && cmake .. +xds-exec -- cd build && make all +``` + +### Using xds-exec within an IDE + +#### Visual Studio Code + +Open your project in VSC + +```bash +cd $MY_PROJECT_DIR +code . & +``` +Add new tasks : press `Ctrl+Shift+P` and select the `Tasks: Configure Task Runner` command and you will see a list of task runner templates. + +And define your own tasks, here is an example to build [unicens2-binding](https://github.com/iotbzh/unicens2-binding) AGL binding based on cmake (_options value of args array must be updated regarding your settings_): + +```json +{ + "version": "0.1.0", + "linux": { + "command": "/opt/AGL/agl-xds-exec/xds-exec" + }, + "isShellCommand": true, + "args": [ + "-url", "localhost:8010", + "-id", "W2EAQBA-HQI75XA_unicens2-binding", + "-sdkid", "poky-agl_aarch64_4.0.1", + "--" + ], + "showOutput": "always", + "tasks": [{ + "taskName": "clean", + "suppressTaskName": true, + "args": [ + "rm -rf build/* && echo Cleanup done." + ] + }, + { + "taskName": "pre-build", + "isBuildCommand": true, + "suppressTaskName": true, + "args": [ + "mkdir -p build && cd build && cmake -DRSYNC_TARGET=root@192.168.168.11 -DRSYNC_PREFIX=./opt" + ] + }, + { + "taskName": "build", + "isBuildCommand": true, + "suppressTaskName": true, + "args": [ + "cd build && make widget" + ], + "problemMatcher": { + "owner": "cpp", + "fileLocation": ["absolute"], + "pattern": { + "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", + "file": 1, + "line": 2, + "column": 3, + "severity": 4, + "message": 5 + } + } + }, + { + "taskName": "populate", + "suppressTaskName": true, + "args" : [ + "cd build && make widget-target-install" + ] + } + ] +} +``` + +> **NOTE** You can also add your own keybindings to trig above tasks, for example: +> ```json +> // 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" +> }, +> ``` +> +> More details about VSC keybindings [here](https://code.visualstudio.com/docs/editor/tasks#_binding-keyboard-shortcuts-to-tasks) +> +> More details about VSC tasks [here](https://code.visualstudio.com/docs/editor/tasks) + +#### Qt Creator +Please refer to [agl-hello-qml](https://github.com/radiosound-com/agl-hello-qml#clone--build-project) project. +Thanks to Dennis for providing this useful example. + +#### Others IDE +*Coming soon...* + + +## How to build + +### Prerequisites + You must install and setup [Go](https://golang.org/doc/install) version 1.7 or + higher to compile this tool. + +### Building +Clone this repo into your `$GOPATH/src/github.com/iotbzh` and use delivered Makefile: +```bash + export GOPATH=$(realpath ~/workspace_go) + mkdir -p $GOPATH/src/github.com/iotbzh + cd $GOPATH/src/github.com/iotbzh + git clone https://github.com/iotbzh/xds-exec.git + cd xds-exec + make +``` + +## Debug + +Visual Studio Code launcher settings can be found into `.vscode/launch.json`. + +>**Tricks:** To debug both `xds-exec` (client part) and `xds-server` (server part), +it may be useful use the same local sources. +So you should replace `xds-server` in `vendor` directory by a symlink. +So clone first `xds-server` sources next to `xds-exec` directory. +You should have the following tree: +``` +> tree -L 3 src +src +|-- github.com + |-- iotbzh + |-- xds-exec + |-- xds-server +``` +Then invoke `vendor/debug` Makefile rule to create a symlink inside vendor +directory : +```bash +cd src/github.com/iotbzh/xds-exec +make vendor/debug +``` diff --git a/docs/part-2/4_xds-gdb.md b/docs/part-2/4_xds-gdb.md new file mode 100644 index 0000000..5fe0ab9 --- /dev/null +++ b/docs/part-2/4_xds-gdb.md @@ -0,0 +1,201 @@ +# xds-gdb: wrapper on gdb for XDS + +`xds-gdb` is a wrapper on gdb debugger for X(cross) Development System. + +This tool allows you to debug an application built with an xds-server without +the need to install gdb or any cross tool. + +Two debugging models are supported: + +1. native debugging + +1. XDS remote debugging requiring an XDS server and allowing cross debug your + application. + + + By default XDS remote debug is used and you need to define `XDS_NATIVE_GDB` +variable to use native gdb debug mode instead. + +> **SEE ALSO**: [xds-server](https://github.com/iotbzh/xds-server), a web server +used to remotely cross build applications. +> **SEE ALSO**: [xds-exec](https://github.com/iotbzh/xds-exec), +wrappers on `exec` command that allows to cross build your application through `xds-server`. + +## Getting Started + +## Installing xds-gdb + +Download latest `xds-gdb` release on [https://github.com/iotbzh/xds-gdb/releases](https://github.com/iotbzh/xds-gdb/releases). + +Extract the tarball anywhere you want, for example: + +```bash +mkdir -p ~/opt/bin +unzip -j $DOWNLOAD_DIR/xds-gdb_linux-amd64-v1.0.0.zip xds-gdb/xds-gdb ~/opt/bin +``` + +## Configuration + + `xds-gdb` configuration is defined by variables (see listed below). + These variables may be set using : + +- environment variables (inherited), +- or a config file set with `XDS_CONFIG` environment variable, for example: + `XDS_CONFIG=/tmp/my_xds_gdb_config.env xds-gdb` +- or by setting variables within a gdb ini file (see details below), +- or a "user" config file located in following directory (first found is taken): + 1. $(CURRENT_DIRECTORY)/.xds-gdb.env + 1. $(CURRENT_DIRECTORY)/../xds-gdb.env + 1. $(CURRENT_DIRECTORY)/target/xds-gdb.env + 1. $(HOME)/.config/xds/xds-gdb.env + +### Configuration Variables + + `XDS_CONFIG` : + Config file defining `XDS_xxx` configuration variables. Variables of this file + will overwrite inherited environment variables. Variables definition may be + prefixed or not by "export" keyword. + Here is an example of + +```bash +cat $HOME/myProject/xds-gdb.env + +export XDS_SERVER_URL=http://xds-docker:8000 +export XDS_PROJECT_ID=IW7B4EE-DBY4Z74_myProject +export XDS_SDK_ID=poky-agl_aarch64_4.0.1 +``` + +`XDS_LOGLEVEL` : +Set logging level (supported levels: panic, fatal, error, warn, info, debug) + +`XDS_LOGFILE` : +Set logging file, default `/tmp/xds-gdb.log`. + +`XDS_NATIVE_GDB` : +Use native gdb mode instead of remote XDS server mode. + +`XDS_PROJECT_ID` : *(mandatory with XDS server mode)* +Project ID you want to build + +`XDS_RPATH` : +Relative path into project + +`XDS_SDK_ID` : *(mandatory with XDS server mode)* +Cross Sdk ID to use to build project + +`XDS_SERVER_URL` : *(mandatory with XDS server mode)* +Remote XDS server url + +### Configuration variables set within gdb init command file + +Above `XDS_xxx` variables may also be defined within gdb init command file +(see --command or -x option of genuine Gdb). +You must respect the following syntax: commented line including `:XDS-ENV:` tag + +Example of gdb init file where we define project and sdk ID: + +```bash + # :XDS-ENV: XDS_PROJECT_ID=IW7B4EE-DBY4Z74_myProject + # :XDS-ENV: XDS_SDK_ID=poky-agl_aarch64_4.0.1 +``` + +## Using xds-gdb from command line + +### XDS remote debugging mode + +First the project you want to debug must be declared on an xds-server and this +project may also has been built using this xds-server (see [xds-server](https://github.com/iotbzh/xds-server) for more details). + +So to debug it you need to know the xds-server url (eg. <http://xds-docker:8000>), +you also need the project and sdk unique id. You can find these IDs in project +page of XDS dashboard or you can get them from command line using the `--list` +option. +This option lists all existing projects ID: + +```bash +XDS_SERVER_URL=http://xds-docker:8000 xds-gdb --list +``` + +Now to refer your project, just set `XDS_PROJECT_ID` and `XDS_SDK_ID` variables. + +You are now ready to use `xds-gdb` to for example cross debug your project. +Here is an example to build and debug a project based on CMakefile and +[AGL app-templates](https://git.automotivelinux.org/apps/app-templates/): + +```bash +# Go into your project directory (for example helloworld-service) +git clone https://github.com/iotbzh/helloworld-service.git +cd helloworld-service + +# Declare your project on xds-server +# <for now, you can only do this step using xds HTML dashboard (see xds-server doc)> + +# Define XDS config +cat <<EOF >./xds-config.env +XDS_SERVER_URL=http://xds-docker:8000 +XDS_PROJECT_ID=IW7B4EE-DBY4Z74_myProject +XDS_SDK_ID=poky-agl_aarch64_4.0.1 +EOF + +# Tell to xds-exec and xds-gdb which is your config file +export XDS_CONFIG=../xds-config.env + +# Create a new build directory +mkdir build && cd build + +# Start remote cross build +xds-exec -- cmake .. +xds-exec -- make +xds-exec -- make remote-target-populate + +# Start debugging +xds-gdb -x target/gdb-on-root@myTarget.ini +``` + +> **Notes** : [Helloworld-service project](https://github.com/iotbzh/helloworld-service) +is an AGL project based on app-templates that can be build and debug using XDS. + +### Native debugging + +To enable native debugging mode, you need to define `XDS_NATIVE_GDB` variable. + +## Using xds-gdb within an IDE + +### Netbeans + +__Netbeans 8.x :__ +Open menu Tools -> Options +Then open C/C++ tab, in "Build Tools" sub-tab, click on "Add" button: +![Add new tool panel](./docs/images/nb_newtool.jpg) + +Then, you should set *Debugger Command* to point to xds-gdb + +![Add new tool panel](./docs/images/nb_xds_options.jpg) + +### Others IDE + +*Coming soon...* + +## How to build xds-gdb from scratch + +### Prerequisites + + You must install and setup [Go](https://golang.org/doc/install) version 1.7 or + higher to compile this tool. + +### Building + +Clone this repo into your `$GOPATH/src/github.com/iotbzh` and use delivered Makefile: + +```bash + export GOPATH=$(realpath ~/workspace_go) + mkdir -p $GOPATH/src/github.com/iotbzh + cd $GOPATH/src/github.com/iotbzh + git clone https://github.com/iotbzh/xds-gdb.git + cd xds-gdb + make +``` + +## Debug + +Visual Studio Code launcher settings can be found into `.vscode/launch.json`. diff --git a/docs/part-2/pictures/.gitkeep b/docs/part-2/pictures/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/docs/part-2/pictures/.gitkeep diff --git a/docs/resources/cover.svg b/docs/resources/cover.svg new file mode 100644 index 0000000..6726de7 --- /dev/null +++ b/docs/resources/cover.svg @@ -0,0 +1,210 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="1800" + height="2360" + viewBox="0 0 1800 2360" + id="svg2" + version="1.1" + inkscape:version="0.91 r13725" + sodipodi:docname="cover.svg"> + <defs + id="defs4175"> + <filter + style="color-interpolation-filters:sRGB" + inkscape:label="Drop Shadow" + id="filter4000"> + <feFlood + result="flood" + flood-color="rgb(0,0,0)" + flood-opacity="0.475" + id="feFlood4002" /> + <feComposite + result="composite1" + operator="in" + in="flood" + in2="SourceGraphic" + id="feComposite4004" /> + <feGaussianBlur + result="blur" + stdDeviation="5" + id="feGaussianBlur4006" /> + <feOffset + result="offset" + dy="8" + dx="8" + id="feOffset4008" /> + <feComposite + result="composite2" + operator="over" + in="SourceGraphic" + in2="offset" + id="feComposite4010" /> + </filter> + <filter + style="color-interpolation-filters:sRGB" + id="filter4000-6" + inkscape:label="Drop Shadow"> + <feFlood + id="feFlood4002-4" + flood-opacity="0.475" + flood-color="rgb(0,0,0)" + result="flood" /> + <feComposite + id="feComposite4004-6" + in2="SourceGraphic" + in="flood" + operator="in" + result="composite1" /> + <feGaussianBlur + id="feGaussianBlur4006-2" + stdDeviation="5" + result="blur" /> + <feOffset + id="feOffset4008-8" + dx="8" + dy="8" + result="offset" /> + <feComposite + id="feComposite4010-9" + in2="offset" + in="SourceGraphic" + operator="over" + result="composite2" /> + </filter> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="0.24748737" + inkscape:cx="928.3577" + inkscape:cy="404.58117" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="false" + inkscape:snap-text-baseline="false" + units="px" + inkscape:window-width="1920" + inkscape:window-height="1171" + inkscape:window-x="1920" + inkscape:window-y="0" + inkscape:window-maximized="1" + showguides="false" /> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(0,1307.6379)"> + <g + id="iotbzh-logo" + transform="matrix(2.3917866,0,0,2.3917866,216.6324,-1946.4393)" + inkscape:export-filename="/home/sdx/Pictures/Logo/logo_iot_bzh_100dpi.png" + inkscape:export-xdpi="100.22011" + inkscape:export-ydpi="100.22011" + style="display:inline;filter:url(#filter4000-6)"> + <text + sodipodi:linespacing="125%" + id="text3557-5-3-7-0-7-3" + y="519.50671" + x="27.886671" + style="font-style:normal;font-weight:normal;font-size:97.09867096px;line-height:125%;font-family:Sans;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none" + xml:space="preserve"><tspan + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:97.09867096px;line-height:125%;font-family:FreeEuro;-inkscape-font-specification:'FreeEuro Bold';text-align:start;writing-mode:lr-tb;text-anchor:start" + y="519.50671" + x="27.886671" + id="tspan3559-5-4-1-5-0-6" + sodipodi:role="line">IOT</tspan></text> + <path + inkscape:connector-curvature="0" + d="m 286.73007,473.23356 c 28.21686,16.29102 28.75566,58.73779 0.99693,78.53831 -7.67688,5.47598 -8.77935,4.91028 -1.99529,-1.0238 17.47377,-15.28453 17.98492,-42.17775 1.08522,-57.09786 l -3.91266,-3.45435 0.72312,-3.71053 c 0.39771,-2.04076 0.5997,-5.73115 0.44885,-8.20083 -0.33876,-5.54623 0.15803,-6.49185 2.65383,-5.05094 z m -64.76568,11.40332 c 7.06047,-7.74198 18.64659,-14.16089 29.04027,-16.08874 l 6.87489,-1.27521 0.87404,2.89709 c 0.4807,1.59343 0.67439,5.2245 0.43037,8.06906 l -0.44364,5.17195 -6.13887,1.6918 c -10.91241,3.00731 -20.4022,10.85909 -25.4533,21.05979 l -2.41633,4.87984 -2.74281,-0.41238 c -5.14252,-0.77316 -12.72985,-3.97645 -12.79123,-5.40033 -0.092,-2.13451 8.34659,-15.74625 12.76661,-20.59287 z m 33.20546,36.39493 c -28.21687,16.29101 -65.24624,-4.46574 -68.51461,-38.40577 -0.9039,-9.38637 0.13723,-10.0583 1.88428,-1.21608 4.49989,22.77499 27.53453,36.66428 48.90556,29.48876 l 4.94788,-1.66128 2.85184,2.48149 c 1.56852,1.36481 4.66349,3.38493 6.87772,4.48914 4.97257,2.47973 5.54308,3.38282 3.04733,4.82374 z m 22.50729,-61.79039 c 3.17451,9.98553 2.94038,23.22889 -0.58688,33.19399 l -2.33309,6.59143 -2.94597,-0.69161 c -1.6203,-0.38041 -4.86173,-2.02821 -7.2032,-3.6618 l -4.25721,-2.97018 1.60429,-6.16234 c 2.85178,-10.95404 0.79685,-23.09833 -5.51167,-32.57307 l -3.01788,-4.53253 1.72854,-2.16916 c 3.24083,-4.06698 9.80863,-9.03614 11.07242,-8.37738 1.89457,0.98756 9.46336,15.1015 11.45065,21.35265 z m -48.80223,10.31437 c 0,-32.58201 36.49058,-54.27201 67.51771,-40.1325 8.58077,3.9104 8.6421,5.148 0.11108,2.23988 -21.97368,-7.49048 -45.51946,5.51348 -49.99082,27.6091 l -1.03521,5.11561 -3.57498,1.22902 c -1.96621,0.67596 -5.26316,2.34622 -7.32655,3.71171 -4.63379,3.06649 -5.70115,3.10904 -5.70115,0.22718 z m 42.25842,50.3871 c -10.23499,-2.24356 -21.58699,-9.06801 -28.45341,-17.10525 l -4.5418,-5.31622 2.07194,-2.20549 c 1.13957,-1.21302 4.18733,-3.19628 6.77282,-4.40726 l 4.70085,-2.20176 4.53458,4.47053 c 8.06061,7.94674 19.60535,12.23927 30.96496,11.51329 l 5.43422,-0.34731 1.01427,2.58154 c 1.90169,4.84014 2.92124,13.01261 1.71883,13.77769 -1.80254,1.14695 -17.80995,0.64475 -24.21726,-0.75976 z" + style="display:inline;fill:#5a2ca0" + id="path3415-4-2-2-5-0-3-7-4-4-1-5" /> + <text + sodipodi:linespacing="125%" + id="text3557-5-3-7-46-7-3-7" + y="519.50671" + x="317.95816" + style="font-style:normal;font-weight:normal;font-size:97.09867096px;line-height:125%;font-family:Sans;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none" + xml:space="preserve"><tspan + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:97.09867096px;line-height:125%;font-family:FreeEuro;-inkscape-font-specification:'FreeEuro Bold';text-align:start;writing-mode:lr-tb;text-anchor:start" + y="519.50671" + x="317.95816" + id="tspan3559-5-4-1-90-0-2-9" + sodipodi:role="line">BZH</tspan></text> + </g> + <flowRoot + xml:space="preserve" + id="root-title" + transform="matrix(2.3469382,0,0,2.3469382,464.13874,-1200)"><flowRegion + id="flowRegion4303"><rect + id="rect4305" + width="679.99994" + height="141.42853" + x="-154.28572" + y="400"/> + </flowRegion> + <flowPara + id="title" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:87.5px;line-height:125%;font-family:Verdana;-inkscape-font-specification:'Verdana, Bold';text-align:center;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1">{title}</flowPara></flowRoot> <flowRoot + xml:space="preserve" + id="root-subtitle" + transform="matrix(1.8523279,0,0,1.8523279,553.97647,-380)"><flowRegion + id="flowRegion4303-6"><rect + id="rect4305-0" + width="852.32806" + height="154.51677" + x="-239.3591" + y="290"/> + </flowRegion> + <flowPara + id="subtitle" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:62.5px;line-height:125%;font-family:Verdana;-inkscape-font-specification:'Verdana, Bold';text-align:center;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1">{subtitle}</flowPara> + </flowRoot> + <flowRoot + id="root-version" + xml:space="preserve" + transform="translate(-2.0185547,164)"><flowRegion + id="flowRegion4169"><rect + y="501.68909" + x="343.32947" + height="99.591171" + width="1117.3768" + id="rect4171" /></flowRegion><flowPara + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:50px;line-height:125%;font-family:Verdana;-inkscape-font-specification:'Verdana, Bold';text-align:center;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1" + id="version">{version}</flowPara></flowRoot> <flowRoot + transform="translate(-2.0185547,238)" + xml:space="preserve" + id="root-date"><flowRegion + id="flowRegion4170"><rect + id="rect4172" + width="1117.3768" + height="99.591171" + x="343.32947" + y="501.68909" /></flowRegion><flowPara + id="date" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:50px;line-height:125%;font-family:Verdana;-inkscape-font-specification:'Verdana, Bold';text-align:center;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1">{date}</flowPara></flowRoot> </g> +</svg> diff --git a/docs/resources/ebook.css b/docs/resources/ebook.css new file mode 100644 index 0000000..39f126c --- /dev/null +++ b/docs/resources/ebook.css @@ -0,0 +1,386 @@ +/* IoT.Bzh theaming */ + +h1 { + color: #330066; + border-bottom: 2px solid #330066; +} + +h2 { + color: #330066; +} + +h3 { + color: #330066; +} + +h4 { + color: #330066; +} + + +/* GENERAL ELEMENTS */ + +/* clear both */ + +.clear { + clear: both; +} + +.section> :last-child { + margin-bottom: 0 !important; +} + +.section> :first-child { + margin-top: 0 !important; +} + + +/* SPECIAL ELEMENTS */ + + +/* page break always after element on pdf/print definition */ + +div.pagebreak { + page-break-after: always; +} + + +/* no page break inside element on pdf/print definition */ + +div.nopb { + page-break-inside: avoid !important; + margin: 4px 0 4px 0; +} + + +/* note blocks */ + +div.note { + background: #FCF8E3 none repeat scroll 0% 0%; + color: #8A6D3B; + padding: 15px; + margin-bottom: 10px; + border-bottom: 5px solid #DDD; + border-color: #FAEBCC; + page-break-inside: avoid; +} + +div.note p { + padding-bottom: 0; + margin-bottom: 0; +} + + +/* images, figures and captions */ + +p img { + /* center all images */ + display: block; + margin: 0 auto; + padding: 10px 0; +} + +figure { + margin: 1.0em 0px; + padding: 10px 0; + text-align: center; + page-break-inside: avoid; + display: block; +} + +figure img { + display: block; + margin: 0 auto; +} + +figcaption { + clear: left; + margin: 1.0em 0 0 0; + text-align: center; + font-style: italic; + line-height: 1.5em; + font-size: 80%; + color: #666; + display: block; +} + +.page .section p img { + margin-top: 10px; +} + + +/* ul, ol list margin fix */ + +.page .section ol, +.page .section ul { + margin-bottom: 10px; +} + + +/* blockquotes */ + +.page .section blockquote { + margin: 0 0 0 5%; + font-style: italic; +} + + +/* PAGE SPECIFIC */ + + +/* set summary page to right side of the paper */ + +.page .toc h1 { + page-break-before: right; +} + +.page .section.toc { + page-break-inside: always; +} + +/* table headers */ + +div#README\.md table { + margin-top: 30px; + font-size: 95%; +} + +div#README\.md table thead { + display: none; +} + + + +/* CITATION AND IMAGES */ + + +/* math image styles */ + +.page .section p img.svg, +.page .section p img.png { + margin-top: 0px; + margin-bottom: -2px; +} + +.page .section p img.math { + vertical-align: middle; + height: auto; + width: auto; + margin-top: -4px; + max-height: 15px; +} + +.page .section p img.math.line1 { + margin-top: -7px; + max-height: 19px; +} + +.page .section p img.math.line2 { + margin-top: -1px; + max-height: 30px; +} + + +/* credits page */ + +.page .section ul.pictures { + margin-left: -30px; +} + +.page .section ul.pictures li { + list-style: outside none none; +} + +.page .section ul.pictures li a { + float: left; +} + +.page .section ul.pictures li span { + display: block; + margin-left: 100px; +} + + + +/* sub and super script */ + +.page .section sub { + font-size: 80%; + margin-left: 1px; +} + + +/* citations and references */ + +.page .section sup { + margin-left: -1px; + margin-right: 2px; + font-size: 80%; +} + +.page .section sup:before { + content: " "; +} + +.page .section ul.citations, +.page .section ul.references { + margin-left: -30px; +} + + +.page .section ul.citations li:nth-child(1) { + margin-top: 20px; + padding-top: 20px; + border-top: 1px solid #BBB; +} + +.page .section ul.citations li, +.page .section ul.references li { + list-style: outside none none; +} + +.page .section ul.citations li { + font-size: 80%; +} + +.page .section ul.citations li>span:nth-child(1), +.page .section ul.references li>span:nth-child(1) { + display: block; + float: left; + text-align: left; + width: 70px +} + +.page .section ul.citations li>span:nth-child(1) { + width: 50px +} + +.page .section ul.references li div { + margin-left: 70px; +} + +.page .section ul.citations li div { + margin-left: 50px; +} + +.page .section a[href="#"], +.page .section a[href="#"]:link, +.page .section a[href="#"]:visited, +.page .section a[href="#"]:hover, +.page .section a[href="#"]:focus { + text-decoration: none; + color: inherit; + cursor: text; + font-style: italic; +} + + +/* self referential footnotes */ + +.page .section div[type="selfref"] a[href="#"], +.page .section div[type="selfref"] a[href="#"]:link, +.page .section div[type="selfref"] a[href="#"]:visited, +.page .section div[type="selfref"] a[href="#"]:hover, +.page .section div[type="selfref"] a[href="#"]:focus { + font-style: normal; +} + +.page .section div[type="selfref"] span:nth-child(1) { + display: none; +} + + +/* page break always after element on pdf/print definition */ + +div.page-break { + page-break-inside: always; +} + +div.page-break:before { + content: ' '; +} + + +/* no page break inside element on pdf/print definition */ + +div.nopb { + page-break-inside: avoid; +} + +/* justify text */ +p { + text-align: justify; +} + +/* page header and footer */ + +.pdf-footer, +.pdf-header { + margin-top: 20px; + color: #aaa; +} + +.pdf-header .header-left { + float: left; + margin-left: 2em; + margin-right: auto; +} + +.pdf-header .header-right { + display: table; + margin-left: auto; + margin-right: 2em; +} + +.pdf-footer .sub { + padding-top: 8px; + font-size: 70%; +} + +.pdf-header .sub { + padding-top: 2px; + font-size: 70%; +} + +.pdf-footer { + padding-top: 10px; + border-top: 1px solid #eee; +} + +.pdf-footer .footer-left { + float: left; + margin-left: 2em; + margin-right: auto; +} + +.pdf-footer .footer-center { + display: table; + margin-left: auto; + margin-right: auto; +} + +.pdf-footer .footer-right { + float: right; + margin-left: auto; + margin-right: 2em; +} + +.pdf-header { + padding-bottom: 10px; + border-bottom: 1px solid #eee; +} + +.pdf-header .header-pages-count { + float: right; + text-align: right; +} + +.pdf-header .header-pages-count a, +.pdf-header .header-pages-count a:visited, +.pdf-header .header-pages-count a:active, +.pdf-header .header-pages-count a:focus, +.pdf-header .header-pages-count a:link { + text-decoration: none; + color: #aaa; + cursor: text; +} diff --git a/docs/resources/make_cover.sh b/docs/resources/make_cover.sh new file mode 100755 index 0000000..1026ecb --- /dev/null +++ b/docs/resources/make_cover.sh @@ -0,0 +1,27 @@ +#!/bin/bash +DOCS_DIR=$(cd $(dirname $0)/.. && pwd) +BOOKFILE=$DOCS_DIR/../book.json + +TITLE=$(grep '"title":' $BOOKFILE | cut -d'"' -f 4) +SUBTITLE=$(grep '"subtitle":' $BOOKFILE | cut -d'"' -f 4) +VERSION="Version $(grep '"version":' $BOOKFILE | cut -d'"' -f 4)" +DATE=$(grep '"published":' $BOOKFILE | cut -d'"' -f 4) + +[ -z "$TITLE" ] && { echo "Error TITLE not set!" ; exit 1; } +[ -z "$VERSION" ] && { echo "Error VERSION not set!" ; exit 1; } +[ -z "$DATE" ] && { echo "Error DATE not set!" ; exit 1; } + + +cat $(dirname $0)/cover.svg | sed -e "s/{title}/$TITLE/g" \ + -e "s/font-size:87.5px/font-size:54px/g" \ + -e "s/{subtitle}/$SUBTITLE/g" \ + -e "s/font-size:62.5px/font-size:40px/g" \ + -e "s/{version}/$VERSION/g" \ + -e "s/{date}/$DATE/g" \ + > /tmp/cover.svg + +# use imagemagick convert tool (cover size must be 1800x2360) +convert -resize "1600x2160!" -border 100 -bordercolor white -background white \ + -flatten -quality 100 /tmp/cover.svg $DOCS_DIR/cover.jpg + +convert -resize "200x262!" $DOCS_DIR/cover.jpg $DOCS_DIR/cover_small.jpg |