<?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>Segger Embedded Studio(Crossworks). Write data to UICR.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/14326/segger-embedded-studio-crossworks-write-data-to-uicr</link><description>Hello.
I am trying to port bootloader project from SDK to SES. But I do not know how to write data to UICR. 
 Steps what I&amp;#39;ve done: 
 
 My nRF52832_xAA_MemoryMap.xml looks like (I&amp;#39;ve added UICR section): 
 
 
 &amp;lt; !DOCTYPE Board_Memory_Definition_File</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 16 Aug 2017 10:42:22 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/14326/segger-embedded-studio-crossworks-write-data-to-uicr" /><item><title>RE: Segger Embedded Studio(Crossworks). Write data to UICR.</title><link>https://devzone.nordicsemi.com/thread/54700?ContentTypeID=1</link><pubDate>Wed, 16 Aug 2017 10:42:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:49a1d9db-4941-4f3d-9a5f-1a29f3862abc</guid><dc:creator>jfDEVmoto</dc:creator><description>&lt;p&gt;fine, I did write &amp;quot;Keep&amp;quot; instead of &amp;quot;keep&amp;quot;....
This did not raise any error but was not taken into account...
However, I see that now, my hex file writes 8 bytes at 0x10001014 instead of just 4 when I used the &amp;quot;onlyfortEst&amp;quot; assignment. Might not be a big deal, but I can&amp;#39;t understand this behavior, as the size of the section is 4
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Segger Embedded Studio(Crossworks). Write data to UICR.</title><link>https://devzone.nordicsemi.com/thread/54699?ContentTypeID=1</link><pubDate>Tue, 15 Aug 2017 13:11:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:57c65fe2-39c7-4288-bc43-c6dc6d3c881d</guid><dc:creator>jfDEVmoto</dc:creator><description>&lt;p&gt;I got it but it does not seem to be effective on my side. I&amp;#39;ll check again.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Segger Embedded Studio(Crossworks). Write data to UICR.</title><link>https://devzone.nordicsemi.com/thread/54701?ContentTypeID=1</link><pubDate>Tue, 15 Aug 2017 10:03:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3aa847cf-a133-4310-81d7-dd34da46eead</guid><dc:creator>Vladimir</dc:creator><description>&lt;p&gt;Yes, see RK&amp;#39;s comment to &amp;quot;answer&amp;quot; here.&lt;/p&gt;
&lt;p&gt;Add:
keep=&amp;quot;Yes&amp;quot;&lt;/p&gt;
&lt;p&gt;in the programsection and the linker script will have to keep option set in it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Segger Embedded Studio(Crossworks). Write data to UICR.</title><link>https://devzone.nordicsemi.com/thread/54698?ContentTypeID=1</link><pubDate>Mon, 14 Aug 2017 21:11:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d921a801-d2cf-4640-a17f-674b799659b0</guid><dc:creator>jfDEVmoto</dc:creator><description>&lt;p&gt;Thanks for this thread, it did help me a lot.
I still don&amp;#39;t have a working dfu as I did with keil toolchain but at least bootloader starts and uicr is written.
Have you found a way to get rid of the &amp;quot;onlyForTest&amp;quot;  assignment ?
I do have to use it to see my UICR section in hex file.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Segger Embedded Studio(Crossworks). Write data to UICR.</title><link>https://devzone.nordicsemi.com/thread/54696?ContentTypeID=1</link><pubDate>Tue, 07 Jun 2016 09:09:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fd42d055-fdaf-4176-a23c-53996ac06b54</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;This file format is documented if you know where to look, there&amp;#39;s quite a few options for those program sections and the other file formats are also documented.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.rowleydownload.co.uk/arm/documentation/index.htm?http://www.rowleydownload.co.uk/arm/documentation/ide_section_placement.htm"&gt;www.rowleydownload.co.uk/.../index.htm&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Segger Embedded Studio(Crossworks). Write data to UICR.</title><link>https://devzone.nordicsemi.com/thread/54695?ContentTypeID=1</link><pubDate>Tue, 07 Jun 2016 09:04:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b5d7fc8e-b9d6-4e80-ab69-fe9d17a6c318</guid><dc:creator>Vladimir</dc:creator><description>&lt;p&gt;Yes, that was the case. And with
&lt;code&gt;keep=&amp;quot;Yes&amp;quot;&lt;/code&gt;
I have all my options and don&amp;#39;t have to use this weird &lt;code&gt;uint32_t onlyForTest = m_uicr_bootloader_start;&lt;/code&gt; Thanks again, RK.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Segger Embedded Studio(Crossworks). Write data to UICR.</title><link>https://devzone.nordicsemi.com/thread/54697?ContentTypeID=1</link><pubDate>Tue, 07 Jun 2016 08:36:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:593312a4-8720-4373-b732-d65d99101b58</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;if that&amp;#39;s the case then just add&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;keep=&amp;quot;Yes&amp;quot; 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;in the programsection and the linker script will have the keep option set in it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Segger Embedded Studio(Crossworks). Write data to UICR.</title><link>https://devzone.nordicsemi.com/thread/54694?ContentTypeID=1</link><pubDate>Tue, 07 Jun 2016 08:11:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:35b3f137-5507-429b-8136-d552f6fa89e6</guid><dc:creator>Vladimir</dc:creator><description>&lt;p&gt;It is looks like that compiler/linker doesn&amp;#39;t care about &amp;quot;volatile&amp;quot; var and just remove it from code (all code optimizations set to none).&lt;/p&gt;
&lt;p&gt;So at least at Segger Embedded Studio it is not enough to just declare&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;volatile static const uint32_t m_uicr_bootloader_start  __attribute__ ((section(&amp;quot;.uicrBootStartAddress&amp;quot;))) = 0x55555555;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To see data at .uicrBootStartAddress section I have to use this m_uicr_bootloader_start variable somethere in code, something like:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;int main(void)
{

uint32_t onlyForTest = m_uicr_bootloader_start;

...

}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;After downloading this to chip I have at right address my 0x55555555:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;C:\Program Files (x86)\Nordic Semiconductor\nrf5x\bin&amp;gt;nrfjprog.exe --memrd 0x10001014
0x10001014: 55555555                              |UUUU|
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Strange, but I can live with it for now.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Segger Embedded Studio(Crossworks). Write data to UICR.</title><link>https://devzone.nordicsemi.com/thread/54693?ContentTypeID=1</link><pubDate>Mon, 06 Jun 2016 14:25:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8b90b90f-649c-42db-80b6-2f363d54d316</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;mine definitely shows up in the correct section. If the linker had removed it it wouldn&amp;#39;t be there at all. SO none doesn&amp;#39;t make sense and it not being in the file doesn&amp;#39;t make sense. It seems for all the world like it&amp;#39;s treating it like initialized data and expecting it to be copied at program start instead of readonly data which is in the flash file.&lt;/p&gt;
&lt;p&gt;Take another look tomorrow and you may see it instantly.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Segger Embedded Studio(Crossworks). Write data to UICR.</title><link>https://devzone.nordicsemi.com/thread/54692?ContentTypeID=1</link><pubDate>Mon, 06 Jun 2016 14:18:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fc15a6c9-5428-47db-86ce-5673b3e7fbb9</guid><dc:creator>Vladimir</dc:creator><description>&lt;p&gt;View-&amp;gt;Symbol Browser -  I see uicrBootStartAddress symbol. With right address, but in &amp;quot;information&amp;quot; option &amp;quot;Section&amp;quot; set to &amp;quot;none&amp;quot; (section that the symbol is defined in). Is that right to be &amp;quot;none&amp;quot; in that case?&lt;/p&gt;
&lt;p&gt;So,  at .map file I have uicrBootStartAddress with the right address, but at elf file there no data at that address. So somehow linker(?) decided remove it.&lt;/p&gt;
&lt;p&gt;Tomorrow I&amp;#39;ll think about it again. Thanks anyway, RK!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Segger Embedded Studio(Crossworks). Write data to UICR.</title><link>https://devzone.nordicsemi.com/thread/54691?ContentTypeID=1</link><pubDate>Mon, 06 Jun 2016 14:04:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ce892015-1ae7-4c74-a958-2c8b608ee1a3</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;not much more to suggest at this point. Can&amp;#39;t see an error, looks right to me and I have a couple of projects with UICR sections in them which I do that way.&lt;/p&gt;
&lt;p&gt;Only thing left to try, View-&amp;gt; Symbol Browser and use the search to find where that symbol has been put, assuming it&amp;#39;s not decided that it isn&amp;#39;t used and just removed it .. but I don&amp;#39;t recall having to tell it to keep the data explicitly.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Segger Embedded Studio(Crossworks). Write data to UICR.</title><link>https://devzone.nordicsemi.com/thread/54690?ContentTypeID=1</link><pubDate>Mon, 06 Jun 2016 14:00:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8d403bc8-6b58-4212-9549-9deb8337d3bc</guid><dc:creator>Vladimir</dc:creator><description>&lt;p&gt;Elf file at the end has 0x00079690 - last data to be written to flash, and after that - 0x20002c00 - RAM. So nothing at UICR (0x10001014). I&amp;#39;ve changed $(FLASH_NAME:UICR) to &amp;quot;UICR&amp;quot;, but in elf still no data for UICR address.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Segger Embedded Studio(Crossworks). Write data to UICR.</title><link>https://devzone.nordicsemi.com/thread/54689?ContentTypeID=1</link><pubDate>Mon, 06 Jun 2016 13:40:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c2bbbf1e-d128-453a-8e4d-5e7232e6d6cb</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;SES should have a viewer for ELF files if you double click on it, see if there&amp;#39;s anything in the file at the address you used.&lt;/p&gt;
&lt;p&gt;I just looked at one of my Crossworks (basically the same product) projects which has a UICR section, in fact it&amp;#39;s just a UICR project and nothing else, I have this&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;const struct
{
	uint8_t	MAC_ADDRESS[6];
	char		PIN[6];
	uint32_t	RESET_CODE;
} RELAY_DATA  __attribute((section(&amp;quot;uicr&amp;quot;)))  = {
	.MAC_ADDRESS = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
	.PIN         = { &amp;#39;0&amp;#39;, 0&amp;#39;, &amp;#39;0&amp;#39;, &amp;#39;0&amp;#39;, &amp;#39;0&amp;#39;, &amp;#39;0&amp;#39; },
	.RESET_CODE  = 0x12345678,
};
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The name of the section in the flash_placement file should be &amp;quot;UICR&amp;quot;,  not $(FLASH_NAME:UICR). That uses the value of FLASH_NAME if it exists and &amp;#39;UICR&amp;#39; if it doesn&amp;#39;t. Using just UICR is better, although I don&amp;#39;t think that&amp;#39;s your problem.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Segger Embedded Studio(Crossworks). Write data to UICR.</title><link>https://devzone.nordicsemi.com/thread/54688?ContentTypeID=1</link><pubDate>Mon, 06 Jun 2016 13:31:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:339fdd5d-94c0-41f6-9676-6b607ee2e286</guid><dc:creator>Vladimir</dc:creator><description>&lt;p&gt;After adding &amp;quot;static const&amp;quot; still have same problem.
As for elf file... actualy, have not read elf files before. As I understand it should has all programm sections/segments in it. My elf file looks like 99% binary data and couple of strings including my &amp;quot;.uicrBootStartAddress&amp;quot;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Segger Embedded Studio(Crossworks). Write data to UICR.</title><link>https://devzone.nordicsemi.com/thread/54687?ContentTypeID=1</link><pubDate>Mon, 06 Jun 2016 12:54:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c614c7b9-a30f-4cf0-963d-61f19981c791</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;Don&amp;#39;t think that&amp;#39;s going to work. The variable declaration isn&amp;#39;t constant so it&amp;#39;ll have reserved space in the UICR expecting to copy the variable in at runtime I think, which isn&amp;#39;t what you want.&lt;/p&gt;
&lt;p&gt;Try making the variable static constant so it actually puts it in the file. Take a look at the ELF file as well.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>