<?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>MPC5xxx中的主题 Re: MPC5604  code jump fail</title>
    <link>https://community.nxp.com/t5/MPC5xxx/MPC5604-160-code-jump-fail/m-p/586837#M4229</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;By the way, I did quick test in CW10.6.4 and it has been already fixed...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 01 Jul 2016 07:37:26 GMT</pubDate>
    <dc:creator>lukaszadrapa</dc:creator>
    <dc:date>2016-07-01T07:37:26Z</dc:date>
    <item>
      <title>MPC5604  code jump fail</title>
      <link>https://community.nxp.com/t5/MPC5xxx/MPC5604-160-code-jump-fail/m-p/586831#M4223</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello，Very thinks to notice my questions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I'm developing bootloader on MPC5604 using UART0 and it works well. I download form linux via uart to MPC5604. Frist I burn bootloader on the address 0x00000000, then bootloader runs and download app to the address 0x00018000, when finished, bootloader jumped to app using&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SYS_Jump2App(*((uint32_t *)(0x00018000+4)));&lt;/P&gt;&lt;P&gt;while(1){};&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;App works well too. But In the app, when I want to jump back to bootloader using&lt;/P&gt;&lt;P&gt;SYS_Jump2App(*((uint32_t *)(0x00000000+4)));&lt;/P&gt;&lt;P&gt;while(1){};&lt;/P&gt;&lt;P&gt;it appears failed, and the bootloader can't run.&amp;nbsp; Hoever, but if when I want to jump back to bootloader using reset&amp;nbsp; method in app, the bootlader can startup well. As when we upgrate our app, reseting the system is not allowed because all IO status should not changed.&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any problem when using&lt;/P&gt;&lt;P&gt;SYS_Jump2App(*((uint32_t *)(0x00000000+4)));&lt;/P&gt;&lt;P&gt;while(1){};&lt;/P&gt;&lt;P&gt;? Or there's other things to notice?&lt;/P&gt;&lt;P&gt;Thanks very much!&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-338308"&gt;BOOT.rar&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jun 2016 05:40:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/MPC5604-160-code-jump-fail/m-p/586831#M4223</guid>
      <dc:creator>ningwang</dc:creator>
      <dc:date>2016-06-30T05:40:44Z</dc:date>
    </item>
    <item>
      <title>Re: MPC5604  code jump fail</title>
      <link>https://community.nxp.com/t5/MPC5xxx/MPC5604-160-code-jump-fail/m-p/586832#M4224</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;there's no problem with the jump itself. But you have to consider other things - the device and its registers are not in default reset state. The most important point - interrupts. You should disable interrupts by means of MSR[EE] bit and also locally in all peripherals. Consider to put also other peripherals to default reset state if necessary. In other words - the bootloader must be aware that device is not in default reset state. &lt;/P&gt;&lt;P&gt;If it doesn't help, some extensive debugging will be necessary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Lukas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jun 2016 07:43:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/MPC5604-160-code-jump-fail/m-p/586832#M4224</guid>
      <dc:creator>lukaszadrapa</dc:creator>
      <dc:date>2016-06-30T07:43:13Z</dc:date>
    </item>
    <item>
      <title>Re: MPC5604  code jump fail</title>
      <link>https://community.nxp.com/t5/MPC5xxx/MPC5604-160-code-jump-fail/m-p/586833#M4225</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Thanks very much, and I think what you said is correct. I want just verify the jump code,&amp;nbsp; when the bootloader strartup, the uart will print "this is in boot mode", and then I let jump to the beginning of the program. If it works, this program may always print this message, but it's just print once, and debugging appears&amp;nbsp; "XXXX Bus Error - No Opcode ". &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; I upload the project,&amp;nbsp; and&amp;nbsp; which part should be set before SYS_Jump2App is not found yet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;int main(void)&lt;/P&gt;&lt;P&gt;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //UPGRADE_Chk();&lt;/P&gt;&lt;P&gt;&amp;nbsp; SWT_Disable();&lt;/P&gt;&lt;P&gt;&amp;nbsp; SYS_Init();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; PERI_ClkGenInit();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; INTC_Init();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //GPIO_Init();&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; UART0_Init();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //IIC_Init();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; enableInterrupts();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //GPIO_OutputPwrOnInit();&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; UART0_Write((unsigned char*)"this is in boot mode\n",strlen("this is in boot mode\n"));&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; disableInterrupts();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SYS_Jump2App( *((uint32_t *)(0x00000000+4)) );&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(1)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MsgHandler();&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jun 2016 10:14:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/MPC5604-160-code-jump-fail/m-p/586833#M4225</guid>
      <dc:creator>ningwang</dc:creator>
      <dc:date>2016-06-30T10:14:41Z</dc:date>
    </item>
    <item>
      <title>Re: MPC5604  code jump fail</title>
      <link>https://community.nxp.com/t5/MPC5xxx/MPC5604-160-code-jump-fail/m-p/586834#M4226</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I got it. It's compiler issue. The call of SYS_Jump2App is translated in this way:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/27753i794643608C97C43A/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_0.png" alt="pastedImage_0.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;se_lwz instruction is used to load the reset vector from flash. But this instruction should not be used because r0 is not replaced by zero but by content of r0 register. Or it could be used but r0 would have to loaded appropriately.&lt;/P&gt;&lt;P&gt;r0 register is 0x0F at that moment:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/27809iBD4B6C29085B84C3/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, it will read address 0x13 which is 0xFFFFFFFF. Then it will jump to this wrong address.&lt;/P&gt;&lt;P&gt;Instead if se_lwz, e_lwz should be used. Here is the description of instructions:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/3679iE16BC5DEFE5F238B/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CodeWarrior 2.10 is not being updated anymore, so it will not be fixed in this version. I'm not sure if this works in CodeWarrior 10.6, I will let you know later.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Workaround:&lt;/P&gt;&lt;P&gt;I found this one - write the function in this way:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#define VECTOR_ADDRESS 0x00000004&lt;/P&gt;&lt;P&gt;asm void SYS_Jump2App(void)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Load reset vector address */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; e_lis&amp;nbsp; r3,VECTOR_ADDRESS@h&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; e_add16i r3,r3,VECTOR_ADDRESS@l&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Load vector */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; e_lwz r3,0(r3)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Move vector to link register */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mtlr r3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Branch link register */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; blr&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And simply call it:&lt;/P&gt;&lt;P&gt;SYS_Jump2App();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I didn't find a way how to use a function with parameter because compiler always uses se_lwz.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Lukas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Jul 2016 05:41:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/MPC5604-160-code-jump-fail/m-p/586834#M4226</guid>
      <dc:creator>lukaszadrapa</dc:creator>
      <dc:date>2016-07-01T05:41:22Z</dc:date>
    </item>
    <item>
      <title>Re: MPC5604  code jump fail</title>
      <link>https://community.nxp.com/t5/MPC5xxx/MPC5604-160-code-jump-fail/m-p/586835#M4227</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much ! At this morning, I also think there may be problem with &lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;SYS_Jump2App(), and I try to use&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt; ((void (*)())( *(uint32_t *)(BOOT_OTA_RCW_ADDR+4)))();&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;and it works!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;I think this may the universal way to realize code jump ! Thank you let know the reason why &lt;SPAN&gt;SYS_Jump2App() can not work.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Jul 2016 06:14:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/MPC5604-160-code-jump-fail/m-p/586835#M4227</guid>
      <dc:creator>ningwang</dc:creator>
      <dc:date>2016-07-01T06:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: MPC5604  code jump fail</title>
      <link>https://community.nxp.com/t5/MPC5xxx/MPC5604-160-code-jump-fail/m-p/586836#M4228</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nice to see that you have found another workaround!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Jul 2016 06:20:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/MPC5604-160-code-jump-fail/m-p/586836#M4228</guid>
      <dc:creator>lukaszadrapa</dc:creator>
      <dc:date>2016-07-01T06:20:08Z</dc:date>
    </item>
    <item>
      <title>Re: MPC5604  code jump fail</title>
      <link>https://community.nxp.com/t5/MPC5xxx/MPC5604-160-code-jump-fail/m-p/586837#M4229</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;By the way, I did quick test in CW10.6.4 and it has been already fixed...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Jul 2016 07:37:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/MPC5604-160-code-jump-fail/m-p/586837#M4229</guid>
      <dc:creator>lukaszadrapa</dc:creator>
      <dc:date>2016-07-01T07:37:26Z</dc:date>
    </item>
  </channel>
</rss>

