<?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>S32 SDKのトピックQuery related to reading current stack poniter DS32K142</title>
    <link>https://community.nxp.com/t5/S32-SDK/Query-related-to-reading-current-stack-poniter-DS32K142/m-p/948366#M1194</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We have query related to reading current stack pointer with STS instruction. &amp;nbsp;Below is macro defined to read current SP, but it is giving compilation error (identifier STS is undefined)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #7f0055; font-size: 10.0pt; "&gt;#define&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; color: black;"&gt; GET_STACKPOINTER(x) _asm(STS x) &lt;/SPAN&gt;Is the STS instruction supports for cortex M4 (DS32k142)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let us know if you have any alternative solution for getting current stack pointer with direct RAM accessible instruction.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Sep 2019 14:41:07 GMT</pubDate>
    <dc:creator>sardalkar</dc:creator>
    <dc:date>2019-09-04T14:41:07Z</dc:date>
    <item>
      <title>Query related to reading current stack poniter DS32K142</title>
      <link>https://community.nxp.com/t5/S32-SDK/Query-related-to-reading-current-stack-poniter-DS32K142/m-p/948366#M1194</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We have query related to reading current stack pointer with STS instruction. &amp;nbsp;Below is macro defined to read current SP, but it is giving compilation error (identifier STS is undefined)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #7f0055; font-size: 10.0pt; "&gt;#define&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; color: black;"&gt; GET_STACKPOINTER(x) _asm(STS x) &lt;/SPAN&gt;Is the STS instruction supports for cortex M4 (DS32k142)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let us know if you have any alternative solution for getting current stack pointer with direct RAM accessible instruction.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Sep 2019 14:41:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32-SDK/Query-related-to-reading-current-stack-poniter-DS32K142/m-p/948366#M1194</guid>
      <dc:creator>sardalkar</dc:creator>
      <dc:date>2019-09-04T14:41:07Z</dc:date>
    </item>
    <item>
      <title>Re: Query related to reading current stack poniter DS32K142</title>
      <link>https://community.nxp.com/t5/S32-SDK/Query-related-to-reading-current-stack-poniter-DS32K142/m-p/948367#M1195</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Sandip Ardalkar,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not aware of the macro that you are trying to use. However, I made an example to read the stack pointer on run time with a different approach. The following function returns the value of the stack pointer.&lt;/P&gt;&lt;PRE class="language-c line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;void&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;GetSP&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;void&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
&lt;SPAN class="property macro token"&gt;#ifdef __GNUC__&lt;/SPAN&gt;
  &lt;SPAN class="keyword token"&gt;void&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt;sp&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
  __asm__ __volatile__ &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"mov %0, sp"&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"=r"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;sp&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
  &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; sp&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="property macro token"&gt;#else&lt;/SPAN&gt;
  &lt;SPAN class="property macro token"&gt;#warning "only for GCC"&lt;/SPAN&gt;
  &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; NULL&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="property macro token"&gt;#endif&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;To call the function I did the following:&lt;/P&gt;&lt;PRE class="language-c line-numbers"&gt;&lt;CODE&gt;  &lt;SPAN class="comment token"&gt;/* Getting SP */&lt;/SPAN&gt;
  &lt;SPAN class="keyword token"&gt;void&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt;vfunc&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;void&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
  vfunc &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; GetSP&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
  &lt;SPAN class="keyword token"&gt;void&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; StackPointer &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;vfunc&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
  uint32_t sp &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;uint32_t&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;StackPointer&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;At the end the variable sp will have the value of the stack pointer.&lt;/P&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;&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;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Sep 2019 16:11:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32-SDK/Query-related-to-reading-current-stack-poniter-DS32K142/m-p/948367#M1195</guid>
      <dc:creator>victorjimenez</dc:creator>
      <dc:date>2019-09-06T16:11:04Z</dc:date>
    </item>
  </channel>
</rss>

