<?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>nRF9160: AWS IoT Sample Application</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/68501/nrf9160-aws-iot-sample-application</link><description>Hi, 
 I am trying to run the nRF9160 AWS IoT sample - https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/nrf9160/aws_iot/README.html on an nRF9160 DK, but have had no luck. I have done all setup, but the code fails during AWS IoT</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 24 Nov 2020 16:09:54 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/68501/nrf9160-aws-iot-sample-application" /><item><title>RE: nRF9160: AWS IoT Sample Application</title><link>https://devzone.nordicsemi.com/thread/281644?ContentTypeID=1</link><pubDate>Tue, 24 Nov 2020 16:09:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:265310ba-2f20-48aa-a3ce-ee475d704d3d</guid><dc:creator>Zeedel</dc:creator><description>&lt;p&gt;Thanks for looking into this Didrik, and kindly informing the developers.&amp;nbsp;A great debugging experience would really be helpful, and allow us to self-serve in most cases.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160: AWS IoT Sample Application</title><link>https://devzone.nordicsemi.com/thread/281642?ContentTypeID=1</link><pubDate>Tue, 24 Nov 2020 15:58:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:008de4a2-e0ea-4381-8286-83267a5e1d58</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;I can confirm that I see the crash when calling aws_topics_populate both with no optimizations and with debug optimizations. The call does not crash when optimizing for size or speed.&lt;/p&gt;
&lt;p&gt;I haven&amp;#39;t yet found a good reason for why the crash happens, but I have informed the developers of that library.&lt;/p&gt;
&lt;p&gt;To me, it seems like aws_topics_populate is inlined in aws_iot_init when optimizing for speed or size. You can still step through the function, but it will look like you are inside the aws_iot_init function. This is exacerbated by the fact that aws_topics_populate is almost exclusively calls to snprintf, so most time would be spent there, rather than the few assembly instructions that &amp;quot;actually&amp;quot; come from aws_topics_populate.&lt;/p&gt;
&lt;p&gt;I can agree that it is not be best debugging experience, but other than the crash when not optimizing the code, I can not find anything wrong.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160: AWS IoT Sample Application</title><link>https://devzone.nordicsemi.com/thread/281170?ContentTypeID=1</link><pubDate>Fri, 20 Nov 2020 17:06:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:57b32d0e-9eb0-4d6d-bb78-21dd6db652ab</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;Hi, and sorry for the late response.&lt;/p&gt;
&lt;p&gt;It&amp;#39;s good to hear that you found the cause of the error.&lt;/p&gt;
&lt;p&gt;I haven&amp;#39;t been able to look much into why you are not able to step into the aws_topics_populate function, but I will do so early next week.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Didrik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160: AWS IoT Sample Application</title><link>https://devzone.nordicsemi.com/thread/280661?ContentTypeID=1</link><pubDate>Wed, 18 Nov 2020 15:25:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ec70709-c53d-4e14-977b-00a48fe3853d</guid><dc:creator>Zeedel</dc:creator><description>&lt;p&gt;Quick update, it appears my client-id is long, so had to adjust&amp;nbsp;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&lt;strong&gt;CONFIG_AWS_IOT_CLIENT_ID_MAX_LEN&lt;/strong&gt;&lt;/span&gt;. I am no longer getting the error. However, I am yet to make sense why I was&amp;nbsp;unable to step into the&amp;nbsp;&lt;span&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&lt;strong&gt;aws_topics_populate&lt;/strong&gt;&lt;/span&gt; function. Would you be able to advise.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160: AWS IoT Sample Application</title><link>https://devzone.nordicsemi.com/thread/280653?ContentTypeID=1</link><pubDate>Wed, 18 Nov 2020 14:52:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2d0cacc9-5bd6-48f6-aa82-0d7788129a0e</guid><dc:creator>Zeedel</dc:creator><description>&lt;p&gt;Hi Didrik,&lt;/p&gt;
&lt;p&gt;Thanks for picking this up, and kindly getting back to me.&lt;/p&gt;
&lt;p&gt;I can confirm that &lt;span&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&lt;strong&gt;CONFIG_AWS_IOT_CLIENT_ID_APP&lt;/strong&gt;&lt;/span&gt;&amp;nbsp;&lt;/span&gt;is not set.&lt;/p&gt;
&lt;p&gt;The &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&lt;strong&gt;aws_iot_init&lt;/strong&gt;&lt;/span&gt; implementation is as follows:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;int aws_iot_init(const struct aws_iot_config *const config,
		 aws_iot_evt_handler_t event_handler)
{
	int err;

	if (IS_ENABLED(CONFIG_AWS_IOT_CLIENT_ID_APP) &amp;amp;&amp;amp;
	    config-&amp;gt;client_id_len &amp;gt;= CONFIG_AWS_IOT_CLIENT_ID_MAX_LEN) {
		LOG_ERR(&amp;quot;Client ID string too long&amp;quot;);
		return -EMSGSIZE;
	}

	if (IS_ENABLED(CONFIG_AWS_IOT_CLIENT_ID_APP) &amp;amp;&amp;amp;
	    config-&amp;gt;client_id == NULL) {
		LOG_ERR(&amp;quot;Client ID not set in the application&amp;quot;);
		return -ENODATA;
	}

	err = aws_iot_topics_populate(config-&amp;gt;client_id, config-&amp;gt;client_id_len);
	if (err) {
		LOG_ERR(&amp;quot;aws_topics_populate, error: %d&amp;quot;, err);
		return err;
	}

#if defined(CONFIG_AWS_FOTA)
	err = aws_fota_init(&amp;amp;client, aws_fota_cb_handler);
	if (err) {
		LOG_ERR(&amp;quot;aws_fota_init, error: %d&amp;quot;, err);
		return err;
	}
#endif

	module_evt_handler = event_handler;

	return err;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;so if a NULL argument is passed for &lt;strong&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;aws_iot_config*&lt;/span&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;config-&amp;gt;client_id&lt;/span&gt;&lt;/strong&gt; evaluates to garbage I would assume but as you correctly stated is not used inside&amp;nbsp;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&lt;strong&gt;aws_iot_topics_populate.&lt;/strong&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I tried debugging into&amp;nbsp;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&lt;strong&gt;aws_iot_topics_populate&lt;/strong&gt;&lt;/span&gt; to see where the failure is happening but for some reason the debugger won&amp;#39;t step into the C function. Here&amp;#39;s a screenshot of what I get:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/config_5F00_debug_5F00_optimizations_5F00_disabled.png" /&gt;&lt;/p&gt;
&lt;p&gt;I thought the reason may be due to optimisations done by the compiler, so I tried the below setting in &lt;strong&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;prj.conf&lt;/span&gt;&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_DEBUG_OPTIMIZATIONS=y&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;but still couldn&amp;#39;t step into the function. In fact, the code seems to crash... please see below:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/config_5F00_debug_5F00_optimizations_5F00_enabled.png" /&gt;&lt;/p&gt;
&lt;p&gt;Any suggestions / pointers?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160: AWS IoT Sample Application</title><link>https://devzone.nordicsemi.com/thread/280629?ContentTypeID=1</link><pubDate>Wed, 18 Nov 2020 13:45:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d0191823-da44-4135-a2c1-82ea4a97b678</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The sample seems to be working for me. I still get an error (when I call getaddrinfo, it does not find the hostname), but that is probably just an error on my end. Anyway, the error I get comes after the point where I should have seen your error, so the call to aws_iot_init returns successfully.&lt;/p&gt;
&lt;p&gt;Looking at the code, the argument is not used in aws_topics_populate, unless you have set CONFIG_AWS_IOT_CLIENT_ID_APP. Do you know which call to snprintf fails in aws_topics_populate.&lt;/p&gt;
&lt;p&gt;As for the note, I think that it is only for when CONFIG_IOT_CLIENT_ID_APP is set. But I agree that the note is confusing, and I will talk to our developers to see if it can be improved.&lt;/p&gt;
&lt;p&gt;The socket will be created and set when you call aws_iot_connect, so you do not need to set that field yourself.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Didrik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>