<?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: Reading PC runtime</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Reading-PC-runtime/m-p/426293#M24573</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Vinayhunsur, &lt;SPAN class="j-post-author"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-post-author"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-post-author"&gt;I think you can use the following code to implement it as a basic instruction. But I suggest you use an subroutine to implement it.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-post-author"&gt;I have compile the following line in KDS tools, it can compile the line successfully.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-post-author"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; __asm("MOV R0,PC");&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, 24 Nov 2015 03:47:31 GMT</pubDate>
    <dc:creator>xiangjun_rong</dc:creator>
    <dc:date>2015-11-24T03:47:31Z</dc:date>
    <item>
      <title>Reading PC runtime</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Reading-PC-runtime/m-p/426292#M24572</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;My setup involves Kinetis KV3x family micro and GCC compiler. What is the best mechanism to access the value of PC during runtime for logging purposes (&amp;amp; also meeting compliance to some software standards) ? There are references to few inline assembly codes however they don't seem to be reliable. Are there any other ways to achieve this ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Nov 2015 13:18:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Reading-PC-runtime/m-p/426292#M24572</guid>
      <dc:creator>vinayhunsur</dc:creator>
      <dc:date>2015-11-19T13:18:57Z</dc:date>
    </item>
    <item>
      <title>Re: Reading PC runtime</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Reading-PC-runtime/m-p/426293#M24573</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Vinayhunsur, &lt;SPAN class="j-post-author"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-post-author"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-post-author"&gt;I think you can use the following code to implement it as a basic instruction. But I suggest you use an subroutine to implement it.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-post-author"&gt;I have compile the following line in KDS tools, it can compile the line successfully.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-post-author"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; __asm("MOV R0,PC");&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, 24 Nov 2015 03:47:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Reading-PC-runtime/m-p/426293#M24573</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2015-11-24T03:47:31Z</dc:date>
    </item>
    <item>
      <title>Re: Reading PC runtime</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Reading-PC-runtime/m-p/426294#M24574</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm curious as to what standard(s)? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Nov 2015 12:59:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Reading-PC-runtime/m-p/426294#M24574</guid>
      <dc:creator>bobpaddock</dc:creator>
      <dc:date>2015-11-24T12:59:33Z</dc:date>
    </item>
    <item>
      <title>Re: Reading PC runtime</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Reading-PC-runtime/m-p/426295#M24575</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Bob,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to assign a register value to a variable or return a register value from a subroutine, it is dependent on compiler, you have to refer to the calling convention in&amp;nbsp; corresponding doc of compiler.&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>Wed, 25 Nov 2015 05:42:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Reading-PC-runtime/m-p/426295#M24575</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2015-11-25T05:42:05Z</dc:date>
    </item>
    <item>
      <title>Re: Reading PC runtime</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Reading-PC-runtime/m-p/426296#M24576</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bob,&lt;/P&gt;&lt;P&gt;as you are using GNU/gcc, you have several options :-).&lt;/P&gt;&lt;P&gt;One way I would do it is to use&lt;/P&gt;&lt;DIV class="number1 alt2 line index0"&gt;&lt;CODE class="keyword cpp bold"&gt;void&lt;/CODE&gt; &lt;CODE class="cpp plain"&gt;__cyg_profile_func_enter(&lt;/CODE&gt;&lt;CODE class="keyword cpp bold"&gt;void&lt;/CODE&gt; &lt;CODE class="cpp plain"&gt;*this_fn, &lt;/CODE&gt;&lt;CODE class="keyword cpp bold"&gt;void&lt;/CODE&gt; &lt;CODE class="cpp plain"&gt;*call_site);&lt;/CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="number2 alt1 line index1"&gt;&lt;CODE class="keyword cpp bold"&gt;void&lt;/CODE&gt; &lt;CODE class="cpp plain"&gt;__cyg_profile_func_exit(&lt;/CODE&gt;&lt;CODE class="keyword cpp bold"&gt;void&lt;/CODE&gt; &lt;CODE class="cpp plain"&gt;*this_fn, &lt;/CODE&gt;&lt;CODE class="keyword cpp bold"&gt;void&lt;/CODE&gt; &lt;CODE class="cpp plain"&gt;*call_site);&lt;/CODE&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;See &lt;A href="http://mcuoneclipse.com/2015/04/04/poor-mans-trace-free-of-charge-function-entryexit-trace-with-gnu-tools/" title="http://mcuoneclipse.com/2015/04/04/poor-mans-trace-free-of-charge-function-entryexit-trace-with-gnu-tools/"&gt;Poor Man’s Trace: Free-of-Charge Function Entry/Exit Trace with GNU Tools | MCU on Eclipse&lt;/A&gt; &lt;/P&gt;&lt;P&gt;I'm reading and storing the program counter that way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another way would be to use the&lt;/P&gt;&lt;P&gt;&lt;CODE class="cpp plain"&gt;__gnu_mcount_nc:&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;with enabled profiling. You can add there your assembly code to store the PC in your custom format if needed.&lt;/P&gt;&lt;P&gt;See &lt;A href="http://mcuoneclipse.com/2014/12/26/code-coverage-for-embedded-target-with-eclipse-gcc-and-gcov/" title="http://mcuoneclipse.com/2014/12/26/code-coverage-for-embedded-target-with-eclipse-gcc-and-gcov/"&gt;Code Coverage for Embedded Target with Eclipse, gcc and gcov | MCU on Eclipse&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yet another way if you have either a Segger J-Link or a FRDM board with OpenSDA (and the Segger J-Link firmware on it) is to use the Segger Realtime Transfer and the Segger System Viewer. See &lt;A href="http://mcuoneclipse.com/2015/11/16/segger-systemview-realtime-analysis-and-visualization-for-freertos/" title="http://mcuoneclipse.com/2015/11/16/segger-systemview-realtime-analysis-and-visualization-for-freertos/"&gt;Segger SystemView: Realtime Analysis and Visualization for FreeRTOS | MCU on Eclipse&lt;/A&gt;&amp;nbsp; and &lt;A href="http://mcuoneclipse.com/2015/11/22/mcuoneclipse-components-22-nov-2015-release/" title="http://mcuoneclipse.com/2015/11/22/mcuoneclipse-components-22-nov-2015-release/"&gt;McuOnEclipse Components: 22-Nov-2015 Release | MCU on Eclipse&lt;/A&gt;. There you can instrument and measure individual pieces of code, see &lt;A href="http://mcuoneclipse.com/2015/11/22/data-logger-with-tinyk20-board/" title="http://mcuoneclipse.com/2015/11/22/data-logger-with-tinyk20-board/"&gt;Data Logger with tinyK20 Board | MCU on Eclipse&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this gives some ideas,&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2015 07:12:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Reading-PC-runtime/m-p/426296#M24576</guid>
      <dc:creator>BlackNight</dc:creator>
      <dc:date>2015-11-25T07:12:02Z</dc:date>
    </item>
    <item>
      <title>Re: Reading PC runtime</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Reading-PC-runtime/m-p/426297#M24577</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN&gt;Erich and Rong thank you for your answers, that was vinayhunsur actual question that you answered.&amp;nbsp; Hopefully he sees them. My question was to vinayhunsur's "meeting compliance to some software standards". What I want to know is what are the software standards (UL1998, DO-178D etc?) that require this? Such standards are a personal interest of mine. &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://www.softwaresafety.net" rel="nofollow"&gt;http://www.softwaresafety.net&lt;/A&gt;&lt;SPAN&gt; Erich, I have used your poor man's trace in the past.&amp;nbsp; Thank You for all that you document. Freescale parts of today would be useless without such examples. Sad how bad the docs have become from the Motorola days. &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2015 18:43:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Reading-PC-runtime/m-p/426297#M24577</guid>
      <dc:creator>bobpaddock</dc:creator>
      <dc:date>2015-11-25T18:43:49Z</dc:date>
    </item>
    <item>
      <title>Re: Reading PC runtime</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Reading-PC-runtime/m-p/426298#M24578</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bob (and Xiangjun),&lt;/P&gt;&lt;P&gt;sorry for mixing up replies ("too many threads" could be my excuse).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;About the software standards: with my experience, pretty much everything for safety critical systems or for good software quality requires some metrics (tested lines of code, code and test coverage, performance analysis and regression testing). I would say that should be commone sense today anyway.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As for the bad docs: If you could be more specific, I believe then someone else could jump in or at least take the feedback?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2015 19:30:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Reading-PC-runtime/m-p/426298#M24578</guid>
      <dc:creator>BlackNight</dc:creator>
      <dc:date>2015-11-25T19:30:43Z</dc:date>
    </item>
  </channel>
</rss>

