<?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>topic Re: Stop KDS optimising out NOP / NOPs in Kinetis Design Studio</title>
    <link>https://community.nxp.com/t5/Kinetis-Design-Studio/Stop-KDS-optimising-out-NOP-NOPs/m-p/594847#M7491</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Such instructions must be marked asVolatile to prevent the compiler from removing it.&lt;/P&gt;&lt;P&gt;Compiler sees that it has no side effects so removes it as unnecessary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For GCC:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#define ATTR_NO_INSTRUMENT_FUNCTION __attribute__( ( no_instrument_function ) )&lt;BR /&gt;/*&lt;BR /&gt; * NOP is not necessarily a time-consuming NOP. The processor might&lt;BR /&gt; * remove it from the pipeline before it reaches the execution stage.&lt;BR /&gt; * Use in combination with the Sync Barrier Instruction to consume time.&lt;BR /&gt; */&lt;BR /&gt;static inline ATTR_NO_INSTRUMENT_FUNCTION void nop( void )&lt;BR /&gt;{&lt;BR /&gt; __asm__ __volatile__ ("nop");&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then use 'nop();' in your code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The pipeline comment depends on what part you are using.&lt;/P&gt;&lt;P&gt;A Sync Barrier Instruction may consume thousands of cycles.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 06 Sep 2016 12:06:45 GMT</pubDate>
    <dc:creator>bobpaddock</dc:creator>
    <dc:date>2016-09-06T12:06:45Z</dc:date>
    <item>
      <title>Stop KDS optimising out NOP / NOPs</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/Stop-KDS-optimising-out-NOP-NOPs/m-p/594846#M7490</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is another newbie question (I've previously used IAR).&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For debuggin purposes in a bit of test code I want some nops to single step through&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If In insert multiple nops e.g.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; __NOP();&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; __NOP();&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; __NOP();&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;they seem to be optimised out. How can I stop this.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've selected the following settings but they don't appear to have any effect on keeping the NOPs&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Project/Properties/C/C++ Build/Tool Settings/Optimization/Optimization Level = None (-O0)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Project/Properties/C/C++ Build/Tool Settings/Debugging/Debug Level = Maximum (-g3)&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Sep 2016 11:11:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/Stop-KDS-optimising-out-NOP-NOPs/m-p/594846#M7490</guid>
      <dc:creator>beng_</dc:creator>
      <dc:date>2016-09-06T11:11:59Z</dc:date>
    </item>
    <item>
      <title>Re: Stop KDS optimising out NOP / NOPs</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/Stop-KDS-optimising-out-NOP-NOPs/m-p/594847#M7491</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Such instructions must be marked asVolatile to prevent the compiler from removing it.&lt;/P&gt;&lt;P&gt;Compiler sees that it has no side effects so removes it as unnecessary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For GCC:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#define ATTR_NO_INSTRUMENT_FUNCTION __attribute__( ( no_instrument_function ) )&lt;BR /&gt;/*&lt;BR /&gt; * NOP is not necessarily a time-consuming NOP. The processor might&lt;BR /&gt; * remove it from the pipeline before it reaches the execution stage.&lt;BR /&gt; * Use in combination with the Sync Barrier Instruction to consume time.&lt;BR /&gt; */&lt;BR /&gt;static inline ATTR_NO_INSTRUMENT_FUNCTION void nop( void )&lt;BR /&gt;{&lt;BR /&gt; __asm__ __volatile__ ("nop");&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then use 'nop();' in your code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The pipeline comment depends on what part you are using.&lt;/P&gt;&lt;P&gt;A Sync Barrier Instruction may consume thousands of cycles.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Sep 2016 12:06:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/Stop-KDS-optimising-out-NOP-NOPs/m-p/594847#M7491</guid>
      <dc:creator>bobpaddock</dc:creator>
      <dc:date>2016-09-06T12:06:45Z</dc:date>
    </item>
    <item>
      <title>Re: Stop KDS optimising out NOP / NOPs</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/Stop-KDS-optimising-out-NOP-NOPs/m-p/594848#M7492</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Sep 2016 14:55:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/Stop-KDS-optimising-out-NOP-NOPs/m-p/594848#M7492</guid>
      <dc:creator>beng_</dc:creator>
      <dc:date>2016-09-12T14:55:24Z</dc:date>
    </item>
  </channel>
</rss>

