<?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>Enabling logs in  Mbed TLS</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/116745/enabling-logs-in-mbed-tls</link><description>Hello! I am trying to monitor mbedtls heap usage in the azure_iot_hub sample (v2.8.0), building for nrf7002dk/nrf5340/cpuapp/ns. I can see in modules/crypto/mbedtls/library/memory_buffer_alloc.c that there is already some code that keeps track how many</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 11 Dec 2024 09:00:22 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/116745/enabling-logs-in-mbed-tls" /><item><title>RE: Enabling logs in  Mbed TLS</title><link>https://devzone.nordicsemi.com/thread/514440?ContentTypeID=1</link><pubDate>Wed, 11 Dec 2024 09:00:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:379a2926-0395-406e-aede-4069dbf2dc2f</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Yes, that is right. By default, heap is only included for debug builds, as discussed &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/102101/sbrk-c-undefined-reference-to-end-in-nrf-connect-sdk-v2-4-0"&gt;here&lt;/a&gt;&amp;nbsp;(making a debug build will oveflow the flash with logging enabled so you will also need to adjust the parittion layout to allow a larger TF-M flash size).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enabling logs in  Mbed TLS</title><link>https://devzone.nordicsemi.com/thread/513981?ContentTypeID=1</link><pubDate>Mon, 09 Dec 2024 09:35:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d6c703c3-4cd6-44d1-9a1a-686f87136f6f</guid><dc:creator>MarkoSagadin</dc:creator><description>&lt;p&gt;Hello!&lt;br /&gt;&lt;br /&gt;I confirmed on my side that the with applied changes from the linked PR the &lt;span style="font-family:inherit;font-size:inherit;"&gt;serial_lte_modem&lt;/span&gt; with enabled Mbed TLS logs compiles.&lt;br /&gt;&lt;br /&gt;The compile time &lt;code&gt;issued&lt;/code&gt; related to the&amp;nbsp; &lt;span style="font-family:inherit;font-size:inherit;"&gt;&lt;code&gt;undefined reference to `end&amp;#39;&lt;/code&gt;&lt;/span&gt; still persists. (I know that wasn&amp;#39;t expected from this PR.)&lt;span style="font-family:inherit;font-size:inherit;"&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enabling logs in  Mbed TLS</title><link>https://devzone.nordicsemi.com/thread/513156?ContentTypeID=1</link><pubDate>Tue, 03 Dec 2024 10:00:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d047b068-2318-46f2-9c5d-d739dad42ece</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I was mistaken earlier. This is a bug introduced in 2.8 due to a missing include folder. It is fixed in &lt;a href="https://github.com/nrfconnect/sdk-nrf/pull/19211"&gt;this pull request&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enabling logs in  Mbed TLS</title><link>https://devzone.nordicsemi.com/thread/512710?ContentTypeID=1</link><pubDate>Fri, 29 Nov 2024 10:20:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f30b178e-7284-413e-8d73-4b77ce916ee2</guid><dc:creator>MarkoSagadin</dc:creator><description>&lt;p&gt;Hello, thank you for your answer!&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;These configs are not relevant when using the nRF Connect SDK (there the mbed TLS that is used is the one in&amp;nbsp;modules/crypto/mbedtls/).&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Can you elaborate why they aren&amp;#39;t relevant? I assumed that they are since&amp;nbsp;&lt;code&gt;CONFIG_MBEDTLS_MEMORY_DEBUG&lt;/code&gt;, &lt;code&gt;CONFIG_MBEDTLS_DEBUG_C&lt;/code&gt; and &lt;code&gt;CONFIG_MBEDTLS_DEBUG_LEVEL&lt;/code&gt; are present in the &lt;code&gt;subsys/nrf_security/Kconfig.tls&lt;/code&gt;. The &lt;code&gt;CONFIG_MBEDTLS_DEBUG &lt;/code&gt;is only present in the Zephyr&lt;code&gt;.&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Since someone took care to create KConfig symbols for defines that were present in the Mbed TLS and used them, it seems to me that this worked at some point.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Perhaps a differnt approach could be to modify&amp;nbsp;nrf/subsys/nrf_security/src/zephyr/mbedtls_heap.c slightly to do the monitoring? If you just need to know the maximum heap usage, perhaps you can write a special pattern to&amp;nbsp;&lt;code&gt;mbedtls_heap&lt;/code&gt; and check with a debugger (in the same way as one traditionally check maximum stack usage)?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;That is a possible strategy. Another one would be to use the monitoring infrastructure that is already in place by defining &lt;code&gt;MEMORY_DEBUG&lt;/code&gt; at the top of the file and temporary remove all calls to mbed_printf (since they cause errors durring build).&lt;br /&gt;Then I could inspect the max allocated usage with gdb.&lt;br /&gt;&lt;br /&gt;I think that both of this approaches would work. But they are only workarounds for a thing that once did work. It would be nice if the root cause of this would be found and fixed.&lt;/p&gt;
&lt;div id="highlighter--hover-tools" style="display:none;"&gt;
&lt;div id="highlighter--hover-tools--container"&gt;
&lt;div class="highlighter--icon highlighter--icon-copy" title="Copy"&gt;&lt;/div&gt;
&lt;div class="highlighter--icon highlighter--icon-change-color" title="Change Color"&gt;&lt;/div&gt;
&lt;div class="highlighter--icon highlighter--icon-delete" title="Delete"&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id="highlighter--hover-tools" style="display:none;"&gt;
&lt;div id="highlighter--hover-tools--container"&gt;
&lt;div class="highlighter--icon highlighter--icon-copy" title="Copy"&gt;&lt;/div&gt;
&lt;div class="highlighter--icon highlighter--icon-change-color" title="Change Color"&gt;&lt;/div&gt;
&lt;div class="highlighter--icon highlighter--icon-delete" title="Delete"&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id="highlighter--hover-tools" style="display:none;"&gt;
&lt;div id="highlighter--hover-tools--container"&gt;
&lt;div class="highlighter--icon highlighter--icon-copy" title="Copy"&gt;&lt;/div&gt;
&lt;div class="highlighter--icon highlighter--icon-change-color" title="Change Color"&gt;&lt;/div&gt;
&lt;div class="highlighter--icon highlighter--icon-delete" title="Delete"&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enabling logs in  Mbed TLS</title><link>https://devzone.nordicsemi.com/thread/512698?ContentTypeID=1</link><pubDate>Fri, 29 Nov 2024 09:32:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ad3251f6-d16f-4389-a55d-edf5e0e40284</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;These configs are not relevant when using the nRF Connect SDK (there the mbed TLS that is used is the one in&amp;nbsp;modules/crypto/mbedtls/). The heap is implemented in &lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/252641c65b6d3e313b53c9886f3bc3c84f7d3863/subsys/nrf_security/src/zephyr/mbedtls_heap.c"&gt;nrf/subsys/nrf_security/src/zephyr/mbedtls_heap.c&lt;/a&gt;. Perhaps a differnt approach could be to modify&amp;nbsp;nrf/subsys/nrf_security/src/zephyr/mbedtls_heap.c slightly to do the monitoring? If you just need to know the maximum heap usage, perhaps you can write a special pattern to&amp;nbsp;&lt;code&gt;mbedtls_heap&lt;/code&gt; and check with a debugger (in the same way as one traditionally check maximum stack usage)?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>