Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

Can not compile sample program for my thingy:91 using nRF Connect SDK in Linux

I followed the different guides to install zephyr, nordic toolchain and nRF Connect SDK for VS Code, but I am unable to compile the RGB_LED sample program for my thingy:91 device.

I could compile and run hello world program, although I can not see any traffic in the serial monitor.

I tried so many things that I have lost track of the status of my VSCode install.

  • I am running kubuntu 22.04, not tested according the instructions, but this is the last LTS (Long Term Support), and it is very much in use in 2023.
  • The python version at the host level is python3.10, but I installed python3,.8 using the deadsnake repositories
  • I followed the video guide, this it means, I installed nRF Connect for Desktop, the Toolchain Manager, and the nRF Connect SDK (v2.2.0  and v2.3.0 recently released), VSCode and all the different nRF plugings, the JLink softwre and the nrf-command-line-tools.
  • I am creating a freestanding application based on zephyr/samples/hello_world, which generates de signed_app.hex firmware, and then zephyr/sample/basic/rgb_led, but I can not compile it.

This is the specific error I am getting if I compile from the command line using west:

quino@Quino:~/ncs/v2.3.0/zephyr/samples/hello_world$ west build -b nrf9160dk_nrf9160_ns
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base (cached)).
-- Application: /home/quino/ncs/v2.3.0/zephyr/samples/hello_world
-- Using NCS Toolchain 2.3.0 for building. (/home/quino/ncs/toolchains/v2.3.0/cmake)
-- Cache files will be written to: /home/quino/.cache/zephyr
-- Zephyr version: 3.2.99 (/home/quino/ncs/v2.3.0/zephyr)
-- Found west (found suitable version "1.0.0", minimum required is "0.7.1")
-- Board: nrf9160dk_nrf9160_ns, Revision: 0.7.0
CMake Error at /home/quino/ncs/v2.3.0/zephyr/cmake/modules/FindZephyr-sdk.cmake:56 (find_package):
  Could not find a package configuration file provided by "Zephyr-sdk"
  (requested version 0.15) with any of the following names:

    Zephyr-sdkConfig.cmake
    zephyr-sdk-config.cmake

  Add the installation prefix of "Zephyr-sdk" to CMAKE_PREFIX_PATH or set
  "Zephyr-sdk_DIR" to a directory containing one of the above files.  If
  "Zephyr-sdk" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  /home/quino/ncs/v2.3.0/zephyr/cmake/modules/FindHostTools.cmake:53 (find_package)
  /home/quino/ncs/v2.3.0/zephyr/cmake/modules/dts.cmake:8 (find_package)
  /home/quino/ncs/v2.3.0/zephyr/cmake/modules/zephyr_default.cmake:108 (include)
  /home/quino/ncs/v2.3.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  /home/quino/ncs/v2.3.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:97 (include_boilerplate)
  CMakeLists.txt:5 (find_package)


-- Configuring incomplete, errors occurred!
FATAL ERROR: command exited with status 1: /home/quino/.local/bin/cmake -DWEST_PYTHON=/usr/bin/python3.8 -B/home/quino/ncs/v2.3.0/zephyr/samples/hello_world/build -GNinja -S/home/quino/ncs/v2.3.0/zephyr/samples/hello_world

And this is the last lines of the OUTPUT Terminal inside VS-Code:

/home/quino/Documents/Sm4rtB10S1st3m/Nordic_Test/rgb_led/src/main.c:21:9: note: in expansion of macro 'PWM_DT_SPEC_GET'
   21 |         PWM_DT_SPEC_GET(DT_ALIAS(blue_pwm_led));
      |         ^~~~~~~~~~~~~~~
/home/quino/ncs/v2.3.0/zephyr/include/zephyr/devicetree.h:230:25: note: in expansion of macro 'DT_CAT'
  230 | #define DT_ALIAS(alias) DT_CAT(DT_N_ALIAS_, alias)
      |                         ^~~~~~
/home/quino/Documents/Sm4rtB10S1st3m/Nordic_Test/rgb_led/src/main.c:21:25: note: in expansion of macro 'DT_ALIAS'
   21 |         PWM_DT_SPEC_GET(DT_ALIAS(blue_pwm_led));
      |                         ^~~~~~~~
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /home/quino/ncs/toolchains/v2.3.0/usr/local/bin/cmake --build /home/quino/Documents/Sm4rtB10S1st3m/Nordic_Test/rgb_led/build

This is the output generated using the Generate Support Information

For help and support, visit the Nordic DevZone at https://devzone.nordicsemi.com/.

{
  "platform": {
    "os": "linux",
    "osVersion": "#36~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Feb 17 15:17:25 UTC 2",
    "osKernel": "5.19.0-35-generic",
    "vscode": "1.76.0",
    "electron": "19.1.11",
    "node": "v16.14.2"
  },
  "system": {
    "date": "2023-03-14T21:42:30.261Z",
    "vscodeRoot": "/usr/share/code/resources/app",
    "nrfConnectForDesktopInstalled": "unknown",
    "vscodeUptime": "01:16:40",
    "osUptime": "29:01:30",
    "cpu": {
      "model": "Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz",
      "speed": "1901 MHz",
      "count": 2
    },
    "memory": {
      "total": "7.65 GB",
      "free": "1.78 GB"
    }
  },
  "workspace": {
    "name": "Untitled (Workspace)",
    "workspaceFile": "1678702149315",
    "folders": [
      "/home/quino/Documents/Sm4rtB10S1st3m/Nordic_Test/hello_world",
      "/home/quino/Documents/Sm4rtB10S1st3m/Nordic_Test/rgb_led"
    ]
  },
  "extensions": {
    "internal": {
      "nordic-semiconductor.nrf-connect": {
        "version": "2023.2.56",
        "path": "/home/quino/.vscode/extensions/nordic-semiconductor.nrf-connect-2023.2.56-linux-x64",
        "isActive": true
      },
      "nordic-semiconductor.nrf-terminal": {
        "version": "2022.11.29",
        "path": "/home/quino/.vscode/extensions/nordic-semiconductor.nrf-terminal-2022.11.29",
        "isActive": true
      },
      "nordic-semiconductor.nrf-devicetree": {
        "version": "2022.11.153",
        "path": "/home/quino/.vscode/extensions/nordic-semiconductor.nrf-devicetree-2022.11.153",
        "isActive": true
      },
      "nordic-semiconductor.nrf-kconfig": {
        "version": "2022.11.50",
        "path": "/home/quino/.vscode/extensions/nordic-semiconductor.nrf-kconfig-2022.11.50",
        "isActive": true
      }
    },
    "external": {
      "marus25.cortex-debug": "1.10.0",
      "ms-vscode.cpptools": null,
      "ms-vscode.js-debug": "1.76.0",
      "ms-vscode.js-debug-companion": "1.0.18",
      "ms-vscode.vscode-js-profile-table": "1.0.3",
      "eamodio.gitlens": "13.3.2",
      "mcu-debug.debug-tracker-vscode": "0.0.14",
      "mcu-debug.memory-view": "0.0.20",
      "mcu-debug.rtos-views": "0.0.6",
      "ms-azuretools.vscode-docker": "1.24.0",
      "redhat.vscode-yaml": "1.12.1",
      "trond-snekvik.gnu-mapfiles": "1.1.0",
      "twxs.cmake": "0.0.17"
    }
  },
  "tools": {
    "/home/quino/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc": "0.15.2",
    "/opt/SEGGER/JLink/JLinkExe": "7.86a",
    "/usr/local/bin/nrfjprog": "10.19.0",
    "nrfutil": "Not found",
    "/home/quino/ncs/toolchains/v2.3.0/usr/local/bin/cmake": "3.20.5",
    "/home/quino/ncs/toolchains/v2.3.0/usr/local/bin/west": "0.14.0",
    "/home/quino/ncs/toolchains/v2.3.0/usr/local/bin/python3": "3.8.2",
    "/home/quino/ncs/toolchains/v2.3.0/usr/local/bin/ninja": "1.9.0",
    "/home/quino/ncs/toolchains/v2.3.0/usr/bin/gperf": "3.1",
    "/home/quino/ncs/toolchains/v2.3.0/usr/bin/dtc": "1.4.7",
    "/home/quino/ncs/toolchains/v2.3.0/opt/bin/gn": "1871",
    "/home/quino/ncs/toolchains/v2.3.0/usr/local/bin/git": "2.37.3",
    "gdbPath": "/home/quino/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gdb"
  },
  "sdks": [
    {
      "version": "2.3.0",
      "path": "/home/quino/ncs/v2.3.0"
    },
    {
      "version": "2.2.0",
      "path": "/home/quino/ncs/v2.2.0"
    }
  ],
  "toolchains": [
    {
      "version": "2.2.0",
      "path": "/home/quino/ncs/toolchains/v2.2.0"
    },
    {
      "version": "2.3.0",
      "path": "/home/quino/ncs/toolchains/v2.3.0"
    }
  ],
  "connectedDevices": [],
  "deviceProviders": [
    "nrfjprog"
  ],
  "config": {
    "nordic-semiconductor.nrf-connect": {
      "topdir": "${nrf-connect.sdk:2.3.0}",
      "toolchain": {
        "path": "${nrf-connect.toolchain:2.3.0}"
      },
      "ozonePath": "",
      "applications": [
        "${workspaceFolder}/blinky",
        "/home/quino/Documents/Sm4rtB10S1st3m/Nordic_Test/rgb_led",
        "${workspaceFolder}"
      ],
      "applicationOptions": {},
      "kconfig": {
        "interface": "kconfig",
        "executeInDefaultShell": false
      },
      "welcome": {
        "showOnStartup": true
      },
      "west": {
        "env": {
          "$base": "terminal"
        }
      },
      "boardRoots": [],
      "enableTelemetry": true,
      "taskBindings": {},
      "debugging": {
        "backend": "nRF Debug",
        "flash": true,
        "bindings": {}
      },
      "activeAppFollowActiveEditor": true
    },
    "nordic-semiconductor.nrf-terminal": {
      "terminalMode": "character",
      "scrollBack": 1000
    },
    "marus25.cortex-debug": {
      "armToolchainPath": null,
      "armToolchainPrefix": "arm-none-eabi",
      "gdbPath": null,
      "objdumpPath": null,
      "JLinkGDBServerPath": null,
      "openocdPath": null,
      "pyocdPath": null,
      "PEGDBServerPath": null,
      "stutilPath": null,
      "stlinkPath": null,
      "stm32cubeprogrammer": null,
      "enableTelemetry": true,
      "registerUseNaturalFormat": true,
      "variableUseNaturalFormat": true,
      "dbgServerLogfile": null,
      "showDevDebugOutput": "none"
    }
  },
  "environment": {
    "westExe": "west",
    "westEnv": {
      "ELECTRON_RUN_AS_NODE": "1",
      "GIT_EXEC_PATH": "/home/quino/ncs/toolchains/v2.3.0/usr/lib/git-core",
      "HOME": "/home/quino",
      "PATH": "/home/quino/ncs/toolchains/v2.3.0/usr/bin:/home/quino/ncs/toolchains/v2.3.0/usr/local/bin:/home/quino/ncs/toolchains/v2.3.0/opt/bin:/home/quino/ncs/toolchains/v2.3.0/opt/nanopb/generator-bin:/home/quino/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin:/home/quino/ncs/toolchains/v2.3.0/arm-zephyr-eabi/bin:/home/quino/.local/bin:/home/quino/ncs/v2.3.0/zephyr/scripts:/home/quino/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
      "ZEPHYR_BASE": "/home/quino/ncs/v2.3.0/zephyr",
      "GNUARMEMB_TOOLCHAIN_PATH": "/opt",
      "ZEPHYR_TOOLCHAIN_VARIANT": "zephyr",
      "ZEPHYR_SDK_INSTALL_DIR": "/home/quino/ncs/toolchains/v2.3.0/opt/zephyr-sdk",
      "PYTHONPATH": "/home/quino/ncs/toolchains/v2.3.0/usr/local/lib/python3.8/site-packages",
      "USER": "quino"
    },
    "inherited": {
      "ELECTRON_RUN_AS_NODE": "1",
      "HOME": "/home/quino",
      "PATH": "/home/quino/.local/bin:/home/quino/ncs/v2.3.0/zephyr/scripts:/home/quino/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
      "ZEPHYR_BASE": "/home/quino/ncs/v2.3.0/zephyr",
      "GNUARMEMB_TOOLCHAIN_PATH": "/opt",
      "ZEPHYR_TOOLCHAIN_VARIANT": "gnuarmemb",
      "PYTHONPATH": "/usr/lib/python3.8",
      "USER": "quino"
    },
    "toolchainPath": "/home/quino/ncs/toolchains/v2.3.0",
    "toolchainBinPath": "/home/quino/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin",
    "toolchainVersion": "2.3.0"
  },
  "terminal": {
    "shell": null,
    "defaultProfile": null
  }
}

Can you please hep me to finish the configuration, or rebuild my VSCode?

Why can I compile the hello world example, but not the rgb_led one?

Parents
  • Hi,

     

    This is the specific error I am getting if I compile from the command line using west:

    To build from the terminal, you need to setup the environment.

    Add this to your environment file (for instance ~/.bashrc):

    export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
    export ZEPHYR_SDK_INSTALL_DIR="/path/to/zephyr-sdk/zephyr-sdk-0.15.1/"

    And before you configure a project, you need to source the zephyr-env.sh:

    source /path/to/ncs/zephyr/zephyr-env.sh

     

    You can also add this "source .." to the .bashrc file if that is wanted.

     

    And this is the last lines of the OUTPUT Terminal inside VS-Code:

    The zephyr/samples/basic/rgb_led sample is by-default targeting another board than the thingy91, meaning that you will need to add specific DT overlay to match the expected LEDs. The sample expects DT defined "red-pwm-led" / "green-pwm-led" / "blue-pwm-led".

    This is done by creating the folder and file boards/thingy91_nrf9160_ns.overlay containing aliases:

    /{
        aliases {
            red-pwm-led = &pwm_led0;
            green-pwm-led = &pwm_led1;
            blue-pwm-led = &pwm_led2;
        };
    };

     

    Remember to re-generate the build (ie. delete the build folder, then create the build again) when adding new overlays.

    Could you try this?

     

    Kind regards,

    Håkon

  • Thank you, very informative. 

    I missed the installation of the Zephyr SDK as expained in the manual installation process.  https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.2.0/nrf/gs_installing.html#install-a-toolchain

    Concerning the automatic installation, shouldn´t this automatic process have installed the Zephyr SDK?, at least thie installation of the Zephyr SDK is not showed in the different videos I watched. From now on I will probably stick to the manual configuration process.

    After removing the build configuration, the application and even the workspace, I notice some gaps in the workspace definition, I can now compile the hello_world both from CLI and from VS-Code.

    Regarding the RGB_LED example, I introduced your definition of the color leds in the following path inside the app build folder:

    /home/quino/Documents/Sm4rtB10S1st3m/Nordic_Test/rgb_led/build/zephyr/boards/boards/arm/thingy91_nrf9160_ns folder

    But I am still getting same errors:

    /home/quino/Documents/Sm4rtB10S1st3m/Nordic_Test/rgb_led/src/main.c:21:25: note: in expansion of macro 'DT_ALIAS'
       21 |         PWM_DT_SPEC_GET(DT_ALIAS(blue_pwm_led));

    My question is: where exactly (full path) should I introduce the color led definitions in the device tree overlay

  • Hi,

     

    kinematik said:
    Concerning the automatic installation, shouldn´t this automatic process have installed the Zephyr SDK?

    We do not edit your environment for your chosen shell/terminal.

    We will however setup vscode with all the appropriate environmental variables, but if you want to use a terminal to build, you must setup the environment manually first.

     

    If you open the terminal from Toolchain Manager, then it will also append the environmental variables for you:

    However; I wanted to show you what I believe is the easiest way, so that you don't have to open a terminal from another application.

     

    kinematik said:
    My question is: where exactly (full path) should I introduce the color led definitions in the device tree overlay

    You should place that in /home/quino/Documents/Sm4rtB10S1st3m/Nordic_Test/rgb_led/boards/$(BOARD).overlay

    For the target of thingy91_nrf9160_ns, it will be: /home/quino/Documents/Sm4rtB10S1st3m/Nordic_Test/rgb_led/boards/thingy91_nrf9160_ns.overlay

     

    If you made changes directly to the ../ncs/nrf/boards/arm/thingy91_nrf9160/, I would recommend that you revert these changes first:

    cd /home/quino/ncs/v2.3.0/ncs/
    git checkout boards/arm/thingy91_nrf9160/*

     

    Kind regards,

    Håkon

  • Thank you very much, after creating a board directory inside my rgb_led app, and the overlay file that includes the three red_pwm_led, green_pwm_led, and blue_pwm_led definitions, I can compile and generate a valid signed_app.hex.

    However the the thingy91 doesn´t light up. I have compared the program folder to the Asset_Tracker_v2 folder, and I have found that in this last app, there is also a board folder, with an additional thingy_nrf9160_ns.conf file, including sensors/actuators configurations  like CONFIG_PWM and CONFIG_LED_PMW flags set to yes.

    My impression is that the rgb_led sample app needs additional configuration to work in the thingy91. I also created an app using as template the zephyr/samples/basic/blinky example, and the leds are flashing as expected, although I did not configure any overlay file for the thingy. 

    I am able now to run the sample apps, taking into consideration the thingy91 does not seem supported by all these sample programs.

    Thank you again, and no additional aclarations are needed.

    Kind Regards,

    Joaquin

  • Hi,

     

    kinematik said:

    Thank you very much, after creating a board directory inside my rgb_led app, and the overlay file that includes the three red_pwm_led, green_pwm_led, and blue_pwm_led definitions, I can compile and generate a valid signed_app.hex.

    However the the thingy91 doesn´t light up. I have compared the program folder to the Asset_Tracker_v2 folder, and I have found that in this last app, there is also a board folder, with an additional thingy_nrf9160_ns.conf file, including sensors/actuators configurations  like CONFIG_PWM and CONFIG_LED_PMW flags set to yes.

    My impression is that the rgb_led sample app needs additional configuration to work in the thingy91. I also created an app using as template the zephyr/samples/basic/blinky example, and the leds are flashing as expected, although I did not configure any overlay file for the thingy. 

    Glad to hear that other samples run as expected. I tried the rgb_led on my side, with the overlay that I previously posted, and it ran as expected.

    The difference between blinky and rgb_led is that blinky sets/clears a GPIO, while rgb_led uses PWM to control the LEDs.

     

    kinematik said:

    I am able now to run the sample apps, taking into consideration the thingy91 does not seem supported by all these sample programs.

    Thank you again, and no additional aclarations are needed.

    Feel free to contact us again if you run into any issues, or have questions!

     

    Kind regards,

    Håkon

Reply
  • Hi,

     

    kinematik said:

    Thank you very much, after creating a board directory inside my rgb_led app, and the overlay file that includes the three red_pwm_led, green_pwm_led, and blue_pwm_led definitions, I can compile and generate a valid signed_app.hex.

    However the the thingy91 doesn´t light up. I have compared the program folder to the Asset_Tracker_v2 folder, and I have found that in this last app, there is also a board folder, with an additional thingy_nrf9160_ns.conf file, including sensors/actuators configurations  like CONFIG_PWM and CONFIG_LED_PMW flags set to yes.

    My impression is that the rgb_led sample app needs additional configuration to work in the thingy91. I also created an app using as template the zephyr/samples/basic/blinky example, and the leds are flashing as expected, although I did not configure any overlay file for the thingy. 

    Glad to hear that other samples run as expected. I tried the rgb_led on my side, with the overlay that I previously posted, and it ran as expected.

    The difference between blinky and rgb_led is that blinky sets/clears a GPIO, while rgb_led uses PWM to control the LEDs.

     

    kinematik said:

    I am able now to run the sample apps, taking into consideration the thingy91 does not seem supported by all these sample programs.

    Thank you again, and no additional aclarations are needed.

    Feel free to contact us again if you run into any issues, or have questions!

     

    Kind regards,

    Håkon

Children
No Data
Related