<?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>attribute &amp;quot;section&amp;quot; does not apply to automatic variables</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/100990/attribute-section-does-not-apply-to-automatic-variables</link><description>getting this error 
 
 attribute &amp;quot;section&amp;quot; does not apply to automatic variables 
 
 when trying to define a thread using 
 
 
 K_THREAD_DEFINE ( blink0_id , STACKSIZE , blink0 , NULL , NULL , NULL , PRIORITY , 0 , 0 ); 
 
 
 why is this ?</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 02 Apr 2024 13:39:25 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/100990/attribute-section-does-not-apply-to-automatic-variables" /><item><title>RE: attribute "section" does not apply to automatic variables</title><link>https://devzone.nordicsemi.com/thread/476617?ContentTypeID=1</link><pubDate>Tue, 02 Apr 2024 13:39:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:04ecb7ec-19be-4f09-971d-8c97d0ded199</guid><dc:creator>ril3y</dc:creator><description>&lt;p&gt;I can confirm that K_THREAD_DEFINE does not work for creating a thread.&lt;/p&gt;
&lt;div class="hover-row"&gt;
&lt;div class="marker hover-contents"&gt;&lt;span&gt;attribute &amp;quot;section&amp;quot; does not apply to automatic variables&lt;/span&gt;&lt;span&gt;C/C++(1861)&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="hover-row markdown-hover"&gt;
&lt;div class="hover-contents code-hover-contents"&gt;
&lt;div class="rendered-markdown"&gt;
&lt;div data-code="id#296"&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: attribute "section" does not apply to automatic variables</title><link>https://devzone.nordicsemi.com/thread/432201?ContentTypeID=1</link><pubDate>Wed, 21 Jun 2023 07:48:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6922f06b-4691-4af7-aa86-33e4d0cc2783</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;I&amp;#39;m glad to hear that you found a way to fix your issue.&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s one of the&amp;nbsp;simplified thread samples which shows the ordering when using K_THREAD_DEFINE:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/main/samples/basic/threads/src/main.c#L111"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/main/samples/basic/threads/src/main.c#L111&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: attribute "section" does not apply to automatic variables</title><link>https://devzone.nordicsemi.com/thread/432087?ContentTypeID=1</link><pubDate>Tue, 20 Jun 2023 14:58:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b331ebbc-b770-4777-b4ab-d8dbbd0d0fe4</guid><dc:creator>sleeper</dc:creator><description>&lt;p&gt;yes it working if i used&amp;nbsp;&lt;span&gt;k_thread_create. I cannot get it to work using&amp;nbsp;K_THREAD_DEFINE macro&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: attribute "section" does not apply to automatic variables</title><link>https://devzone.nordicsemi.com/thread/432085?ContentTypeID=1</link><pubDate>Tue, 20 Jun 2023 14:53:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:33dd1a30-62bf-4b4b-8496-34c486ad1e1e</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Was the issue solved?&lt;/p&gt;
&lt;p&gt;It is a bit hard to see based on the code that you pasted.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: attribute "section" does not apply to automatic variables</title><link>https://devzone.nordicsemi.com/thread/431995?ContentTypeID=1</link><pubDate>Tue, 20 Jun 2023 11:56:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a3cc87ef-df38-405a-a79f-1a245301dfa3</guid><dc:creator>sleeper</dc:creator><description>&lt;p&gt;i&amp;#39;m now doing like this, as this works&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; struct&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;k_thread&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;gnss_thread_data&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; K_THREAD_STACK_DEFINE&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;gnss_thread_stack&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;GNSS_THREAD_STACK_SIZE&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;k_tid_t&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;thread_id&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;k_thread_create&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&amp;amp;&lt;/span&gt;&lt;span&gt;gnss_thread_data&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;gnss_thread_stack&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;K_THREAD_STACK_SIZEOF&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;gnss_thread_stack&lt;/span&gt;&lt;span&gt;),&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;gnss_thread&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;NULL&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;NULL&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;NULL&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;GNSS_THREAD_PRIORITY&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;K_NO_WAIT&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;if&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;!&lt;/span&gt;&lt;span&gt;thread_id&lt;/span&gt;&lt;span&gt;) &lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;LOG_DBG&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&amp;quot;ERROR spawning tx_thread&lt;/span&gt;&lt;span&gt;\n&lt;/span&gt;&lt;span&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: attribute "section" does not apply to automatic variables</title><link>https://devzone.nordicsemi.com/thread/431993?ContentTypeID=1</link><pubDate>Tue, 20 Jun 2023 11:54:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bfb330f1-e414-415d-a492-a9ddef94d609</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Are you declaring it within a function? Try moving it to the global scope.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>