<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>labels missing from DTS in nRF Connect SDK 2.1.0</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/92108/labels-missing-from-dts-in-nrf-connect-sdk-2-1-0</link><description>In nRF Connect SDK 2.1.0 the devices in the DTS file are missing the &amp;quot;label&amp;quot;. 
 For example, in nRF Connect SDK 2.0.0: 
 gpio0: gpio@842500 { 
 compatible = &amp;quot;nordic,nrf-gpio&amp;quot;; 
 gpio-controller; 
 reg = &amp;lt;0x842500 0x300&amp;gt;; 
 #gpio-cells = &amp;lt;2&amp;gt;; 
 label </description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 28 Sep 2022 11:20:37 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/92108/labels-missing-from-dts-in-nrf-connect-sdk-2-1-0" /><item><title>RE: labels missing from DTS in nRF Connect SDK 2.1.0</title><link>https://devzone.nordicsemi.com/thread/388328?ContentTypeID=1</link><pubDate>Wed, 28 Sep 2022 11:20:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0c7f80d3-aa06-41ef-bbeb-eea8dc1bd7ae</guid><dc:creator>Marko W</dc:creator><description>[quote userid="92402" url="~/f/nordic-q-a/92108/labels-missing-from-dts-in-nrf-connect-sdk-2-1-0/388147"]The developers recommend not using device_get_binding() [/quote]
&lt;p&gt;&lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b ChMk0b"&gt;&lt;span class="Q4iAWc"&gt;However, it is strange that the Zephyr examples use strings with device_get_binding.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;For example:&lt;/p&gt;
&lt;p&gt;samples\boards\nrf\nrf53_sync_rtc\net\src\main.c&lt;br /&gt; 67: ipm_dev = device_get_binding(&amp;quot;IPM_2&amp;quot;);&lt;/p&gt;
&lt;p&gt;samples\drivers\flash_shell\src\main.c&lt;br /&gt;const char *name;&lt;br /&gt;name = argv[1];&lt;br /&gt; 714: dev = device_get_binding(name);&lt;/p&gt;
&lt;p&gt;samples\drivers\i2s\litex\src\main.c&lt;br /&gt; 37: host_i2s_rx_dev = device_get_binding(&amp;quot;i2s_rx&amp;quot;);&lt;/p&gt;
&lt;p&gt;samples\sensor\thermometer\src\main.c&lt;br /&gt; 17: temp_dev = device_get_binding(&amp;quot;TEMP_0&amp;quot;);&lt;/p&gt;
&lt;p&gt;samples\subsys\usb\hid\src\main.c&lt;br /&gt; 154: hdev = device_get_binding(&amp;quot;HID_0&amp;quot;);&lt;/p&gt;
&lt;p&gt;samples\subsys\usb\hid-cdc\src\main.c&lt;br /&gt; 550: hid0_dev = device_get_binding(&amp;quot;HID_0&amp;quot;);&lt;br /&gt; 556: hid1_dev = device_get_binding(&amp;quot;HID_1&amp;quot;);&lt;/p&gt;
&lt;p&gt;samples\subsys\usb\hid-mouse\src\main.c&lt;br /&gt; 249: hid_dev = device_get_binding(&amp;quot;HID_0&amp;quot;);&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: labels missing from DTS in nRF Connect SDK 2.1.0</title><link>https://devzone.nordicsemi.com/thread/388196?ContentTypeID=1</link><pubDate>Tue, 27 Sep 2022 15:21:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cd9e1760-a993-4bb5-a4c5-99e9403b81de</guid><dc:creator>denis</dc:creator><description>&lt;p&gt;Sounds like Nordic does not want to keep the label property because it is confused with the node label. &amp;nbsp;I&amp;#39;m fine with that as I can implement my dynamic lookup by adding my own label properties to the device tree, etc.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: labels missing from DTS in nRF Connect SDK 2.1.0</title><link>https://devzone.nordicsemi.com/thread/388147?ContentTypeID=1</link><pubDate>Tue, 27 Sep 2022 12:52:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c9451335-777b-4e08-9adb-085ea4b38532</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The main reason the labels were removed is that they were, in most cases, incorrectly used as node labels.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The developers recommend not using device_get_binding() when wanting an application to have access to devices by some sort of name or similar. It is better to implement a custom solution, for example something like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;struct gpios {
   const char *name;
   const struct device *dev;
}

const struct gpios my_gpios = {
   { .name = &amp;quot;GPIO0&amp;quot;, .dev = DEVICE_DT_GET(DT_NODELABEL(gpio0)) },
   { .name = &amp;quot;GPIO1&amp;quot;, .dev = DEVICE_DT_GET(DT_NODELABEL(gpio1)) }
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;They do not recommend relying on the label property, nor using a workaround where this is added in devicetree.&lt;/p&gt;
&lt;p&gt;Is there any specific reason why you are using the ports directly in your code? You could also implement something that uses devicetree to describe devices properly (with gpio specs, etc.), use the device model, etc.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: labels missing from DTS in nRF Connect SDK 2.1.0</title><link>https://devzone.nordicsemi.com/thread/387612?ContentTypeID=1</link><pubDate>Fri, 23 Sep 2022 07:25:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0e478bb9-b54c-4a6c-9539-e8b769105d60</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You are correct that this does not solve the issue, since giving the node label at runtime does not work.&lt;/p&gt;
&lt;p&gt;I am not sure why the old labels were removed, as I see no reason why keeping them should be an issue. It does seem to have been intentional, yes. I found the commit (which you can see &lt;a href="https://github.com/nrfconnect/sdk-zephyr/commit/4c3cccbbf1505de8370f0435f9c44839b0722cf6"&gt;here&lt;/a&gt;), and that only says it was removed because the label properties are not required, no other reasoning. I agree that this is an issue, as even if it is a small change it is still a change which might break projects, as is the case here. This has been reported, and I will keep you informed if the developers provide any other reasons for the removal.&lt;/p&gt;
&lt;p&gt;I can think of two possible workarounds. One is to add the labels in an overlay or in your devicetree as you have done. The other is to use the entire device name in the string you form at runtime. This is most likely not a good workaround though, as the name will be something like &amp;quot;gpio@50000000&amp;quot;.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: labels missing from DTS in nRF Connect SDK 2.1.0</title><link>https://devzone.nordicsemi.com/thread/387324?ContentTypeID=1</link><pubDate>Wed, 21 Sep 2022 13:55:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:08bc92bb-7a05-460f-9bd5-fac9f18a4790</guid><dc:creator>denis</dc:creator><description>&lt;p&gt;As I noted in my original post, I&amp;#39;m forming the string to lookup the device at runtime. &amp;nbsp;So I can&amp;#39;t use the hard coded form you suggested above.&lt;/p&gt;
&lt;p&gt;I ended up adding the old lables back in my custom board dts so that things still work.&lt;/p&gt;
&lt;p&gt;Do you know&amp;nbsp;why the old labels were removed from v2.1.0? &amp;nbsp;Is that bug or was it intentional? &amp;nbsp;If so why?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: labels missing from DTS in nRF Connect SDK 2.1.0</title><link>https://devzone.nordicsemi.com/thread/387008?ContentTypeID=1</link><pubDate>Tue, 20 Sep 2022 08:03:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0b2692cc-80fe-4f58-b67d-8b7ab62f59f1</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The node still has its node label, so you can use that instead. For gpio0 you can for example do this:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;const struct device *dev;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;dev = device_get_binding(DEVICE_DT_NAME(DT_NODELABEL(gpio0)));&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>