<?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>ColdFire/68K Microcontrollers and ProcessorsのトピックRe: Coldfire mcf54418 CAU assembly</title>
    <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Coldfire-mcf54418-CAU-assembly/m-p/757386#M13386</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I expected the definition of the Assembly Instruction Format for the cp0ld and cp0st instructions to be in the "CFPRM.PDF" (ColdFire Family Programmer's Reference Manual). It isn't. That was last updated in 2005.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I would expect it should be in the "3.3.2 Instruction Set Architecture (ISA_C)" section of the Reference Manual. It isn't, and it refers to the "ColdFire Family Programmer's Reference Manual".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The instructions are detailed in "26.3.2 Coprocessor Instructions".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;The example assembler syntax for the CAU is:

&amp;nbsp;&amp;nbsp;&amp;nbsp; cp0ld.l&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;ea&amp;gt;,&amp;lt;CMD&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; coprocessor load
&amp;nbsp;&amp;nbsp;&amp;nbsp; cp0st.l&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;ea&amp;gt;,&amp;lt;CMD&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; coprocessor store

The &amp;lt;ea&amp;gt; field specifies the source operand (operand1) for load
instructions and destination (result) for store instructions.
The basic ColdFire addressing modes {Rn, (An), -(An), (An)+,
(d16,An)} are supported for this field. The &amp;lt;CMD&amp;gt; field is a 9-bit
value that specifies the CAU command for an instruction.&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above is probably what the GNU Assembler expects - with the "&amp;lt;ea&amp;gt;" field not being optional, even for instructions that don't use it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The "/mmcau_lib_release/cau/README.txt" file says:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;These functions are written in the ColdFire assembler used by the Core &amp;amp;
Platform design team. This assembler may not be compatible with the wide
assortment of other development tools, but typically can be easily translated
into the required format.

One particular item related to porting deserved mention: compare instructions.&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So they expect you (or someone else) to translate it. The item about "compare instructions" is that different assemblers disagree on which way around the comparison instructions should go. Some assembly standards have "compare a, b" followed by a test mean "a &amp;gt; b" and others mean "b &amp;gt; a", depending on on whether the assembly format is "left to right" or "right to left". Except the original Sun M68k assembler was used by PDP-11 assembly programmers and they got annoyed that the two assembly languages had the opposite format, so they changed their M68k assembler to reverse the "compare" instruction operands so they wouldn't get confused. But so everyone else would because that assembler does the OPPOSITE of what the Motorola assembly documents said. That's what the README is warning about. No, I don't know which way around the GNU assembler is for these instructions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There should be some documentation on the GNU Assembler that details the specific assembly formats, including the one used for these instructions, but I can't find any.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;So I guess you have to read the SOURCE CODE for the GNU Assembler to find out what it expects!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Which is here, together with the explanations of the patch that added this functionality:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://sourceware.org/ml/binutils/2007-06/msg00139.html" rel="nofollow noopener noreferrer" target="_blank"&gt;http://sourceware.org/ml/binutils/2007-06/msg00139.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It also has an attached "cf_prm_coproc.pdf" file which I can't find anywhere else (so grab a copy) which also details the instructions and also explains the extra fields that seem to be in the GNU Assembly that the NXP document doesn't mention (Op,.size &amp;lt;ea&amp;gt;, Rx, ET, cmd). The "ET" field seems to be zero for the CAU, so NXP don't document it, but are in the following, and the GNU assembler seems to want it:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://sourceware.org/ml/binutils/2007-06/msg00139/cf_prm_coproc.pdf" rel="nofollow noopener noreferrer" target="_blank"&gt;https://sourceware.org/ml/binutils/2007-06/msg00139/cf_prm_coproc.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm SO glad the CPUs we use have the MDHA and SKHA. They're so much easier to use than the CAU.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 04 Jan 2018 23:41:29 GMT</pubDate>
    <dc:creator>TomE</dc:creator>
    <dc:date>2018-01-04T23:41:29Z</dc:date>
    <item>
      <title>Coldfire mcf54418 CAU assembly</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Coldfire-mcf54418-CAU-assembly/m-p/757384#M13384</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using the CAU on MCF54418.&amp;nbsp; &amp;nbsp;The compiler is GCC. I have got the "mmcau_lib_release.zip" from NXP.&lt;/P&gt;&lt;P&gt;But the GCC can not identify the&amp;nbsp; CAU commands, such as cp0ld.l , cp0st.l, etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The assembly codes below can not through compiler.&lt;/P&gt;&lt;P&gt;cp0ld.l (%a2)+,&amp;amp;LDR+CA0 # h[0] -&amp;gt; CA0&lt;BR /&gt; cp0ld.l (%a2)+,&amp;amp;LDR+CA1 # h[1] -&amp;gt; CA1&lt;BR /&gt; cp0ld.l (%a2)+,&amp;amp;LDR+CA2 # h[2] -&amp;gt; CA2&lt;BR /&gt; cp0ld.l (%a2)+,&amp;amp;LDR+CA3 # h[3] -&amp;gt; CA3&lt;BR /&gt; cp0ld.l (%a2)+,&amp;amp;LDR+CA4 # h[4] -&amp;gt; CA4&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wonder to know, how can I use the source codes in&amp;nbsp; "&lt;SPAN&gt;mmcau_lib_release.zip " with GCC ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks a lot.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Jan 2018 11:19:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Coldfire-mcf54418-CAU-assembly/m-p/757384#M13384</guid>
      <dc:creator>changliu1</dc:creator>
      <dc:date>2018-01-02T11:19:00Z</dc:date>
    </item>
    <item>
      <title>Re: Coldfire mcf54418 CAU assembly</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Coldfire-mcf54418-CAU-assembly/m-p/757385#M13385</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't know how or even IF you can use that code with gcc. That code probably one works with CodeWarrior.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The C language is standardised, but pretty much all assemblers are different to each other. They have different ways of specifying registers, immediates, and even use different characters to specify comments.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For instance, your example is using "#" as a comment character, whereas that's used as the "constant" designator in gcc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've just proved that gcc is able to assemble these opcodes, first by running "strings" on the assembler to see if it contains those opcodes (it does):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;tevans@p1 ..ares/projects/cdd_root/cdd_kernel/adl3 (git)-[6.03] % strings /opt/cross/m68k-elf/bin/m68k-elf-as | grep cp0ld
cp0ldb
cp0ldw
cp0ldl
cp0ld
&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;&lt;/P&gt;&lt;P&gt;Then google found me this page:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/Chadster766/McWRT/blob/master/attitude_adjustment/target/linux/coldfire/patches/011-Add-CAU-driver-for-MCF5445x-and-MCF5441x.patch" rel="nofollow noopener noreferrer" target="_blank"&gt;https://github.com/Chadster766/McWRT/blob/master/attitude_adjustment/target/linux/coldfire/patches/011-Add-CAU-driver-for-MCF5445x-and-MCF5441x.patch&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That contains sample code that gcc likes. For instance, one of the simplest opcodes is AESR, and this works:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #define MCFCAU_AESR&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (0x0E0)

&amp;nbsp;&amp;nbsp;&amp;nbsp; asm("cp0ld.l&amp;nbsp;&amp;nbsp;&amp;nbsp; %%d0,%%d0,#1,%0" : : "n"(MCFCAU_AESR));
&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The NXP example for the same thing in the MCF5441x Reference Manual is just "cp0ld.l #AESR", so you can see there's a big difference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm guessing you (or someone else) will have to translate all the opcodes in the NXP library for gcc, or use (or adapt) the patch in the previous link.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Jan 2018 02:36:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Coldfire-mcf54418-CAU-assembly/m-p/757385#M13385</guid>
      <dc:creator>TomE</dc:creator>
      <dc:date>2018-01-04T02:36:45Z</dc:date>
    </item>
    <item>
      <title>Re: Coldfire mcf54418 CAU assembly</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Coldfire-mcf54418-CAU-assembly/m-p/757386#M13386</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I expected the definition of the Assembly Instruction Format for the cp0ld and cp0st instructions to be in the "CFPRM.PDF" (ColdFire Family Programmer's Reference Manual). It isn't. That was last updated in 2005.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I would expect it should be in the "3.3.2 Instruction Set Architecture (ISA_C)" section of the Reference Manual. It isn't, and it refers to the "ColdFire Family Programmer's Reference Manual".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The instructions are detailed in "26.3.2 Coprocessor Instructions".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;The example assembler syntax for the CAU is:

&amp;nbsp;&amp;nbsp;&amp;nbsp; cp0ld.l&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;ea&amp;gt;,&amp;lt;CMD&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; coprocessor load
&amp;nbsp;&amp;nbsp;&amp;nbsp; cp0st.l&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;ea&amp;gt;,&amp;lt;CMD&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; coprocessor store

The &amp;lt;ea&amp;gt; field specifies the source operand (operand1) for load
instructions and destination (result) for store instructions.
The basic ColdFire addressing modes {Rn, (An), -(An), (An)+,
(d16,An)} are supported for this field. The &amp;lt;CMD&amp;gt; field is a 9-bit
value that specifies the CAU command for an instruction.&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above is probably what the GNU Assembler expects - with the "&amp;lt;ea&amp;gt;" field not being optional, even for instructions that don't use it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The "/mmcau_lib_release/cau/README.txt" file says:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;These functions are written in the ColdFire assembler used by the Core &amp;amp;
Platform design team. This assembler may not be compatible with the wide
assortment of other development tools, but typically can be easily translated
into the required format.

One particular item related to porting deserved mention: compare instructions.&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So they expect you (or someone else) to translate it. The item about "compare instructions" is that different assemblers disagree on which way around the comparison instructions should go. Some assembly standards have "compare a, b" followed by a test mean "a &amp;gt; b" and others mean "b &amp;gt; a", depending on on whether the assembly format is "left to right" or "right to left". Except the original Sun M68k assembler was used by PDP-11 assembly programmers and they got annoyed that the two assembly languages had the opposite format, so they changed their M68k assembler to reverse the "compare" instruction operands so they wouldn't get confused. But so everyone else would because that assembler does the OPPOSITE of what the Motorola assembly documents said. That's what the README is warning about. No, I don't know which way around the GNU assembler is for these instructions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There should be some documentation on the GNU Assembler that details the specific assembly formats, including the one used for these instructions, but I can't find any.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;So I guess you have to read the SOURCE CODE for the GNU Assembler to find out what it expects!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Which is here, together with the explanations of the patch that added this functionality:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://sourceware.org/ml/binutils/2007-06/msg00139.html" rel="nofollow noopener noreferrer" target="_blank"&gt;http://sourceware.org/ml/binutils/2007-06/msg00139.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It also has an attached "cf_prm_coproc.pdf" file which I can't find anywhere else (so grab a copy) which also details the instructions and also explains the extra fields that seem to be in the GNU Assembly that the NXP document doesn't mention (Op,.size &amp;lt;ea&amp;gt;, Rx, ET, cmd). The "ET" field seems to be zero for the CAU, so NXP don't document it, but are in the following, and the GNU assembler seems to want it:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://sourceware.org/ml/binutils/2007-06/msg00139/cf_prm_coproc.pdf" rel="nofollow noopener noreferrer" target="_blank"&gt;https://sourceware.org/ml/binutils/2007-06/msg00139/cf_prm_coproc.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm SO glad the CPUs we use have the MDHA and SKHA. They're so much easier to use than the CAU.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Jan 2018 23:41:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Coldfire-mcf54418-CAU-assembly/m-p/757386#M13386</guid>
      <dc:creator>TomE</dc:creator>
      <dc:date>2018-01-04T23:41:29Z</dc:date>
    </item>
  </channel>
</rss>

