<?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>fstorage in chosen area</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/23683/fstorage-in-chosen-area</link><description>Hello,
I&amp;#39;d like to store a large amount of data in flash and in a chosen area. As a start, I&amp;#39;ve chosen the area starting from 0x77000 and ending at 0x78000
Iv&amp;#39;e written this 
 const tGlobalData romData __attribute__((at(0x77000))) __attribute__((used</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 28 Jul 2017 09:49:49 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/23683/fstorage-in-chosen-area" /><item><title>RE: fstorage in chosen area</title><link>https://devzone.nordicsemi.com/thread/93097?ContentTypeID=1</link><pubDate>Fri, 28 Jul 2017 09:49:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:25f84254-f250-4232-88e1-909f412d7822</guid><dc:creator>cedric</dc:creator><description>&lt;p&gt;Hello, the problem was from an other side, and it would be intersting for nordic to have a look at it.&lt;/p&gt;
&lt;p&gt;First of all , fs_init() should be call after softdevice initialization, otherwise that won&amp;#39;t work, and the callback will never be serviced. I guess this is because of the queue managment, I don&amp;#39;t have  time to investigate deeper.&lt;/p&gt;
&lt;p&gt;Then, and the most important, I had to change the fstorage.c file.
fs_erase function always returned FS_ERR_INVALID_ADDR, despite the address was valid.&lt;/p&gt;
&lt;p&gt;The test&lt;br /&gt;
&lt;strong&gt;p_page_addr + (FS_PAGE_SIZE_WORDS * num_pages &amp;gt; p_config-&amp;gt;p_end_addr&lt;/strong&gt;&lt;br /&gt;
was always &lt;strong&gt;true&lt;/strong&gt;
So I did add a temporary uint32_t variable and wrote the following code :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;tmp32 = FS_PAGE_SIZE_WORDS * num_pages + (uint32_t)p_page_addr;
    // Check that the operation doesn&amp;#39;t go outside the client&amp;#39;s memory boundaries.
    if ((p_page_addr &amp;lt; p_config-&amp;gt;p_start_addr) ||
        ((tmp32) &amp;gt; (uint32_t)p_config-&amp;gt;p_end_addr))
    {
        return FS_ERR_INVALID_ADDR;
    }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The compiler is Keil µVision 5&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fstorage in chosen area</title><link>https://devzone.nordicsemi.com/thread/93096?ContentTypeID=1</link><pubDate>Wed, 26 Jul 2017 13:20:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3d333f16-3ec1-4ae4-af39-96144f0dd242</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Yes, I mentioned, I modified the code and can set the start address. It worked. Code I used:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;	FS_REGISTER_CFG(fs_config_t fs_config) =
	{
		  .callback  = fs_evt_handler, // Function for event callbacks.
			.num_pages = NUM_PAGES,      // Number of physical flash pages required.
			.priority  = 0xFE,            // Priority for flash usage.
        .p_start_addr = (uint32_t*)0x57000,
        .p_end_addr = (uint32_t*)0x58000
	};
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fstorage in chosen area</title><link>https://devzone.nordicsemi.com/thread/93095?ContentTypeID=1</link><pubDate>Tue, 25 Jul 2017 10:04:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:320a8546-d5a3-41dc-9698-9e6085ce0aa0</guid><dc:creator>cedric</dc:creator><description>&lt;p&gt;Hello, I&amp;#39;ve comment fs_init during tries, I just forgot to uncomment before posting the code. In the example you gave, you don&amp;#39;t control the destination address of the stored data. It&amp;#39;s somewhere in the ROM area reserved for peer manager data and some other. I need more space,  and as I have a bootloader too, I need to precisely control the ROM address of the stored data.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fstorage in chosen area</title><link>https://devzone.nordicsemi.com/thread/93094?ContentTypeID=1</link><pubDate>Mon, 24 Jul 2017 11:50:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e90db87b-e77f-4be5-8219-02458d6a667f</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Cedric,&lt;/p&gt;
&lt;p&gt;Why did you comment out fs_init() ?&lt;/p&gt;
&lt;p&gt;I tested with this example &lt;a href="https://devzone.nordicsemi.com/question/95960/how-to-use-fstorage-on-nrf52-with-nrf5-sdk-v12/?answer=96492#post-id-96492"&gt;here&lt;/a&gt; and able to set the start address, no problem.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>