<?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>Kinetis Microcontrollers中的主题 Re: How to verify safe stack usage on KL17?</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-verify-safe-stack-usage-on-KL17/m-p/589988#M34733</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Rick,&lt;/P&gt;&lt;P&gt;I think we have not the tools to check if the stack is safe. But I think you can write the stack with a pattern, then running the code and check if pattern has been changed for the out of&amp;nbsp; range of stack memory.&lt;/P&gt;&lt;P&gt;Hope it can help you.&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Xiangjun Rong&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 13 Sep 2016 09:31:04 GMT</pubDate>
    <dc:creator>xiangjun_rong</dc:creator>
    <dc:date>2016-09-13T09:31:04Z</dc:date>
    <item>
      <title>How to verify safe stack usage on KL17?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-verify-safe-stack-usage-on-KL17/m-p/589987#M34732</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We are about mid point in our development and would like to test if our stack usage is safe (not close to overflowing) on our KL17 processor?&amp;nbsp; What tools are available to a developer to make this assessment?&amp;nbsp; We are using the IAR Workbench IDE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Sep 2016 20:49:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-verify-safe-stack-usage-on-KL17/m-p/589987#M34732</guid>
      <dc:creator>rickstuart</dc:creator>
      <dc:date>2016-09-02T20:49:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to verify safe stack usage on KL17?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-verify-safe-stack-usage-on-KL17/m-p/589988#M34733</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Rick,&lt;/P&gt;&lt;P&gt;I think we have not the tools to check if the stack is safe. But I think you can write the stack with a pattern, then running the code and check if pattern has been changed for the out of&amp;nbsp; range of stack memory.&lt;/P&gt;&lt;P&gt;Hope it can help you.&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Xiangjun Rong&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Sep 2016 09:31:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-verify-safe-stack-usage-on-KL17/m-p/589988#M34733</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2016-09-13T09:31:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to verify safe stack usage on KL17?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-verify-safe-stack-usage-on-KL17/m-p/589989#M34734</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Rick,&lt;/P&gt;&lt;P&gt;I have used this approach to analyses the stack in my applications:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://www.iar.com/support/resources/articles/stack-usage-analysis-for-rx/" title="https://www.iar.com/support/resources/articles/stack-usage-analysis-for-rx/"&gt;IAR Stack usage analysis for RX&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and get it really usefull.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;R.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Sep 2016 10:49:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-verify-safe-stack-usage-on-KL17/m-p/589989#M34734</guid>
      <dc:creator>rastislav_pavlanin</dc:creator>
      <dc:date>2016-09-13T10:49:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to verify safe stack usage on KL17?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-verify-safe-stack-usage-on-KL17/m-p/589990#M34735</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Moving the stack from the top of RAM to near the bottom is an often over looked method.&lt;/P&gt;&lt;P&gt;When it overflows it will generate an exception rather than silently corrupting things.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Explained here: &amp;nbsp;&lt;A class="link-titled" href="http://embeddedgurus.com/state-space/2014/02/are-we-shooting-ourselves-in-the-foot-with-stack-overflow/" title="http://embeddedgurus.com/state-space/2014/02/are-we-shooting-ourselves-in-the-foot-with-stack-overflow/"&gt;Are We Shooting Ourselves in the Foot with Stack Overflow? « State Space&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to read the stack pointer:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In Generic C, a good tools set should complain about returning the address of a local variable:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*&lt;BR /&gt; * void *CheckStackDepth( void )&lt;BR /&gt; * {&lt;BR /&gt; * volatile uint32_t dummy; // Put a variable on the stack&lt;BR /&gt; * return( (void *) &amp;amp;dummy ); // Return its address - therefore the (approx.) present SP value&lt;BR /&gt; * }&lt;BR /&gt; */&lt;BR /&gt;&lt;BR /&gt;In GCC:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;static __inline__ void *sp_get(void)&lt;BR /&gt;{&lt;BR /&gt; void *sp;&lt;/P&gt;&lt;P&gt;__asm__ __volatile__ ("mrs %0, msp" : "=r"(sp));&lt;/P&gt;&lt;P&gt;return( sp );&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I call sp_get() in IRQs then test and save to a global variable (which in general should be avoided) that will show the stack depth. &amp;nbsp;Something different would need done if have nested IRQs.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Sep 2016 12:59:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-verify-safe-stack-usage-on-KL17/m-p/589990#M34735</guid>
      <dc:creator>bobpaddock</dc:creator>
      <dc:date>2016-09-13T12:59:43Z</dc:date>
    </item>
  </channel>
</rss>

