<?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>undefined reference to `__device_dts_ord_131&amp;#39; error when building bme280 sample on nrf5340dk</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/98709/undefined-reference-to-__device_dts_ord_131-error-when-building-bme280-sample-on-nrf5340dk</link><description>Hello 
 
 I&amp;#39;m attempting to build the following sample bme280 programme on a nRF5340dk development board. 
 - ncs\v2.3.0\zephyr\samples\sensor\bme280 
 
 However, I&amp;#39;m getting the following error: 
 - undefined reference to `__device_dts_ord_131&amp;#39; 
 
 I</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 17 Apr 2023 13:39:34 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/98709/undefined-reference-to-__device_dts_ord_131-error-when-building-bme280-sample-on-nrf5340dk" /><item><title>RE: undefined reference to `__device_dts_ord_131' error when building bme280 sample on nrf5340dk</title><link>https://devzone.nordicsemi.com/thread/420797?ContentTypeID=1</link><pubDate>Mon, 17 Apr 2023 13:39:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c599d0dd-2f20-42ce-9805-87b8e31db218</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi Ron,&lt;/p&gt;
&lt;p&gt;There are some tips in Zephyr&amp;#39;s devicetree documentation here: &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.3.0/zephyr/build/dts/troubleshooting.html"&gt;Troubleshooting devicetree&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I can also share some tips about what I usually look for.&lt;/p&gt;
&lt;p&gt;The first thing I do is to look at the line referenced in the error message. For example, if I add things from the&amp;nbsp;bme280 sensor sample to blinky as you did (without adding&amp;nbsp;CONFIG_SENSOR) I get the following error:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;ncs/zephyr/samples/basic/blinky/src/main.c:83: undefined reference to `__device_dts_ord_131&amp;#39;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Sometimes this points to a line where the device is used directly. Then I will immediately know which device the issue is with and can start looking into configurations and devicetree for the device. Other times, as in this case, the line will be the end of a function where the device is used. This is not as helpful, but it might help you narrow down the possible devices.&lt;/p&gt;
&lt;p&gt;If I cannot figure out the device using the method above, I look in the generated devicetree files in the build directory for the device number from the error. In zephyr/samples/basic/blinky/build/zephyr/include/generated/devicetree_generated.h you can find a list of the nodes. In this case, the file shows me this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt; *   128 /soc/peripheral@40000000/qspi@2b000
 *   129 /soc/peripheral@40000000/qspi@2b000/mx25r6435f@0
 *   130 /soc/peripheral@40000000/spi@a000
 *   131 /soc/peripheral@40000000/spi@a000/bme280@0&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;So here I immediately see that device 131 is bme280, and thus I know that this must be the device causing the issue.&lt;/p&gt;
&lt;p&gt;After figuring out the device, the next thing is to figure out what the issue is. Then I look at the devicetree files to see if anything is missing. This could, for example, be that the device is not defined or the status is not &amp;quot;okay&amp;quot;. For this, I look at zephyr/samples/basic/blinky/build/zephyr/zephyr.dts, which contains the complete generated devicetree for the build, and sometimes compare it with the board and overlay files. If everything looks fine in the devicetree, I look at the configurations instead and figure out which configurations are needed and which are missing.&lt;/p&gt;
&lt;p&gt;I hope this helps!&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: undefined reference to `__device_dts_ord_131' error when building bme280 sample on nrf5340dk</title><link>https://devzone.nordicsemi.com/thread/420765?ContentTypeID=1</link><pubDate>Mon, 17 Apr 2023 12:27:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:89c4cc98-e4d1-4842-be4f-4c4db0abb382</guid><dc:creator>RoW</dc:creator><description>&lt;p&gt;Hello Marte&lt;/p&gt;
&lt;p&gt;Thanks for your reply.&lt;/p&gt;
&lt;p&gt;It works with that line included.&lt;/p&gt;
&lt;p&gt;Not sure how I missed that - I must have had another &amp;quot;prj.conf&amp;quot; open at the same time and copied that instead.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m interested to know: is there anyway to debug from the&amp;nbsp;&lt;span&gt;`__device_dts_ord_xxx&amp;#39;&lt;/span&gt;&amp;nbsp;errors?&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Ron&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: undefined reference to `__device_dts_ord_131' error when building bme280 sample on nrf5340dk</title><link>https://devzone.nordicsemi.com/thread/420401?ContentTypeID=1</link><pubDate>Fri, 14 Apr 2023 07:41:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ea05a91f-b41c-405f-95db-d571afe830b7</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi RoW,&lt;/p&gt;
&lt;p&gt;You need to enable sensor drivers by setting CONFIG_SENSOR=y in prj.conf.&lt;/p&gt;
&lt;p&gt;Errors on the form &amp;quot;undefined reference to `__device_dts_ord_131&amp;#39;&amp;quot; indicates that a devicetree node is not correctly defined. Causes can be a Kconfig option missing (such as CONFIG_SENSOR here), or that something is incorrect in devicetree, such as the device not being defined at all, or that it is missing status=&amp;quot;okay&amp;quot;.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>