<?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: Flash programming for GB60 and compatibles in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Flash-programming-for-GB60-and-compatibles/m-p/131126#M2648</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;Here's an improved version, one byte shorter.&amp;nbsp; Instead of NOP we use LSRA which provides the same delay but also leaves A with only FCCF bit set.&amp;nbsp; Later, instead of "LOOP: LDA FSTAT, LSLA, BPL LOOP" we use the mask already in A to do "LOOP: BIT FSTAT, BEQ LOOP"&lt;/P&gt;&lt;P&gt;We can check for errors once we exit this RAM routine, from the Flash portion, by loading FSTAT and checking for FPVIOL and FACCERR.&lt;/P&gt;&lt;P&gt;&lt;A href="mailto:tonyp@acm.org" rel="nofollow" target="_blank"&gt;tonyp@acm.org&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="1"&gt;;*******************************************************************************&lt;BR /&gt;; Purpose: RAM routine to do the job we can't do from Flash&lt;BR /&gt;; Input&amp;nbsp; : A = value to program&lt;BR /&gt;; Output : None&lt;BR /&gt;; Note(s): This routine is modified in RAM by its loader at @2,3 and @5&lt;BR /&gt;;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : Stack needed: 20 bytes + 2 for JSR/BSR&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="1"&gt;?RAM_Execute&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sta&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EEPROM&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; ;Step 1 - Latch data/address&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;;EEPROM (@2,@3) replaced&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;lda&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #mByteProg&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;mByteProg (@5) replaced&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;sta&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FCMD&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; ;Step 2 - Write command to FCMD&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="1"&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;lda&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #FCBEF_&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;sta&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FSTAT&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; ;Step 3 - Write FCBEF_ in FSTAT&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;lsra&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; ;min delay before checking FSTAT&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;;(FCBEF -&amp;gt; FCCF for later BIT)&lt;BR /&gt;?RAM_Execute.Loop&amp;nbsp;&amp;nbsp;bit&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FSTAT&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; ;Step 4 - Wait for completion&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;beq&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ?RAM_Execute.Loop&amp;nbsp;&amp;nbsp; ;check FCCF_ for completion&lt;BR /&gt;?RAM_Execute_End&amp;nbsp;&amp;nbsp;&amp;nbsp;rts&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="1"&gt;;after exit, check FSTAT for FPVIOL and FACCERR&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="1"&gt;?RAM_Needed&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;equ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *-?RAM_Execute&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Message Edited by tonyp on &lt;SPAN class="date_text"&gt;04-20-2006&lt;/SPAN&gt;&lt;SPAN class="time_text"&gt;03:24 PM&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 20 Apr 2006 19:18:59 GMT</pubDate>
    <dc:creator>tonyp</dc:creator>
    <dc:date>2006-04-20T19:18:59Z</dc:date>
    <item>
      <title>Flash programming for GB60 and compatibles</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Flash-programming-for-GB60-and-compatibles/m-p/131119#M2641</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;Hi all,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I'm trying to minimize the RAM size needed to program the flash of a GB60, QG8 or compatibles.&amp;nbsp; So, I made some changes to working code, and it no longer works.&amp;nbsp; But I&amp;nbsp;want to understand why.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;From various documentation (GB60, QG8, HCS08) about flash programming, it seems that a flash command is actually 'launched' when the FCBEF bit in FSTAT is written with 1.&amp;nbsp; It should then be possible to do all previous steps (i.e., latching the address and data "sta ,x", writing to FCMD) from Flash, not RAM.&amp;nbsp; Only the steps of writing FCBEF in FSTAT (that launches the command) and waiting for the FCCF to become set (that marks the end of a command) should be executed from RAM.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;It isn't very clear when a Flash programming session actually begins, so that Flash is no longer available for running code from it.&amp;nbsp; Any ideas or better reference that explains the steps in greater detail?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;A class="jive-link-email-small" href="mailto:tonyp@acm.org"&gt;tonyp@acm.org&lt;/A&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 02 Apr 2006 02:50:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Flash-programming-for-GB60-and-compatibles/m-p/131119#M2641</guid>
      <dc:creator>tonyp</dc:creator>
      <dc:date>2006-04-02T02:50:01Z</dc:date>
    </item>
    <item>
      <title>Re: Flash programming for GB60 and compatibles</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Flash-programming-for-GB60-and-compatibles/m-p/131120#M2642</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hi, Tony:&lt;BR /&gt;&lt;BR /&gt;My understanding, and it's based on vague communications with Motorola tech support (remember them?) on a GP20 issue, was that the address latch is affected by both reads and writes to flash. So the instruction fetch cycles would interfere with programming.&lt;BR /&gt;&lt;BR /&gt;Not sure how reliable that information is today, however. Working with flash was a struggle back then.&lt;P&gt;Message Edited by rocco on &lt;SPAN class="date_text"&gt;04-02-2006&lt;/SPAN&gt;&lt;SPAN class="time_text"&gt;02:00 PM&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Apr 2006 03:59:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Flash-programming-for-GB60-and-compatibles/m-p/131120#M2642</guid>
      <dc:creator>rocco</dc:creator>
      <dc:date>2006-04-03T03:59:22Z</dc:date>
    </item>
    <item>
      <title>Re: Flash programming for GB60 and compatibles</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Flash-programming-for-GB60-and-compatibles/m-p/131121#M2643</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 face="Comic Sans MS"&gt;Hi Rocco &amp;amp; Tony,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Comic Sans MS"&gt;The problem on the GP was on some of HC08 family.&lt;BR /&gt;QG and GB are S08 and use a completely different technology from HC08.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Comic Sans MS"&gt;Therefore we can't make any comparison between these.&lt;BR /&gt;I have never heard of any problem on S08 Flash yet.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Comic Sans MS"&gt;Cheers,&lt;BR /&gt;Alban.&lt;/FONT&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Apr 2006 22:54:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Flash-programming-for-GB60-and-compatibles/m-p/131121#M2643</guid>
      <dc:creator>Alban</dc:creator>
      <dc:date>2006-04-05T22:54:21Z</dc:date>
    </item>
    <item>
      <title>Re: Flash programming for GB60 and compatibles</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Flash-programming-for-GB60-and-compatibles/m-p/131122#M2644</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hi, Alban:&lt;BR /&gt;&lt;BR /&gt;I don't think that Tony is implying that there is a problem, he is just attempting to push the envelope a little.&lt;BR /&gt;&lt;BR /&gt;And though the technologies are different between HC08 and HCS08, the programming algorithms are so similar that I would bet the address latch has the same behavior. Not that this behavior is a problem, this is simply an exercise in understanding the mechanisms behind flash programming.&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Apr 2006 02:27:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Flash-programming-for-GB60-and-compatibles/m-p/131122#M2644</guid>
      <dc:creator>rocco</dc:creator>
      <dc:date>2006-04-06T02:27:21Z</dc:date>
    </item>
    <item>
      <title>Re: Flash programming for GB60 and compatibles</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Flash-programming-for-GB60-and-compatibles/m-p/131123#M2645</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 face="Courier New" size="4"&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;That's right.&amp;nbsp; I never said there was a problem with Flash programming, just that I was looking for way to reduce the RAM required (especially for the QG8), and that the manuals leave&amp;nbsp;unanswered the question of 'when exactly'&amp;nbsp;flash access is inhibited.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;Anyway, I managed to shorten the example code given in Fig. 4-12 of the HCS08 Family Reference Manual from 24 bytes to 21 bytes&amp;nbsp;+ 2 for the JSR/BSR.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;This was done by making these changes (RAM&amp;nbsp;portion of code&amp;nbsp;listed below):&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;1. Preload A with the value to write just before calling the routine.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;2. Use immediate addressing mode for the loading of the command byte.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;3. Have the loader patch the address in STA FLASH with the actual address that eliminating the need to load HX inside the routine and then use STA ,X.&amp;nbsp; (We couldn't possibly avoid using HX for calling the RAM routine because any other method would mean extra stack used by the loader portion, so the benefit would be lost.)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;But I had hoped to do even better by being able to the "sta FLASH" and "lda...sta FCMD" outside this routine.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="mailto:tonyp@acm.org" rel="nofollow" target="_blank"&gt;&lt;FONT face="Courier New" size="2"&gt;tonyp@acm.org&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="1"&gt;;*******************************************************************************&lt;BR /&gt;; Purpose: RAM routine to do the&amp;nbsp;job we can't do&amp;nbsp;from Flash&lt;BR /&gt;; Input&amp;nbsp;&amp;nbsp;: A = value to program&lt;BR /&gt;; Note(s): This routine is modified in RAM by its loader at @2,3 and @5&lt;BR /&gt;;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;: Stack needed: 21 bytes + 2 for JSR/BSR&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="1"&gt;?RAM_Execute&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt; &lt;FONT face="Courier New" size="1"&gt;&amp;nbsp;sta&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;FLASH&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; ;FLASH (@2,@3) is replaced&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="1"&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;lda&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #mByteProg&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;mByteProg (@5) is replaced&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;sta&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FCMD&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; ;Step 2 - Write command to FCMD&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="1"&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;lda&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #FCBEF_&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;sta&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FSTAT&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; ;Step 3 - Write FCBEF_ in FSTAT&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;nop&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; ;required delay&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="1"&gt;?RAM_Execute.Loop&amp;nbsp;&amp;nbsp;lda&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FSTAT&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; ;Step 4 - Wait for completion&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;lsla&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; ;check FCCF_ for completion&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;bpl&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ?RAM_Execute.Loop&lt;BR /&gt;?RAM_Execute_End&amp;nbsp;&amp;nbsp;&amp;nbsp;rts&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; ;on exit, A has non-zero if error&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="1"&gt;?RAM_Needed&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;equ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *-?RAM_Execute&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Apr 2006 18:32:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Flash-programming-for-GB60-and-compatibles/m-p/131123#M2645</guid>
      <dc:creator>tonyp</dc:creator>
      <dc:date>2006-04-06T18:32:34Z</dc:date>
    </item>
    <item>
      <title>Re: Flash programming for GB60 and compatibles</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Flash-programming-for-GB60-and-compatibles/m-p/131124#M2646</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 face="Comic Sans MS"&gt;Hi guys,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Comic Sans MS"&gt;nah, I'm all right and wasn't getting nervous at all &lt;IMG alt=":smileyvery-happy:" class="emoticon emoticon-smileyvery-happy" id="smileyvery-happy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-very-happy.gif" title="Smiley Very Happy" /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Comic Sans MS"&gt;Still I think you can compare the S08 to the S12 for the Flash but nor really for HC08. First reason being the state machine it uses with commands instead of timings for you to manage...&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Comic Sans MS"&gt;&lt;IMG alt=":smileywink:" class="emoticon emoticon-smileywink" id="smileywink" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif" title="Smiley Wink" /&gt;Alban&lt;IMG alt=":smileywink:" class="emoticon emoticon-smileywink" id="smileywink" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif" title="Smiley Wink" /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Apr 2006 23:58:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Flash-programming-for-GB60-and-compatibles/m-p/131124#M2646</guid>
      <dc:creator>Alban</dc:creator>
      <dc:date>2006-04-07T23:58:29Z</dc:date>
    </item>
    <item>
      <title>Re: Flash programming for GB60 and compatibles</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Flash-programming-for-GB60-and-compatibles/m-p/131125#M2647</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;Alban wrote:&lt;BR /&gt;&lt;P&gt;&lt;FONT face="Comic Sans MS"&gt;. . . First reason being the state machine it uses with commands instead of timings for you to manage...&lt;/FONT&gt;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;Ah, yes, I see your point now, after reading over the flash programming chapters for both parts. I guess I will have to experiment some, as I also need to reduce the ram footprint of my boot loaders.&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Apr 2006 10:49:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Flash-programming-for-GB60-and-compatibles/m-p/131125#M2647</guid>
      <dc:creator>rocco</dc:creator>
      <dc:date>2006-04-10T10:49:55Z</dc:date>
    </item>
    <item>
      <title>Re: Flash programming for GB60 and compatibles</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Flash-programming-for-GB60-and-compatibles/m-p/131126#M2648</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;Here's an improved version, one byte shorter.&amp;nbsp; Instead of NOP we use LSRA which provides the same delay but also leaves A with only FCCF bit set.&amp;nbsp; Later, instead of "LOOP: LDA FSTAT, LSLA, BPL LOOP" we use the mask already in A to do "LOOP: BIT FSTAT, BEQ LOOP"&lt;/P&gt;&lt;P&gt;We can check for errors once we exit this RAM routine, from the Flash portion, by loading FSTAT and checking for FPVIOL and FACCERR.&lt;/P&gt;&lt;P&gt;&lt;A href="mailto:tonyp@acm.org" rel="nofollow" target="_blank"&gt;tonyp@acm.org&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="1"&gt;;*******************************************************************************&lt;BR /&gt;; Purpose: RAM routine to do the job we can't do from Flash&lt;BR /&gt;; Input&amp;nbsp; : A = value to program&lt;BR /&gt;; Output : None&lt;BR /&gt;; Note(s): This routine is modified in RAM by its loader at @2,3 and @5&lt;BR /&gt;;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : Stack needed: 20 bytes + 2 for JSR/BSR&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="1"&gt;?RAM_Execute&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sta&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EEPROM&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; ;Step 1 - Latch data/address&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;;EEPROM (@2,@3) replaced&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;lda&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #mByteProg&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;mByteProg (@5) replaced&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;sta&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FCMD&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; ;Step 2 - Write command to FCMD&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="1"&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;lda&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #FCBEF_&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;sta&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FSTAT&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; ;Step 3 - Write FCBEF_ in FSTAT&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;lsra&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; ;min delay before checking FSTAT&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;;(FCBEF -&amp;gt; FCCF for later BIT)&lt;BR /&gt;?RAM_Execute.Loop&amp;nbsp;&amp;nbsp;bit&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FSTAT&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; ;Step 4 - Wait for completion&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;beq&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ?RAM_Execute.Loop&amp;nbsp;&amp;nbsp; ;check FCCF_ for completion&lt;BR /&gt;?RAM_Execute_End&amp;nbsp;&amp;nbsp;&amp;nbsp;rts&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="1"&gt;;after exit, check FSTAT for FPVIOL and FACCERR&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="1"&gt;?RAM_Needed&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;equ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *-?RAM_Execute&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Message Edited by tonyp on &lt;SPAN class="date_text"&gt;04-20-2006&lt;/SPAN&gt;&lt;SPAN class="time_text"&gt;03:24 PM&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Apr 2006 19:18:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Flash-programming-for-GB60-and-compatibles/m-p/131126#M2648</guid>
      <dc:creator>tonyp</dc:creator>
      <dc:date>2006-04-20T19:18:59Z</dc:date>
    </item>
    <item>
      <title>I did some squeezing . . .</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Flash-programming-for-GB60-and-compatibles/m-p/131127#M2649</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hi, Tony:&lt;BR /&gt;&lt;BR /&gt;I noticed that you were not using the H:X registers for anything. Is there a reason?&lt;BR /&gt;&lt;BR /&gt;I tried using it for the address to program, and squeezed out two bytes, for a total of 18.&lt;BR /&gt;&lt;BR /&gt;PS: I had to use a .PDF attachment, as I can't prevent the board from munging the formatting on the code, and the board won't accept .txt, .asm .ect . . .&lt;P&gt;Message Edited by rocco on &lt;SPAN class="date_text"&gt;04-20-2006&lt;/SPAN&gt;&lt;SPAN class="time_text"&gt;03:45 PM&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Apr 2006 05:41:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Flash-programming-for-GB60-and-compatibles/m-p/131127#M2649</guid>
      <dc:creator>rocco</dc:creator>
      <dc:date>2006-04-21T05:41:24Z</dc:date>
    </item>
    <item>
      <title>Re: I did some more squeezing . . .</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Flash-programming-for-GB60-and-compatibles/m-p/131128#M2650</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;But then I tried the same thing for Flash register addressing, and saved 5 bytes, for a total of 15.&lt;BR /&gt;&lt;BR /&gt;PS: I did a second post because the board doesn't appear to allow two attachments in one post&lt;P&gt;Message Edited by rocco on &lt;SPAN class="date_text"&gt;04-20-2006&lt;/SPAN&gt;&lt;SPAN class="time_text"&gt;03:45 PM&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Apr 2006 05:44:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Flash-programming-for-GB60-and-compatibles/m-p/131128#M2650</guid>
      <dc:creator>rocco</dc:creator>
      <dc:date>2006-04-21T05:44:59Z</dc:date>
    </item>
    <item>
      <title>Re: I did some more squeezing . . .</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Flash-programming-for-GB60-and-compatibles/m-p/131129#M2651</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;OK, both your squeezes are already known, but here's why they won't do...&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The first one won't really save you any RAM since to use HX inside the routine you must find a different (other than JSR ,X) way of calling the stacked routine.&amp;nbsp; One way is to do this:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;; this is right after stacking the routine to RAM&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;LDHX #RETURN_ADDRESS&lt;BR /&gt;PSHHX&lt;BR /&gt;TSX&lt;BR /&gt;AIX #2 ;skip return address&lt;BR /&gt;PSHHX&lt;BR /&gt;LDHX #FSTAT&lt;BR /&gt;STA COPCTL&lt;BR /&gt;SEI&lt;BR /&gt;RTS ;call routine&lt;/DIV&gt;&lt;DIV&gt;RETURN_ADDRESS:&lt;BR /&gt;...etc...&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;So, what you save inside the routine, you lose outside before calling it.&amp;nbsp; And it evens out.&amp;nbsp; The comment should read: "Stack Needed: 18 bytes + 4 for JSR emulation"&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The second squeeze, although in practice I've tested several times and seems to work, I can't 'officially' trust it yet because, for the time being at least, it violates the timing requirement of four cycles between writing to FSTAT (with STA ,X) and checking it (with BIT ,X).&amp;nbsp; So, if there is any possibility of FSTAT giving a wrong response, the test may fail unpredictably, and the routine will be unreliable.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;But, if Freescale can verify that there is no problem (since in reality it 'appears' to work OK), then I'll be fine with it, and it's the shortest possibility found todate.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;A href="mailto:tonyp@acm.org" rel="nofollow" target="_blank"&gt;tonyp@acm.org&lt;/A&gt;&lt;/DIV&gt;&lt;P&gt;Message Edited by tonyp on &lt;SPAN class="date_text"&gt;04-21-2006&lt;/SPAN&gt;&lt;SPAN class="time_text"&gt;02:04 AM&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Message Edited by tonyp on &lt;SPAN class="date_text"&gt;04-21-2006&lt;/SPAN&gt;&lt;SPAN class="time_text"&gt;02:34 AM&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Apr 2006 06:00:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Flash-programming-for-GB60-and-compatibles/m-p/131129#M2651</guid>
      <dc:creator>tonyp</dc:creator>
      <dc:date>2006-04-21T06:00:54Z</dc:date>
    </item>
    <item>
      <title>Re: I did some more squeezing . . .</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Flash-programming-for-GB60-and-compatibles/m-p/131130#M2652</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Ahh, You WERE using H:X already! I didn't notice that.&lt;BR /&gt;&lt;BR /&gt;I also didn't notice the four cycle delay. In my mind, that is a deal breaker. I would not violate the delay, without express, written permission from Freescale and it's insurance company. You don't want the flash failing in the field.&lt;BR /&gt;&lt;BR /&gt;My flash routine sits in a dedicated portion of ram, not on the stack, so I call it with an extended address. The flash routine never runs when the firmware is operational, so I just overlay expendable data.&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Apr 2006 04:07:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Flash-programming-for-GB60-and-compatibles/m-p/131130#M2652</guid>
      <dc:creator>rocco</dc:creator>
      <dc:date>2006-04-22T04:07:49Z</dc:date>
    </item>
  </channel>
</rss>

