<?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>Example of a bootloader that could boot 2 different app codes?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/57018/example-of-a-bootloader-that-could-boot-2-different-app-codes</link><description>In the documentation for “Bootloader and DFU …” / SDK16.0.0 is written “you can use such a bootloader, for example, to switch between several applications”, but I can’t find example or detail instructions how to do this, so: 
 Could you refer me to any</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 29 Jan 2020 14:16:15 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/57018/example-of-a-bootloader-that-could-boot-2-different-app-codes" /><item><title>RE: Example of a bootloader that could boot 2 different app codes?</title><link>https://devzone.nordicsemi.com/thread/231682?ContentTypeID=1</link><pubDate>Wed, 29 Jan 2020 14:16:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2dd7295e-1eb3-406e-aaa4-81d51ca98f00</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;You can either do a Dual or Single Bank update, see&amp;nbsp;&lt;a title="Dual-bank and single-bank updates" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/lib_bootloader_dfu_banks.html?cp=7_1_3_5_1_2"&gt;Dual-bank and single-bank updates&lt;/a&gt;&amp;nbsp;in the bootloader documenation.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Example of a bootloader that could boot 2 different app codes?</title><link>https://devzone.nordicsemi.com/thread/231526?ContentTypeID=1</link><pubDate>Wed, 29 Jan 2020 02:44:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:165aef7b-211a-4620-9159-f95e9c0e65d9</guid><dc:creator>samsam</dc:creator><description>&lt;p&gt;Ok, Thanks - I followed your advice and made HID keyboard with FreeRTOS, don&amp;#39;t see any other problems other than those that and the original example has, so far working good enough :)&amp;nbsp; &amp;nbsp;Can you recommend some manual or reference where can see what free space will need in the nRF52832 flash in order to DFU only App, or everything with bootlader etc.?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Example of a bootloader that could boot 2 different app codes?</title><link>https://devzone.nordicsemi.com/thread/231312?ContentTypeID=1</link><pubDate>Tue, 28 Jan 2020 08:17:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:541209c8-3c99-41df-9b23-2454a9e48e07</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;OK, understand.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It is possible to jump to different applications from the bootloader using a legacy method, see snippet below&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**
 * @brief Function for aborting current application/bootloader jump to to other app/bootloader.
 *
 * @details This functions will use the address provide to swap the stack pointer and then load 
 *          the address of the reset handler to be executed. It will check current system mode 
 *          (thread/handler) and if in thread mode it will reset into other application.
 *          If in handler mode \ref isr_abort will be executed to ensure correct exit of handler 
 *          mode and jump into reset handler of other application.
 *
 * @param[in]  start_addr  Start address of other application. This address must point to the 
               initial stack pointer of the application.
 *
 * @note This function will never return but issue a reset into provided application.
 */
#if defined ( __CC_ARM )
__asm static void bootloader_util_reset(uint32_t start_addr)
{
    LDR   R5, [R0]              ; Get App initial MSP for bootloader.
    MSR   MSP, R5               ; Set the main stack pointer to the applications MSP.
    LDR   R0, [R0, #0x04]       ; Load Reset handler into R0. This will be first argument to branch instruction (BX).

    MOVS  R4, #0xFF             ; Load ones to R4.
    SXTB  R4, R4                ; Sign extend R4 to obtain 0xFFFFFFFF instead of 0xFF.
    MRS   R5, IPSR              ; Load IPSR to R5 to check for handler or thread mode.
    CMP   R5, #0x00             ; Compare, if 0 then we are in thread mode and can continue to reset handler of bootloader.
    BNE   isr_abort             ; If not zero we need to exit current ISR and jump to reset handler of bootloader.

    MOV   LR, R4                ; Clear the link register and set to ones to ensure no return, R4 = 0xFFFFFFFF.
    BX    R0                    ; Branch to reset handler of bootloader.

isr_abort
                                ; R4 contains ones from line above. Will be popped as R12 when exiting ISR (Cleaning up the registers).
    MOV   R5, R4                ; Fill with ones before jumping to reset handling. We be popped as LR when exiting ISR. Ensures no return to application.
    MOV   R6, R0                ; Move address of reset handler to R6. Will be popped as PC when exiting ISR. Ensures the reset handler will be executed when exist ISR.
    MOVS  r7, #0x21             ; Move MSB reset value of xPSR to R7. Will be popped as xPSR when exiting ISR. xPSR is 0x21000000 thus MSB is 0x21.
    REV   r7, r7                ; Reverse byte order to put 0x21 as MSB.
    PUSH  {r4-r7}               ; Push everything to new stack to allow interrupt handler to fetch it on exiting the ISR.

    MOVS  R4, #0x00             ; Fill with zeros before jumping to reset handling. We be popped as R0 when exiting ISR (Cleaning up of the registers).
    MOVS  R5, #0x00             ; Fill with zeros before jumping to reset handling. We be popped as R1 when exiting ISR (Cleaning up of the registers).
    MOVS  R6, #0x00             ; Fill with zeros before jumping to reset handling. We be popped as R2 when exiting ISR (Cleaning up of the registers).
    MOVS  R7, #0x00             ; Fill with zeros before jumping to reset handling. We be popped as R3 when exiting ISR (Cleaning up of the registers).
    PUSH  {r4-r7}               ; Push zeros (R4-R7) to stack to prepare for exiting the interrupt routine.

    MOVS  R0, #0xF9             ; Move the execution return command into register, 0xFFFFFFF9.
    SXTB  R0, R0                ; Sign extend R0 to obtain 0xFFFFFFF9 instead of 0xF9.
    BX    R0                    ; No return - Handler mode will be exited. Stack will be popped and execution will continue in reset handler initializing other application.
    ALIGN
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;However, I would recommend trying to either integrate the HID keyboard example in to the FreeRTOS code or vice versa to avoid adding on even more complexity. As stated, performing DFU with multiple application images may be difficult and is not supported by our bootloader.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Bjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Example of a bootloader that could boot 2 different app codes?</title><link>https://devzone.nordicsemi.com/thread/231291?ContentTypeID=1</link><pubDate>Tue, 28 Jan 2020 04:57:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a2311f99-1060-4a08-831b-fb79e9f6d124</guid><dc:creator>samsam</dc:creator><description>&lt;p&gt;My motivation is the &amp;quot;line of minimum resistance&amp;quot; ;) I want to combine the HID keyboard example(with light modification) and some my code that use a lot of FreeRTOS. Both variants will not work together or1 1 / or 2 . So the easiest way I though would be just to change the start vector from the Bootloader, else will have to modify the HID example to work with FreeRTOS and I&amp;#39;m not sure will be lucky enough to make it in acceptable time frame as there is no proper manuals on the FreeRTOS&amp;lt;&amp;gt;nRFSDK &amp;quot;interface&amp;quot; and also SES debugger still cant get it when can and when cant use it reliably (also lacks documentation, or at least what are limitations there), so will be harder with just NRF_LOG_ * s&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Example of a bootloader that could boot 2 different app codes?</title><link>https://devzone.nordicsemi.com/thread/231074?ContentTypeID=1</link><pubDate>Mon, 27 Jan 2020 10:27:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ce0e88f-b9d9-44e4-ae19-8142cb2e6b27</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Hi Samsam,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;we do not have any official examples for switching between multiple applications. The main reason for this is that the SoftDevice&amp;nbsp; interrupts/events mechanism, i.e that it forwards interrupts and events to a vector table that it assumes is located on the first flash page after the SoftDevice.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It is possible to alter this by calling&amp;nbsp;sd_softdevice_vector_table_base_set(), but in order to initialize the SD you will have to revert to a legacy approach for initializing the SD, see the example in &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/16382/switching-between-apps-with-dual-bank"&gt;this&lt;/a&gt; answer.&lt;/p&gt;
&lt;p&gt;What is your motivation for switching between two applicaitons? This adds quite a lot of complexity and will make it difficult to perfrom DFU with the bootloader from our SDK.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Bjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>