<?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: bx  lr vs ret</title>
    <link>https://community.nxp.com/t5/S32K/bx-lr-vs-ret/m-p/1002595#M5962</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/hajianik@gmail.com"&gt;hajianik@gmail.com&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.1px;"&gt;BX LR is the&amp;nbsp;Return from function call.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.1px;"&gt;What is the&amp;nbsp;EXC_RETURN value in the LR?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.1px;"&gt;What exception do you get (Fault Status Register (CSFR))?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.1px;"&gt;But since there is the "ret instruction" which is not a Cortex M4F instruction, I would recommend contacting Green Hills.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.1px;"&gt;BR, Daniel&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 11 Feb 2020 13:39:56 GMT</pubDate>
    <dc:creator>danielmartynek</dc:creator>
    <dc:date>2020-02-11T13:39:56Z</dc:date>
    <item>
      <title>bx  lr vs ret</title>
      <link>https://community.nxp.com/t5/S32K/bx-lr-vs-ret/m-p/1002594#M5961</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Target is S32K148,Compiler is Green Hills&lt;/P&gt;&lt;P&gt;I've written the following C function:&lt;/P&gt;&lt;P&gt;void launch_flsh_com(void)&lt;BR /&gt;&amp;nbsp;{&lt;BR /&gt;&lt;STRONG&gt;#if 1&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;#pragma asm&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; ;ldr&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r1, =0x40020000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; movw&amp;nbsp;&amp;nbsp;&amp;nbsp; r1,0x0000&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; movt&amp;nbsp;&amp;nbsp;&amp;nbsp; r1,0x4002&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; movs&amp;nbsp;&amp;nbsp;&amp;nbsp; r0, #128&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; 0x80&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; strb&amp;nbsp;&amp;nbsp;&amp;nbsp; r0, [r1, #0]&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; L1:&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; ldrb&amp;nbsp;&amp;nbsp;&amp;nbsp; r0, [r1, #0]&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; lsls&amp;nbsp;&amp;nbsp;&amp;nbsp; r0, r0, #24&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; bpl&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; L1&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; ;bx&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lr&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;#pragma endasm&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;#endif&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I looked at the list file for this and I notice there is a "ret" instruction at the end.AS you see I had to comment&amp;nbsp; "bx lr"&lt;/P&gt;&lt;P&gt;otherwise It generates an exception(I believe a hard fault) why do I need to comment that out?&lt;/P&gt;&lt;P&gt;is not true that PC(Return address)&amp;nbsp;is pushed on the stack and pops back into PC?&lt;/P&gt;&lt;P&gt;if so why LR registered is used in the first place.&lt;/P&gt;&lt;P&gt;Has it to do something with the Thumb bit?&lt;/P&gt;&lt;P&gt;and why when I use it here it generates a hard fault exception?&lt;/P&gt;&lt;P&gt;when the "ret" is&amp;nbsp;executed and PC is restored , isn't the thumb bit set?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Koorosh Hajiani&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Feb 2020 19:09:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/bx-lr-vs-ret/m-p/1002594#M5961</guid>
      <dc:creator>hajianik</dc:creator>
      <dc:date>2020-02-07T19:09:57Z</dc:date>
    </item>
    <item>
      <title>Re: bx  lr vs ret</title>
      <link>https://community.nxp.com/t5/S32K/bx-lr-vs-ret/m-p/1002595#M5962</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/hajianik@gmail.com"&gt;hajianik@gmail.com&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.1px;"&gt;BX LR is the&amp;nbsp;Return from function call.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.1px;"&gt;What is the&amp;nbsp;EXC_RETURN value in the LR?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.1px;"&gt;What exception do you get (Fault Status Register (CSFR))?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.1px;"&gt;But since there is the "ret instruction" which is not a Cortex M4F instruction, I would recommend contacting Green Hills.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.1px;"&gt;BR, Daniel&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Feb 2020 13:39:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/bx-lr-vs-ret/m-p/1002595#M5962</guid>
      <dc:creator>danielmartynek</dc:creator>
      <dc:date>2020-02-11T13:39:56Z</dc:date>
    </item>
  </channel>
</rss>

