diff options
author | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2018-01-18 09:44:34 +0100 |
---|---|---|
committer | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2018-01-18 09:44:34 +0100 |
commit | bd814eafac20a5264782bad69ce2df1599921c68 (patch) | |
tree | 7b2f14fec5457d1fdc1ed4a0d7236d6f09525dca /docs/part-1 | |
parent | 2a297d08d6b686abe9ab8404a15aa892f4832e25 (diff) |
Split markdown files to have a detailed TOC/summary.
Change-Id: I7d578335ba0d1719030bc2efc6518da17a6150dc
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
Diffstat (limited to 'docs/part-1')
-rw-r--r-- | docs/part-1/1_install-client.md | 14 | ||||
-rw-r--r-- | docs/part-1/2-1_install-xds-server-docker.md | 152 | ||||
-rw-r--r-- | docs/part-1/2-2_install-xds-server-vm.md | 82 | ||||
-rw-r--r-- | docs/part-1/2-3_install-xds-server-native.md | 72 | ||||
-rw-r--r-- | docs/part-1/2_install-xds-server.md | 316 | ||||
-rw-r--r-- | docs/part-1/3_install-sdks.md | 2 | ||||
-rw-r--r-- | docs/part-1/4-1_build-first-app-setup.md | 26 | ||||
-rw-r--r-- | docs/part-1/4-2_build-first-app-cmd.md | 117 | ||||
-rw-r--r-- | docs/part-1/4-3_build-first-app-dashboard.md | 47 | ||||
-rw-r--r-- | docs/part-1/4-4_build-first-app-ide.md | 187 | ||||
-rw-r--r-- | docs/part-1/4_build-first-app.md | 384 | ||||
-rw-r--r-- | docs/part-1/5-1_debug-first-app-config.md | 76 | ||||
-rw-r--r-- | docs/part-1/5-2_debug-first-app-cmd.md | 69 | ||||
-rw-r--r-- | docs/part-1/5-3_debug-first-app-ide.md | 44 | ||||
-rw-r--r-- | docs/part-1/5_debug-first-app.md | 191 |
15 files changed, 901 insertions, 878 deletions
diff --git a/docs/part-1/1_install-client.md b/docs/part-1/1_install-client.md index 255401d..2e26c7c 100644 --- a/docs/part-1/1_install-client.md +++ b/docs/part-1/1_install-client.md @@ -75,7 +75,7 @@ sudo zypper install agl-xds-gdb XDS-agent is a client tool that must run on your local / user development machine when you use XDS. -For Linux distro, a user systemd service is provided, `xds-agent.service`. +For **Linux** distro, a user systemd service is provided, `xds-agent.service`. To start it automatically at boot and you can enable it using following commands: @@ -93,3 +93,15 @@ systemctl --user start xds-agent.service # Get status and log of xds-agent service systemctl --user status xds-agent.service ``` + +On **MacOS** (or Linux), you can start-it manually using following commands: + +```batch +/opt/AGL/bin/xds-agent +``` + +On **Windows**, you can start-it manually using following commands: + +```batch +C:\AGL\xds\xds-agent\xds-agent.exe +``` diff --git a/docs/part-1/2-1_install-xds-server-docker.md b/docs/part-1/2-1_install-xds-server-docker.md new file mode 100644 index 0000000..85d9340 --- /dev/null +++ b/docs/part-1/2-1_install-xds-server-docker.md @@ -0,0 +1,152 @@ +# Installation based on Docker container + +## 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 +wget -O - http://iot.bzh/download/public/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 +docker images "docker.automotivelinux.org/agl/worker-xds*" + +REPOSITORY TAG IMAGE ID CREATED SIZE +docker.automotivelinux.org/agl/worker-xds 5.0 877979e534ff 3 hours ago 106MB +``` + +## Create and start a new container + +Use provided script to create a new docker image and start a new container: + +```bash +# Get script +wget -O xds-docker-create-container.sh 'https://gerrit.automotivelinux.org/gerrit/gitweb?p=src/xds/xds-server.git;a=blob_plain;f=scripts/xds-docker-create-container.sh;hb=master' + +# Create new XDS worker container +bash ./xds-docker-create-container.sh + +# Check that new container is running +docker ps | grep worker-xds +f67079db4339 docker.automotivelinux.org/agl/worker-xds:5.0 "/usr/bin/wait_for..." About a minute ago Up 34 seconds 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-HOSTNAME-0-USERNAME +``` + +This container exposes following ports: + +| Port number | Description | +|-------------|---------------------------------------------| +| 8000 | `xds-server`: serve XDS webapp and REST API | +| 69 | TFTP | +| 2222 | ssh | + +This container also creates the following volumes (shared folders between +inside and outside docker): + +| Directory on host | Directory inside docker | Comment | +|-------------------|-------------------------|---------| +| $HOME/xds-workspace | /home/devel/xds-workspace | XDS projects workspace location| +| $HOME/xds-workspace/.xdt_0 | /xdt | location to store SDKs | +| $USER_VOLUME | $USER_VOLUME | user path, see `--volume` option of `xds-docker-create-container.sh` script | + +<!-- note --> +**Note:** + +You can add a new shared directory using `--volume` option in order +to use for example with Path-Mapping folder type. + +```bash +# Create new XDS worker container and share extra '$HOME/my-workspace' directory +bash ./xds-docker-create-container.sh --volume /my-workspace:$HOME/my-workspace +``` + +You can change docker used port with `-id` option + +```bash +# Create new XDS worker container with a different port number +bash ./xds-docker-create-container.sh -id ${ID} + +# Check that new container is running +docker ps | grep worker-xds +f67079db4339 docker.automotivelinux.org/agl/worker-xds:5.0 "/usr/bin/wait_for..." About a minute ago Up 34 seconds 0.0.0.0:(2222+ID)->22/tcp, 0.0.0.0:(69+ID)->69/udp, 0.0.0.0:(8000+ID)->8000/tcp, 0.0.0.0:(10809+ID)->10809/tcp agl-xds-HOSTNAME-ID-USERNAME +``` + +<!-- endnote --> + +### Manually setup docker user id + +<!-- note --> +**Note:** + +If you used `xds-docker-create-container.sh` script to create XDS +docker container, user uid/gid inside docker has already been changed by this script. +<!-- endnote --> + +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) +export CONTAINER_NAME=agl-xds-seb@laptop-0-seb +docker ps | grep -q ${CONTAINER_NAME} || echo "ERROR: No container name \"${CONTAINER_NAME}\" please set a valid CONTAINER_NAME before you continue" + +# First kill all processes of devel user (including running xds-server) +docker exec ${CONTAINER_NAME} bash -c "/bin/loginctl kill-user devel" + +# Change user and group id inside docker to match your ids +docker exec ${CONTAINER_NAME} bash -c "usermod -u $(id -u) devel" +docker exec ${CONTAINER_NAME} bash -c "groupmod -g $(id -g) devel" + +# Update some files ownership +docker exec ${CONTAINER_NAME} bash -c "chown -R devel:devel /home/devel /tmp/xds*" + +# Restart devel autologin service +docker exec ${CONTAINER_NAME} bash -c "systemctl restart autologin" + +# Restart xds-server as a service (ssh port 2222 may depend on your container ID) +ssh -p 2222 devel@localhost -- "systemctl --user restart xds-server" +``` + +## Check if xds-server is running (open XDS webapp) + +**`xds-server` is automatically started** as a service on container startup. + +If the container is running on your localhost, you can access to a basic web +application: + +```bash +xdg-open http://localhost:8000 +``` + +If needed you can status / stop / start it manually using following commands: + +```bash +# Status XDS server: +ssh -p 2222 devel@localhost systemctl --user status xds-server.service + +# Stop XDS server +ssh -p 2222 devel@localhost systemctl --user stop xds-server.service + +# Start XDS server +ssh -p 2222 devel@localhost systemctl --user start xds-server.service + +# Get XDS server logs +ssh -p 2222 devel@localhost journalctl --user --unit=xds-server.service --output=cat +``` + +`xds-server` is now up and running, you can now install AGL SDKs, please refer +to next chapter named [Installing AGL SDKs](./3_install-sdks.html) + +<!-- note --> +Please refer to [xds-server configuration](../part-2/1_xds-server/1_config.html) chapter for additional info about xds-server settings. +<!-- endnote --> diff --git a/docs/part-1/2-2_install-xds-server-vm.md b/docs/part-1/2-2_install-xds-server-vm.md new file mode 100644 index 0000000..c93d982 --- /dev/null +++ b/docs/part-1/2-2_install-xds-server-vm.md @@ -0,0 +1,82 @@ +# Installation based on Virtual Machine appliance + +## Virtual Machine appliance prerequisites + +> VirtualBox is installed on the host machine + +please refer to [VirtualBox documentation](https://www.virtualbox.org/wiki/Downloads) for more details. + +## Get the appliance + +Load the pre-build AGL SDK appliance image including `xds-server`: + +```bash +wget http://iot.bzh/download/public/XDS/appliance/xds-vm-debian9_latest.ova +``` + +## Clean old appliance + +You must have one and one xds appliance only. + +So, first remove the oldest xds appliance if needed. + +```bash +# Get the virtual machine name +VDS_VMNAME=$(VBoxManage list vms | grep xds-vm-debian | cut -d "\"" -f2) +echo ${VDS_VMNAME} + +# Remove old XDS appliance +[ -n ${VDS_VMNAME} ] && VBoxManage controlvm ${VDS_VMNAME} poweroff +[ -n ${VDS_VMNAME} ] && VBoxManage unregistervm ${VDS_VMNAME} --delete +``` + +## Create and start a new appliance + +Used provided script to create a new appliance or you can use VirtualBox GUI: + +```bash +# Import image into VirtualBox +VBoxManage import ./xds-vm-debian9_latest.ova + +# Check import result +VDS_VMNAME=$(VBoxManage list vms | grep xds-vm-debian | cut -d "\"" -f2) +echo ${VDS_VMNAME} + +# Start XDS appliance +[ -n ${VDS_VMNAME} ] && VBoxManage startvm ${VDS_VMNAME} +``` + +**Mandatory**: + +Add share folder to appliance, to allow files sharing using pathmap method: + +```bash +# Create local share folder +mkdir -p $HOME/xds-workspace + +#Add share folder to appliance +vboxmanage sharedfolder add ${VDS_VMNAME} --name XDS-workspace --hostpath $HOME/xds-workspace +``` + +## Appliance settings + +This image exposes following network ports (NAT mode): + +- 8000 : `xds-server` to serve XDS basic web page +- 69 : TFTP +- 2222 : ssh + +## 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 basic web page that gives you some instructions: + +```bash +# if container/appliance is running on your local host +# (else replace localhost by the name or the ip of the machine running the container) +xdg-open http://localhost:8000 +``` + +`xds-server` is now up and running, you can now install AGL SDKs, please refer +to next chapter named [Installing AGL SDKs](./3_install-sdks.html) diff --git a/docs/part-1/2-3_install-xds-server-native.md b/docs/part-1/2-3_install-xds-server-native.md new file mode 100644 index 0000000..ffdbc7c --- /dev/null +++ b/docs/part-1/2-3_install-xds-server-native.md @@ -0,0 +1,72 @@ +# Native installation + +You can chose to install xds-server 'natively' instead of within a docker +container but note that only Linux host OSes are supported and tested for native +installation ! + +## 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} +export DISTRO="xUbuntu_16.04" + +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-server +``` + +## Install packages for openSUSE distro type + +```bash +# DISTRO can be set to {openSUSE_Leap_42.2, openSUSE_Leap_42.3, openSUSE_Tumbleweed} +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-server +``` + +## Configure xds-server + +<!-- note --> +**Optional step**: skip this chapter if you plan to use default settings +<!-- endnote --> + +Please refer to [Configuration chapter of xds-server](../part-2/1_xds-server/1_config.html) +documentation for more details about JSON configuration file. + +## Start/Stop xds-server + +`xds-server` can be managed as a systemd service with the following commands: + +```bash +# Status XDS server: +systemctl --user status xds-server.service + +# Stop XDS server +systemctl --user stop xds-server.service + +# Start XDS server +systemctl --user start xds-server.service + +# Get XDS server logs +systemctl --user --unit=xds-server.service --output=cat +``` + +To check if xds-server is correctly install and running, you can access the web +interface, using a web browser : + +```bash +xdg-open http://localhost:8000 +``` + +or get the current version using the following curl command: + +```bash +curl http://localhost:8000/api/v1/version +``` diff --git a/docs/part-1/2_install-xds-server.md b/docs/part-1/2_install-xds-server.md index cbbca44..76afee3 100644 --- a/docs/part-1/2_install-xds-server.md +++ b/docs/part-1/2_install-xds-server.md @@ -13,316 +13,6 @@ Several installation types are supported: | Install type | Supported OS | Section to refer | |--------------|--------------|------------------| -| Container | Linux or MacOS | [see Installation based on Docker container](#installation-based-on-docker-container) | -| Virtual Machine | Linux, MacOS or Windows | [see Installation based on VirtualBox appliance](#installation-based-on-virtual-machine-appliance) | -| Native | Linux | [see Native installation](#native-installation) | - -## Installation based on Docker container - -### 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 -wget -O - http://iot.bzh/download/public/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 -docker images "docker.automotivelinux.org/agl/worker-xds*" - -REPOSITORY TAG IMAGE ID CREATED SIZE -docker.automotivelinux.org/agl/worker-xds 5.0 877979e534ff 3 hours ago 106MB -``` - -### Create and start a new container - -Use provided script to create a new docker image and start a new container: - -```bash -# Get script -wget -O xds-docker-create-container.sh 'https://gerrit.automotivelinux.org/gerrit/gitweb?p=src/xds/xds-server.git;a=blob_plain;f=scripts/xds-docker-create-container.sh;hb=master' - -# Create new XDS worker container -bash ./xds-docker-create-container.sh - -# Check that new container is running -docker ps | grep worker-xds -f67079db4339 docker.automotivelinux.org/agl/worker-xds:5.0 "/usr/bin/wait_for..." About a minute ago Up 34 seconds 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-HOSTNAME-0-USERNAME -``` - -This container exposes following ports: - -| Port number | Description | -|-------------|---------------------------------------------| -| 8000 | `xds-server`: serve XDS webapp and REST API | -| 69 | TFTP | -| 2222 | ssh | - -This container also creates the following volumes (shared folders between -inside and outside docker): - -| Directory on host | Directory inside docker | Comment | -|-------------------|-------------------------|---------| -| $HOME/xds-workspace | /home/devel/xds-workspace | XDS projects workspace location| -| $HOME/xds-workspace/.xdt_0 | /xdt | location to store SDKs | -| $USER_VOLUME | $USER_VOLUME | user path, see `--volume` option of `xds-docker-create-container.sh` script | - -<!-- note --> -**Note:** - -You can add a new shared directory using `--volume` option in order -to use for example with Path-Mapping folder type. - -```bash -# Create new XDS worker container and share extra '$HOME/my-workspace' directory -bash ./xds-docker-create-container.sh --volume /my-workspace:$HOME/my-workspace -``` - -You can change docker used port with `-id` option - -```bash -# Create new XDS worker container with a different port number -bash ./xds-docker-create-container.sh -id ${ID} - -# Check that new container is running -docker ps | grep worker-xds -f67079db4339 docker.automotivelinux.org/agl/worker-xds:5.0 "/usr/bin/wait_for..." About a minute ago Up 34 seconds 0.0.0.0:(2222+ID)->22/tcp, 0.0.0.0:(69+ID)->69/udp, 0.0.0.0:(8000+ID)->8000/tcp, 0.0.0.0:(10809+ID)->10809/tcp agl-xds-HOSTNAME-ID-USERNAME -``` - -<!-- endnote --> - -#### Manually setup docker user id - -<!-- note --> -**Note:** - -If you used `xds-docker-create-container.sh` script to create XDS -docker container, user uid/gid inside docker has already been changed by this script. -<!-- endnote --> - -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) -export CONTAINER_NAME=agl-xds-seb@laptop-0-seb -docker ps | grep -q ${CONTAINER_NAME} || echo "ERROR: No container name \"${CONTAINER_NAME}\" please set a valid CONTAINER_NAME before you continue" - -# First kill all processes of devel user (including running xds-server) -docker exec ${CONTAINER_NAME} bash -c "/bin/loginctl kill-user devel" - -# Change user and group id inside docker to match your ids -docker exec ${CONTAINER_NAME} bash -c "usermod -u $(id -u) devel" -docker exec ${CONTAINER_NAME} bash -c "groupmod -g $(id -g) devel" - -# Update some files ownership -docker exec ${CONTAINER_NAME} bash -c "chown -R devel:devel /home/devel /tmp/xds*" - -# Restart devel autologin service -docker exec ${CONTAINER_NAME} bash -c "systemctl restart autologin" - -# Restart xds-server as a service (ssh port 2222 may depend on your container ID) -ssh -p 2222 devel@localhost -- "systemctl --user restart xds-server" -``` - -### Check if xds-server is running (open XDS webapp) - -**`xds-server` is automatically started** as a service on container startup. - -If the container is running on your localhost, you can access to a basic web -application: - -```bash -xdg-open http://localhost:8000 -``` - -If needed you can status / stop / start it manually using following commands: - -```bash -# Status XDS server: -ssh -p 2222 devel@localhost systemctl --user status xds-server.service - -# Stop XDS server -ssh -p 2222 devel@localhost systemctl --user stop xds-server.service - -# Start XDS server -ssh -p 2222 devel@localhost systemctl --user start xds-server.service - -# Get XDS server logs -ssh -p 2222 devel@localhost journalctl --user --unit=xds-server.service --output=cat -``` - -`xds-server` is now up and running, you can now install AGL SDKs, please refer -to next chapter named [Installing AGL SDKs](3_install-sdks.html#installing-agl-sdks) - -<!-- note --> -Please refer to [part 2 - xds-server](../part-2/1_xds-server.html#sdk-cross-toolchain-management) documentation -for additional info. -<!-- endnote --> - -## Installation based on Virtual Machine appliance - -### Virtual Machine appliance prerequisites - -> VirtualBox is installed on the host machine - -please refer to [VirtualBox documentation](https://www.virtualbox.org/wiki/Downloads) for more details. - -### Get the appliance - -Load the pre-build AGL SDK appliance image including `xds-server`: - -```bash -wget http://iot.bzh/download/public/XDS/appliance/xds-vm-debian9_latest.ova -``` - -### Clean old appliance - -You must have one and one xds appliance only. - -So, first remove the oldest xds appliance if needed. - -```bash -# Get the virtual machine name -VDS_VMNAME=$(VBoxManage list vms | grep xds-vm-debian | cut -d "\"" -f2) -echo ${VDS_VMNAME} - -# Remove old XDS appliance -[ -n ${VDS_VMNAME} ] && VBoxManage controlvm ${VDS_VMNAME} poweroff -[ -n ${VDS_VMNAME} ] && VBoxManage unregistervm ${VDS_VMNAME} --delete -``` - -### Create and start a new appliance - -Used provided script to create a new appliance or you can use VirtualBox GUI: - -```bash -# Import image into VirtualBox -VBoxManage import ./xds-vm-debian9_latest.ova - -# Check import result -VDS_VMNAME=$(VBoxManage list vms | grep xds-vm-debian | cut -d "\"" -f2) -echo ${VDS_VMNAME} - -# Start XDS appliance -[ -n ${VDS_VMNAME} ] && VBoxManage startvm ${VDS_VMNAME} -``` - -**Mandatory**: - -Add share folder to appliance, to allow files sharing using pathmap method: - -```bash -# Create local share folder -mkdir -p $HOME/xds-workspace - -#Add share folder to appliance -vboxmanage sharedfolder add ${VDS_VMNAME} --name XDS-workspace --hostpath $HOME/xds-workspace -``` - -### Appliance settings - -This image exposes following network ports (NAT mode): - -- 8000 : `xds-server` to serve XDS basic web page -- 69 : TFTP -- 2222 : ssh - -## 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 basic web page that gives you some instructions: - -```bash -# if container/appliance is running on your local host -# (else replace localhost by the name or the ip of the machine running the container) -xdg-open http://localhost:8000 -``` - -`xds-server` is now up and running, you can now install AGL SDKs, please refer -to next chapter named [Installing AGL SDKs](3_install-sdks.html#installing-agl-sdks) - -## Native installation - -You can chose to install xds-server 'natively' instead of within a docker -container but note that only Linux host OSes are supported and tested for native -installation ! - -### 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} -export DISTRO="xUbuntu_16.04" - -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-server -``` - -### Install packages for openSUSE distro type - -```bash -# DISTRO can be set to {openSUSE_Leap_42.2, openSUSE_Leap_42.3, openSUSE_Tumbleweed} -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-server -``` - -### Configure xds-server - -<!-- note --> -**Optional step**: skip this chapter if you plan to use default settings -<!-- endnote --> - -Please refer to [Configuration chapter of xds-server](../part-2/1_xds-server.html#configuration) -documentation for more details about JSON configuration file. - -### Start/Stop xds-server - -`xds-server` can be managed as a systemd service with the following commands: - -```bash -# Status XDS server: -systemctl --user status xds-server.service - -# Stop XDS server -systemctl --user stop xds-server.service - -# Start XDS server -systemctl --user start xds-server.service - -# Get XDS server logs -systemctl --user --unit=xds-server.service --output=cat -``` - -To check if xds-server is correctly install and running, you can access the web -interface, using a web browser : - -```bash -xdg-open http://localhost:8000 -``` - -or get the current version using the following curl command: - -```bash -curl http://localhost:8000/api/v1/version -``` +| Container | Linux or MacOS | [see Installation based on Docker container](./2-1_install-xds-server-docker.html) | +| Virtual Machine | Linux, MacOS or Windows | [see Installation based on VirtualBox appliance](./2-2_install-xds-server-vm.html) | +| Native | Linux | [see Native installation](./2-3_install-xds-server-native.html) | diff --git a/docs/part-1/3_install-sdks.md b/docs/part-1/3_install-sdks.md index 67a6002..8fc0774 100644 --- a/docs/part-1/3_install-sdks.md +++ b/docs/part-1/3_install-sdks.md @@ -93,5 +93,5 @@ Note that you can abort installation by clicking on `CANCEL` button. ## More info -Please refer to [xds-server](../part-2/1_xds-server.html) chapter for more details +Please refer to [xds-server](../part-2/1_xds-server/0_abstract.html) chapter for more details about SDKs management. diff --git a/docs/part-1/4-1_build-first-app-setup.md b/docs/part-1/4-1_build-first-app-setup.md new file mode 100644 index 0000000..f974b9e --- /dev/null +++ b/docs/part-1/4-1_build-first-app-setup.md @@ -0,0 +1,26 @@ +# Setup + +Let's use _helloworld-native-application_ project as example, 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 +``` diff --git a/docs/part-1/4-2_build-first-app-cmd.md b/docs/part-1/4-2_build-first-app-cmd.md new file mode 100644 index 0000000..02de723 --- /dev/null +++ b/docs/part-1/4-2_build-first-app-cmd.md @@ -0,0 +1,117 @@ +# Build using command line tool + +## Declare project + +Use XDS command line tool named [xds-cli](../part-2/3_xds-cli/0_abstract.html) to declare your +project from command line and more precisely the `projects add` command +(short option: `prj add`). + +```bash +xds-cli prj add --label="Project_helloworld-native-application" --type=pm --path=/home/seb/xds-workspace/helloworld-native-application --server-path=/home/devel/xds-workspace/helloworld-native-application +``` + +> **Note:** option `--url=http://localhost:1234` may be added to `xds-cli` in +> order to set url of `xds-agent` in case of agent is not running on default +> port (for example here, 1234) + +## 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 `xds-cli` tool and `projects list` command (short: `prj ls`): + +```bash +xds-cli prj ls +ID Label LocalPath +f9904f70-d441-11e7-8c59-3c970e49ad9b Project_helloworld-service /home/seb/xds-workspace/helloworld-service +4021617e-ced0-11e7-acd2-3c970e49ad9b Project_helloworld-native-application /home/seb/xds-workspace/helloworld-native-application +``` + +XDS tools, including `xds-cli` are installed by default in `/opt/AGL/bin` +directory and this path has been added into your PATH variable. + +If it is not the case, just add it manually using `export PATH=${PATH}:/opt/AGL/bin` command line. + +Now to refer your project, just use --id option or use `XDS_PROJECT_ID` +environment variable. + +<!-- note --> +**Note:** + +Short id notation is also supported as soon as given id value is non ambiguous. + +For example, to refer to Project_helloworld-native-application project listed +in above command, you can simply use --id 40 instead of --id 4021617e-ced0-11e7-acd2-3c970e49ad9b +<!-- endnote --> + +You also need to determine the ID of the cross SDK you want to use to cross build +you application. + +To list installed SDK, use the following command: + +```bash +xds-cli sdks ls +List of installed SDKs: + ID NAME + 7aa19224-b769-3463-98b1-4c029d721766 aarch64 (3.99.1+snapshot) + 41a1efc4-8443-3fb0-afe5-8313e0c96efd corei7-64 (3.99.2+snapshot) + c226821b-b5c0-386d-94fe-19f807946d03 aarch64 (3.99.3) +``` + +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 +# Go into your project directory and create a build directory +cd $MY_PROJECT_DIR +mkdir build + +# Generate build system using cmake +xds-cli exec --id=4021617e --sdkid=c226821b -- "cd build && cmake .." + +# Build the project +xds-cli exec --id=4021617e --sdkid=c226821b -- "cd build && make all" +``` + +<!-- note --> +**Note:** If you use `&&`, `||` or `;` statement in the executed command line, +you need to double quote the command, for example `"cd build && make`. +<!-- endnote --> + +To avoid to set project id, sdks id, url, ... for each command line, you can +define these settings as environment variables within an env file and just set +`--config` option or source file before executing xds-cli command. + +Note that XDS creates a file named `xds-project.conf` (only if not already exists) +when you declare a new project using XDS Dashboard (or using `xds-cli prj add...`). +Edit this file if needed and then refer it with `--config` option. + +For example, the equivalence of above command is: + +```bash +# MY_PROJECT_DIR=/home/seb/xds-workspace/helloworld-native-application +cd $MY_PROJECT_DIR + +# Edit and potentially adapt xds-project.conf file that has been created +# automatically on project declaration using XDS Dashboard +cat xds-project.conf + # XDS project settings + export XDS_AGENT_URL=localhost:8800 + export XDS_PROJECT_ID=4021617e-ced0-11e7-acd2-3c970e49ad9b + export XDS_SDK_ID=c226821b-b5c0-386d-94fe-19f807946d03 + +# Create build directory and invoke cmake and then build project +xds-cli exec --config=./xds-project.conf -- "mkdir -p build && cd build && cmake .." +cd build && xds-cli exec --config=../xds-project.conf -- "make all" + +# Or equivalent by first sourcing conf file (avoid to set --config option) +source xds-project.conf +xds-cli exec "mkdir -p build && cd build && cmake .." +cd build && xds-cli exec "make all" +``` + +<!-- note --> +**Note:** all parameters after a double dash (--) are considered as the command +to execute. +<!-- endnote --> diff --git a/docs/part-1/4-3_build-first-app-dashboard.md b/docs/part-1/4-3_build-first-app-dashboard.md new file mode 100644 index 0000000..4519f54 --- /dev/null +++ b/docs/part-1/4-3_build-first-app-dashboard.md @@ -0,0 +1,47 @@ +# Build using XDS Dashboard + +## Declare project + +Use XDS Dashboard to declare your project. Open a browser and connect to XDS +Dashboard. + +URL depends of your config, for example `http://localhost:8800` + +Open the right sidebar and select `Projects` entry to open project page and then +create/declare a new project by with the plus icon: + +![](./pictures/xds-dashboard-icon-2.png){:: style="margin:auto; display:flex"} + +<!-- pagebreak --> + +Set `Sharing Type` and paths according to your needs. + +![](./pictures/xds-dashboard-prj-1.png){:: style="width:90%; max-width:560px; margin:auto; display:flex"} + +Note that XDS creates (if not already exists) a file named `xds-project.conf` +when you declare a new project. + +This file may be very useful when you plan to use XDS client tools such as `xds-cli` or `xds-gdb`. + +<!-- note --> +**Note:** + +When `Path mapping` type is selected, you must clone your project into +`$HOME/xds-workspace` directory (named **Local Path** in modal window). + +If XDS server is running in the XDS docker container (see [Installation based on Docker container](./2-1_install-xds-server-docker.html) ), +the **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 wherever you want on +your local disk. +<!-- endnote --> + +## Build from XDS dashboard + +Open the build page build entry of left sidebar ![](./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%; max-width:600px; margin:auto; display:flex"} diff --git a/docs/part-1/4-4_build-first-app-ide.md b/docs/part-1/4-4_build-first-app-ide.md new file mode 100644 index 0000000..c3c0cda --- /dev/null +++ b/docs/part-1/4-4_build-first-app-ide.md @@ -0,0 +1,187 @@ +# Build using a source code editor / IDE + +First create an XDS config file or reuse the previous one, 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-project.conf << EOF + export XDS_AGENT_URL=localhost:8800 + export XDS_PROJECT_ID=4021617e-ced0-11e7-acd2-3c970e49ad9b + export XDS_SDK_ID=c226821b-b5c0-386d-94fe-19f807946d03 +EOF +``` + +## NetBeans + +This chapter will show you how to create 2 configurations, one to compile your +project natively (using native GNU gcc) and one to cross-compile your project +using XDS. + +You can easily switch from one to other configuration using menu +**Run -> Set Project Configuration**. + +__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){:: style="width:90%; max-width:700px; margin:auto; display:flex"} + + - Then, you should set **Make Command** and **Debugger Command** to point to xds tools: + + ![Add new tool panel](./pictures/nb_xds_options.png){:: style="width:90%; max-width:700px; margin:auto; display:flex"} + + - Finally click on **OK** button. + +- Now create we first declare project into NetBeans and create first a native + configuration. To do that, open menu **File** -> **New Project** + +- Select **C/C++ Project with Existing Sources** ; + Click on **Next** button + +- Specify your project directory and set **Select Configuration Mode** to + **Custom**. Keep **Tool Collection** to **Default GNU** in order to create a + *native configuration* based on native GNU GCC. Finally click on **Next** button. + + ![Select Model panel](./pictures/nb_new-project-1.png){:: style="width:90%; max-width:700px; margin:auto; display:flex"} + +- Just update **Run in Folder** field and add `build_native` suffix so that + resulting build files will be located into `build_native` sub-directory. + Keep all others settings to default value and click on **Next** button. + + ![Select Model panel](./pictures/nb_new-project-2.png){:: style="width:90%; max-width:700px; margin:auto; display:flex"} + +- Click several times on **Next button** (always keep default settings) and + click on **Finish** button to complete creation of native configuration. + +- Now we will create a **cross configuration** based on XDS tools. + 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 Build category](./pictures/nb_new-project-3.png){:: style="width:90%; max-width:700px; margin:auto; display:flex"} + + - Click on **Set Active** button + + - Select **Pre-Build** sub-category, and set: + - Working Directory: `build_gen3` + - Command Line: `xds-cli exec -c ../xds-project.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-cli exec -c ../xds-project.conf -- make remote-target-populate` + - Clean Command: `xds-cli exec -c ../xds-project.conf -- make clean` + + ![Select Make sub-category](./pictures/nb_new-project-4.png){:: style="width:90%; max-width:700px; margin:auto; display:flex"} + + - Select **Run** sub-category, and set: + - Run Command: `target/start-on-root@renesas-gen3.sh` + - Run Directory: `build-gen3` + + ![Select Run sub-category](./pictures/nb_new-project-5.png){:: style="width:90%; max-width:700px; margin:auto; display:flex"} + + - 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 the 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` +command and you will see a list of task runner templates. + +And define your own tasks, here is an example to build +[helloworld-native-application](https://github.com/iotbzh/helloworld-native-application) +AGL helloworld application based on cmake template. + +```json +{ + "version": "2.0.0", + "type": "shell", + "presentation": { + "reveal": "always" + }, + "tasks": [ + { + "taskName": "clean", + "command": "/bin/rm -rf ${workspaceFolder}/build/* && mkdir -p build && echo Cleanup done.", + "problemMatcher": [] + }, + { + "taskName": "pre-build", + "group": "build", + "command": "/opt/AGL/bin/xds-cli exec --rpath build --config xds-project.conf -- cmake -DRSYNC_TARGET=root@renesas-gen3 -DRSYNC_PREFIX=/opt ../", + "problemMatcher": [ + "$gcc" + ] + }, + { + "taskName": "build", + "group": "build", + "command": "/opt/AGL/bin/xds-cli exec --rpath build --config xds-project.conf -- make widget", + "problemMatcher": [ + "$gcc" + ] + }, + { + "taskName": "populate", + "command": "/opt/AGL/bin/xds-cli exec --rpath build --config xds-project.conf -- make widget-target-install", + "problemMatcher": [] + } + ] +} +``` + +> **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/4_build-first-app.md b/docs/part-1/4_build-first-app.md index f6810d1..34f895b 100644 --- a/docs/part-1/4_build-first-app.md +++ b/docs/part-1/4_build-first-app.md @@ -6,386 +6,16 @@ (see previous chapter: [Installing XDS client tools](./1_install-client.html) ) - `xds-server` is running locally in a docker container or is accessible on your network (see previous chapter: [Installing XDS server](./2_install-xds-server.html)) -- one or more SDK have been installed (see previous chapter: [Installing AGL SDKs](3_install-sdks.html)) +- one or more SDK have been installed (see previous chapter: [Installing AGL SDKs](./3_install-sdks.html)) - XDS configuration is correct: in other words, connection is correctly established between `xds-agent` and `xds-server` and no error message is displayed when you open XDS Dashboard in a web browser. -## Setup +--- -Let's use _helloworld-native-application_ project as example, so you need first to clone -this project into a directory that will be accessible by `xds-server`. +Links to subchapters : -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 using XDS Dashboard - -Use XDS Dashboard to declare your project. Open a browser and connect to XDS -Dashboard. - -URL depends of your config, for example `http://localhost:8800` - -Open the right sidebar and select `Projects` entry to open project page and then -create/declare a new project by with the plus icon: - -![](./pictures/xds-dashboard-icon-2.png){:: style="margin:auto; display:flex"} - -<!-- pagebreak --> - -Set `Sharing Type` and paths according to your needs. - -![](./pictures/xds-dashboard-prj-1.png){:: style="width:90%; max-width:560px; margin:auto; display:flex"} - -Note that XDS creates (if not already exists) a file named `xds-project.conf` -when you declare a new project. - -This file may be very useful when you plan to use XDS client tools such as `xds-cli` or `xds-gdb`. - -<!-- note --> -**Note:** - -When `Path mapping` type is selected, you must clone your project into -`$HOME/xds-workspace` directory (named **Local Path** in modal window). - -If XDS server is running in the XDS docker container (see [Installation based on Docker container](./2_install-xds-server.html#installation-based-on-docker-container) ), -the **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 wherever you want on -your local disk. -<!-- endnote --> - -### Declare project from command line - -Use XDS command line tool named [xds-cli](./part2/3_xds-cli.html) to declare your -project from command line and more precisely the `projects add` command -(short option: `prj add`). - -```bash -xds-cli prj add --label="Project_helloworld-native-application" --type=pm --path=/home/seb/xds-workspace/helloworld-native-application --server-path=/home/devel/xds-workspace/helloworld-native-application -``` - -> **Note:** option `--url=http://localhost:1234` may be added to `xds-cli` in -> order to set url of `xds-agent` in case of agent is not running on default -> port (for example here, 1234) - -<!-- pagebreak --> - -## Build from XDS dashboard - -Open the build page build entry of left sidebar ![](./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%; max-width:600px; margin:auto; display:flex"} - -## 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 `xds-cli` tool and `projects list` command (short: `prj ls`): - -```bash -xds-cli prj ls -ID Label LocalPath -f9904f70-d441-11e7-8c59-3c970e49ad9b Project_helloworld-service /home/seb/xds-workspace/helloworld-service -4021617e-ced0-11e7-acd2-3c970e49ad9b Project_helloworld-native-application /home/seb/xds-workspace/helloworld-native-application -``` - -XDS tools, including `xds-cli` are installed by default in `/opt/AGL/bin` -directory and this path has been added into your PATH variable. - -If it is not the case, just add it manually using `export PATH=${PATH}:/opt/AGL/bin` command line. - -Now to refer your project, just use --id option or use `XDS_PROJECT_ID` -environment variable. - -<!-- note --> -**Note:** - -Short id notation is also supported as soon as given id value is non ambiguous. - -For example, to refer to Project_helloworld-native-application project listed -in above command, you can simply use --id 40 instead of --id 4021617e-ced0-11e7-acd2-3c970e49ad9b -<!-- endnote --> - -You also need to determine the ID of the cross SDK you want to use to cross build -you application. - -To list installed SDK, use the following command: - -```bash -xds-cli sdks ls -List of installed SDKs: - ID NAME - 7aa19224-b769-3463-98b1-4c029d721766 aarch64 (3.99.1+snapshot) - 41a1efc4-8443-3fb0-afe5-8313e0c96efd corei7-64 (3.99.2+snapshot) - c226821b-b5c0-386d-94fe-19f807946d03 aarch64 (3.99.3) -``` - -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 -# Go into your project directory and create a build directory -cd $MY_PROJECT_DIR -mkdir build - -# Generate build system using cmake -xds-cli exec --id=4021617e --sdkid=c226821b -- "cd build && cmake .." - -# Build the project -xds-cli exec --id=4021617e --sdkid=c226821b -- "cd build && make all" -``` - -<!-- note --> -**Note:** If you use `&&`, `||` or `;` statement in the executed command line, -you need to double quote the command, for example `"cd build && make`. -<!-- endnote --> - -To avoid to set project id, sdks id, url, ... for each command line, you can -define these settings as environment variables within an env file and just set -`--config` option or source file before executing xds-cli command. - -Note that XDS creates a file named `xds-project.conf` (only if not already exists) -when you declare a new project using XDS Dashboard (or using `xds-cli prj add...`). -Edit this file if needed and then refer it with `--config` option. - -For example, the equivalence of above command is: - -```bash -# MY_PROJECT_DIR=/home/seb/xds-workspace/helloworld-native-application -cd $MY_PROJECT_DIR - -# Edit and potentially adapt xds-project.conf file that has been created -# automatically on project declaration using XDS Dashboard -cat xds-project.conf - # XDS project settings - export XDS_AGENT_URL=localhost:8800 - export XDS_PROJECT_ID=4021617e-ced0-11e7-acd2-3c970e49ad9b - export XDS_SDK_ID=c226821b-b5c0-386d-94fe-19f807946d03 - -# Create build directory and invoke cmake and then build project -xds-cli exec --config=./xds-project.conf -- "mkdir -p build && cd build && cmake .." -cd build && xds-cli exec --config=../xds-project.conf -- "make all" - -# Or equivalent by first sourcing conf file (avoid to set --config option) -source xds-project.conf -xds-cli exec "mkdir -p build && cd build && cmake .." -cd build && xds-cli exec "make all" -``` - -<!-- note --> -**Note:** all parameters after a double dash (--) are considered as the command -to execute. -<!-- endnote --> - -## Build from IDE - -First create an XDS config file or reuse the previous one, 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-project.conf << EOF - export XDS_AGENT_URL=localhost:8800 - export XDS_PROJECT_ID=4021617e-ced0-11e7-acd2-3c970e49ad9b - export XDS_SDK_ID=c226821b-b5c0-386d-94fe-19f807946d03 -EOF -``` - -### NetBeans - -This chapter will show you how to create 2 configurations, one to compile your -project natively (using native GNU gcc) and one to cross-compile your project -using XDS. - -You can easily switch from one to other configuration using menu -**Run -> Set Project Configuration**. - -__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){:: style="width:90%; max-width:700px; margin:auto; display:flex"} - - - Then, you should set **Make Command** and **Debugger Command** to point to xds tools: - - ![Add new tool panel](./pictures/nb_xds_options.png){:: style="width:90%; max-width:700px; margin:auto; display:flex"} - - - Finally click on **OK** button. - -- Now create we first declare project into NetBeans and create first a native - configuration. To do that, open menu **File** -> **New Project** - -- Select **C/C++ Project with Existing Sources** ; - Click on **Next** button - -- Specify your project directory and set **Select Configuration Mode** to - **Custom**. Keep **Tool Collection** to **Default GNU** in order to create a - *native configuration* based on native GNU GCC. Finally click on **Next** button. - - ![Select Model panel](./pictures/nb_new-project-1.png){:: style="width:90%; max-width:700px; margin:auto; display:flex"} - -- Just update **Run in Folder** field and add `build_native` suffix so that - resulting build files will be located into `build_native` sub-directory. - Keep all others settings to default value and click on **Next** button. - - ![Select Model panel](./pictures/nb_new-project-2.png){:: style="width:90%; max-width:700px; margin:auto; display:flex"} - -- Click several times on **Next button** (always keep default settings) and - click on **Finish** button to complete creation of native configuration. - -- Now we will create a **cross configuration** based on XDS tools. - 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 Build category](./pictures/nb_new-project-3.png){:: style="width:90%; max-width:700px; margin:auto; display:flex"} - - - Click on **Set Active** button - - - Select **Pre-Build** sub-category, and set: - - Working Directory: `build_gen3` - - Command Line: `xds-cli exec -c ../xds-project.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-cli exec -c ../xds-project.conf -- make remote-target-populate` - - Clean Command: `xds-cli exec -c ../xds-project.conf -- make clean` - - ![Select Make sub-category](./pictures/nb_new-project-4.png){:: style="width:90%; max-width:700px; margin:auto; display:flex"} - - - Select **Run** sub-category, and set: - - Run Command: `target/start-on-root@renesas-gen3.sh` - - Run Directory: `build-gen3` - - ![Select Run sub-category](./pictures/nb_new-project-5.png){:: style="width:90%; max-width:700px; margin:auto; display:flex"} - - - 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 the 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` -command and you will see a list of task runner templates. - -And define your own tasks, here is an example to build -[helloworld-native-application](https://github.com/iotbzh/helloworld-native-application) -AGL helloworld application based on cmake template. - -```json -{ - "version": "2.0.0", - "type": "shell", - "presentation": { - "reveal": "always" - }, - "tasks": [ - { - "taskName": "clean", - "command": "/bin/rm -rf ${workspaceFolder}/build/* && mkdir -p build && echo Cleanup done.", - "problemMatcher": [] - }, - { - "taskName": "pre-build", - "group": "build", - "command": "/opt/AGL/bin/xds-cli exec --rpath build --config xds-project.conf -- cmake -DRSYNC_TARGET=root@renesas-gen3 -DRSYNC_PREFIX=/opt ../", - "problemMatcher": [ - "$gcc" - ] - }, - { - "taskName": "build", - "group": "build", - "command": "/opt/AGL/bin/xds-cli exec --rpath build --config xds-project.conf -- make widget", - "problemMatcher": [ - "$gcc" - ] - }, - { - "taskName": "populate", - "command": "/opt/AGL/bin/xds-cli exec --rpath build --config xds-project.conf -- make widget-target-install", - "problemMatcher": [] - } - ] -} -``` - -> **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...* +- [Setup](./4-1_build-first-app-setup.html) +- [Build using command line tool](./4-2_build-first-app-cmd.html) +- [Build using XDS Dashboard](./4-3_build-first-app-dashboard.html) +- [Build using a source code editor / IDE](./4-4_build-first-app-ide.html) diff --git a/docs/part-1/5-1_debug-first-app-config.md b/docs/part-1/5-1_debug-first-app-config.md new file mode 100644 index 0000000..8743bc1 --- /dev/null +++ b/docs/part-1/5-1_debug-first-app-config.md @@ -0,0 +1,76 @@ +# 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 configuration file: + +```bash +# for example: +# MY_PROJECT_DIR=/home/seb/xds-workspace/helloworld-native-application +cat > $MY_PROJECT_DIR/xds-gen3.conf << EOF +export XDS_AGENT_URL=localhost:8800 +export XDS_PROJECT_ID=4021617e-ced0-11e7-acd2-3c970e49ad9b +export XDS_SDK_ID=c226821b-b5c0-386d-94fe-19f807946d03 +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 mode. + +`XDS_PROJECT_ID` *(mandatory in XDS mode)* + +Project ID you want to build + +`XDS_RPATH` + +Relative path into project + +`XDS_SDK_ID` *(mandatory in XDS mode)* + +Cross Sdk ID to use to build project + +`XDS_AGENT_URL` + +Local XDS agent url (default `http://localhost:8800`) + +## 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=4021617e-ced0-11e7-acd2-3c970e49ad9b + # :XDS-ENV: XDS_SDK_ID=c226821b-b5c0-386d-94fe-19f807946d03 +``` diff --git a/docs/part-1/5-2_debug-first-app-cmd.md b/docs/part-1/5-2_debug-first-app-cmd.md new file mode 100644 index 0000000..8d0d764 --- /dev/null +++ b/docs/part-1/5-2_debug-first-app-cmd.md @@ -0,0 +1,69 @@ +# Debug 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 using XDS (see [Create your first AGL application](./4_build-first-app.html) for more details). + +So to debug it you need to have the XDS agent - server chain in place and +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-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 +#optional if not default value: XDS_AGENT_URL=http://localhost:8800 +XDS_PROJECT_ID=IW7B4EE-DBY4Z74_myProject +XDS_SDK_ID=poky-agl_aarch64_4.0.1 +EOF + +# Tell to xds-cli 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-cli exec -- cmake -DRSYNC_TARGET=root@myTarget .. +xds-cli exec -- make +xds-cli 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. diff --git a/docs/part-1/5-3_debug-first-app-ide.md b/docs/part-1/5-3_debug-first-app-ide.md new file mode 100644 index 0000000..0473892 --- /dev/null +++ b/docs/part-1/5-3_debug-first-app-ide.md @@ -0,0 +1,44 @@ +# Debug using xds-gdb within an IDE + +First the project you want to debug must be declared on an xds-server and this +project may also has been built using using XDS (see [Create your first AGL application](./4_build-first-app.html) for more details). + +## 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){:: style="width:90%; max-width:700px; margin:auto; display:flex"} + + - Then, you should set **Make Command** and **Debugger Command** to point to xds tools: + + ![Add new tool panel](./pictures/nb_xds_options.png){:: style="width:90%; max-width:700px; margin:auto; display:flex"} + + - 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){:: style="width:90%; max-width:700px; margin:auto; display:flex"} + + - 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/5_debug-first-app.md b/docs/part-1/5_debug-first-app.md index 01a183e..e1bdffd 100644 --- a/docs/part-1/5_debug-first-app.md +++ b/docs/part-1/5_debug-first-app.md @@ -13,191 +13,10 @@ Two debugging models are supported: By default XDS debug model is used and you need to define `XDS_NATIVE_GDB` variable to use native gdb debug mode instead. -## Configuration +--- - `xds-gdb` configuration is defined by variables (see listed below). - These variables may be set using : +Links to subchapters : -- 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 configuration file: - -```bash -# for example: -# MY_PROJECT_DIR=/home/seb/xds-workspace/helloworld-native-application -cat > $MY_PROJECT_DIR/xds-gen3.conf << EOF -export XDS_AGENT_URL=localhost:8800 -export XDS_PROJECT_ID=4021617e-ced0-11e7-acd2-3c970e49ad9b -export XDS_SDK_ID=c226821b-b5c0-386d-94fe-19f807946d03 -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 mode. - -`XDS_PROJECT_ID` *(mandatory in XDS mode)* - -Project ID you want to build - -`XDS_RPATH` - -Relative path into project - -`XDS_SDK_ID` *(mandatory in XDS mode)* - -Cross Sdk ID to use to build project - -`XDS_AGENT_URL` - -Local XDS agent url (default `http://localhost:8800`) - -### 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=4021617e-ced0-11e7-acd2-3c970e49ad9b - # :XDS-ENV: XDS_SDK_ID=c226821b-b5c0-386d-94fe-19f807946d03 -``` - -## 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 using XDS (see [Create your first AGL application](./4_build-first-app.html) for more details). - -So to debug it you need to have the XDS agent - server chain in place and -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-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 -#optional if not default value: XDS_AGENT_URL=http://localhost:8800 -XDS_PROJECT_ID=IW7B4EE-DBY4Z74_myProject -XDS_SDK_ID=poky-agl_aarch64_4.0.1 -EOF - -# Tell to xds-cli 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-cli exec -- cmake -DRSYNC_TARGET=root@myTarget .. -xds-cli exec -- make -xds-cli 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){:: style="width:90%; max-width:700px; margin:auto; display:flex"} - - - Then, you should set **Make Command** and **Debugger Command** to point to xds tools: - - ![Add new tool panel](./pictures/nb_xds_options.png){:: style="width:90%; max-width:700px; margin:auto; display:flex"} - - - 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){:: style="width:90%; max-width:700px; margin:auto; display:flex"} - - - 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...* +- [Configuration](./5-1_debug-first-app-config.html) +- [xds-gdb from command line](./5-2_debug-first-app-cmd.html) +- [xds-gdb within an IDE](./5-3_debug-first-app-ide.html) |