Using NCS Docker image with JLink

Hi devzone,

I am starting to write some tests for my application, and I have a couple questions/remarks about the provided Docker image. Link to documentation.

1/ The first few tests I have written are done using the native_sim board. When I want to compile for this board using the Docker image, the container seems to be missing gcc and gcc-multilib. Manually installing them did the trick, but maybe there is a better way of doing this ?

2/ I am not able to properly install JLink, either in CI or manually. Here is my CI setup:

  build-and-test-in-docker:
    runs-on: ubuntu-24.04
    container:
      image: ghcr.io/nrfconnect/sdk-nrf-toolchain:v3.2.1
      options: --privileged
      env:
        ACCEPT_JLINK_LICENSE: 1
    defaults:
      run:
        # Bash shell is needed to set toolchain related environment variables in docker container
        # It is a workaround for GitHub Actions limitation https://github.com/actions/runner/issues/1964
        shell: bash

Note: the previous documentation link runs on ubuntu-22.04,the example application runs its CI on 24.04. I tried both, with the same results.

Here is the error I get when I manually create a container (but it is the same when using the container in CI):

> docker run --rm -ti --privileged -v ./..:/home -e ACCEPT_JLINK_LICENSE=1 --entrypoint bash ghcr.io/nrfconnect/sdk-nrf-toolchain:v3.2.1

To install JLink you have to accept following license

By accessing and using Software and Materials provided by SEGGER as free download, you acknowledge and agree to the following Terms of Use. If you do not agree to these Terms, do not download or use any Software or Material.

1) You agree that you will not use the Software or Material for any purpose that is unlawful or illegal.
2) You agree to use the Software only in accordance with the license regulations included in the Software.
3) You acknowledge that the Software and Material is provided by SEGGER on "as is" basis without any express or implied warranty of any kind.
4) You confirm that you are not a person, entity or organization designated by the European Community as a terrorist, terror organization or entity pursuant to the applicable European Council Regulations.
5) You confirm that you are not located in a prohibited or embargoed country and confirm that you will not ship, distribute, transfer and/or export our Software or Material to any prohibited or embargoed country as mentioned in any such European Union law or regulation.

Further information with regard to the listed persons, entities and organizations can be obtained from the official EU website. If there is any doubt if you are on this list it is strongly recommended to review such lists or get in touch with SEGGER prior download of any Software or Material.

Copyright (c) SEGGER Microcontroller GmbH

Do you accept these Terms of Use (y/n)? y
License accepted, Jlink will be installed
Selecting previously unselected package jlink.
(Reading database ... 28836 files and directories currently installed.)
Preparing to unpack /jlink/JLink_Linux.deb ...
Removing /opt/SEGGER/JLink ...
/opt/SEGGER/JLink not found (OK)
Unpacking jlink (8.76.0) ...
Setting up jlink (8.76.0) ...
Updating udev rules via udevadm...
Failed to reload udevadm rules, retrying...
Failed to send reload request: No such file or directory
Error: Failed to update udevadm rules.
dpkg: error processing package jlink (--install):
 installed jlink package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 jlink
root@0b8852859161:/# exit

I eventually intend to do on-device testing on a custom runner. I imagine JLink is needed for flashing the tests to the board ? Is there a way to have JLink be properly installed during container initialization ?

Thanks for your help,

Nicolas Goualard

Parents
  • Hi Nicolas,

    Question 1: Compiling

    You're correct, `gcc` is not installed and thus native_sim targets won't compile. When compiling against a non sim board (such as nrf54lm20dk/nrf54lm20a/cpuapp), it works, because the zephyr-arm variant of GCC is installed at /opt/ncs/toolchains/f911d4f4e7/opt/zephyr-sdk/arm-zephyr-eabi/bin.

    I'll let the relevant team know of this issue. At the moment, the best workaround, as you say, is probably to either

    A: Manually install gcc and gcc-multilib each time
    B: Create your own docker image based on ghcr.io/nrfconnect/sdk-nrf-toolchain

    Question 2: J-Link error

    This error is somewhat misleading. It's able to install JLink and then complains it can't reload the udev rules. Even though this error is printed, the JLink binaries are there and working (although the installation is in an error state). You can attempt this with `nrfutil device list` to see your connected devices. If JLink is not installed, it'll also print a warning. 

    I think this is a bug, I'll let the team know.

Reply
  • Hi Nicolas,

    Question 1: Compiling

    You're correct, `gcc` is not installed and thus native_sim targets won't compile. When compiling against a non sim board (such as nrf54lm20dk/nrf54lm20a/cpuapp), it works, because the zephyr-arm variant of GCC is installed at /opt/ncs/toolchains/f911d4f4e7/opt/zephyr-sdk/arm-zephyr-eabi/bin.

    I'll let the relevant team know of this issue. At the moment, the best workaround, as you say, is probably to either

    A: Manually install gcc and gcc-multilib each time
    B: Create your own docker image based on ghcr.io/nrfconnect/sdk-nrf-toolchain

    Question 2: J-Link error

    This error is somewhat misleading. It's able to install JLink and then complains it can't reload the udev rules. Even though this error is printed, the JLink binaries are there and working (although the installation is in an error state). You can attempt this with `nrfutil device list` to see your connected devices. If JLink is not installed, it'll also print a warning. 

    I think this is a bug, I'll let the team know.

Children
No Data
Related