<?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>8-bit MicrocontrollersのトピックRe: EEPROM emulation on QGx</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140592#M5678</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;bigmac wrote:&lt;BR /&gt;&lt;BR /&gt;&lt;P&gt;&lt;FONT size="2"&gt;When an immediate value includes some arithmetic, you might need to surround the expression by parenthesis.&lt;/FONT&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;FONT size="2"&gt;I seem to recall that I previoulsy experienced a similar problem, but not necessarily with this specific instruction.&lt;/FONT&gt;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;Bigmac, thanks for the idea, but that didn't cure it. I tried splitting up the first line into two by first adding the two things and then running the AIS operand. But now I get the same warning at my new ADD operand. Seems that what's choking up the compiler is the second line, SpSubSize: equ (*-SpSub).&lt;BR /&gt;&lt;BR /&gt;What is that equate doing?&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 23 Jun 2006 07:33:50 GMT</pubDate>
    <dc:creator>irob</dc:creator>
    <dc:date>2006-06-23T07:33:50Z</dc:date>
    <item>
      <title>EEPROM emulation on QGx</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140585#M5671</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I've read &lt;/SPAN&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fforums.freescale.com%2Ffreescale%2Fboard%2Fmessage%3Fboard.id%3D8BITCOMM%26message.id%3D627" rel="nofollow" target="_blank"&gt;this thread&lt;/A&gt;&lt;SPAN&gt;, and &lt;/SPAN&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fforums.freescale.com%2Ffreescale%2Fboard%2Fmessage%3Fboard.id%3D8BITCOMM%26message.id%3D800" rel="nofollow" target="_blank"&gt;this one&lt;/A&gt;&lt;SPAN&gt;, oh and &lt;/SPAN&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fforums.freescale.com%2Ffreescale%2Fboard%2Fmessage%3Fboard.id%3D8BITCOMM%26message.id%3D434" rel="nofollow" target="_blank"&gt;this one too&lt;/A&gt;&lt;SPAN&gt;. Too many choices makes my head spin!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But my local FAE was kind enough to send me a sample CodeWarrior project for EEPROM emulation on the MC9S08GB60. My target is a QG4/8 demo board. I’ve ported the project over to the QG8 with all the correct include files, timing differences, flash location differences, but haven’t gotten it to work just yet.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My question is this. Page 26 of the MC9S08QG8 rev 1.01 10/2005 datasheet states:&lt;/SPAN&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;EM&gt;The internal frequency is nominally 16-MHz and the default ICS settings will provide for a&lt;BR /&gt;4-MHz bus out of reset.&lt;/EM&gt;&lt;/BLOCKQUOTE&gt;&lt;SPAN&gt;Yet page 21, figure 1-2 (clock distribution) shows the BUSCLK as divided by 2 from ICSOUT. So which is it? Seems to me that the bus clock should be 8MHz, but it's stated that it will be 4 by default.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Naturally, these clock settings determine my flash programming clock setup. I'm guessing that timing is my problem.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2006 02:31:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140585#M5671</guid>
      <dc:creator>irob</dc:creator>
      <dc:date>2006-06-22T02:31:39Z</dc:date>
    </item>
    <item>
      <title>Re: EEPROM emulation on QGx</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140586#M5672</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;irob -&lt;/P&gt;&lt;P&gt;The correct answer is 4MHz. See this thread. The last post has the correct explanation.&lt;/P&gt;&lt;P&gt;&lt;A href="http://forums.freescale.com/freescale/board/message?board.id=8BITCOMM&amp;amp;message.id=1520#M1520" target="_blank"&gt;http://forums.freescale.com/freescale/board/message?board.id=8BITCOMM&amp;amp;message.id=1520#M1520&lt;/A&gt;&lt;/P&gt;&lt;P&gt;- Rocky&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2006 04:22:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140586#M5672</guid>
      <dc:creator>RockyRoad</dc:creator>
      <dc:date>2006-06-22T04:22:31Z</dc:date>
    </item>
    <item>
      <title>Re: EEPROM emulation on QGx</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140587#M5673</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;Ahh, thanks Rocky.&amp;nbsp; Regardless, I tried my project both ways and for 4MHz bus clock, I have this:&lt;/P&gt;&lt;P&gt;&lt;SPAN class="msg_source_code"&gt;&lt;SPAN class="text_smallest"&gt;Code:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;FCDIV = 0x13; // FLASH clock initialization to 200kHz&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;0x13 is a 0 for PRDIV8 and a 19d for DIV.&amp;nbsp;&amp;nbsp;Yet, I'm not seeing anything going on with my flash target page at 0xE200.&lt;/P&gt;&lt;P&gt;Here's a possible problem.&amp;nbsp; I have the following compiler warning:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;A13003: Value is truncated to one byte&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Here's the code in question:&lt;/P&gt;&lt;P&gt;&lt;SPAN class="msg_source_code"&gt;&lt;SPAN class="text_smallest"&gt;Code:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;I_cont:     ais #SpSubSize+3 ;deallocate sub body + H:X + commandSpSubSize:  equ (*-SpSub)&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;The top line gets the warning.&amp;nbsp; I'm not seeing what the problem is.&amp;nbsp; The AIS operand supports immediate addressing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 08:41:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140587#M5673</guid>
      <dc:creator>irob</dc:creator>
      <dc:date>2020-10-29T08:41:12Z</dc:date>
    </item>
    <item>
      <title>Re: EEPROM emulation on QGx</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140588#M5674</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;Hi Rob,&lt;/P&gt;&lt;P&gt;The AIS instruction ONLY accepts immediate and it is sign extended 8-bit. It looks like you are trying to squeeze a bigger value in there.&lt;/P&gt;&lt;P&gt;Also can someone re-rate my two posts referred to here by Rocky, now the wrong one has 5 and the correct none!&lt;/P&gt;&lt;P&gt;Regards David&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2006 05:47:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140588#M5674</guid>
      <dc:creator>peg</dc:creator>
      <dc:date>2006-06-22T05:47:50Z</dc:date>
    </item>
    <item>
      <title>Re: EEPROM emulation on QGx</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140589#M5675</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hmm, my assembly is really rusty. What is the asterisk in the above second line? Is that like casting? Then the minus sign in front of the label SpSub, what's that all about?&lt;BR /&gt;&lt;BR /&gt;Speaking of assembly, can anyone recommend a good resource for syntax? Or a good reference book?&lt;P&gt;Message Edited by irob on &lt;SPAN class="date_text"&gt;2006-06-21&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;06:47 PM&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Message Edited by irob on &lt;SPAN class="date_text"&gt;2006-06-21&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;06:48 PM&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2006 07:47:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140589#M5675</guid>
      <dc:creator>irob</dc:creator>
      <dc:date>2006-06-22T07:47:31Z</dc:date>
    </item>
    <item>
      <title>Re: EEPROM emulation on QGx</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140590#M5676</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;Hi Robyn,&lt;/P&gt;&lt;P&gt;The asterisk in this example means current address&lt;/P&gt;&lt;P&gt;the minus sign means minus (just like you learnt in 1st grade)&lt;/P&gt;&lt;P&gt;So the label will equate to the current address less the value of SpSub&lt;/P&gt;&lt;P&gt;Which is perhaps equal to the size of the routine???&lt;/P&gt;&lt;P&gt;Regards David&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2006 08:14:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140590#M5676</guid>
      <dc:creator>peg</dc:creator>
      <dc:date>2006-06-22T08:14:04Z</dc:date>
    </item>
    <item>
      <title>Re: EEPROM emulation on QGx</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140591#M5677</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;FONT size="2"&gt;Hello irob,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;When an immediate&amp;nbsp;value includes some arithmetic, you might need to surround the expression by parenthesis.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;I_cont:&amp;nbsp;&amp;nbsp;ais #(SpSubSize+3)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;I seem to recall that I&amp;nbsp;previoulsy experienced a similar problem, but not necessarily with this specific instruction.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;Regards,&lt;BR /&gt;Mac&lt;/FONT&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2006 12:22:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140591#M5677</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2006-06-22T12:22:06Z</dc:date>
    </item>
    <item>
      <title>Re: EEPROM emulation on QGx</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140592#M5678</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;bigmac wrote:&lt;BR /&gt;&lt;BR /&gt;&lt;P&gt;&lt;FONT size="2"&gt;When an immediate value includes some arithmetic, you might need to surround the expression by parenthesis.&lt;/FONT&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;FONT size="2"&gt;I seem to recall that I previoulsy experienced a similar problem, but not necessarily with this specific instruction.&lt;/FONT&gt;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;Bigmac, thanks for the idea, but that didn't cure it. I tried splitting up the first line into two by first adding the two things and then running the AIS operand. But now I get the same warning at my new ADD operand. Seems that what's choking up the compiler is the second line, SpSubSize: equ (*-SpSub).&lt;BR /&gt;&lt;BR /&gt;What is that equate doing?&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jun 2006 07:33:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140592#M5678</guid>
      <dc:creator>irob</dc:creator>
      <dc:date>2006-06-23T07:33:50Z</dc:date>
    </item>
    <item>
      <title>Re: EEPROM emulation on QGx</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140593#M5679</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Hello irob,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;I presume there exists a sub-routine labelled&amp;nbsp;&lt;FONT face="Courier New"&gt;SpSub&lt;/FONT&gt;.&amp;nbsp; The expression&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;SpSubSize:&amp;nbsp; equ (*-SpSub)&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;should be present immediately following the last instruction of the routine (presumably &lt;FONT face="Courier New"&gt;RTS&lt;/FONT&gt;).&amp;nbsp;&lt;/FONT&gt; &lt;FONT face="Courier New" size="2"&gt;SpSubSize &lt;FONT face="Arial"&gt;should then give the number of bytes in the sub-routine, and&amp;nbsp;this must not exceed a decimal value of 124 for compatibility with&amp;nbsp;your &lt;FONT face="Courier New"&gt;AIS&lt;/FONT&gt; instruction.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;I have tried something similar with an assembly&amp;nbsp;program I am working on, and did not get any warnings during the assembly process.&amp;nbsp; However, I am using absolute assembly, so the linker is not involved.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;I have found that the "truncated to one byte" warning can also&amp;nbsp;occur if an undefined label is referenced, in addition to&amp;nbsp;the over-range condition.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Regards.&lt;BR /&gt;Mac&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;Message Edited by bigmac on &lt;SPAN class="date_text"&gt;2006-06-23&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;02:16 PM&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jun 2006 11:11:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140593#M5679</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2006-06-23T11:11:58Z</dc:date>
    </item>
    <item>
      <title>Re: EEPROM emulation on QGx</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140594#M5680</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;bigmac, you are correct. Here is the full snippet:&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="Courier New"&gt;SpSub:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ldhx LOW(SpSubSize+4),sp ;get flash address from stack&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sta 0,x ;write to flash; latch addr and data&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;lda SpSubSize+3,sp ;get flash command&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sta FCMD ;write the flash command&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;lda #FSTAT_FACCERR ;mask to initiate command&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sta FSTAT ;[pwpp] register command&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;nop ;[p] want min 4~ from w cycle to r&lt;BR /&gt;ChkDone:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;lda FSTAT ;[prpp] so FCCF is valid&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;lsla ;FCCF now in MSB&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;bpl ChkDone ;loop if FCCF = 0&lt;BR /&gt;SpSubEnd:&amp;nbsp;&amp;nbsp;&amp;nbsp;rts ;back into DoOnStack in flash&lt;BR /&gt;SpSubSize:&amp;nbsp;&amp;nbsp;equ (*-SpSub)&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;As you can see, this routine is clearly under 124 bytes. Is there a way to get my linker to start behaving here?&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 Jun 2006 00:29:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140594#M5680</guid>
      <dc:creator>irob</dc:creator>
      <dc:date>2006-06-24T00:29:38Z</dc:date>
    </item>
    <item>
      <title>Re: EEPROM emulation on QGx</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140595#M5681</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;A little update on this. I rewrote the offending assembly:&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="Courier New"&gt;I_cont: lda #SpSubSize&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;add #3&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;psha&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;But now I get the byte truncate warning at the first line, lda. So the compiler is definitely seeing SpSubSize as being larger than one byte. Hmmm.&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 Jun 2006 04:55:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140595#M5681</guid>
      <dc:creator>irob</dc:creator>
      <dc:date>2006-06-24T04:55:09Z</dc:date>
    </item>
    <item>
      <title>Re: EEPROM emulation on QGx</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140596#M5682</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;FONT size="2"&gt;Hello irob,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;It would seem more likely that&amp;nbsp;the linker cannot find the value of &lt;FONT face="Courier New"&gt;SpSubSize&lt;/FONT&gt;.&amp;nbsp; I assume that the instructions following the &lt;FONT face="Courier New"&gt;Icont&lt;/FONT&gt; label&amp;nbsp;would either&amp;nbsp;need to be in the same file as SpSub routine, or alternatively the file containing &lt;FONT face="Courier New"&gt;SpSub&lt;/FONT&gt; would need to be INCLUDEd prior to the &lt;FONT face="Courier New"&gt;Icont&lt;/FONT&gt; instructions.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;Regards,&lt;BR /&gt;Mac&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 Jun 2006 11:53:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140596#M5682</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2006-06-24T11:53:42Z</dc:date>
    </item>
    <item>
      <title>Re: EEPROM emulation on QGx</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140597#M5683</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi guys,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Isn't this just the assembler warning that as you are doing maths with 16-bit values that the answer could _potentially_ be 16-bit and that as the opcode only accepts an 8-bit operand, it is only using the low byte. Which is what you want anyway.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Below is the output listing file from P&amp;amp;E's assembler which doesn't complain.&lt;/DIV&gt;&lt;DIV&gt;Why don't you try replacing the "*-SpSub" with two dummy 8-bit values that produce the same result just to see what happens like I did at the end of the code below.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Note: I just put some dummy equ's in there.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN class="msg_source_code"&gt;&lt;SPAN class="text_smallest"&gt;Code:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;PRE&gt;IROB.ASM  Assembled with CasmHCS08_Pro v1.00  24/06/2006  3:35:08 PM     PAGE 1            0000FEEF     1 FSTAT        equ     $feef     00             0000FEEE     2 FCMD equ     $FEEE     00             00000080     3 FACCERR      equ     %10000000     00                          4                          5      org $e800                         6                          7 *SpSub:      ldhx LOW(SpSubSize+4),sp ;get flash add                           ress from stack E800  [05] 9EFE1C       8 SpSub:      ldhx SpSubSize+4,sp ;get flash address f                           rom stack E803  [02] F7           9             sta 0,x ;write to flash; latch addr and                            data E804  [05] 9ED6001B    10             lda SpSubSize+3,sp ;get flash command E808  [04] C7FEEE      11             sta FCMD ;write the flash command E80B  [02] A680        12             lda #FACCERR ;mask to initiate command E80D  [04] C7FEEF      13             sta FSTAT ;[pwpp] register command E810  [01] 9D          14             nop ;[p] want min 4~ from w cycle to r E811  [04] C6FEEF      15 ChkDone:    lda FSTAT ;[prpp] so FCCF is valid E814  [01] 48          16             lsla ;FCCF now in MSB E815  [03] 2AFA        17             bpl ChkDone ;loop if FCCF = 0 E817  [06] 81          18 SpSubEnd:   rts ;back into DoOnStack in flash            00000018    19 SpSubSize:  equ (*-SpSub)     00                         20  E818  [02] A618        21 I_cont: lda #SpSubSize E81A  [02] AB03        22         add #3 E81C  [02] 87          23         psha                        24             0000001A    25 test1        equ     $1A     00             00000002    26 test2        equ     $2     00             00000018    27 test3        equ     (test1-test2)     00  Symbol Table  0000E811  CHKDONE 00000080  FACCERR 0000FEEE  FCMD 0000FEEF  FSTAT 0000E818  I_CONT 0000E800  SPSUB 0000E817  SPSUBEND 00000018  SPSUBSIZE 0000001A  TEST1 00000002  TEST2 00000018  TEST3 Absolute Memory Utilization by Segments   Address Range       Length     Segment Name-------------------  ----------  -------------- 0000E800-0000E81C    0000001D   &lt;/PRE&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;Regards David&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 08:41:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140597#M5683</guid>
      <dc:creator>peg</dc:creator>
      <dc:date>2020-10-29T08:41:14Z</dc:date>
    </item>
    <item>
      <title>Re: EEPROM emulation on QGx</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140598#M5684</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;FONT size="2"&gt;Hello Peg, irob,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;Actually the CW assembler doesn't complain either provided a single file contains both SpSub and Icont routines, and with the use of absolute assembly.&amp;nbsp; I assume that Peg's sample also uses absolute assembly.&amp;nbsp; The main concern with the warning message would be if the value was truncated to zero (as it could well be if the linker could not identify the reference).&amp;nbsp; The value of SpSubSize should be known when Icont is linked, and for the example given this&amp;nbsp;is a non-zero&amp;nbsp;single byte value,&amp;nbsp;so the warning&amp;nbsp;message should not occur.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;With relocatable assembly, if the two routines happen to be in different files, I believe XDEF and XREF directives should be included with respect to the value (symbol) SpSubSize.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;Regards,&lt;BR /&gt;Mac&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 25 Jun 2006 03:37:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140598#M5684</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2006-06-25T03:37:25Z</dc:date>
    </item>
    <item>
      <title>Which came first, the definition or the reference.</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140599#M5685</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Does the code line&lt;PRE&gt;I_cont:     ais #SpSubSize+3 ;deallocate sub body + H:X + command&lt;/PRE&gt;precede the line&lt;PRE&gt;SpSubSize:  equ (*-SpSub)&lt;/PRE&gt;?&lt;BR /&gt;I have found that my assembler (prior to CW) does not complain about the truncation if it already knows that the high byte is zero. If the reference to "SpSubSize" precedes the definition, it doesn't yet know that.&lt;P&gt;Message Edited by rocco on &lt;SPAN class="date_text"&gt;2006-06-25&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;12:35 AM&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 08:41:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140599#M5685</guid>
      <dc:creator>rocco</dc:creator>
      <dc:date>2020-10-29T08:41:16Z</dc:date>
    </item>
    <item>
      <title>Re: EEPROM emulation on QGx</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140600#M5686</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;bigmac wrote:&lt;BR /&gt;&lt;P&gt;&lt;FONT size="2"&gt;I assume that the instructions following the &lt;FONT face="Courier New"&gt;Icont&lt;/FONT&gt; label would either need to be in the same file as SpSub routine, or alternatively the file containing &lt;FONT face="Courier New"&gt;SpSub&lt;/FONT&gt; would need to be INCLUDEd prior to the &lt;FONT face="Courier New"&gt;Icont&lt;/FONT&gt; instructions.&lt;/FONT&gt;&lt;/P&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;Bigmac, both I_cont and SpSub are in the same assembly file. So the includes that you're recommending aren't relevant (I think?).&lt;P&gt;Message Edited by irob on &lt;SPAN class="date_text"&gt;2006-06-28&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;05:36 PM&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jun 2006 06:36:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140600#M5686</guid>
      <dc:creator>irob</dc:creator>
      <dc:date>2006-06-29T06:36:28Z</dc:date>
    </item>
    <item>
      <title>Re: Which came first, the definition or the reference.</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140601#M5687</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;rocco wrote:&lt;BR /&gt;Does the code line&lt;PRE&gt;I_cont:     ais #SpSubSize+3 ;deallocate sub body + H:X + command&lt;/PRE&gt;precede the line&lt;PRE&gt;SpSubSize:  equ (*-SpSub)&lt;/PRE&gt;?&lt;BR /&gt;I have found that my assembler (prior to CW) does not complain about the truncation if it already knows that the high byte is zero. If the reference to "SpSubSize" precedes the definition, it doesn't yet know that.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;Correct, the I_cont line precedes the SpSubSize line. Hmm, the trouble with relocating the definition of&lt;PRE&gt;SpSubSize:  equ (*-SpSub)&lt;/PRE&gt;to before the I_cont line is that SpSub occurs after I_cont.&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 08:41:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140601#M5687</guid>
      <dc:creator>irob</dc:creator>
      <dc:date>2020-10-29T08:41:18Z</dc:date>
    </item>
    <item>
      <title>Re: Which came first, the definition or the reference.</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140602#M5688</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;I don't think there is any way around this message.&lt;BR /&gt;&lt;BR /&gt;At least it is only a warning. But it is a warning that may be destined to annoy you for the rest of your life, maybe longer.&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jun 2006 14:18:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140602#M5688</guid>
      <dc:creator>rocco</dc:creator>
      <dc:date>2006-06-29T14:18:58Z</dc:date>
    </item>
    <item>
      <title>Re: Which came first, the definition or the reference.</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140603#M5689</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Sorry to post in the old thread again. This code is still in the current HCS08RMV1.pdf&lt;BR /&gt;&lt;BR /&gt;Warning (A13003) happens on this line.&lt;BR /&gt;I_cont: ais #SpSubSize+3 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; ;deallocate sub body + H:X + command&lt;BR /&gt;&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;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; ;H:X flash pointer OK from SpSub&lt;BR /&gt;&lt;BR /&gt;The same warning (A13003) happens on this line.&lt;BR /&gt;&lt;BR /&gt;SpSub:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ldhx&amp;nbsp; SpSubSize+4,sp&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;get flash address from stack&lt;BR /&gt;&lt;BR /&gt;Going off previous posts, I guess the code works, its just been released with warnings...?&lt;BR /&gt;&lt;BR /&gt;I was wondering, is there any way to tell the compliler that the result of this line:&lt;BR /&gt;SpSubSize:&amp;nbsp;&amp;nbsp;&amp;nbsp; equ&amp;nbsp;&amp;nbsp; (*-SpSub)&lt;BR /&gt;is only allowed to be one byte i.e. cast it as byte? This should stop the warning (i think).&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Oct 2007 12:32:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140603#M5689</guid>
      <dc:creator>CarlFST60L_3rd</dc:creator>
      <dc:date>2007-10-04T12:32:15Z</dc:date>
    </item>
    <item>
      <title>Re: Which came first, the definition or the reference.</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140604#M5690</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Hello,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;To avoid the warning an equate must be defined before it is used.&amp;nbsp; As has been said previously, this is easily solved for the first warning, by repositioning the I_cont (routine) code &lt;U&gt;after&lt;/U&gt; the SpSub routine.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;For the second warning, it is a little more complex, since the first line of SpSub uses SpSubSize value.&amp;nbsp; A possible work around is to remove the LDHX instruction from the routine, and instead pre-load the H:X value immediately prior to calling this routine.&amp;nbsp; The calling code can then be positioned after the definition of SpSubSize.&amp;nbsp; Of course, the offset for the LDHX instruction will need to be adjusted to take into acount that the return address for SpSub is then not present on the stack.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Regards,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Mac&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Oct 2007 22:40:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/EEPROM-emulation-on-QGx/m-p/140604#M5690</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2007-10-04T22:40:54Z</dc:date>
    </item>
  </channel>
</rss>

