labels missing from DTS in nRF Connect SDK 2.1.0

In nRF Connect SDK 2.1.0 the devices in the DTS file are missing the "label".

For example, in nRF Connect SDK 2.0.0:

gpio0: gpio@842500 {

        compatible = "nordic,nrf-gpio";

        gpio-controller;

        reg = <0x842500 0x300>;

        #gpio-cells = <2>;

        label = "GPIO_0";

        status = "disabled";

        port = <0>;

};

But in nRF Connect SDK 2.1.0:

gpio0: gpio@842500 {

        compatible = "nordic,nrf-gpio";

        gpio-controller;

        reg = <0x842500 0x300>;

        #gpio-cells = <2>;

        status = "disabled";

        port = <0>;

};

This breaks code that does dynamic lookup of the device using the function device_get_binding (in my case passing in a string that is constructed at run time).

  • The developers recommend not using device_get_binding()

    However, it is strange that the Zephyr examples use strings with device_get_binding.

    For example:

    samples\boards\nrf\nrf53_sync_rtc\net\src\main.c
    67: ipm_dev = device_get_binding("IPM_2");

    samples\drivers\flash_shell\src\main.c
    const char *name;
    name = argv[1];
    714: dev = device_get_binding(name);

    samples\drivers\i2s\litex\src\main.c
    37: host_i2s_rx_dev = device_get_binding("i2s_rx");

    samples\sensor\thermometer\src\main.c
    17: temp_dev = device_get_binding("TEMP_0");

    samples\subsys\usb\hid\src\main.c
    154: hdev = device_get_binding("HID_0");

    samples\subsys\usb\hid-cdc\src\main.c
    550: hid0_dev = device_get_binding("HID_0");
    556: hid1_dev = device_get_binding("HID_1");

    samples\subsys\usb\hid-mouse\src\main.c
    249: hid_dev = device_get_binding("HID_0");

Related