<?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>S32KのトピックRe: Jump to app from Bootloader issue with S32K142</title>
    <link>https://community.nxp.com/t5/S32K/Jump-to-app-from-Bootloader-issue-with-S32K142/m-p/1532085#M18110</link>
    <description>&lt;P&gt;Hello &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/204530"&gt;@BriceC&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Just regarding the jump.&lt;/P&gt;
&lt;P&gt;The SP can't be 0x10000, because the stack is in the SRAM.&lt;/P&gt;
&lt;P&gt;Refer to AN12218SW&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.nxp.com/docs/en/application-note-software/AN12218SW.zip" target="_blank" rel="noopener"&gt;https://www.nxp.com/docs/en/application-note-software/AN12218SW.zip&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Bootloader_Software\S32K148_bootloader\src\main.c&lt;/P&gt;
&lt;P&gt;R0 register should be loaded with *((uint32_t*)0x10000, that means the value (an SRAM address) at 0x10000. &lt;/P&gt;
&lt;P&gt;Similarly for 0x10004.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 04 Oct 2022 10:59:50 GMT</pubDate>
    <dc:creator>danielmartynek</dc:creator>
    <dc:date>2022-10-04T10:59:50Z</dc:date>
    <item>
      <title>Jump to app from Bootloader issue with S32K142</title>
      <link>https://community.nxp.com/t5/S32K/Jump-to-app-from-Bootloader-issue-with-S32K142/m-p/1531645#M18093</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am having issue with my Jump to boot function. I have a bootloader located in flash code at address 0x00000000 to 0x00010000 and an application in flash code at address 0x00010000 to 0x00040000.&lt;/P&gt;&lt;P&gt;Here are my linker files&lt;/P&gt;&lt;P&gt;Boot&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;/* Specify the memory areas */
MEMORY
{
  /* Flash */
  m_interrupts          (RX)  : ORIGIN = 0x00000000, LENGTH = 0x00000400
  m_flash_config        (RX)  : ORIGIN = 0x00000400, LENGTH = 0x00000010
  m_text                (RX)  : ORIGIN = 0x00000410, LENGTH = 0x0f000 - 0x410

   /* programe_flash*/
  m_boot_version           (RWX)  : ORIGIN = 0x0000f000, LENGTH = 0x00000040  /*version number */

  /* SRAM_L */
  m_data                (RW)  : ORIGIN = 0x1FFFC000, LENGTH = 0x00004000

  
  /* SRAM_U */
  m_data_2              (RW)  : ORIGIN = 0x20000000, LENGTH = 0x00003000
  
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Application&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;/* Specify the memory areas */
MEMORY
{
  /* Flash */
  m_interrupts          (RXW)  : ORIGIN = 0x00010000, LENGTH = 0x00000400
  m_flash_config        (RXW)  : ORIGIN = 0x00010400, LENGTH = 0x00000010
  m_text                (RXW)  : ORIGIN = 0x00010410, LENGTH = 0x00030000 - 0x410
 
  /* programe_flash*/
  ccp_code_sav            (RWX)  : ORIGIN = 0x00030000, LENGTH = 0x00002000  /*8k*/
  ccp_code_tem            (RWX)  : ORIGIN = 0x00032000, LENGTH = 0x00002000  /*8k*/
  m_app_version              (RWX)  : ORIGIN = 0x00034000, LENGTH = 0x00001000  /*version number 4k*/
  ROM_writeflas           (RWX)  : ORIGIN = 0x00035000, LENGTH = 0x00001000  /* ROM_writeflash 4k*/

 
  /* data_flash */
  app_programe_dat            (RW)  : ORIGIN = 0x10000000, LENGTH = 0x00001000 /*8k*/
  eeprom_dat                  (RW)  : ORIGIN = 0x10002000, LENGTH = 0x00002000 /*8k*/

  
      /* SRAM_L */
  m_data                   (RW)  : ORIGIN = 0x1FFFC000, LENGTH = 0X00001000  /*4K place have initialize global variable that not include 0*/
  m_data_2                 (RW)  : ORIGIN = 0x1FFFD000, LENGTH = 0x00003000  /*12k  heap and stack size*/
  
    /* SRAM_U */
  m_data_RAM0              (RW)  : ORIGIN = 0X20000000, LENGTH = 0x00001000/* 4k  gloab */
  m_data_RAM1              (RW)  : ORIGIN = 0x20001000, LENGTH = 0x00001000/* 4k  app data*/
  m_data_RAM3              (RW)  : ORIGIN = 0x20002000, LENGTH = 0x00001000/* 4k  CCP data*/ 
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is just an offset of 0x10000. And here is my code to jump to application :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;void JumpToExecute(uint32_t SP, uint32_t Startup)
{
	/* Mask interrupt */
	DISABLE_INTERRUPTS()

	__asm__("mov r0, #0x00");
	__asm__("msr control, r0"); // nPRIV = 0

	/* Set up Main and Process stack pointer (MSP, PSP)*/
	__asm("ldr r0, =0x00010000");
	__asm("msr msp, r0");
	__asm("msr psp, r0");

	/* Relocate Vector table */
	S32_SCB-&amp;gt;VTOR = (uint32_t)APP_IMAGE_START;// &amp;amp; S32_SCB_VTOR_TBLOFF_MASK;

	/* Set program counter (PC) to the start of the reset handler */
	__asm("ldr r1, =0x00010004");
	__asm("mov pc, r1");
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When i set a breakpoint on the last instruction i.e __asm("mov pc, r1"); it jump to unknown code:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="debug_jump_to_app.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/195594i3509EAF8BA728569/image-size/large?v=v2&amp;amp;px=999" role="button" title="debug_jump_to_app.png" alt="debug_jump_to_app.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="debug_end.png" style="width: 771px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/195595iF96C5F549D74235E/image-size/large?v=v2&amp;amp;px=999" role="button" title="debug_end.png" alt="debug_end.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;But as you can see in the register view, i can see that sp is set to 0x10000 and pc is set to 0x10004.&lt;/P&gt;&lt;P&gt;I tried different addresses for setting PC, as 0x10410 but it doesn't jump at my start code application, i know it since i have set a Debug flag as in&amp;nbsp;&lt;A href="https://techblog.paalijarvi.fi/2021/08/07/debugging-tricky-arm-cortex-m4-code-with-register-values/" target="_self"&gt;this article&lt;/A&gt;&amp;nbsp;and a breakpoint with a condition on r11, and it never reach my flag..&lt;/P&gt;&lt;P&gt;Any ideas of what can be wrong ?&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2022 13:22:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Jump-to-app-from-Bootloader-issue-with-S32K142/m-p/1531645#M18093</guid>
      <dc:creator>BriceC</dc:creator>
      <dc:date>2022-10-03T13:22:12Z</dc:date>
    </item>
    <item>
      <title>Re: Jump to app from Bootloader issue with S32K142</title>
      <link>https://community.nxp.com/t5/S32K/Jump-to-app-from-Bootloader-issue-with-S32K142/m-p/1532085#M18110</link>
      <description>&lt;P&gt;Hello &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/204530"&gt;@BriceC&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Just regarding the jump.&lt;/P&gt;
&lt;P&gt;The SP can't be 0x10000, because the stack is in the SRAM.&lt;/P&gt;
&lt;P&gt;Refer to AN12218SW&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.nxp.com/docs/en/application-note-software/AN12218SW.zip" target="_blank" rel="noopener"&gt;https://www.nxp.com/docs/en/application-note-software/AN12218SW.zip&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Bootloader_Software\S32K148_bootloader\src\main.c&lt;/P&gt;
&lt;P&gt;R0 register should be loaded with *((uint32_t*)0x10000, that means the value (an SRAM address) at 0x10000. &lt;/P&gt;
&lt;P&gt;Similarly for 0x10004.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2022 10:59:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Jump-to-app-from-Bootloader-issue-with-S32K142/m-p/1532085#M18110</guid>
      <dc:creator>danielmartynek</dc:creator>
      <dc:date>2022-10-04T10:59:50Z</dc:date>
    </item>
    <item>
      <title>Re: Jump to app from Bootloader issue with S32K142</title>
      <link>https://community.nxp.com/t5/S32K/Jump-to-app-from-Bootloader-issue-with-S32K142/m-p/1532481#M18118</link>
      <description>&lt;P&gt;Hello Daniel,&lt;/P&gt;&lt;P&gt;Thank you for your answer. When i look to your example, you do&lt;/P&gt;&lt;LI-CODE lang="c"&gt;/* Set up stack pointer */
__asm("msr msp, r0");
__asm("msr psp, r0");

/* Relocate vector table */
S32_SCB-&amp;gt;VTOR = (uint32_t)APP_START_ADDRESS;

/* Jump to application PC (r1) */
__asm("mov pc, r1");&lt;/LI-CODE&gt;&lt;P&gt;But in my case r0 and r1 are set to zero all the time. so when i load the values in SP and PC they are zero aswell.&lt;/P&gt;&lt;P&gt;Is it normal ?&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 07:41:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Jump-to-app-from-Bootloader-issue-with-S32K142/m-p/1532481#M18118</guid>
      <dc:creator>BriceC</dc:creator>
      <dc:date>2022-10-05T07:41:26Z</dc:date>
    </item>
    <item>
      <title>Re: Jump to app from Bootloader issue with S32K142</title>
      <link>https://community.nxp.com/t5/S32K/Jump-to-app-from-Bootloader-issue-with-S32K142/m-p/1532511#M18120</link>
      <description>&lt;P&gt;Hello &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/204530"&gt;@BriceC&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;In the demo, the code is placed within a function that takes two arguments.&lt;/P&gt;
&lt;P&gt;So, at the start of the function, the first argument is placed in R0 and the second argument in R1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR, Daniel&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 08:52:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Jump-to-app-from-Bootloader-issue-with-S32K142/m-p/1532511#M18120</guid>
      <dc:creator>danielmartynek</dc:creator>
      <dc:date>2022-10-05T08:52:05Z</dc:date>
    </item>
    <item>
      <title>Re: Jump to app from Bootloader issue with S32K142</title>
      <link>https://community.nxp.com/t5/S32K/Jump-to-app-from-Bootloader-issue-with-S32K142/m-p/1532528#M18121</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Ok i see how r0 and r1 are set, now they have the value in memory at address 0x10000 and 0x10004, but it seems that my userSP and Startup are erased, since they are equal to 0xFFFFFFFF. Which are the values at theses addresses, but not what i want.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 09:33:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Jump-to-app-from-Bootloader-issue-with-S32K142/m-p/1532528#M18121</guid>
      <dc:creator>BriceC</dc:creator>
      <dc:date>2022-10-05T09:33:56Z</dc:date>
    </item>
    <item>
      <title>Re: Jump to app from Bootloader issue with S32K142</title>
      <link>https://community.nxp.com/t5/S32K/Jump-to-app-from-Bootloader-issue-with-S32K142/m-p/1532548#M18122</link>
      <description>&lt;P&gt;Can you open 0x10000 - 0x10004 in the Memory view, not Disassembly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 10:35:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Jump-to-app-from-Bootloader-issue-with-S32K142/m-p/1532548#M18122</guid>
      <dc:creator>danielmartynek</dc:creator>
      <dc:date>2022-10-05T10:35:20Z</dc:date>
    </item>
    <item>
      <title>Re: Jump to app from Bootloader issue with S32K142</title>
      <link>https://community.nxp.com/t5/S32K/Jump-to-app-from-Bootloader-issue-with-S32K142/m-p/1532572#M18124</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="memory_0x10000_0x10004.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/195773iADA4DCADFE2280DA/image-size/large?v=v2&amp;amp;px=999" role="button" title="memory_0x10000_0x10004.png" alt="memory_0x10000_0x10004.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you can see values at 0x10000 and 0x10004 are 0xFFFFFFFF&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 11:27:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Jump-to-app-from-Bootloader-issue-with-S32K142/m-p/1532572#M18124</guid>
      <dc:creator>BriceC</dc:creator>
      <dc:date>2022-10-05T11:27:29Z</dc:date>
    </item>
    <item>
      <title>Re: Jump to app from Bootloader issue with S32K142</title>
      <link>https://community.nxp.com/t5/S32K/Jump-to-app-from-Bootloader-issue-with-S32K142/m-p/1532612#M18125</link>
      <description>&lt;P&gt;I don't even see a valid stack address in the whole memory range you posted.&lt;/P&gt;
&lt;P&gt;There should be something like 0xXXXXXX20 (SRAM_U) or 0xXXXXXX1F (SRAM_L), depending on the location of the stack.&lt;/P&gt;
&lt;P&gt;There is clearly something wrong with the bootloader.&lt;/P&gt;
&lt;P&gt;Check the SREC file of the application and see how it is being programmed by the bootloader.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR, Daniel&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 13:19:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Jump-to-app-from-Bootloader-issue-with-S32K142/m-p/1532612#M18125</guid>
      <dc:creator>danielmartynek</dc:creator>
      <dc:date>2022-10-05T13:19:20Z</dc:date>
    </item>
    <item>
      <title>Re: Jump to app from Bootloader issue with S32K142</title>
      <link>https://community.nxp.com/t5/S32K/Jump-to-app-from-Bootloader-issue-with-S32K142/m-p/1532694#M18126</link>
      <description>&lt;P&gt;Hi Daniel,&lt;/P&gt;&lt;P&gt;I found that a part of the SREC was not correctly flashed because of a missing equal in&amp;nbsp;&lt;/P&gt;&lt;P&gt;if(address&amp;gt;=APP_IMAGE_START)&lt;/P&gt;&lt;P&gt;Now my code is jumping correctly and i can see my debug flag, thank you for your help !&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 14:39:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Jump-to-app-from-Bootloader-issue-with-S32K142/m-p/1532694#M18126</guid>
      <dc:creator>BriceC</dc:creator>
      <dc:date>2022-10-05T14:39:58Z</dc:date>
    </item>
  </channel>
</rss>

