<?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>Flash nRF7002 ROM patch via external SPI flash</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/111841/flash-nrf7002-rom-patch-via-external-spi-flash</link><description>I have been using the nRF7002 DK board; the nRF7002 uses the QSPI bus and the external NOR flash uses SPI. 
 The nRF WiFi driver&amp;#39;s HAL and interface functions all require that the external firmware be accessible via the address bus, which means it can</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 07 Jun 2024 08:51:56 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/111841/flash-nrf7002-rom-patch-via-external-spi-flash" /><item><title>RE: Flash nRF7002 ROM patch via external SPI flash</title><link>https://devzone.nordicsemi.com/thread/487860?ContentTypeID=1</link><pubDate>Fri, 07 Jun 2024 08:51:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a2d2a8fb-0a59-45f3-adbc-c0d3ba0481a8</guid><dc:creator>AHaug</dc:creator><description>[quote user="Daniel K"]IMO the help text on this should just state that it requires custom flashing support to write the firmware, or have another config switch to control whether it is automatically flashed.[/quote]
&lt;p&gt;Both yes and no. The philosophy is that the configuration documentation should only contain the most necessary information (which it does with !nRF7002DK), and that you should refer to the nRF7002DK regarding why (no QSPI in between external flash and nRF5340). But I agree that it is hard to find out why it is this way (I had to spend some time myself) and that it should be some other help text regarding programming firmware to external flash through spi and not qspi.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
[quote user="Daniel K"]I hope that when NRFJPROG-157 is implemented, it does not interfere with that.[/quote]
&lt;p&gt;I&amp;#39;ve queried the discussion in NRFJPROG-157 for a status regarding it&amp;#39;s priority. To my knowledge it should not interfere with this, as it&amp;#39;s no problem use an external flash with SPI normally. It is just this part regarding the firmware patch relocation through the linker and programming through nrfjprog that interfers with this.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll get back to you with some more information regarding NRFJPROG-157 when I have some more constructive regarding this&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash nRF7002 ROM patch via external SPI flash</title><link>https://devzone.nordicsemi.com/thread/487780?ContentTypeID=1</link><pubDate>Thu, 06 Jun 2024 14:41:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:237e9d48-3ad6-4394-989a-7d035685ef4a</guid><dc:creator>Daniel K</dc:creator><description>&lt;p&gt;I think enabling this option is not going to be simple; when I force it on, I get this error:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;-- nRF WiFi FW patch binary will be stored in external flash
CMake Error at D:/Projects/nrf_sdk/v2.6.0/nrf/drivers/wifi/nrf700x/CMakeLists.txt:167 (message):
  Unable to find XIP area in dts
  &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;So this means the build system is still assuming it is a QSPI peripheral with XIP.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash nRF7002 ROM patch via external SPI flash</title><link>https://devzone.nordicsemi.com/thread/487776?ContentTypeID=1</link><pubDate>Thu, 06 Jun 2024 14:21:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c0b395f-bd9b-41af-ab1c-15e356259806</guid><dc:creator>Daniel K</dc:creator><description>&lt;p&gt;I am using the external flash for other things related to firmware update, not just the ROM patch.&amp;nbsp; I hope that when NRFJPROG-157 is implemented, it does not interfere with that.&amp;nbsp; IMO the help text on this should just state that it requires custom flashing support to write the firmware, or have another config switch to control whether it is automatically flashed.&lt;/p&gt;
&lt;p&gt;The NCS SDK is so tightly bound to existing use cases and assumptions made by partition manager in the name of &amp;quot;making it easy on developers&amp;quot; that it actually makes it extremely difficult to customize the system beyond the use cases and designs of the SDK.&lt;/p&gt;
&lt;p&gt;For additional context, I am implementing secure boot via a custom b0 and b0n bootloader, with custom image signing tools and update protocol (mcuboot is not used either); an update package is downloaded to external flash and update is done from there, which allows for more code space on the main flash without reserving half of the app code space for a second slot.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash nRF7002 ROM patch via external SPI flash</title><link>https://devzone.nordicsemi.com/thread/487764?ContentTypeID=1</link><pubDate>Thu, 06 Jun 2024 13:59:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a2b782bd-981f-41d1-99f8-605270927834</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Ah you&amp;#39;re right. I will look closer into this, because I was certain that this configuration could be used with SPI and not QSPI, but in practice this means that since the nRF7002DK uses SPI for communication with the external flash it does not work as I thought. Effectively the !nRF7002DK means &amp;quot;it needs QSPI&amp;quot; (as you also say)..&lt;/p&gt;
[quote user="Daniel K"]Do you know why this option is disabled if that&amp;#39;s the way it&amp;#39;s supposed to work?&amp;nbsp; Is it broken?[/quote]
&lt;p&gt;I did some digging and it is not a bug but it has rather to do with nrfjprog as nrfjprog only has qspi_write and not spi_write. What this means is that you will have to add your own programming scheme that allows for this (I know of other customer who has done this and uses the configuration I mention together with SPI only).&lt;/p&gt;
[quote user="Daniel K"]Also what does it mean in the description by &amp;quot;Execute from RAM&amp;quot;?&amp;nbsp; At some point I think I looked into this and I saw a virtual flash region was created in RAM, but I don&amp;#39;t remember at the moment.&amp;nbsp; However, I don&amp;#39;t want to eat up a whole bunch of RAM for something that only happens once during boot.[/quote]
&lt;p&gt;AFAIK this is only done once as it is read from the external flash into RAM and then it is placed on the 7002 through the kernel malloc (see&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/v2.6.1/drivers/wifi/nrf700x/src/fw_load.c#L210"&gt;https://github.com/nrfconnect/sdk-nrf/blob/v2.6.1/drivers/wifi/nrf700x/src/fw_load.c#L210&lt;/a&gt;). This is done in the same heap that you will use later by the Wifi stack, so it needs to both be big enough to store this firmware patch (1 time only as its usage of RAM is removed after it&amp;#39;s been loaded) and to accommodate for your wifi applications.&lt;/p&gt;
&lt;p&gt;I will look around to see if there is any incentive from our developers to modify this configuration (most likely it will not be included in the soon to release 2.7.0 of NCS), to support SPI, but as mentioned you can create your own solution for this so it is possible to circumvent it.&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash nRF7002 ROM patch via external SPI flash</title><link>https://devzone.nordicsemi.com/thread/487746?ContentTypeID=1</link><pubDate>Thu, 06 Jun 2024 13:24:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5e431b9a-dcd7-4fbd-b886-b2622ad53574</guid><dc:creator>Daniel K</dc:creator><description>&lt;p&gt;The Kconfig for this does not work in this case, because it is specifically disallowed for the nRF7002 DK:&amp;nbsp; This is from menuconfig:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;Name: NRF_WIFI_PATCHES_EXT_FLASH_STORE
Prompt: Store nRF700x FW patches in external memory but execute from RAM
Type: bool
Value: n

Direct dependencies (=n):
     !BOARD_NRF7002DK_NRF5340_CPUAPP(undefined/n)  (=y)
  &amp;amp;&amp;amp; !BOARD_NRF7002DK_NRF5340_CPUAPP_NS(undefined/n)  (=y)
  &amp;amp;&amp;amp; &amp;lt;choice NRF_WIFI_PATCHES_EXT_FLASH_SUPPORT&amp;gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Do you know why this option is disabled if that&amp;#39;s the way it&amp;#39;s supposed to work?&amp;nbsp; Is it broken?&lt;/p&gt;
&lt;p&gt;Also what does it mean in the description by &amp;quot;Execute from RAM&amp;quot;?&amp;nbsp; At some point I think I looked into this and I saw a virtual flash region was created in RAM, but I don&amp;#39;t remember at the moment.&amp;nbsp; However, I don&amp;#39;t want to eat up a whole bunch of RAM for something that only happens once during boot.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash nRF7002 ROM patch via external SPI flash</title><link>https://devzone.nordicsemi.com/thread/487741?ContentTypeID=1</link><pubDate>Thu, 06 Jun 2024 13:14:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bf2aaf33-d247-4680-8932-9b14c1d0576d</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""]The nRF WiFi driver&amp;#39;s HAL and interface functions all require that the external firmware be accessible via the address bus, which means it can only be loaded from SRAM or over QSPI with XIP enabled.&amp;nbsp;[/quote]
&lt;p&gt;You can store the Wifi firmware patch in external flash without QSPI and XiP as well.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;To do so you will need to have your communication with the external flash set up with SPI and use&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/kconfig/index.html#CONFIG_NRF_WIFI_PATCHES_EXT_FLASH_STORE"&gt;CONFIG_NRF_WIFI_PATCHES_EXT_FLASH_STORE&lt;/a&gt;&amp;nbsp;and then use regular flash API to load the patch from the external flash.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/device_guides/nrf70/nrf70_fw_patch_update.html#ug-nrf70-fw-patch-update"&gt;https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/device_guides/nrf70/nrf70_fw_patch_update.html&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Are you certain that this configuration does not fit your use case? It has been created for this exact purpose&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash nRF7002 ROM patch via external SPI flash</title><link>https://devzone.nordicsemi.com/thread/487535?ContentTypeID=1</link><pubDate>Wed, 05 Jun 2024 13:38:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a81b2ec8-9411-43ba-83ac-04ebda764884</guid><dc:creator>Daniel K</dc:creator><description>&lt;p&gt;My CMakeLists.txt overriding the changes:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;# Modifying the library in the sdk at /nrf/drivers/wifi/nrf700x
set(ZEPHYR_CURRENT_LIBRARY ..__nrf__drivers__wifi__nrf700x)

# Add a new source
zephyr_library_sources(nrf70_fw_loader.c)

set(_files_to_remove
    src/fw_load.c
    .*/nrfxlib/nrf_wifi/hw_if/hal/src/hal_fw_patch_loader.c
)

# Remove the old firmware loader source
get_target_property(_nrf_wifi_sources ${ZEPHYR_CURRENT_LIBRARY} SOURCES)
foreach(_filename ${_files_to_remove})
    list_find_regex(_nrf_wifi_sources ${_filename} _found_index)
    if(${_found_index} GREATER -1)
        message(STATUS &amp;quot;Removing ${_filename}&amp;quot;)
        list(REMOVE_AT _nrf_wifi_sources ${_found_index})
    else()
        message(FATAL_ERROR &amp;quot;${_filename} not found!&amp;quot;)
    endif()
endforeach()
set_target_properties(${ZEPHYR_CURRENT_LIBRARY} PROPERTIES SOURCES &amp;quot;${_nrf_wifi_sources}&amp;quot;)
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;My Kconfig:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;# Add a new choice to the built-in choice list

if WIFI_NRF700X

choice NRF_WIFI_PATCHES_EXT_FLASH_SUPPORT
	bool &amp;quot;Store nRF700x FW patches in external flash&amp;quot;

config NRF_WIFI_PATCHES_CUSTOM_EXT_FLASH_DRIVER
    bool &amp;quot;Use custom external flash loader&amp;quot;

endchoice

endif # WIFI_NRF700X
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>