<?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>NRF5340 MCUboot is incompatible with PacketCraft and Large Application</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/102714/nrf5340-mcuboot-is-incompatible-with-packetcraft-and-large-application</link><description>We finished our application on the NRF5340 and need to do firmware updates and are unable due to the current criteria: 
 
 
 NRF53 firmware update over USB CDC ACM (which needs at least 0x10000 rather than 0xC000) 
 Our application is large and is over</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 17 Aug 2023 16:52:19 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/102714/nrf5340-mcuboot-is-incompatible-with-packetcraft-and-large-application" /><item><title>RE: NRF5340 MCUboot is incompatible with PacketCraft and Large Application</title><link>https://devzone.nordicsemi.com/thread/441938?ContentTypeID=1</link><pubDate>Thu, 17 Aug 2023 16:52:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9df4a48b-150d-49f1-b702-9ac477759a97</guid><dc:creator>ernieforzano</dc:creator><description>&lt;p&gt;Hi!&amp;nbsp;&lt;br /&gt;&lt;br /&gt;We figured it out!! For anyone who needs an answer for this, there are two&amp;nbsp;main options for the NRF5340 with MCUboot and your application is large (larger then the allowed 400k for both slot0 and slot1) and we needed USB as well:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;need to be able to update just the application core (CONFIG_SINGLE_APPLICATION_SLOT)&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;need to update the the application and network core (CONFIG_SINGLE_APPLICATION_SLOT and CONFIG_NRF53_RECOVERY_NETWORK_CORE)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;For, the &lt;strong&gt;first option&lt;/strong&gt; you should be able to use this example &lt;a href="https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/tree/main/bootloader_samples/serial_recovery/mcuboot_serial_recovery_cdc_acm"&gt;USB_CDC&lt;/a&gt;&amp;nbsp;or the serial example. (There are a number of options, waiting for boot, button, USB in these &lt;a href="https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/tree/main/bootloader_samples/serial_recovery/"&gt;examples&lt;/a&gt;.)&lt;/p&gt;
&lt;p&gt;For the &lt;strong&gt;second option&lt;/strong&gt;, there are a few things you will have to do. For most of this we are mainly combining the files for&amp;nbsp;&lt;span&gt;mcuboot_serial_recovery_cdc_acm and&amp;nbsp;&lt;/span&gt; &lt;span&gt;mcuboot_netcore_serial_recovery &lt;a href="https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/tree/main/bootloader_samples/serial_recovery"&gt;examples&lt;/a&gt;&lt;/span&gt;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;For your prj.conf include&amp;nbsp;
&lt;ol&gt;
&lt;li&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_BT=y
CONFIG_MCUBOOT_IMAGE_VERSION=&amp;quot;0.0.0+0&amp;quot;
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_NRF53_UPGRADE_NETWORK_CORE=y
CONFIG_ADD_MCUBOOT_MEDIATE_SIM_FLASH_DTS=y
CONFIG_USB_CDC_ACM=y
CONFIG_LOG=n
CONFIG_LOG_MODE_MINIMAL=y&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;For your child_image/mcu_boot.conf
&lt;ol&gt;
&lt;li&gt;&lt;pre class="ui-code" data-mode="text"&gt;#
# Copyright (c) 2022 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

CONFIG_MAIN_STACK_SIZE=10240
# Flash
CONFIG_FLASH=y

# Enable MCUboot Serial Recovery
CONFIG_MCUBOOT_SERIAL=y
CONFIG_UART_CONSOLE=n
CONFIG_SIZE_OPTIMIZATIONS=y
CONFIG_SINGLE_APPLICATION_SLOT=y

# MCUBoot serial
CONFIG_MCUBOOT_SERIAL=y
CONFIG_MCUBOOT_SERIAL_DIRECT_IMAGE_UPLOAD=y

# Point Serial Recovery to CDC_ACM
CONFIG_BOOT_SERIAL_CDC_ACM=y
CONFIG_PM_PARTITION_SIZE_MCUBOOT=0x10000

# Decrease memory footprint
CONFIG_CBPRINTF_NANO=y
CONFIG_TIMESLICING=n
CONFIG_BOOT_BANNER=n
CONFIG_CONSOLE=n
CONFIG_CONSOLE_HANDLER=n
CONFIG_UART_CONSOLE=n
CONFIG_RTT_CONSOLE=n
CONFIG_USE_SEGGER_RTT=n
CONFIG_LOG=n
CONFIG_RESET_ON_FATAL_ERROR=n

# The following configurations are required to support serial recovery of the
# network image
CONFIG_PCD_APP=y

CONFIG_FLASH_SIMULATOR=y
CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y
CONFIG_FLASH_SIMULATOR_STATS=n

CONFIG_BOOT_IMAGE_ACCESS_HOOKS=y
CONFIG_NRF53_RECOVERY_NETWORK_CORE=y
CONFIG_MCUBOOT_INDICATION_LED=y&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;We needed USB so we included pm_static.yml for&amp;nbsp;increasing the size for the USB_CDC&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;&lt;pre class="ui-code" data-mode="text"&gt;mcuboot:
  address: 0x0
  end_address: 0x10000
  placement:
    before:
    - mcuboot_primary
  region: flash_primary
  size: 0x10000&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;Edit the CMAKE for&amp;nbsp;&lt;span&gt;&lt;span&gt;C:\ncs\v2.4.0\nrf\modules\mcuboot\CMakeLists.txt and put (this is where we messed up before because we needed to put network core starting address which we found was&amp;nbsp;&lt;/span&gt;&lt;/span&gt;0x1008800. We used a slot size of 0x40000 of the primary_bootloader1). This should get you passed the img_tool.py error.&amp;nbsp;
&lt;ol&gt;
&lt;li&gt;&lt;span&gt;&lt;img style="max-height:224px;max-width:224px;" alt=" " height="224" src="https://devzone.nordicsemi.com/resized-image/__size/448x448/__key/communityserver-discussions-components-files/4/pastedimage1692290398983v1.png" width="224" /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;If you are using packet craft (NRF5340 audio binary), you have two more steps:
&lt;ol&gt;
&lt;li&gt;Edit the&amp;nbsp;\tools\buildprog\ble5-ctr-rpmsg_sign.py (the size of our slot, because its hardcoded to look for the secondary slot, which we don&amp;#39;t want or need).
&lt;ol&gt;
&lt;li&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1692290673492v2.png" /&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;When building your audio application, we found creating and building the audio example with CONFIG_BOOTLOADER_MCU enabled was easiest to getting the MCUBOOT firmware update file.&amp;nbsp;
&lt;ol&gt;
&lt;li&gt;&lt;em&gt;NOTE: You may have to edit the&amp;nbsp;nrf5340_audio\dfu\conf\Kconfig.dfu to&amp;nbsp;&lt;/em&gt;
&lt;div&gt;
&lt;div&gt;&lt;em&gt;AUDIO_DFU to 1 and&amp;nbsp;&lt;/em&gt;
&lt;div&gt;
&lt;div&gt;&lt;em&gt;B0N_MINIMAL to y.&amp;nbsp;&lt;/em&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;Once you build you will have a file&amp;nbsp;build\ble5-ctr_net_core_update.bin
&lt;ol&gt;
&lt;li&gt;This is the way to update the network core.&amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;Finally, we can update our device over the mcumgr. Reset your device and hold down your button or your preferred way to get it into boot loader mode then:&amp;nbsp;
&lt;ol&gt;
&lt;li&gt;for updating your application&amp;nbsp;
&lt;ol&gt;
&lt;li&gt;mcumgr --conntype serial --connstring COM49 image upload -e build\zephyr\app_update.bin -n 1&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;for updating your network core
&lt;ol&gt;
&lt;li&gt;mcumgr --conntype serial --connstring COM49 image upload -e build\zephyr\net_core_app_update.bin -n 3&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;We are now done!! Hope this helps anyone in the same predicament.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF5340 MCUboot is incompatible with PacketCraft and Large Application</title><link>https://devzone.nordicsemi.com/thread/441722?ContentTypeID=1</link><pubDate>Wed, 16 Aug 2023 22:01:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:19d4e21e-2149-4579-8fa6-3026a2cde635</guid><dc:creator>Hieu</dc:creator><description>[quote user="ernieforzano"]Yeah that is what we figured, but is there not a way to direct upload? Like use&amp;nbsp;&lt;span&gt;CONFIG_BOOT_UPGRADE_ONLY&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;y.&amp;nbsp;&lt;/span&gt;[/quote]
&lt;p&gt;Unfortunately, no.&amp;nbsp;MCUboot lies on the application core and manage the serial recovery process, but it doesn&amp;#39;t have access to the network core&amp;nbsp;flash. Thus, the process&amp;nbsp;always involves copying the image to shared RAM, after which&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.4.1/nrf/samples/nrf5340/netboot/README.html"&gt;the Network core bootloader (AKA netboot, AKA b0n)&lt;/a&gt;&amp;nbsp;on the network core will then copy the image to the flash memory using &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.4.1/nrf/libraries/dfu/pcd.html"&gt;Peripheral CPU DFU (PCD)&lt;/a&gt;.&lt;/p&gt;
[quote user="ernieforzano"]Sweetness! So I was using the same strategy of CONFIG_SINGLE_APPLICATION_SLOT and nRF53 Network Core Serial Recovery. I was able to compile it by finding there is a file C:\ncs\v2.4.0\nrf\modules\mcuboot\CMakeLists.txt that is auto generating a command for the imgtool.py.&amp;nbsp;The slot size and the start address offset gets hardcoded to the secondary partition. I modified is so that it used the slot size of mcu_boot_primary_1 and its start address offset.&amp;nbsp;[/quote]
&lt;p&gt;Great finding. I am not very knowledgeable with&amp;nbsp;this area and could not find it at all.&lt;/p&gt;
&lt;p&gt;I followed your tip and was too able to build successfully.&lt;/p&gt;
[quote user="ernieforzano"]I am now able to compile and run the network and application core, run mcuboot in serial recovery mode, and update the application!!&lt;br /&gt;&lt;br /&gt;Whenever, I try to update the network core it seems like it gets in an unhappy state. Should I be able to update the network core with mcuboot in this scenario??[/quote]
&lt;p&gt;Since you successfully updated the application core, I skipped it. I hope it&amp;#39;s OK.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Conceptually&lt;/em&gt; you should be able to. What kind of issue did you encounter? Did you remember to, before resetting, leave the device alone for ~30 seconds after the upload so that PCD can finish updating flash memory?&lt;/p&gt;
&lt;p&gt;I also run several attempts at it. My experiment is based on the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.4.1/zephyr/samples/bluetooth/beacon/README.html"&gt;Bluetooth: Beacon&lt;/a&gt; sample, and I can see that after the netcore update, the sample runs as intended. However, the printk() line I added to hci_rpmsg main.c doesn&amp;#39;t work post update&lt;span style="text-decoration:line-through;"&gt;, which leads me to think that&amp;nbsp;even though it is working,&amp;nbsp;it is probably not reliable&lt;/span&gt;. I am thus unsure what is on the network core. It could be either the old image or the new image, but it certainly is not working correctly, and &lt;em&gt;thus is unreliable&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;I already let our R&amp;amp;D know of your progress two days ago, but they have been too busy to follow up. I will update them after this&amp;nbsp;with my progress as well, at the same time check if they can help now.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF5340 MCUboot is incompatible with PacketCraft and Large Application</title><link>https://devzone.nordicsemi.com/thread/441209?ContentTypeID=1</link><pubDate>Mon, 14 Aug 2023 14:59:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cae2704b-bbac-45db-bbb4-0ff2d7ac3cbb</guid><dc:creator>ernieforzano</dc:creator><description>[quote userid="9456" url="~/f/nordic-q-a/102714/nrf5340-mcuboot-is-incompatible-with-packetcraft-and-large-application/441148"]It is not possible to shrink the secondary partition. It is supposed to be large enough to completely hold another copy of the application image. This is required in a&amp;nbsp;dual-slot setup to provide features like image testing or verification.[/quote]
&lt;p&gt;Yeah that is what we figured, but is there not a way to direct upload? Like use&amp;nbsp;&lt;span&gt;CONFIG_BOOT_UPGRADE_ONLY&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;y.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Sweetness! So I was using the same strategy of CONFIG_SINGLE_APPLICATION_SLOT and nRF53 Network Core Serial Recovery. I was able to compile it by finding there is a file C:\ncs\v2.4.0\nrf\modules\mcuboot\CMakeLists.txt that is auto generating a command for the imgtool.py.&amp;nbsp;The slot size and the start address offset gets hardcoded to the secondary partition. I modified is so that it used the slot size of mcu_boot_primary_1 and its start address offset.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1692024822123v1.png" alt=" " /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;I am now able to compile and run the network and application core, run mcuboot in serial recovery mode, and update the application!!&lt;br /&gt;&lt;br /&gt;Whenever, I try to update the network core it seems like it gets in an unhappy state. Should I be able to update the network core with mcuboot in this scenario??&lt;/p&gt;
&lt;p&gt;I am flashing the same application with modifying the network and application output to test.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Thanks for the help!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF5340 MCUboot is incompatible with PacketCraft and Large Application</title><link>https://devzone.nordicsemi.com/thread/441148?ContentTypeID=1</link><pubDate>Mon, 14 Aug 2023 12:20:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:99639956-229a-49e5-ae9a-2088bdd1a40b</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;It is not possible to shrink the secondary partition. It is supposed to be large enough to completely hold another copy of the application image. This is required in a&amp;nbsp;dual-slot setup to provide features like image testing or verification.&lt;/p&gt;
&lt;p&gt;Fundamentally, if the secondary slot&amp;nbsp;cannot fit an application, then there is no point to it at all.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;For the past few days, I have looked into combining CONFIG_SINGLE_APPLICATION_SLOT and nRF53 Network Core Serial Recovery, which should essentially give us what we need. However,&amp;nbsp;I am completely stuck at an error where the build system cannot generate the proper imgtool.py command. It&amp;#39;s likely that it is not prepared to handle this setup.&lt;/p&gt;
&lt;p&gt;I have informed our engineer about this issue, and they will work on it. Unfortunately, I cannot comment on when they will fix it.&lt;/p&gt;
&lt;p&gt;At 920 kB, I am not certain how much impact optimization can help. However, have you looked at optimizing the memory footprint?&lt;/p&gt;
&lt;p&gt;We have a short guide&amp;nbsp;for that here:&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.4.1/nrf/app_dev/optimizing/memory.html"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.4.1/nrf/app_dev/optimizing/memory.html&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF5340 MCUboot is incompatible with PacketCraft and Large Application</title><link>https://devzone.nordicsemi.com/thread/440788?ContentTypeID=1</link><pubDate>Thu, 10 Aug 2023 14:27:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1d2ca4e3-3be4-4ca9-aebc-eeca4733c4e3</guid><dc:creator>ernieforzano</dc:creator><description>&lt;p&gt;We are okay with any solution that upgrades network and application core. We don&amp;#39;t necessarily need&amp;nbsp;CONFIG_SINGLE_APPLICATION_SLOT, but thought it was close.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;We just want to be able to upgrade the application and network cores through USB and it seems MCUboot requires large slots for the primary (main application) and secondary (for network).&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Is there anyway to shrink these down through pm_static.yml? Or any other way that could be useful?&lt;br /&gt;&lt;br /&gt;Thank you for your response!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF5340 MCUboot is incompatible with PacketCraft and Large Application</title><link>https://devzone.nordicsemi.com/thread/440764?ContentTypeID=1</link><pubDate>Thu, 10 Aug 2023 13:34:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:99682263-5aed-4d18-90c1-4f1086f855c0</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi ernieforzano,&lt;/p&gt;
&lt;p&gt;As I am coincidentally also working on another question about getting CONFIG_SINGLE_APPLICATION_SLOT for the nRF5340, I will be supporting you with this case.&lt;/p&gt;
&lt;p&gt;Right now, I am still&amp;nbsp;trying to get it to work. I will keep you updated about the progress. I hope a little wait is not too much inconvenient.&lt;/p&gt;
&lt;p&gt;Hieu&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>