<?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>CodeWarrior for MCUのトピックMixed C and Assembly style coding for K60 on Code warrior 10.3</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Mixed-C-and-Assembly-style-coding-for-K60-on-Code-warrior-10-3/m-p/266276#M10053</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;I am trying to write a delay function for k60 in codewarrior 10.3 using the __asm directive.The compiler gives me an error as follows&lt;/P&gt;&lt;P&gt;"expected '(' before '{' token" .The help manual for Codewarrior 10.3 states that&lt;/P&gt;&lt;P&gt;"To ensure that the C/C++ compiler recognizes the asm keyword, you must clear the &lt;STRONG class="cBold"&gt;ANSI Keywords Only&lt;/STRONG&gt; checkbox in the &lt;STRONG class="cBold"&gt;C/C++ Language&lt;/STRONG&gt; panel. "&lt;/P&gt;&lt;P&gt;But the C/C++ Build properties do not have an option for this particular setting.&lt;/P&gt;&lt;P&gt;In the Build properties panel under the ARM LTD windows GCC C compiler --&amp;gt;Miscellaneous--&amp;gt;Language standard If I change it from Compiler default to ISO C9 -ansi teh error related to asm directive goes away . But the rest of my C code throws up Multiple errors.&lt;/P&gt;&lt;P&gt;I know that asm directive is&amp;nbsp; ansi keyword. How do I enable my compiler to accept ANSI keywords?&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 31 May 2013 05:14:48 GMT</pubDate>
    <dc:creator>nasreenshaikh</dc:creator>
    <dc:date>2013-05-31T05:14:48Z</dc:date>
    <item>
      <title>Mixed C and Assembly style coding for K60 on Code warrior 10.3</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Mixed-C-and-Assembly-style-coding-for-K60-on-Code-warrior-10-3/m-p/266276#M10053</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;I am trying to write a delay function for k60 in codewarrior 10.3 using the __asm directive.The compiler gives me an error as follows&lt;/P&gt;&lt;P&gt;"expected '(' before '{' token" .The help manual for Codewarrior 10.3 states that&lt;/P&gt;&lt;P&gt;"To ensure that the C/C++ compiler recognizes the asm keyword, you must clear the &lt;STRONG class="cBold"&gt;ANSI Keywords Only&lt;/STRONG&gt; checkbox in the &lt;STRONG class="cBold"&gt;C/C++ Language&lt;/STRONG&gt; panel. "&lt;/P&gt;&lt;P&gt;But the C/C++ Build properties do not have an option for this particular setting.&lt;/P&gt;&lt;P&gt;In the Build properties panel under the ARM LTD windows GCC C compiler --&amp;gt;Miscellaneous--&amp;gt;Language standard If I change it from Compiler default to ISO C9 -ansi teh error related to asm directive goes away . But the rest of my C code throws up Multiple errors.&lt;/P&gt;&lt;P&gt;I know that asm directive is&amp;nbsp; ansi keyword. How do I enable my compiler to accept ANSI keywords?&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 May 2013 05:14:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Mixed-C-and-Assembly-style-coding-for-K60-on-Code-warrior-10-3/m-p/266276#M10053</guid>
      <dc:creator>nasreenshaikh</dc:creator>
      <dc:date>2013-05-31T05:14:48Z</dc:date>
    </item>
    <item>
      <title>Re: Mixed C and Assembly style coding for K60 on Code warrior 10.3</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Mixed-C-and-Assembly-style-coding-for-K60-on-Code-warrior-10-3/m-p/266277#M10054</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Nasreen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GCC compiler will recognize asm directive by default, below you can see a very simple example. using asm instructions in a c file and also calling an assembly subroutine in a .s file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;in main.c&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#include &lt;SPAN style="color: #2a00ff; font-size: 10pt;"&gt;"derivative.h"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;extern&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;STRONG style="color: #7f0055; font-size: 10pt;"&gt;&lt;STRONG style="color: #7f0055; font-size: 10pt;"&gt;void&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; _add();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG style="color: #7f0055; font-size: 10pt;"&gt;&lt;STRONG style="color: #7f0055; font-size: 10pt;"&gt;&amp;nbsp; &lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P align="left"&gt;int&lt;SPAN style="font-size: 10pt;"&gt; main(&lt;/SPAN&gt;&lt;STRONG style="color: #7f0055; font-size: 10pt;"&gt;&lt;STRONG style="color: #7f0055; font-size: 10pt;"&gt;void&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;SPAN style="font-size: 10pt;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG style="color: #7f0055; font-size: 10pt;"&gt;&lt;STRONG style="color: #7f0055; font-size: 10pt;"&gt;&amp;nbsp; &lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;asm &lt;SPAN style="font-size: 10pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #2a00ff; font-size: 10pt;"&gt;"mov r0, #0x0A"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;asm &lt;SPAN style="font-size: 10pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #2a00ff; font-size: 10pt;"&gt;"mov r1, #0x03"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left"&gt;asm &lt;SPAN style="font-size: 10pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #2a00ff; font-size: 10pt;"&gt;"bl _add"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;); &lt;/SPAN&gt;&lt;SPAN style="color: #3f7f5f; font-size: 10pt;"&gt;//using assembly code&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left"&gt; &lt;/P&gt;&lt;P align="left"&gt;&lt;SPAN style="font-size: 10pt;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left"&gt; &lt;/P&gt;&lt;P align="left"&gt; &lt;/P&gt;&lt;P align="left"&gt;&lt;STRONG style="font-size: 10pt;"&gt;in add.s&lt;/STRONG&gt;&lt;/P&gt;&lt;P align="left"&gt; &lt;/P&gt;&lt;P align="left"&gt;.global &lt;SPAN style="font-size: 10pt;"&gt;_add&lt;/SPAN&gt;&lt;STRONG&gt;&lt;STRONG style="color: #7f0055; font-size: 10pt;"&gt;&lt;STRONG style="color: #7f0055; font-size: 10pt;"&gt;&amp;nbsp; &lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;STRONG&gt;&lt;STRONG style="color: #7f0055; font-size: 10pt;"&gt;&lt;/STRONG&gt;&lt;/STRONG&gt; &lt;/P&gt;&lt;P align="left"&gt;.text&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG style="color: #7f0055; font-size: 10pt;"&gt;&lt;STRONG style="color: #7f0055; font-size: 10pt;"&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P align="left"&gt;.align &lt;SPAN style="font-size: 10pt;"&gt;4&lt;/SPAN&gt;&lt;STRONG&gt;&lt;STRONG style="color: #7f0055; font-size: 10pt;"&gt;&lt;STRONG style="color: #7f0055; font-size: 10pt;"&gt;&amp;nbsp; &lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;/P&gt;&lt;P align="left"&gt;_add:&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #7f0055; font-size: 10pt;"&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;add r0, r0, r1&lt;/P&gt;&lt;P&gt;&amp;nbsp; bx lr&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P align="left"&gt;　&lt;/P&gt;&lt;P align="left"&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;/P&gt;&lt;P align="left"&gt;Hope this helps!&lt;/P&gt;&lt;P align="left"&gt;&lt;/P&gt;&lt;P align="left"&gt;Carlos&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Jun 2013 21:30:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Mixed-C-and-Assembly-style-coding-for-K60-on-Code-warrior-10-3/m-p/266277#M10054</guid>
      <dc:creator>Carlos_Musich</dc:creator>
      <dc:date>2013-06-03T21:30:50Z</dc:date>
    </item>
    <item>
      <title>Re: Mixed C and Assembly style coding for K60 on Code warrior 10.3</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Mixed-C-and-Assembly-style-coding-for-K60-on-Code-warrior-10-3/m-p/266278#M10055</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank You Carlos&lt;/P&gt;&lt;P&gt;The asm directive does work with the GCC compiler. The problem was that I was using the syntax of HCS08 compiler as i was working on a project which uses both HCS08 and Kinetis K60. After using the correct syntax for GCC the error goes away. below is the function which I have written .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void delay10us(uint16_t us)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;//uint16_t cnt;&lt;/P&gt;&lt;P&gt;asm volatile(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "\n"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "L_dl1%=:"&amp;nbsp;&amp;nbsp; "\n\t"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "mov r1, %1" "\n\t" &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "L_dl2%=:"&amp;nbsp;&amp;nbsp; "\n\t"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "sub r1, #1" "\n\t"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "bne L_dl2%=""\n\t"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "mov r2, %0" "\n\t"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "sub r2, #1"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "\n\t"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "bne L_dl1%=""\n\t"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :: "r" (us), "r" (delay_count_us)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; );&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Jun 2013 04:10:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Mixed-C-and-Assembly-style-coding-for-K60-on-Code-warrior-10-3/m-p/266278#M10055</guid>
      <dc:creator>nasreenshaikh</dc:creator>
      <dc:date>2013-06-04T04:10:18Z</dc:date>
    </item>
  </channel>
</rss>

