<?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>Modifying Region / Partition for Application in NCS</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/69076/modifying-region-partition-for-application-in-ncs</link><description>Hi team, 
 I am working with nRF9160DK on NCS v1.3.2. 
 I am building the asset_tracker application and from my understanding when running running west build -b nrf9160dk_nrf9160ns, it is building 3 hex files that are subsequently merged: spm, mcuboot</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 09 Dec 2020 13:54:53 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/69076/modifying-region-partition-for-application-in-ncs" /><item><title>RE: Modifying Region / Partition for Application in NCS</title><link>https://devzone.nordicsemi.com/thread/284090?ContentTypeID=1</link><pubDate>Wed, 09 Dec 2020 13:54:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3c4cb2d2-2d48-4750-8057-fa63e7e2ae77</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi Akash,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="AkashPatel"]What should be running on the host side if it is an MCU? Say for example, we would like the update to come from an nRF52840.&amp;nbsp;[/quote]
&lt;p&gt;As far as I know, there&amp;#39;s no mcumgr implementation that is able to run on a microcontroller, as of now.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Modifying Region / Partition for Application in NCS</title><link>https://devzone.nordicsemi.com/thread/283957?ContentTypeID=1</link><pubDate>Wed, 09 Dec 2020 07:48:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:343eb517-1a69-4156-82ca-910d7fef3464</guid><dc:creator>Akash Patel</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;H&amp;aring;kon,&lt;/span&gt;&lt;/p&gt;
[quote userid="2115" url="~/f/nordic-q-a/69076/modifying-region-partition-for-application-in-ncs/283861#283861"]&lt;p&gt;This means that the host controller must implement support for the mcuboot protocol (like &amp;quot;mcumgr&amp;quot; does on the PC-side)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;[/quote]
&lt;p&gt;What should be running on the host side if it is an MCU? Say for example, we would like the update to come from an nRF52840.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Akash&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Modifying Region / Partition for Application in NCS</title><link>https://devzone.nordicsemi.com/thread/283861?ContentTypeID=1</link><pubDate>Tue, 08 Dec 2020 14:46:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6146b423-4cea-4db0-81d7-1919d8bd399b</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="AkashPatel"]Thanks for all this information. If there is no application present on the device, only mcuboot, is it possible to use mcuboot to download the application&amp;nbsp;from another MCU that is connected to the device over UART?[/quote]
&lt;p&gt;If you have enabled serial in mcuboot, and triggered it; it is theoretically possible that you can update it from any source, as long as the host supports the expected format.&lt;/p&gt;
&lt;p&gt;This means that the host controller must implement support for the mcuboot protocol (like &amp;quot;mcumgr&amp;quot; does on the PC-side)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I compiled mcuboot (ncs/bootloader/mcuboot/boot/zephyr/), with MCUBOOT_SERIAL=y and UART_CONSOLE=n, for nrf9160dk_nrf9160, and added CONFIG_BOOTLOADER_MCUBOOT=y to at_client, and build this, as a quick test. It updated using &amp;quot;mcumgr&amp;quot;:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;mcumgr --conntype=serial --connstring=&amp;#39;dev=/dev/ttyACM0,baud=115200&amp;#39; image upload -e zephyr/app_update.bin&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And ran the at_client + spm, as expected after a reboot.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Modifying Region / Partition for Application in NCS</title><link>https://devzone.nordicsemi.com/thread/283681?ContentTypeID=1</link><pubDate>Tue, 08 Dec 2020 00:48:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:04fc8f02-fc77-4c34-86f7-5af5730bca72</guid><dc:creator>Akash Patel</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;H&amp;aring;kon,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks for all this information. If there is no application present on the device, only mcuboot, is it possible to use mcuboot to download the application&amp;nbsp;from another MCU that is connected to the device over UART?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Akash Patel&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Modifying Region / Partition for Application in NCS</title><link>https://devzone.nordicsemi.com/thread/283588?ContentTypeID=1</link><pubDate>Mon, 07 Dec 2020 14:30:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d16fc06a-59b7-4702-94a3-5f9847331d3d</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
[quote user="AkashPatel"]partitions.yml is a generated file, i.e. it is not there before I build the project. I am wondering what settings it is using to generate this file. In the Partition Manager documentation, it says &amp;quot;The Partition Manager script reads configuration files named pm.yml, which define flash and RAM partitions.&amp;quot; What is the pm.yml file and where is it located?[/quote]
&lt;p&gt;&amp;nbsp;Based on your board, and configuration, it builds x amount of projects. For the scenario where you have a secure app, non-secure app, and a bootloader; it first splits your regions; then adds each image to a specified offset in RAM and flash.&lt;/p&gt;
&lt;p&gt;Since the bootloader is updating a non-secure application, it splits that region into two (close to equal portions).&lt;/p&gt;
&lt;p&gt;In addition; any sections that are defined, like &amp;quot;storage&amp;quot;, will be placed by the application, so any storing of settings are set to a defined area; in case the overall address delegation scheme does not overlap.&lt;/p&gt;
&lt;p&gt;This is all done by the partition manager, based on the initial&amp;nbsp;permissions (ie: if you have secure/non-secure regions etc)&amp;nbsp;in your board; then any empty/unused flash for your device will be allocated towards the application space.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;The file itself, partitions.yml / pm.yml is generated when you initially configure your application (ie: cmake .. -DBOARD=$(BOARD) -REST_OF_CONFIG), just like other static configurations, like the overall kconfig file &amp;quot;.config&amp;quot;.&lt;/p&gt;
&lt;p&gt;By copying this build-folder/partitions.yml file to your application folder, and renaming it to pm_static.yml, you ensure that future upgrades (ncs vX -&amp;gt; ncs vY), follow the exact same flash layout as your initial project.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote user="AkashPatel"]I want to adjust the main application size to something larger. Where should I modify that parameter?&amp;nbsp;&lt;span style="text-decoration:underline;"&gt;Please provide the exact steps I can take to make the application partition to 512kB (or more) while keeping mcuboot at 0x0 (size 0xc000).&lt;/span&gt; If the banks are uneven of if the mcuboot secondary partition is removed as a result,&amp;nbsp;that is acceptable. Essentially, this is the configuration that a customer would need who would like to have the ability to do firmware update even though their application is of size &amp;gt;512 kB.&amp;nbsp;[/quote]
&lt;p&gt;&amp;nbsp;Unfortunately, the partition manager does not support handling of single slot update,&amp;nbsp;so its not possible at this moment to do this without either omitting mcuboot, or manually building each component by disabling the usage of PM and multi-build, which we do not have any documentation on how to do.&lt;/p&gt;
[quote user="AkashPatel"]Also, what is&amp;nbsp;mcuboot_secondary for? Is that available space to store a second SPM + application after a DFU (dual bank update)?[/quote]
&lt;p&gt;&amp;nbsp;Its the second slot for the application, for dual banking.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Modifying Region / Partition for Application in NCS</title><link>https://devzone.nordicsemi.com/thread/283391?ContentTypeID=1</link><pubDate>Fri, 04 Dec 2020 19:30:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c05f2bf9-c5ea-414e-a3b7-f3665107ef35</guid><dc:creator>Akash Patel</dc:creator><description>[quote userid="2115" url="~/f/nordic-q-a/69076/modifying-region-partition-for-application-in-ncs/283263#283263"]&lt;p&gt;You can also see in the &amp;quot;build-folder/partitions.yml&amp;quot; how it places each region (flash and RAM wise).&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What is not shown here is the mcuboot secondary partition. Adjusting the main application would then make the banks un-even, which has a great impact if you want to swap your image in the future.&lt;/p&gt;[/quote]
&lt;p&gt;partitions.yml is a generated file, i.e. it is not there before I build the project. I am wondering what settings it is using to generate this file. In the Partition Manager documentation, it says &amp;quot;The Partition Manager script reads configuration files named pm.yml, which define flash and RAM partitions.&amp;quot; What is the pm.yml file and where is it located?&lt;/p&gt;
&lt;p&gt;I want to adjust the main application size to something larger. Where should I modify that parameter?&amp;nbsp;&lt;span style="text-decoration:underline;"&gt;Please provide the exact steps I can take to make the application partition to 512kB (or more) while keeping mcuboot at 0x0 (size 0xc000).&lt;/span&gt; If the banks are uneven of if the mcuboot secondary partition is removed as a result,&amp;nbsp;that is acceptable. Essentially, this is the configuration that a customer would need who would like to have the ability to do firmware update even though their application is of size &amp;gt;512 kB.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Also, what is&amp;nbsp;mcuboot_secondary for? Is that available space to store a second SPM + application after a DFU (dual bank update)?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Modifying Region / Partition for Application in NCS</title><link>https://devzone.nordicsemi.com/thread/283263?ContentTypeID=1</link><pubDate>Fri, 04 Dec 2020 09:06:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2764f750-ee3c-4683-b85b-9a2b48fbcbf6</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi Akash,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]From the build output, the region size for the application is 441856B (0x6be00). Which file inside the SDK do I need to open to modify this? Let&amp;#39;s say I want this to be 524288B (512kB). Where do I set this?[/quote]
&lt;p&gt;&amp;nbsp;This is automatically adjusted and partitioned by the component &amp;quot;partition manager&amp;quot;, which you can read about here:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/scripts/partition_manager/partition_manager.html"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/scripts/partition_manager/partition_manager.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;You can also see in the &amp;quot;build-folder/partitions.yml&amp;quot; how it places each region (flash and RAM wise).&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What is not shown here is the mcuboot secondary partition. Adjusting the main application would then make the banks un-even, which has a great impact if you want to swap your image in the future.&lt;/p&gt;
[quote user=""]I see that after building a project, inside the build folder, I have&amp;nbsp;partitions_nrf9160dk_nrf9160.yml and&amp;nbsp;pm_nrf9160dk_nrf9160.config which mention 0x6be00 but where is that number being pulled from? Can you help me understand how this partitioning is related to/different from the partitions in zephyr\boards\arm\nrf9160dk_nrf9160\nrf9160dk_nrf9160_partition_conf.dts?[/quote]
&lt;p&gt;partitions_$board.yml is the defined partitioning. This will hold all sections, like a &amp;quot;storage&amp;quot; partition if you use a filesystem of sorts, mcuboot slot0 and slot1, any secure/non-secure regions.&lt;/p&gt;
&lt;p&gt;You can also map external flash in this area. It will hold each component (or section) that the multibuild has targeted.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;nrf9160dk_nrf9160_partition_conf.dts gives a default example on flash (with both secure and non-secure slots). On the RAM-side; its a fixed setting if the component(s) are present in the multi-build.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote user=""]Also, why does the region for the SPM + MCUboot + Application not equal 1MB? What is the rest of the space doing?[/quote]
&lt;p&gt;&amp;nbsp;mcuboot has a primary and a secondary slot. The remainder of the flash is used for the secondary slot. If you go into your build folder using a terminal, and write &amp;quot;ninja rom_report&amp;quot;, it will show you a simplified layout of the flash. Here&amp;#39;s an example from asset_tracker (configured for thingy91):&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;$ ninja rom_report
[0/18] Performing build step for &amp;#39;spm_subimage&amp;#39;
ninja: no work to do.
[1/8] Performing build step for &amp;#39;mcuboot_subimage&amp;#39;
ninja: no work to do.
[4/5] cd /opt/ncs/nrf/applications/asset_tracker/build/modules/nrf &amp;amp;&amp;amp; /usr/bin/python3.8...n_manager_report.py --input /opt/ncs/nrf/applications/asset_tracker/build/partitions.yml
 (0x100000 - 1024kB):
+-----------------------------------------+
| 0x0: mcuboot (0xc000)                   |
+---0xc000: mcuboot_primary (0x69000)-----+
| 0xc000: mcuboot_pad (0x200)             |
+---0xc200: mcuboot_primary_app (0x68e00)-+
| 0xc200: spm (0xc000)                    |
| 0x18200: app (0x5ce00)                  |
| 0x75000: mcuboot_secondary (0x69000)    |
| 0xde000: mcuboot_scratch (0x1e000)      |
| 0xfc000: EMPTY_0 (0x2000)               |
| 0xfe000: settings_storage (0x2000)      |
+-----------------------------------------+&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;MCUboot also uses some sections for handling.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you remove mcuboot (just build the mqtt_simple sample, and&amp;nbsp;run &amp;quot;ninja rom_report&amp;quot;), you will be left with the secure region (spm) and the non-secure region (mqtt_simple application):&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;$ ninja rom_report
[0/11] Performing build step for &amp;#39;spm_subimage&amp;#39;
ninja: no work to do.
[2/3] cd /opt/ncs/nrf/samples/nrf9160/...f9160/mqtt_simple/build/partitions.yml
 (0x100000 - 1024kB):
+-----------------------+
| 0x0: spm (0xc000)     |
| 0xc000: app (0xf4000) |
+-----------------------+
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>