<?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>Changed board to secure thingy91_nrf9160 (NOT NS)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/95401/changed-board-to-secure-thingy91_nrf9160-not-ns</link><description>I&amp;#39;m trying to build some of your samples using nRF Connect/VSCode, but when I try to build a non-secure build for the Thingy91 (thingy91_nrf9160_ns), it changes to secure build (with the message &amp;quot;Changed board to secure thingy91_nrf9160 (NOT NS)&amp;quot;). 
</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 16 Jan 2023 16:48:57 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/95401/changed-board-to-secure-thingy91_nrf9160-not-ns" /><item><title>RE: Changed board to secure thingy91_nrf9160 (NOT NS)</title><link>https://devzone.nordicsemi.com/thread/405110?ContentTypeID=1</link><pubDate>Mon, 16 Jan 2023 16:48:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:944061eb-bd47-473a-b7c6-40496c2f0d1f</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;Sorry for the late reply.&lt;/p&gt;
[quote user="ArmNewbie"]Regarding the CONFIG_MCUBOOT_SERIAL stuff in thingy91_nrf9160.conf, that is for being able to bootload the nRF9160 via the nRF52840 and the USB on the Thingy:91 right? &lt;br /&gt;Without using the SWD interface and external debug probe?[/quote]
&lt;p&gt;Yes, CONFIG_MCUBOOT_SERIAL is used to enable serial recovery mode, which let you put the device in bootloader-mode and upload a new image over UART.&lt;/p&gt;
[quote user="ArmNewbie"]Anyhow, I&amp;#39;ve created the&lt;em&gt; mcuboot.conf&lt;/em&gt; file as you suggested, and now&amp;nbsp;the error from above is now gone,&amp;nbsp;but still the NS boot doesn&amp;#39;t seem to work (the sample program doesn&amp;#39;t seem to start).[/quote]
&lt;p&gt;Could you try to do an erase-all when you flash, if you haven&amp;#39;t done so already?&lt;/p&gt;
&lt;p&gt;I tried to create a custom board myself, based on the Thingy:91, following the webinar you linked to. This builds and runs for me:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/hello_5F00_custom_5F00_board.zip"&gt;devzone.nordicsemi.com/.../hello_5F00_custom_5F00_board.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changed board to secure thingy91_nrf9160 (NOT NS)</title><link>https://devzone.nordicsemi.com/thread/404355?ContentTypeID=1</link><pubDate>Wed, 11 Jan 2023 14:12:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:08d99ab7-b966-4346-8ff5-fe4cc63af0bf</guid><dc:creator>ArmNewbie</dc:creator><description>&lt;p&gt;Hi Didrik, and thanks for the clarification, and also pointers to the additional config files!&lt;br /&gt;Regarding the antenna design; we have only static antenna matching (yet), so no RF switches controlled by the MAGPIO lines (so far, but might be added later).&lt;/p&gt;
&lt;p&gt;Regarding the CONFIG_MCUBOOT_SERIAL stuff in thingy91_nrf9160.conf, that is for being able to bootload the nRF9160 via the nRF52840 and the USB on the Thingy:91 right? &lt;br /&gt;Without using the SWD interface and external debug probe?&lt;br /&gt;On our custom board we have only the 9160, (and no 52840), so all flashing/debugging is done via a separate nRF9160-DK card connected to the SWD interface via the &amp;quot;Debug out&amp;quot; connector.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Anyhow, I&amp;#39;ve created the&lt;em&gt; mcuboot.conf&lt;/em&gt; file as you suggested, and now&amp;nbsp;the error from above is now gone,&amp;nbsp;but still the NS boot doesn&amp;#39;t seem to work (the sample program doesn&amp;#39;t seem to start).&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve followed the main bim code with the debugger (&lt;em&gt;.../v2.0.2/bootloader/mcuboot/boot/zephyr/main.c&lt;/em&gt; ), and it seems to execute ok from (struct arm_vector_table) vt-&amp;gt;reset (in line 277), with the entry address &amp;nbsp;0x0C345 (that seems correct).&lt;br /&gt;Then when further executing into the main code (in .../&lt;em&gt;modules/tee/tf-m/trusted-firmware-m/secure_fw/spm/cmsis_psa/main.c&lt;/em&gt;) it seems to stop in&lt;em&gt; nrf_spu_flashregion_set()&lt;/em&gt;, on the first assert() on line 408:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;NRFX_ASSERT(!(p_reg-&amp;gt;FLASHREGION[region_id].PERM &amp;amp; SPU_FLASHREGION_PERM_LOCK_Msk));&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The region_id is 14 (when asserting).&lt;/p&gt;
&lt;p&gt;Is it possible based on these details to tell what the&amp;nbsp;problem now might be?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changed board to secure thingy91_nrf9160 (NOT NS)</title><link>https://devzone.nordicsemi.com/thread/404115?ContentTypeID=1</link><pubDate>Tue, 10 Jan 2023 13:48:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2ce44328-a445-4fe0-b341-03b5d073a78d</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;The Thingy:91 board files will include MCUBoot automatically, to make it possible to run samples unmodified on the Thingy:91 without a debugger.&lt;/p&gt;
&lt;p&gt;However, that also means that you get some Kconfig options that were meant to be Thingy:91 specific when you use that board as a starting point for your custom board.&lt;/p&gt;
&lt;p&gt;One of those settings is that MCUBoot is enabled automatically, but you don&amp;#39;t also get the Thingy:91-specific options for the MCUBoot child image.&lt;/p&gt;
&lt;p&gt;To add the extra MCUBoot settings to your project, you can create a &amp;lt;your project directory&amp;gt;/child_image/mcuboot.conf file, with the contents of bootloader\mcuboot\boot\zephyr\boards\thingy91_nrf9160.conf.&lt;/p&gt;
&lt;p&gt;In addition, depending on your antenna design, you might need to add the options from nrf\lib\modem_antenna\Kconfig to your project (your main prj.conf, not child_image/mcuboot.conf)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changed board to secure thingy91_nrf9160 (NOT NS)</title><link>https://devzone.nordicsemi.com/thread/404073?ContentTypeID=1</link><pubDate>Tue, 10 Jan 2023 12:02:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:07e1f9e8-ac01-4679-9998-480d2a4bedcb</guid><dc:creator>ArmNewbie</dc:creator><description>&lt;p&gt;Thanks for elaborating the details Didrik, it really makes sense, and obvious that both the &amp;quot;secure&amp;quot; and &amp;quot;unsecure&amp;quot; parts are to be built.&lt;br /&gt;I got kind of &amp;quot;blindfolded&amp;quot; by the fact that our custom board fails running an unsecure build, and I kind of &amp;quot;short circuited&amp;quot; that with the error in the build log.&lt;br /&gt;Which obvious are two separate things!&lt;br /&gt;For the record; the Thingy:91 runs fine with the NS build (as expected), but an NS build for the custom board does not (same code).&lt;br /&gt;The error message from the console log is this (e.g. when running a &lt;em&gt;hello_world&lt;/em&gt; example project):&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;*** Booting Zephyr OS build v3.0.99-ncs1-1  ***
I: Starting bootloader
I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Boot source: none
I: Swap type: none
I: Bootloader chainload address offset: 0xc000
I: Jumping to the first image slot
E: Protect mcuboot flash failed, cancel startup.
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;The culprit then points to the board files I guess, and this being not correct.&lt;br /&gt;We have been using your recommendation regarding creating custom board files: &lt;a href="https://www.youtube.com/watch?v=KSivO9Cf1TE"&gt;www.youtube.com/watch&lt;/a&gt;&lt;br /&gt;And have been using the Thingy:91 as basis.&lt;br /&gt;The status now (when building (secure) for the custom board) is that the HW seems to work fine (LED, GPIO, UART, I2C, SPI etc), but the NS builds will not run.&lt;br /&gt;Is it possible to determine anything pointing to the problem from the console output from our&amp;nbsp;board?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BR&lt;/p&gt;
&lt;p&gt;-Alf&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changed board to secure thingy91_nrf9160 (NOT NS)</title><link>https://devzone.nordicsemi.com/thread/403535?ContentTypeID=1</link><pubDate>Fri, 06 Jan 2023 09:24:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6a25cecf-5656-416b-b26c-9b048c1463dc</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;This is expected.&lt;/p&gt;
&lt;p&gt;When the CPU is reset, it will reboot in &amp;quot;secure&amp;quot; mode. You will therefore need some code to be &amp;quot;secure&amp;quot;, which can set up the &amp;quot;non-secure&amp;quot; environment, and jump to the &amp;quot;non-secure&amp;quot; application.&lt;/p&gt;
&lt;p&gt;(And just to avoid any misunderstanding, having the application run in the &amp;quot;non-secure&amp;quot; domain doesn&amp;#39;t make it less secure. It is the separation between the domains that brings the security)&lt;/p&gt;
&lt;p&gt;When you build your application as &amp;quot;non-secure&amp;quot;, the build system will include the &amp;quot;secure&amp;quot; application automatically (TF-M or SPM depending on the NCS version). In addition, if you have a bootloader enabled (which is the default on the Thingy:91), it will also be built for the &amp;quot;secure&amp;quot; domain.&lt;/p&gt;
&lt;p&gt;If you look at the log in more detail, you will see that it first builds the application for the &amp;quot;non-secure&amp;quot; domain (technically, at this point, it only generates the ninja and configuration files), then it changes the board to the &amp;quot;secure&amp;quot; version and builds the SPM and MCUBoot.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: /Users/alfe/Documents/NRF_side/hello_world

...

Changed board to secure thingy91_nrf9160 (NOT NS)

=== child image spm -  begin ===
loading initial cache file /Users/alfe/Documents/NRF_side/hello_world/build_T/spm/child_image_preload.cmake
Loading Zephyr default modules (Zephyr base).
-- Application: /opt/nordic/ncs/v2.0.2/nrf/samples/spm

...

Changed board to secure thingy91_nrf9160 (NOT NS)

=== child image mcuboot -  begin ===
loading initial cache file /Users/alfe/Documents/NRF_side/hello_world/build_T/mcuboot/child_image_preload.cmake
Loading Zephyr default modules (Zephyr base).
-- Application: /opt/nordic/ncs/v2.0.2/bootloader/mcuboot/boot/zephyr&lt;/pre&gt;&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>