<?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>Extra flash when emulating 52810 (to allow debugging with Optimization=none)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/53268/extra-flash-when-emulating-52810-to-allow-debugging-with-optimization-none</link><description>I compiled and debugged the PCA10040e ANCS example (ie emulating the 52810 using the 52832) from SDK 15.3 - successfully. But I wanted to turn off code optimization to facilitate debugging. That seems to bring the solution over the flash size limit of</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 17 Oct 2019 20:51:55 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/53268/extra-flash-when-emulating-52810-to-allow-debugging-with-optimization-none" /><item><title>RE: Extra flash when emulating 52810 (to allow debugging with Optimization=none)</title><link>https://devzone.nordicsemi.com/thread/215608?ContentTypeID=1</link><pubDate>Thu, 17 Oct 2019 20:51:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5e1a4547-19be-49df-855b-1fa1bbfe9c1e</guid><dc:creator>Shockel</dc:creator><description>&lt;p&gt;This is what ended up working for me ...&lt;/p&gt;
&lt;p&gt;Create a file &amp;quot;SetupTarget.JLinkScript&amp;quot; in the project folder, with the following content:&lt;/p&gt;
&lt;p&gt;int SetupTarget(void) {&lt;br /&gt; JLINK_SetDevice(&amp;quot;nrf52832_xxAB&amp;quot;);&lt;br /&gt; return 0;&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;JLink will call this function just before writing the flash, making it realize that the actual target is a nRF52832.&lt;/p&gt;
&lt;p&gt;(I tried changing the target via&amp;nbsp;Project Options -&amp;gt; Debug -&amp;gt; Debugger, but that wreaked havoc with my .emProject file requiring manual cleanup. Apart from causing compile time errors with respect to use of the FPU.)&lt;/p&gt;
&lt;p&gt;The .emProject file then looks like this towards the file end:&lt;/p&gt;
&lt;p&gt;&amp;lt;configuration Name=&amp;quot;Release&amp;quot;&lt;br /&gt; linker_section_placement_macros=&amp;quot;FLASH_PH_START=0x0;FLASH_PH_SIZE=0x30000;RAM_PH_START=0x20000000;RAM_PH_SIZE=0x6000;FLASH_START=0x19000;FLASH_SIZE=0x17000;RAM_START=0x20001c18;RAM_SIZE=0x43e8&amp;quot;&lt;br /&gt; linker_section_placements_segments=&amp;quot;FLASH RX 0x0 0x30000;RAM RWX 0x20000000 0x6000&amp;quot;&lt;br /&gt; c_preprocessor_definitions=&amp;quot;NDEBUG&amp;quot;&lt;br /&gt; gcc_optimization_level=&amp;quot;Optimize For Size&amp;quot; /&amp;gt;&lt;br /&gt; &amp;lt;configuration Name=&amp;quot;Debug&amp;quot;&lt;br /&gt; JLinkScriptFileName=&amp;quot;$(ProjectDir)/SetupTarget.JLinkScript&amp;quot;&lt;br /&gt; linker_section_placement_macros=&amp;quot;FLASH_PH_START=0x0;FLASH_PH_SIZE=0x80000;RAM_PH_START=0x20000000;RAM_PH_SIZE=0x6000;FLASH_START=0x19000;FLASH_SIZE=0x67000;RAM_START=0x20001c18;RAM_SIZE=0x43e8&amp;quot;&lt;br /&gt; linker_section_placements_segments=&amp;quot;FLASH RX 0x0 0x80000;RAM RWX 0x20000000 0x6000&amp;quot;&lt;br /&gt; c_preprocessor_definitions=&amp;quot;DEBUG; DEBUG_NRF&amp;quot;&lt;br /&gt; gcc_optimization_level=&amp;quot;None&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt;This gives you 512k of flash while emulating the nRF52810 allowing to debug without code optimization.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Extra flash when emulating 52810 (to allow debugging with Optimization=none)</title><link>https://devzone.nordicsemi.com/thread/215548?ContentTypeID=1</link><pubDate>Thu, 17 Oct 2019 13:43:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:64dc4ec2-eedf-48a9-a177-9013254c6f93</guid><dc:creator>Shockel</dc:creator><description>&lt;p&gt;Vidar, ok. I had found the following interesting, but wouldn&amp;#39;t know how to incorporate the results into SES, and whether this makes debugging possible now:&lt;/p&gt;
&lt;p&gt;If I run the JLink executable in the install folder, and issue the following commands ...&lt;/p&gt;
&lt;p&gt;&amp;gt;erase&lt;/p&gt;
&lt;p&gt;&amp;gt;device nrf52810_xxAA&lt;/p&gt;
&lt;p&gt;&amp;gt;loadfile &amp;lt;outputfile&amp;gt;.hex&lt;/p&gt;
&lt;p&gt;Response: Unspecified error -1&lt;/p&gt;
&lt;p&gt;&amp;gt;erase&lt;/p&gt;
&lt;p&gt;&amp;gt;device nrf52832_xxAB&lt;/p&gt;
&lt;p&gt;&amp;gt;loadfile &amp;lt;outputfile&amp;gt;.hex&lt;/p&gt;
&lt;p&gt;Result:No errors.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Extra flash when emulating 52810 (to allow debugging with Optimization=none)</title><link>https://devzone.nordicsemi.com/thread/215496?ContentTypeID=1</link><pubDate>Thu, 17 Oct 2019 11:57:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e1a4a462-455d-4720-a59e-25db286fee48</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Sorry for the back and forth on this, I really thought I tested it without optimization, but it&amp;#39;s not working now. I guess the debugger reports the error because the image exceeds the address range defined for the 52810. However, it still didn&amp;#39;t work after I changed the target device in the debug settings. I need to spend some more time on this to figure out what is going on. Can you use the &amp;quot;pca10040&amp;quot; project for debugging in the meantime?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Extra flash when emulating 52810 (to allow debugging with Optimization=none)</title><link>https://devzone.nordicsemi.com/thread/215480?ContentTypeID=1</link><pubDate>Thu, 17 Oct 2019 11:20:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dbc35f4f-f1b9-4964-a9bc-8c53c2e6b0bd</guid><dc:creator>Shockel</dc:creator><description>&lt;p&gt;Your optimization level is set to &amp;quot;Level 3&amp;quot;, which also works for me. What happens on your end if you set it to &amp;quot;None&amp;quot;. It fails here.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Extra flash when emulating 52810 (to allow debugging with Optimization=none)</title><link>https://devzone.nordicsemi.com/thread/215473?ContentTypeID=1</link><pubDate>Thu, 17 Oct 2019 10:58:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:68edff42-1d90-479c-be65-1da4dd706a58</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Attached is my modified example. I tested it with SDK 15.3.0.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/4087.ses.zip"&gt;devzone.nordicsemi.com/.../4087.ses.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Extra flash when emulating 52810 (to allow debugging with Optimization=none)</title><link>https://devzone.nordicsemi.com/thread/215467?ContentTypeID=1</link><pubDate>Thu, 17 Oct 2019 10:48:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e511ebd5-6aa1-4390-9dab-ddb0ef7c2c1f</guid><dc:creator>Shockel</dc:creator><description>&lt;p&gt;Vidar, so first of all: Thank you for the original input to also adjust linker_section_placements_segments. Presumably that is a fix. And it sounds like you were able to flash it.&lt;/p&gt;
&lt;p&gt;As to my specific case, it appears that it turns into a JLink / Segger issue ?!&lt;/p&gt;
&lt;p&gt;I repeated my setup with a JLink-Lite and a different target board, and same result: I cannot flash the &amp;quot;emulated with extra flash&amp;quot; version to either target board due to the generic error.&lt;/p&gt;
&lt;p&gt;I upgraded JLink to the latest 6.52e version and also upgraded SES to 4.22 .&lt;/p&gt;
&lt;p&gt;Above, I assume I was to issue a &amp;quot;nrfjprog --eraseall&amp;quot;. It did not help. I was able to program the softdevice and the hex file using &amp;quot;nrgprog --program &amp;lt;&amp;gt;.hex&amp;quot;, if that tells you something.&lt;/p&gt;
&lt;p&gt;* if you don&amp;#39;t mind, could I send you my .emProject file and you give it a quick try, just to make sure there is no hidden incorrect setting.&lt;/p&gt;
&lt;p&gt;* Otherwise, I presume, this is more a Segger issue ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Extra flash when emulating 52810 (to allow debugging with Optimization=none)</title><link>https://devzone.nordicsemi.com/thread/215347?ContentTypeID=1</link><pubDate>Wed, 16 Oct 2019 14:18:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0aa7bb6-453d-4828-81d8-858287bf496a</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;It worked here, but I had to increase the address to 0x3A000 to be able to build without optimization.&amp;nbsp;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;linker_section_placement_macros=&amp;quot;FLASH_PH_START=0x0;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;FLASH_PH_SIZE=0x3A000;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;RAM_PH_START=0x20000000;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;RAM_PH_SIZE=0x6000;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;FLASH_START=0x19000;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;FLASH_SIZE=0x26000;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;RAM_START=0x20001c18;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;RAM_SIZE=0x43e8&amp;quot;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;br /&gt; linker_section_placements_segments=&amp;quot;FLASH RX 0x0 0x3A000;RAM RWX 0x20000000 0x6000&amp;quot;&lt;/p&gt;
&lt;p&gt;But the linker settings should not lead to&amp;nbsp; debugger errors. Can you try to do a chip erase with nrfjprog first and see if you get the same result?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;gt; nrfjprog --erase&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Extra flash when emulating 52810 (to allow debugging with Optimization=none)</title><link>https://devzone.nordicsemi.com/thread/215335?ContentTypeID=1</link><pubDate>Wed, 16 Oct 2019 13:54:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8d0bbfaa-3b1e-4d56-87da-bc3d04096cb1</guid><dc:creator>Shockel</dc:creator><description>&lt;p&gt;Vidar, I am still getting the&amp;nbsp;&lt;span&gt;&amp;quot;Error reported. Failed to download application. Generic error.&amp;quot; when launching the debugger in SES.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Extra flash when emulating 52810 (to allow debugging with Optimization=none)</title><link>https://devzone.nordicsemi.com/thread/215331?ContentTypeID=1</link><pubDate>Wed, 16 Oct 2019 13:41:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f2d0eb60-1dc8-49f3-b4a3-e07a63195a0f</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;I think the easiest way might be to just use the pca10040 (without the &amp;#39;e&amp;#39;) configuration with the same source code. That said, I think you were pretty close to achieve this with&amp;nbsp;your pca10040e project. In addition to increasing the&amp;nbsp;&lt;span&gt;FLASH_PH_SIZE you need to change the total flash size in your &amp;quot;linker_section_placements_segments&amp;quot; macro.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The original setting from ble_app_ancs_c_pca10040e_112.emProject file&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="xml"&gt;      linker_section_placements_segments=&amp;quot;FLASH RX 0x0 0x30000;RAM RWX 0x20000000 0x6000&amp;quot;&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;must be changed to:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="xml"&gt;      linker_section_placements_segments=&amp;quot;FLASH RX 0x0 0x38000;RAM RWX 0x20000000 0x6000&amp;quot;&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>