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/part-1 |
Initial commit
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
Diffstat (limited to 'docs/part-1')
20 files changed, 819 insertions, 0 deletions
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 |