diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 0a5684b2d9eb3d..3bb78f4ca03294 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -35,7 +35,8 @@ RUN apt-get -fy install git vim emacs sudo \ wget curl telnet \ docker.io \ iputils-ping net-tools \ - libncurses5 + libncurses5 \ + libpython2.7 RUN groupadd -g $USER_GID $USERNAME RUN useradd -s /bin/bash -u $USER_UID -g $USER_GID -G docker -m $USERNAME @@ -83,3 +84,5 @@ RUN sed -i '/^TIZEN_SDK_DATA_PATH/d' $TIZEN_SDK_ROOT/sdk.info \ && echo TIZEN_SDK_DATA_PATH=/home/$USERNAME/tizen-sdk-data >> $TIZEN_SDK_ROOT/sdk.info \ && ln -sf /home/$USERNAME/.tizen-cli-config $TIZEN_SDK_ROOT/tools/.tizen-cli-config \ && : # last line + +ENV TIZEN_ROOTFS /tizen_rootfs diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 7de88dd3bc868c..e80dfa78bded48 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -24,6 +24,7 @@ // Add the IDs of extensions you want installed when the container is created in the array below. "extensions": [ "aaron-bond.better-comments", + "augustocdias.tasks-shell-input", "christian-kohler.path-intellisense", "eamodio.gitlens", "editorconfig.editorconfig", diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 91adec5ed52ac8..6ce0339c697719 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -5,6 +5,7 @@ // List of extensions which should be recommended for users of this workspace. "recommendations": [ "aaron-bond.better-comments", + "augustocdias.tasks-shell-input", "christian-kohler.path-intellisense", "eamodio.gitlens", "editorconfig.editorconfig", diff --git a/.vscode/launch.json b/.vscode/launch.json index 3439327d84e5a2..77739937fc05a0 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -90,6 +90,39 @@ } ] }, + { + "name": "LightingApp (Tizen) [remote]", + "type": "cppdbg", + "request": "launch", + "cwd": "${workspaceFolder}/out/tizen-arm-light", + "program": "${workspaceFolder}/out/tizen-arm-light/chip-lighting-app", + "miDebuggerPath": "${env:TIZEN_SDK_ROOT}/tools/arm-linux-gnueabi-gcc-9.2/bin/arm-linux-gnueabi-gdb", + "additionalSOLibSearchPath": "${env:TIZEN_ROOTFS}", + "preLaunchTask": "Launch LightingApp with gdbserver attached (Tizen)", + "miDebuggerServerAddress": "localhost:9999", + "linux": { + "MIMode": "gdb" + }, + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + }, + { + "text": "set solib-absolute-prefix ${env:TIZEN_ROOTFS}" + }, + { + "text": "set sysroot ${env:TIZEN_SDK_SYSROOT}" + }, + { + "text": "set debug-file-directory {env:TIZEN_SDK_SYSROOT}/usr/lib/debug" + }, + { + "text": "set solib-search-path ${workspaceFolder}/out/tizen-arm-light" + } + ] + }, { "name": "Debug Mbed examples", diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 9f34c08e27a6af..20aff730a74613 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -192,6 +192,68 @@ "problemMatcher": { "base": "$gcc" } + }, + { + "label": "Build LightingApp (Tizen)", + "type": "shell", + "command": "scripts/run_in_build_env.sh", + "args": [ + "${workspaceFolder}/scripts/build/build_examples.py --target tizen-arm-light --enable-flashbundle build" + ], + "group": "build", + "problemMatcher": { + "base": "$gcc" + } + }, + { + "label": "Connect to device (Tizen)", + "type": "shell", + "command": "sdb", + "args": ["connect", "${input:tizenTargetDeviceAddress}"], + "problemMatcher": [], + "runOptions": { + "reevaluateOnRerun": false + } + }, + { + "label": "Install LightingApp (Tizen)", + "type": "shell", + "command": "sdb", + "args": [ + "-s", + "${input:tizenTargetDeviceAddressSdb}", + "install", + "${workspaceFolder}/out/tizen-arm-light/package/out/org.tizen.matter.example.lighting-1.0.0.tpk" + ], + "problemMatcher": [], + "runOptions": { + "reevaluateOnRerun": false + } + }, + { + "label": "Launch LightingApp with gdbserver attached (Tizen)", + "type": "shell", + "command": "bash", + "args": [ + "${workspaceFolder}/scripts/helpers/tizen_gdbserver_run.sh", + "--app-name", + "org.tizen.matter.example.lighting", + "--target", + "${input:tizenTargetDeviceAddressSdb}" + ], + "problemMatcher": [], + "runOptions": { + "reevaluateOnRerun": false + }, + "isBackground": false, + "presentation": { + "echo": true, + "reveal": "always", + "focus": false, + "panel": "dedicated", + "showReuseMessage": true, + "clear": true + } } ], "inputs": [ @@ -377,6 +439,21 @@ "telink-tlsr9518adk80d-light-switch", "tizen-arm-light" ] + }, + { + "type": "promptString", + "id": "tizenTargetDeviceAddress", + "description": "Enter the target device address and port in format
:" + }, + { + "id": "tizenTargetDeviceAddressSdb", + "type": "command", + "command": "shellCommand.execute", + "args": { + "command": "sdb devices | grep -v 'List of devices attached' |awk '{print $1 \"|\" $1, $3, \"(\" $2 \")\"}'", + "fieldSeparator": "|", + "description": "Select target device" + } } ] } diff --git a/examples/lighting-app/tizen/README.md b/examples/lighting-app/tizen/README.md index f2707b0e3f318f..4b9eea699f8d9c 100644 --- a/examples/lighting-app/tizen/README.md +++ b/examples/lighting-app/tizen/README.md @@ -12,11 +12,11 @@ Generating tizen-arm-light ```sh gn gen --check \ - --fail-on-unused-args \ - --export-compile-commands \ - --root=$PW_PROJECT_ROOT/examples/lighting-app/tizen \ - "--args=target_os=\"tizen\" target_cpu=\"arm\" tizen_sdk_root=\"$TIZEN_SDK_ROOT\" tizen_sdk_sysroot=\"$TIZEN_SDK_SYSROOT\"" \ - $PW_PROJECT_ROOT/out/tizen-arm-light + --fail-on-unused-args \ + --export-compile-commands \ + --root=$PW_PROJECT_ROOT/examples/lighting-app/tizen \ + "--args=target_os=\"tizen\" target_cpu=\"arm\" tizen_sdk_root=\"$TIZEN_SDK_ROOT\" tizen_sdk_sysroot=\"$TIZEN_SDK_SYSROOT\"" \ + $PW_PROJECT_ROOT/out/tizen-arm-light ``` Building tizen-arm-light @@ -33,16 +33,16 @@ author data as needed. ```sh $TIZEN_SDK_ROOT/tools/ide/bin/tizen certificate \ - --alias=CHIP \ - --name=CHIP \ - --email=chip@tizen.org \ - --password=chiptizen + --alias=CHIP \ + --name=CHIP \ + --email=chip@tizen.org \ + --password=chiptizen $TIZEN_SDK_ROOT/tools/ide/bin/tizen security-profiles add \ - --active \ - --name=CHIP \ - --author=$HOME/tizen-sdk-data/keystore/author/author.p12 \ - --password=chiptizen + --active \ + --name=CHIP \ + --author=$HOME/tizen-sdk-data/keystore/author/author.p12 \ + --password=chiptizen ``` This is only _one-time action_. To regenerate the author certificate and @@ -51,9 +51,9 @@ specified commands: ```sh rm -r \ - $HOME/tizen-sdk-data \ - $HOME/.tizen-cli-config \ - $HOME/.secretsdb + $HOME/tizen-sdk-data \ + $HOME/.tizen-cli-config \ + $HOME/.secretsdb ``` After that, normally call scripts to generate the author certificate and @@ -97,3 +97,50 @@ e.g.: ```sh app_launcher --start=org.tizen.matter.example.lighting discriminator 43 wifi true ``` + +## Vscode support + +To run all commands below `sdb` has to be installed on computer and available in +`PATH`. Also vscode has to have the `augustocdias.tasks-shell-input` extension +installed. + +### Tasks + +1. Build app: + +``` +open the Command Palette (Ctrl+Shift+P) -> + Tasks: Run Task -> + Build LightingApp (Tizen) +``` + +2. SDB connect to device: required to run Tizen commands below if device is + debugged over network + +``` +open the Command Palette (Ctrl+Shift+P) -> + Tasks: Run Task -> Connect to device (Tizen) -> + insert IP address and port +``` + +3. Install app: it is separated from build app step. + +``` +open the Command Palette (Ctrl+Shift+P) -> + Tasks: Run Task -> + Install LightingApp (Tizen) +``` + +4. Launch LightingApp with gdbserver attached: require to install app + previously. + +``` +open the Command Palette (Ctrl+Shift+P) -> + Tasks: Run Task -> + Launch LightingApp with gdbserver attached (Tizen) +``` + +### Debug + +To debug app using vscode gdbserver has to be available on the target device, +run `./scripts/helpers/tizen_gdbserver_run.sh --help` for more information. diff --git a/integrations/docker/images/chip-build-tizen/Dockerfile b/integrations/docker/images/chip-build-tizen/Dockerfile index cd3915b3b0e5d3..3ae8192ec138c9 100644 --- a/integrations/docker/images/chip-build-tizen/Dockerfile +++ b/integrations/docker/images/chip-build-tizen/Dockerfile @@ -44,6 +44,7 @@ RUN set -x \ http://download.tizen.org/sdk/tizenstudio/official/binary/certificate-generator_0.1.3_ubuntu-64.zip \ http://download.tizen.org/sdk/tizenstudio/official/binary/new-common-cli_2.5.7_ubuntu-64.zip \ http://download.tizen.org/sdk/tizenstudio/official/binary/new-native-cli_2.5.7_ubuntu-64.zip \ + http://download.tizen.org/sdk/tizenstudio/official/binary/sdb_4.2.23_ubuntu-64.zip \ # Install tizen studio CLI && unzip -o '*.zip' \ && cp -rf data/* $TIZEN_SDK_ROOT \ @@ -56,7 +57,7 @@ RUN set -x \ COPY secret-tool.py $TIZEN_SDK_ROOT/tools/certificate-encryptor/secret-tool RUN chmod 0755 $TIZEN_SDK_ROOT/tools/certificate-encryptor/secret-tool -ENV PATH="$TIZEN_SDK_ROOT/tools/ide/bin:$PATH" +ENV PATH="$TIZEN_SDK_ROOT/tools/ide/bin:$TIZEN_SDK_ROOT/tools:$PATH" # ------------------------------------------------------------------------------ # Get toolchain @@ -94,8 +95,11 @@ RUN set -x \ -A 'libffi-devel-*.armv7l.rpm' \ -A 'liblzma-*.armv7l.rpm' \ -A 'libmount-devel-*.armv7l.rpm' \ + -A 'libncurses6-*.armv7l.rpm' \ + -A 'libreadline-*.armv7l.rpm' \ -A 'libuuid-*.armv7l.rpm' \ -A 'pcre-devel-*.armv7l.rpm' \ + -A 'readline-devel-*.armv7l.rpm' \ -A 'xdgmime-*.armv7l.rpm' \ # Unified packages && wget --progress=dot:mega -r -nd --no-parent \ @@ -115,6 +119,7 @@ RUN set -x \ -A 'libcynara-commons-*.armv7l.rpm' \ -A 'libdns_sd-*.armv7l.rpm' \ -A 'libjson-glib-*.armv7l.rpm' \ + -A 'libsessiond-0*.armv7l.rpm' \ -A 'libsystemd-*.armv7l.rpm' \ -A 'libtzplatform-config-*.armv7l.rpm' \ -A 'parcel-0*.armv7l.rpm' \ @@ -134,10 +139,10 @@ RUN set -x \ # Install packages && unrpm *.rpm \ && cp -rf lib usr $TIZEN_SDK_SYSROOT \ - # Fix some symbolic links - && ln -sf libcap.so.2 $TIZEN_SDK_SYSROOT/usr/lib/libcap.so \ - && ln -sf libdns_sd.so.878.70.2 $TIZEN_SDK_SYSROOT/usr/lib/libdns_sd.so \ - && ln -sf libdns_sd.so.878.70.2 $TIZEN_SDK_SYSROOT/usr/lib/libdns_sd.so.878 \ + # Make symbolic links relative + && for LNK in $(find $TIZEN_SDK_SYSROOT/usr/lib -maxdepth 1 -type l); \ + do ln -sf $(basename $(readlink "$LNK")) "$LNK" ; done \ + && ln -sf ../../lib/libcap.so.2 $TIZEN_SDK_SYSROOT/usr/lib/libcap.so \ && ln -sf openssl1.1.pc $TIZEN_SDK_SYSROOT/usr/lib/pkgconfig/openssl.pc \ # Cleanup && rm -rf /tmp/workdir \ diff --git a/integrations/docker/images/chip-build/version b/integrations/docker/images/chip-build/version index db9cb06c063642..37c987396c50b9 100644 --- a/integrations/docker/images/chip-build/version +++ b/integrations/docker/images/chip-build/version @@ -1 +1 @@ -0.5.79 Version bump reason: [Ameba] Update ameba SDK to expose xPortResetHeapMinimumEverFreeHeapSize API +0.5.80 Version bump reason: [Tizen] Add vscode debug support diff --git a/scripts/helpers/tizen_gdbserver_run.sh b/scripts/helpers/tizen_gdbserver_run.sh new file mode 100755 index 00000000000000..e1fb8fa62a19ce --- /dev/null +++ b/scripts/helpers/tizen_gdbserver_run.sh @@ -0,0 +1,111 @@ +#!/bin/bash + +set -e + +GDBSERVER_DEFAULT_PORT=9999 +GDBSERVER_TARGET_PATH="/opt/usr/home/owner/share/tmp/sdk_tools/gdbserver" +RESULT_MODE="debug" +USAGE_INFO_MSG="See: $0 --help" + +function help() { + + cat <