<?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 Development ToolsのトピックRe: Macro in Assembler HCS12</title>
    <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Macro-in-Assembler-HCS12/m-p/1516943#M8851</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;You have error A2314. This error description.&lt;/P&gt;
&lt;DIV class="contents"&gt;An absolute expression is expected at the specified position. Assembler directives expecting an absolute value are: &lt;CODE&gt;OFFSET, ORG, ALIGN, SET, BASE, 
DS, LLEN, PLEN, SPC, TABS, IF, IFEQ, IFNE, IFLE, IFLT, IFGE, IFGT.&lt;/CODE&gt; The first operand in a DCB directive must be absolute:&lt;/DIV&gt;
&lt;DIV class="contents"&gt;&lt;STRONG&gt;Example:&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV class="contents"&gt;
&lt;DIV class="contents"&gt;
&lt;DIV class="fragment"&gt;
&lt;PRE class="fragment"&gt;DataSec: SECTION
label1:  DS.W 1
label2:  DS.W 2
label3:  EQU  8

codeSec: SECTION

         BASE label1

         ALIGN label2
&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;H2&gt;&lt;FONT size="4"&gt;&lt;A class="anchor" name="tips" target="_blank"&gt;&lt;/A&gt;Tips&lt;/FONT&gt;&lt;/H2&gt;
&lt;/DIV&gt;
&lt;DIV class="contents"&gt;&lt;FONT size="4"&gt;Specify an absolute expression at the specified position.&lt;/FONT&gt;
&lt;H2&gt;&lt;FONT size="4"&gt;&lt;A class="anchor" name="example" target="_blank"&gt;&lt;/A&gt;Example&lt;/FONT&gt;&lt;/H2&gt;
&lt;DIV class="fragment"&gt;
&lt;PRE class="fragment"&gt;DataSec: SECTION
label1:  DS.W 1
label2:  DS.W 2
label3:  EQU  8

codeSec: SECTION

         BASE label3

         ALIGN 4
&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
    <pubDate>Mon, 05 Sep 2022 09:46:54 GMT</pubDate>
    <dc:creator>ZhangJennie</dc:creator>
    <dc:date>2022-09-05T09:46:54Z</dc:date>
    <item>
      <title>Macro in Assembler HCS12</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Macro-in-Assembler-HCS12/m-p/1516316#M8850</link>
      <description>&lt;P&gt;Good day&lt;BR /&gt;I am trying to use a microcontroller HCS12&lt;BR /&gt;I have a module built in Assembler, and I would like to automatically exchange the "BRA" and "LBRA" command on assembler code&lt;BR /&gt;I built this macro in which it should automatically recognize if the jump distance is too big for the BRA command.&lt;/P&gt;&lt;P&gt;MyBRA macro&lt;BR /&gt;&amp;nbsp;&amp;nbsp; if ( \1 &amp;lt; (*)+256)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BRA \1&lt;BR /&gt;&amp;nbsp;&amp;nbsp; else&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LBRA \1&lt;BR /&gt;&amp;nbsp;&amp;nbsp; endif&lt;BR /&gt;endm&lt;/P&gt;&lt;P&gt;Unfortunately the compiler shows me an error on line "if( \1 &amp;lt;(*)+256)" : "A2314 expression must be absolute"&lt;BR /&gt;Is there a method in assembler to make this macro work? ... or another method that works&lt;BR /&gt;My purpose is to make the assembler decide whether to use LBRA or BRA&lt;/P&gt;&lt;P&gt;Thanks to all&lt;/P&gt;</description>
      <pubDate>Fri, 02 Sep 2022 12:55:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Macro-in-Assembler-HCS12/m-p/1516316#M8850</guid>
      <dc:creator>Molibdeno</dc:creator>
      <dc:date>2022-09-02T12:55:14Z</dc:date>
    </item>
    <item>
      <title>Re: Macro in Assembler HCS12</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Macro-in-Assembler-HCS12/m-p/1516943#M8851</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;You have error A2314. This error description.&lt;/P&gt;
&lt;DIV class="contents"&gt;An absolute expression is expected at the specified position. Assembler directives expecting an absolute value are: &lt;CODE&gt;OFFSET, ORG, ALIGN, SET, BASE, 
DS, LLEN, PLEN, SPC, TABS, IF, IFEQ, IFNE, IFLE, IFLT, IFGE, IFGT.&lt;/CODE&gt; The first operand in a DCB directive must be absolute:&lt;/DIV&gt;
&lt;DIV class="contents"&gt;&lt;STRONG&gt;Example:&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV class="contents"&gt;
&lt;DIV class="contents"&gt;
&lt;DIV class="fragment"&gt;
&lt;PRE class="fragment"&gt;DataSec: SECTION
label1:  DS.W 1
label2:  DS.W 2
label3:  EQU  8

codeSec: SECTION

         BASE label1

         ALIGN label2
&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;H2&gt;&lt;FONT size="4"&gt;&lt;A class="anchor" name="tips" target="_blank"&gt;&lt;/A&gt;Tips&lt;/FONT&gt;&lt;/H2&gt;
&lt;/DIV&gt;
&lt;DIV class="contents"&gt;&lt;FONT size="4"&gt;Specify an absolute expression at the specified position.&lt;/FONT&gt;
&lt;H2&gt;&lt;FONT size="4"&gt;&lt;A class="anchor" name="example" target="_blank"&gt;&lt;/A&gt;Example&lt;/FONT&gt;&lt;/H2&gt;
&lt;DIV class="fragment"&gt;
&lt;PRE class="fragment"&gt;DataSec: SECTION
label1:  DS.W 1
label2:  DS.W 2
label3:  EQU  8

codeSec: SECTION

         BASE label3

         ALIGN 4
&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 05 Sep 2022 09:46:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Macro-in-Assembler-HCS12/m-p/1516943#M8851</guid>
      <dc:creator>ZhangJennie</dc:creator>
      <dc:date>2022-09-05T09:46:54Z</dc:date>
    </item>
    <item>
      <title>Re: Macro in Assembler HCS12</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Macro-in-Assembler-HCS12/m-p/1520543#M8854</link>
      <description>&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Thanks ZhangJennie ....To simplify everything ..... I tried to create new project ... a small example of testing in "relocable assembler":&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;main.asm:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;; Include derivative-specific definitions&lt;BR /&gt;INCLUDE 'derivative.inc'&lt;BR /&gt;; export symbols&lt;BR /&gt;XDEF Entry, _Startup, main&lt;/P&gt;&lt;P&gt;XREF __SEG_END_SSTACK ; symbol defined by the linker for the end of the stack&lt;/P&gt;&lt;P&gt;MyBRA macro&lt;BR /&gt;if (\1&amp;lt;(*+256))&lt;BR /&gt;BRA \1&lt;BR /&gt;else&lt;BR /&gt;LBRA \1&lt;BR /&gt;endif&lt;BR /&gt;endm&lt;/P&gt;&lt;P&gt;; variable/data section&lt;BR /&gt;MY_EXTENDED_RAM: SECTION&lt;BR /&gt;Counter ds.w 1&lt;/P&gt;&lt;P&gt;; code section&lt;BR /&gt;MyCode: SECTION&lt;BR /&gt;main:&lt;BR /&gt;_Startup:&lt;BR /&gt;Entry:&lt;BR /&gt;LDS #__SEG_END_SSTACK ; initialize the stack pointer&lt;BR /&gt;EndlessLoop:&lt;BR /&gt;LDX #1 ; X contains counter&lt;BR /&gt;CouterLoop:&lt;BR /&gt;STX Counter ; update global.&lt;BR /&gt;LDX Counter&lt;BR /&gt;INX&lt;BR /&gt;CPX #24 ; larger values cause overflow.&lt;BR /&gt;BNE CouterLoop&lt;BR /&gt;MyBRA EndlessLoop ; restart.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; My macro &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Unfortunately now it gives me a different mistake&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;LI-EMOJI id="lia_disappointed-face" title=":disappointed_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/P&gt;&lt;P&gt;A2401:Complex relocable expression not supported&lt;/P&gt;&lt;P&gt;Macro Expression "if(EndlessLoop &amp;lt;* + 256)"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Sep 2022 12:10:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Macro-in-Assembler-HCS12/m-p/1520543#M8854</guid>
      <dc:creator>Molibdeno</dc:creator>
      <dc:date>2022-09-12T12:10:18Z</dc:date>
    </item>
    <item>
      <title>Re: Macro in Assembler HCS12</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Macro-in-Assembler-HCS12/m-p/1521097#M8855</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Molibdeno&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please follow this tips to fix error&lt;/P&gt;
&lt;DIV class="contents"&gt;
&lt;H2&gt;&lt;A class="anchor" name="description" target="_blank"&gt;&lt;/A&gt;Description&lt;/H2&gt;
A complex relocatable expression has been detected. A complex relocatable expression is detected when the expression contains:
&lt;UL&gt;
&lt;LI&gt;An operation between labels located in two different sections.&lt;/LI&gt;
&lt;LI&gt;A multiplication, division or modulo operation between two labels.&lt;/LI&gt;
&lt;LI&gt;The addition of two labels located in the same section.&lt;/LI&gt;
&lt;/UL&gt;
&lt;H2&gt;&lt;A class="anchor" name="example" target="_blank"&gt;&lt;/A&gt;Example&lt;/H2&gt;
&lt;DIV class="fragment"&gt;
&lt;PRE class="fragment"&gt;          XDEF offset
DataSec1: SECTION SHORT
DataLbl1: DS.B 10
DataSec2: SECTION SHORT
DataLbl2: DS.W 15
offset:   EQU DataLbl2 - DataLbl1
&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;H2&gt;&lt;A class="anchor" name="tips" target="_blank"&gt;&lt;/A&gt;Tips&lt;/H2&gt;
The macro assembler does not support complex relocatable expressions. The corresponding expression must be evaluated at execution time.
&lt;P&gt;If both DataSec1 and DataSec2 are in the same section and defined in this module, the assembler can compute the difference:&lt;/P&gt;
&lt;DIV class="fragment"&gt;
&lt;PRE class="fragment"&gt;DataSec1: SECTION SHORT
DataLbl1: DS.B 10
DataLbl2: DS.W 15
offset:   EQU DataLbl2 - DataLbl1
&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;Have a nice day&lt;/P&gt;
&lt;P&gt;Jun Zhang&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2022 08:45:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Macro-in-Assembler-HCS12/m-p/1521097#M8855</guid>
      <dc:creator>ZhangJennie</dc:creator>
      <dc:date>2022-09-13T08:45:43Z</dc:date>
    </item>
  </channel>
</rss>

