<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Jump into Application from Custom bootloader. in i.MX RT Crossover MCUs</title>
    <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Jump-into-Application-from-Custom-bootloader/m-p/1558090#M22596</link>
    <description>&lt;P&gt;Hi，&lt;BR /&gt;Thanks for your reply.&lt;BR /&gt;The Jay shared function should be suitable for bare-metal or RTOS software mode.&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;void mfb_jump_to_application(uint32_t vectorStartAddr)
{
#if MFB_APP_JUMP_ENABLE
    mfb_printf("\r\nMFB: Jump to Application code at 0x%x.\r\n", EXAMPLE_FLEXSPI_AMBA_BASE + MFB_APP_IMAGE_OFFSET);
    mfb_printf("-------------------------------------\r\n");
    static uint32_t s_resetEntry = 0;
    static uint32_t s_stackPointer = 0;
    s_resetEntry = *(uint32_t *)(vectorStartAddr + 4);
    s_stackPointer = *(uint32_t *)vectorStartAddr;
    // Turn off interrupts.
    __disable_irq();

    // Set the VTOR.
    SCB-&amp;gt;VTOR = vectorStartAddr;

    // Memory barriers for good measure.
    __ISB();
    __DSB();

    // Set main stack pointer and process stack pointer.
    __set_MSP(s_stackPointer);
    __set_PSP(s_stackPointer);

    // Jump to application entry point, does not return.
    static void (*s_entry)(void) = 0;
    s_entry = (void (*)(void))s_resetEntry;
    s_entry();
#endif
}&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;TIC&lt;/P&gt;
&lt;P&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&gt;Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;</description>
    <pubDate>Wed, 23 Nov 2022 02:16:34 GMT</pubDate>
    <dc:creator>jeremyzhou</dc:creator>
    <dc:date>2022-11-23T02:16:34Z</dc:date>
    <item>
      <title>Jump into Application from Custom bootloader.</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Jump-into-Application-from-Custom-bootloader/m-p/1557466#M22579</link>
      <description>&lt;P&gt;Hello Team,&lt;/P&gt;&lt;P&gt;Currently I'm working in bootloader development activity for i.MXRT1064, I received the new firmware image from the file system and write into the internal flash memory.&amp;nbsp; After write the new firmware image, I want jump from custom bootloader to application, custom bootloader's address range from 0x70000000 to 0x70080400, rest of address space allocated for application.&amp;nbsp; I've referred the SDK of mcuboot_opensource source and I took jump to application code from this SDK example, there I've updated the ivt, disabled the vector and I tried to execute jump, but unfortunately it is not happening.&amp;nbsp; Please refer my following jump to application code.&lt;/P&gt;&lt;P&gt;#define APP_VECTOR_TABLE_ADDRESS 0x70080400&lt;/P&gt;&lt;P&gt;#define&amp;nbsp;STACK_POINTER_SIZE&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0x20001FFFUL&lt;BR /&gt;struct arm_vector_table&lt;BR /&gt;{&lt;BR /&gt;uint32_t msp;&lt;BR /&gt;uint32_t reset;&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;//! @brief Exits bootloader and jumps to the user application.&lt;BR /&gt;void jump_to_application(void)&lt;BR /&gt;{&lt;BR /&gt;/*LED*/&lt;BR /&gt;gpio_pin_config_t led_config = {kGPIO_DigitalOutput, 0, kGPIO_NoIntmode};&lt;BR /&gt;GPIO_PinInit(GPIO3, 4U, &amp;amp;led_config);&lt;BR /&gt;GPIO_PinWrite(GPIO3, 4U, 1U); // 6th LED //&lt;BR /&gt;/*LED*/&lt;/P&gt;&lt;P&gt;//Jump Implementation//&lt;BR /&gt;PRINTF("\nStart Jump process\n");&lt;BR /&gt;__asm volatile ("cpsid i");&lt;BR /&gt;SCB_DisableDCache();&lt;/P&gt;&lt;P&gt;vt = (struct arm_vector_table *)(APP_VECTOR_TABLE_ADDRESS);&lt;BR /&gt;vt-&amp;gt;msp = STACK_POINTER_SIZE;&lt;BR /&gt;//cleanup();&lt;BR /&gt;SCB_DisableICache();&lt;BR /&gt;SCB_DisableDCache();&lt;BR /&gt;ARM_MPU_Disable();&lt;BR /&gt;DbgConsole_Deinit();&lt;BR /&gt;//bspstop();&lt;/P&gt;&lt;P&gt;for (long delay = 0; delay &amp;lt; 1000000; delay++)&lt;BR /&gt;{&lt;BR /&gt;// Do nothing..&lt;BR /&gt;for (long delay1 = 0; delay1 &amp;lt; 1000; delay1++)&lt;BR /&gt;{&lt;BR /&gt;// Do nothing..&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;//!&amp;lt;Experimental part&amp;gt;&lt;BR /&gt;//PRINTF("\nBefore VTOR init\n");&lt;BR /&gt;// Set the VTOR to the application vector table address.&lt;BR /&gt;//SCB-&amp;gt;VTOR = (uint32_t *)(0x70080400);&lt;BR /&gt;//!&amp;lt;Experiment part&amp;gt;&lt;/P&gt;&lt;P&gt;__set_CONTROL(0);&lt;BR /&gt;__set_MSP(vt-&amp;gt;msp);&lt;BR /&gt;__ISB();&lt;BR /&gt;((void (*)(void))vt-&amp;gt;reset)();&lt;BR /&gt;//Should never print this statement//&lt;BR /&gt;PRINTF("\nJUMP SUCCESSFUL\n");&lt;BR /&gt;//Jump Implementation - END//&lt;BR /&gt;//Boot loader end //&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;Please find the attached application's hex file snap for your reference.&amp;nbsp; Please let me know, what I'm missing in the code and give me solution to jump.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2022 04:13:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Jump-into-Application-from-Custom-bootloader/m-p/1557466#M22579</guid>
      <dc:creator>saranbabu</dc:creator>
      <dc:date>2022-11-22T04:13:02Z</dc:date>
    </item>
    <item>
      <title>Re: Jump into Application from Custom bootloader.</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Jump-into-Application-from-Custom-bootloader/m-p/1557479#M22581</link>
      <description>&lt;P&gt;You can refer to &lt;SPAN class="pl-en"&gt;mfb_jump_to_application&lt;/SPAN&gt;() function in below source, it is standard implementation. vectorStartAddr arg should be 0x70080400 for your case.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/JayHeng/RT-MFB/blob/main/boards/mimxrt/mfb_fw/src/mfb.c" target="_blank" rel="noopener"&gt;https://github.com/JayHeng/RT-MFB/blob/main/boards/mimxrt/mfb_fw/src/mfb.c&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2022 05:03:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Jump-into-Application-from-Custom-bootloader/m-p/1557479#M22581</guid>
      <dc:creator>jay_heng</dc:creator>
      <dc:date>2022-11-22T05:03:34Z</dc:date>
    </item>
    <item>
      <title>Re: Jump into Application from Custom bootloader.</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Jump-into-Application-from-Custom-bootloader/m-p/1557991#M22593</link>
      <description>&lt;P&gt;Hello Team,&lt;/P&gt;&lt;P&gt;Thanks for your quick response and support.&lt;/P&gt;&lt;P&gt;The solution which you've given, it is working fine it seems.&amp;nbsp; But here, I'm having one observation, currently we are using RTXC RTOS, I'm not able to jump from custom bootloader to application from the RTXC RTOS.&amp;nbsp; Jump to application happens only when RTOS is not initialized.&amp;nbsp; Please let me know the solution to jump from custom bootloader to application from the RTOS task.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2022 19:48:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Jump-into-Application-from-Custom-bootloader/m-p/1557991#M22593</guid>
      <dc:creator>saranbabu</dc:creator>
      <dc:date>2022-11-22T19:48:31Z</dc:date>
    </item>
    <item>
      <title>Re: Jump into Application from Custom bootloader.</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Jump-into-Application-from-Custom-bootloader/m-p/1558090#M22596</link>
      <description>&lt;P&gt;Hi，&lt;BR /&gt;Thanks for your reply.&lt;BR /&gt;The Jay shared function should be suitable for bare-metal or RTOS software mode.&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;void mfb_jump_to_application(uint32_t vectorStartAddr)
{
#if MFB_APP_JUMP_ENABLE
    mfb_printf("\r\nMFB: Jump to Application code at 0x%x.\r\n", EXAMPLE_FLEXSPI_AMBA_BASE + MFB_APP_IMAGE_OFFSET);
    mfb_printf("-------------------------------------\r\n");
    static uint32_t s_resetEntry = 0;
    static uint32_t s_stackPointer = 0;
    s_resetEntry = *(uint32_t *)(vectorStartAddr + 4);
    s_stackPointer = *(uint32_t *)vectorStartAddr;
    // Turn off interrupts.
    __disable_irq();

    // Set the VTOR.
    SCB-&amp;gt;VTOR = vectorStartAddr;

    // Memory barriers for good measure.
    __ISB();
    __DSB();

    // Set main stack pointer and process stack pointer.
    __set_MSP(s_stackPointer);
    __set_PSP(s_stackPointer);

    // Jump to application entry point, does not return.
    static void (*s_entry)(void) = 0;
    s_entry = (void (*)(void))s_resetEntry;
    s_entry();
#endif
}&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;TIC&lt;/P&gt;
&lt;P&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&gt;Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2022 02:16:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Jump-into-Application-from-Custom-bootloader/m-p/1558090#M22596</guid>
      <dc:creator>jeremyzhou</dc:creator>
      <dc:date>2022-11-23T02:16:34Z</dc:date>
    </item>
    <item>
      <title>Re: Jump into Application from Custom bootloader.</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Jump-into-Application-from-Custom-bootloader/m-p/1558309#M22603</link>
      <description>&lt;P&gt;Hello Team,&lt;/P&gt;&lt;P&gt;Thanks for your great support, now everything working fine it seems.&amp;nbsp; Keep up your good work.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2022 07:55:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Jump-into-Application-from-Custom-bootloader/m-p/1558309#M22603</guid>
      <dc:creator>saranbabu</dc:creator>
      <dc:date>2022-11-23T07:55:42Z</dc:date>
    </item>
    <item>
      <title>Re: Jump into Application from Custom bootloader.</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Jump-into-Application-from-Custom-bootloader/m-p/1863915#M30282</link>
      <description>&lt;P&gt;is it the same for KW45b41?&lt;/P&gt;</description>
      <pubDate>Sun, 12 May 2024 15:16:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Jump-into-Application-from-Custom-bootloader/m-p/1863915#M30282</guid>
      <dc:creator>Ahmed_Elessawy257</dc:creator>
      <dc:date>2024-05-12T15:16:43Z</dc:date>
    </item>
    <item>
      <title>Re: Jump into Application from Custom bootloader.</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Jump-into-Application-from-Custom-bootloader/m-p/1865774#M30346</link>
      <description>&lt;P&gt;It is common for all Cortex-M based MCUs&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2024 01:05:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Jump-into-Application-from-Custom-bootloader/m-p/1865774#M30346</guid>
      <dc:creator>jay_heng</dc:creator>
      <dc:date>2024-05-15T01:05:08Z</dc:date>
    </item>
  </channel>
</rss>

