<?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>nRF9160 custom board bootloader problems</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/95728/nrf9160-custom-board-bootloader-problems</link><description>Dear Nordic Team, 
 I am working on a custom board and I am currently implementing the firmware-over-the-air library via https. For this I need to use the MCUBootloader. Unfortunately I ran into some troubles implementing the bootloader. 
 I am using</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 27 Jan 2023 08:59:57 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/95728/nrf9160-custom-board-bootloader-problems" /><item><title>RE: nRF9160 custom board bootloader problems</title><link>https://devzone.nordicsemi.com/thread/406797?ContentTypeID=1</link><pubDate>Fri, 27 Jan 2023 08:59:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f68b19e4-30d8-4204-b770-d371bfde6769</guid><dc:creator>AscherA</dc:creator><description>&lt;p&gt;Hello Didrik,&lt;/p&gt;
&lt;p&gt;thanks again for your help. I tried implementing the NVS-Sample(None-Volatile-Storage-Sample) and the sample seems to work with my setup. Which means I will try writing my configuration to the NVS Storage partition.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 custom board bootloader problems</title><link>https://devzone.nordicsemi.com/thread/406472?ContentTypeID=1</link><pubDate>Wed, 25 Jan 2023 13:34:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6212424f-6f40-4856-af3c-67a4535a7438</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;No. The non-secure partition must start at a 32kB boundary, which means that there might be some empty space e´between the secure and the non-secure firmware if the secure FW doesn&amp;#39;t use a whole multiplum of 32kB.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 custom board bootloader problems</title><link>https://devzone.nordicsemi.com/thread/406312?ContentTypeID=1</link><pubDate>Tue, 24 Jan 2023 15:13:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b4e9a299-cfd8-4890-925b-fe527c7df7d7</guid><dc:creator>AscherA</dc:creator><description>&lt;p&gt;If I understand correctly this means, that the &amp;quot;EMPTY_0&amp;quot; partition is only a &amp;quot;filler&amp;quot;, but it is automatically assigned to the secure partition of the TF-M. Is there a way to assign it to the none-secure partition?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 custom board bootloader problems</title><link>https://devzone.nordicsemi.com/thread/406300?ContentTypeID=1</link><pubDate>Tue, 24 Jan 2023 14:44:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ecea55b0-4b5d-4ae4-8067-80f428af831b</guid><dc:creator>Didrik Rokhaug</dc:creator><description>[quote user="AscherA"]Is it possible that with the addition of the bootloader this empty flash partition was somehow locked by the TF-M secure functions and that is why I am not able to access it?[/quote]
&lt;p&gt;Yes. The application (and non-secure flash area) must start at a 32kB boundary. If the TF-M partition isn&amp;#39;t large enough to fill a whole sector, an empty partition will be inserted to enusre proper alignment of the non-secure area.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 custom board bootloader problems</title><link>https://devzone.nordicsemi.com/thread/406179?ContentTypeID=1</link><pubDate>Tue, 24 Jan 2023 09:06:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:89ff18e0-3b2f-445d-9020-7d3ca08fee28</guid><dc:creator>AscherA</dc:creator><description>&lt;p&gt;Hello Didrik,&lt;/p&gt;
&lt;p&gt;after finding out the exact address of our empty flash portion I tried to change our flash read function accordingly, but unfortunately this did not work and the nrf9160 still just restarts, when trying to read the flash partition.&lt;/p&gt;
&lt;p&gt;Is it possible that with the addition of the bootloader this empty flash partition was somehow locked by the TF-M secure functions and that is why I am not able to access it?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 custom board bootloader problems</title><link>https://devzone.nordicsemi.com/thread/406028?ContentTypeID=1</link><pubDate>Mon, 23 Jan 2023 12:38:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4645b8de-9d52-4c93-9a5a-82ba8e93e1c9</guid><dc:creator>AscherA</dc:creator><description>&lt;p&gt;Hello Didrik,&lt;/p&gt;
&lt;p&gt;thank you for the information. I checked my partitions.yml and have gone through all its entries.&lt;/p&gt;
&lt;p&gt;The flash partition I am trying to access is at the address 0xfa000 and the flash_size I am tying to access is 0x6000.&lt;/p&gt;
&lt;p&gt;The first entry in my partitions.yml is:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;EMPTY_0:
  address: 0xf4000
  end_address: 0x100000
  placement:
    after:
    - mcuboot_secondary
  region: flash_primary
  size: 0xc000
app:
  address: 0x1c200
  end_address: 0x80000
  region: flash_primary
  size: 0x63e00&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This should mean that the portion of the flash I am trying to access should be empty and not used by any other part of the application, if I am reading the partitions.yml right.&lt;/p&gt;
&lt;p&gt;Also all the others partitions.yml entries to not use the specified flash memory partition.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 custom board bootloader problems</title><link>https://devzone.nordicsemi.com/thread/405855?ContentTypeID=1</link><pubDate>Fri, 20 Jan 2023 14:12:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c7f1ce85-f517-4d86-a1de-0c20587c3f38</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;In NCS, we don&amp;#39;t use the flash partitioning from the device tree, instead, we use the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.2.0/nrf/scripts/partition_manager/partition_manager.html"&gt;Partition Manager&lt;/a&gt;, which dynamically partitions the flash when you build the project.&lt;/p&gt;
&lt;p&gt;You can find the resulting partition map in &amp;lt;your build folder&amp;gt;/partitions.yml. Could you check if the address you try to read from is not taken by MCUBoot or TF-M (and therefore not accessible from the non-secure application).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 custom board bootloader problems</title><link>https://devzone.nordicsemi.com/thread/405410?ContentTypeID=1</link><pubDate>Wed, 18 Jan 2023 09:24:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9a9a7d65-ab96-4c4b-bf8d-3dc394b7591a</guid><dc:creator>AscherA</dc:creator><description>&lt;p&gt;Hi Didrik,&lt;/p&gt;
&lt;p&gt;unfortunately my original assessment was wrong. My nrf9160 does start my application even with the bootloader, but when I try to access my configuration the board restarts. Since accessing my configuration is the first point in my application it seemed like the bootloader was the cause.&lt;br /&gt;But without the bootloader my application is working fine and my configuration can be recalled by the app.&lt;/p&gt;
&lt;p&gt;Here some details about my configuration:&lt;/p&gt;
&lt;p&gt;I am storing the configuration in the storage_partition of the nrf9160. Here you can see&amp;nbsp; my board configuration:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;flash0 {

	partitions {
		compatible = &amp;quot;fixed-partitions&amp;quot;;
		#address-cells = &amp;lt;1&amp;gt;;
		#size-cells = &amp;lt;1&amp;gt;;

		boot_partition: partition@0 {
			label = &amp;quot;mcuboot&amp;quot;;
			reg = &amp;lt;0x00000000 0x10000&amp;gt;;
		};
		slot0_partition: partition@10000 {
			label = &amp;quot;image-0&amp;quot;;
		};
		slot0_ns_partition: partition@50000 {
			label = &amp;quot;image-0-nonsecure&amp;quot;;
		};
		slot1_partition: partition@80000 {
			label = &amp;quot;image-1&amp;quot;;
		};
		slot1_ns_partition: partition@c0000 {
			label = &amp;quot;image-1-nonsecure&amp;quot;;
		};
		scratch_partition: partition@f0000 {
			label = &amp;quot;image-scratch&amp;quot;;
			reg = &amp;lt;0x000f0000 0xa000&amp;gt;;
		};
		storage_partition: partition@fa000 {
			label = &amp;quot;storage&amp;quot;;
			reg = &amp;lt;0x000fa000 0x00006000&amp;gt;;
		};
	};
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The custom board is derived from the nrf9160dk_nrf9160 and there are only minimal changes to the configurations as can be seen for example in the partition management which is the same as the nrf9160dk.&lt;br /&gt;To be able to store the configuration we used the &amp;quot;zephyr/drivers/flash.h&amp;quot; flash functions. Like mentioned above as soon as the application triggers the my custom &amp;quot;flash_data_read&amp;quot; function, the whole board panics and restarts.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// read flash
int flash_data_read(void)
{
    //FLASH_SIZE defined above with 0x6000
    int result = flash_read(flash_dev,0xfa000, ptr_flash,FLASH_SIZE);

    //LOG_INF(&amp;quot;Read config from flash -&amp;gt; result: %d&amp;quot;, result);

    return result;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I though I made sure that none of the other functions used by my application uses this partition in any way. I also&amp;nbsp;looked at the MCUBoot documentation and there is not mentioning of the storage_partition:&amp;nbsp;&lt;br /&gt;&lt;a id="" href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/mcuboot/readme-zephyr.html"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/mcuboot/readme-zephyr.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Without the bootloader the configuration does not cause any problem. Is the storage_partition used by the bootloader in any way?&lt;/p&gt;
&lt;p&gt;Since this is not directly connected to my original question please let me know if i should open a new topic for this problem.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 custom board bootloader problems</title><link>https://devzone.nordicsemi.com/thread/405299?ContentTypeID=1</link><pubDate>Tue, 17 Jan 2023 14:57:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f7f46f3c-3373-455e-bda5-422955f8ab7d</guid><dc:creator>AscherA</dc:creator><description>&lt;p&gt;Hi Didrik,&lt;/p&gt;
&lt;p&gt;I tested adding the MCUBoot to the hello_world sample and I also build it with my custom secure board.&lt;/p&gt;
&lt;p&gt;This worked fine without any problems. I tested this with the tfm_hello_world and the hello_world sample both started normal.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 custom board bootloader problems</title><link>https://devzone.nordicsemi.com/thread/405157?ContentTypeID=1</link><pubDate>Tue, 17 Jan 2023 07:47:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0586b83-b5af-4506-89ad-76030735430b</guid><dc:creator>AscherA</dc:creator><description>&lt;p&gt;Hi Didrik,&lt;/p&gt;
&lt;p&gt;thanks for your help.&lt;/p&gt;
&lt;p&gt;Yes my application fails to boot after I add the bootloader. I first added the FOTA library to be able to do a firmware update and after implementing it into my application I realized that I need the bootloader because my building process did not manufacture the app_update.bin output file.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I will try you suggestion and come back to you with the results.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 custom board bootloader problems</title><link>https://devzone.nordicsemi.com/thread/405114?ContentTypeID=1</link><pubDate>Mon, 16 Jan 2023 17:05:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0e0bf7e7-5715-4bf4-9c13-47938822732f</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Did I understand you correctly that the application failed to boot when you added the bootloader?&lt;/p&gt;
&lt;p&gt;Or did it work with a bootloader, but when you changed the settings for the bootloader, it failed?&lt;/p&gt;
&lt;p&gt;What happens if you try to run an application built for the secure domain?&lt;/p&gt;
&lt;p&gt;E.g. try add MCUBoot (with your added configurations) to the hello_world sample, and build for the secure version of the board (the one that &lt;em&gt;doesn&amp;#39;t&lt;/em&gt; end with &amp;quot;_ns&amp;quot;).&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Didrik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>