<?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 coverage reports for device testing with nRF Connect SDK</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/90166/enabling-coverage-reports-for-device-testing-with-nrf-connect-sdk</link><description>This may just be more of a Zephyr question but wondering if anyone in the Nordic community has experience with this. 
 I&amp;#39;d like to generate code coverage reports when running tests using the Zephyr Test Framework (Ztest). This works well when testing</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 19 Aug 2022 07:33:23 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/90166/enabling-coverage-reports-for-device-testing-with-nrf-connect-sdk" /><item><title>RE: Enabling coverage reports for device testing with nRF Connect SDK</title><link>https://devzone.nordicsemi.com/thread/382383?ContentTypeID=1</link><pubDate>Fri, 19 Aug 2022 07:33:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5fc36758-8fab-4562-af5c-1e15a1378980</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;Thank you for providing your findings.&lt;br /&gt;&lt;br /&gt;I am really glad that you found the way to get the coverage report.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
[quote user="jpwright0"] So this issue can be closed, I will pursue a cleaner way of changing&amp;nbsp;the coverage heap size&amp;nbsp;with Zephyr team.[/quote]
&lt;p&gt;If you want, you can close the case now.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enabling coverage reports for device testing with nRF Connect SDK</title><link>https://devzone.nordicsemi.com/thread/382321?ContentTypeID=1</link><pubDate>Thu, 18 Aug 2022 15:37:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d1b6868e-e675-4da8-89e5-494929c06940</guid><dc:creator>Jason Wright</dc:creator><description>&lt;p&gt;Hi Dejan,&lt;/p&gt;
&lt;p&gt;Not quite, because although CONFIG_CPLUSPLUS provides a workaround for console output halting, I still could not get the coverage report.&lt;/p&gt;
&lt;p&gt;However,&amp;nbsp;digging on this further today, I discovered the heap&amp;nbsp;size for coverage data is hardcoded to 16384 bytes in Zephyr:&amp;nbsp;&lt;a href="https://github.com/zephyrproject-rtos/zephyr/blob/main/subsys/testsuite/coverage/coverage.c#L18"&gt;https://github.com/zephyrproject-rtos/zephyr/blob/main/subsys/testsuite/coverage/coverage.c#L18&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And occasionally that would be not enough to allocate the gcov buffer, resulting in &amp;quot;No Mem available to continue dump&amp;quot; being printed in the gcov files which breaks parsing.&lt;/p&gt;
&lt;p&gt;By manually increasing&amp;nbsp;MALLOC_MAX_HEAP_SIZE to 32768 bytes I was able to generate coverage reports for the attached sample. I also needed to increase CONFIG_MAIN_STACK_SIZE in prj.conf. So this issue can be closed, I will pursue a cleaner way of changing&amp;nbsp;the coverage heap size&amp;nbsp;with Zephyr team.&lt;/p&gt;
&lt;p&gt;Example attached, I was able to generate the coverage report on nrf5340dk by running&amp;nbsp;&lt;br /&gt;&lt;span&gt;twister -T . --device-testing --device-serial /dev/ttyACM2 --device-ser&lt;br /&gt;ial-baud 115200 -p nrf5340dk_nrf5340_cpuapp --coverage&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/hello_5F00_world_5F00_coverage.zip"&gt;devzone.nordicsemi.com/.../hello_5F00_world_5F00_coverage.zip&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enabling coverage reports for device testing with nRF Connect SDK</title><link>https://devzone.nordicsemi.com/thread/382258?ContentTypeID=1</link><pubDate>Thu, 18 Aug 2022 12:00:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fd2db113-6fed-4678-8eb5-77043191ae20</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;I have found the discussion related to your question on&amp;nbsp;Z&lt;span&gt;ephyr&amp;#39;s Discord #nordic channel. As mentioned there, the main issue is related to the RAM requirement.&lt;br /&gt;&lt;br /&gt;Is the reply that you got on Discord channel satisfactory?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enabling coverage reports for device testing with nRF Connect SDK</title><link>https://devzone.nordicsemi.com/thread/380522?ContentTypeID=1</link><pubDate>Mon, 08 Aug 2022 07:56:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0ae1ecfe-46f4-427f-9b5e-03be37d20d02</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;I am sorry for the delay. Due to vacation time, you may need to wait for the reply longer than initially expected. I&amp;#39;ll come back to you when I get new information, most probably in a week or two after August 15.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enabling coverage reports for device testing with nRF Connect SDK</title><link>https://devzone.nordicsemi.com/thread/378972?ContentTypeID=1</link><pubDate>Wed, 27 Jul 2022 15:50:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9518e1f0-ae4b-4015-b3ed-cd5c6cffe292</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;I have reported the issue internally.&lt;br /&gt;I&amp;#39;ll get back to you when I get new information, hopefully till the end of next week.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enabling coverage reports for device testing with nRF Connect SDK</title><link>https://devzone.nordicsemi.com/thread/378779?ContentTypeID=1</link><pubDate>Tue, 26 Jul 2022 16:39:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c64d7d2f-67e5-4fe0-b158-79e73415e467</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;I have reproduced the issue. I would need to investigate this further.&lt;br /&gt;I&amp;#39;ll come back to you with new information, hopefully till the end of this week.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enabling coverage reports for device testing with nRF Connect SDK</title><link>https://devzone.nordicsemi.com/thread/378574?ContentTypeID=1</link><pubDate>Mon, 25 Jul 2022 15:35:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0c1b82fa-8b8f-47e5-a78b-c115e401419c</guid><dc:creator>Jason Wright</dc:creator><description>&lt;p&gt;Yes, that&amp;#39;s right - nothing changed in configuration except enabling coverage. Here are the exact steps using the Zephyr hello_world example:&lt;/p&gt;
&lt;p&gt;(1) Running the Zephyr hello_world example unmodified:&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;code&gt;&lt;strong&gt;*** Booting Zephyr OS build v3.0.99-ncs1 &amp;nbsp;*** &lt;/strong&gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&lt;strong&gt;Hello World! nrf5340dk_nrf5340_cpuapp&lt;/strong&gt;&lt;/code&gt; &lt;br /&gt;&lt;br /&gt;(2) Running with coverage support enabled&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;- add &amp;quot;select HAS_COVERAGE_SUPPORT&amp;quot; to ncs/zephyr/boards/arm/nrf5340dk_nrf5340/Kconfig.board line 10&lt;br /&gt;&lt;/span&gt;&lt;span&gt;- add CONFIG_COVERAGE=y to prj.conf&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;no terminal output&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;(3) Based on advice from someone on Zephyr discord, I also tried running with C++ support (related to this issue:&amp;nbsp;&lt;a id="" href="https://github.com/zephyrproject-rtos/zephyr/issues/40668"&gt;https://github.com/zephyrproject-rtos/zephyr/issues/40668&lt;/a&gt;)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;- add CONFIG_CPLUSPLUS=y to prj.conf&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;strong&gt;&lt;code&gt;*** Booting Zephyr OS build&lt;/code&gt;&amp;nbsp;&lt;/strong&gt;prints repeatedly, looks like CPU is resetting due to a hardfault, but at least get terminal output&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enabling coverage reports for device testing with nRF Connect SDK</title><link>https://devzone.nordicsemi.com/thread/378572?ContentTypeID=1</link><pubDate>Mon, 25 Jul 2022 15:15:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6e043744-7cd4-4e6e-92e4-99bb8ea17da0</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;When coverage support is disabled you can see the expected output in the terminal application, but when coverage is enabled, there is nothing displayed in the terminal even though you have not changed anything in the configuration. Is this correct?&lt;br /&gt;&lt;br /&gt;Can you provide more information on what you can see in the terminal application connected to the serial port when coverage support is not enabled?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enabling coverage reports for device testing with nRF Connect SDK</title><link>https://devzone.nordicsemi.com/thread/378383?ContentTypeID=1</link><pubDate>Fri, 22 Jul 2022 20:06:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:57c17c16-fa9e-40a3-8644-c62040dd01f9</guid><dc:creator>Jason Wright</dc:creator><description>&lt;p&gt;Thank you -&amp;nbsp;This is not&amp;nbsp;really a Twister issue, and I was able to build with coverage support by selecting HAS_COVERAGE_SUPPORT in Kconfig.board. However, tests do not seem to&amp;nbsp;run properly when COVERAGE is enabled. There is no output on the serial port. Other boards like mps2_an385&amp;nbsp;support this so it should be possible, if the nRF5340 has enough RAM, but how much RAM is sufficient?&lt;br /&gt;Having coverage reports is important for my application.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enabling coverage reports for device testing with nRF Connect SDK</title><link>https://devzone.nordicsemi.com/thread/377892?ContentTypeID=1</link><pubDate>Wed, 20 Jul 2022 13:40:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:12dc5971-37f1-4d2e-8590-a7d62870907f</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;CONFIG_HAS_COVERAGE_SUPPORT should be selected in Kconfig.board file to enable device coverage. Reporting the coverage for any particular application also requires CONFIG_COVERAGE. You can take a look at&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/develop/test/coverage.html"&gt;generating coverage reports&lt;/a&gt;.&amp;nbsp;There you can find a link to&amp;nbsp;&lt;a href="https://gcc.gnu.org/onlinedocs/gcc/Gcov.html#Gcov"&gt;gcov test coverage program&lt;/a&gt;. Note that you need to have sufficient RAM available when enabling coverage for the device.&lt;br /&gt;&lt;br /&gt;You can also take a look at the&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/tests/crypto/README.html#crypto-test-ztest-custom"&gt;cryptography tests&lt;/a&gt;&amp;nbsp;sample which uses Ztest to run tests.&lt;br /&gt;&lt;br /&gt;As Twister is Zephyr test script, there are several places where you can ask Zephyr related questions.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/zephyrproject-rtos/zephyr/issues/new/choose"&gt;GitHub issue&lt;/a&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://discord.com/invite/Ck7jw53nU2"&gt;Zephyr Discord channel&lt;/a&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://lists.zephyrproject.org/g/main/subgroups"&gt;Mailing list&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>