<?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: QG8 - Programming a byte in Flash (C based)</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/QG8-Programming-a-byte-in-Flash-C-based/m-p/194508#M15433</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Hello Tim,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Sorry, I omitted the PRM file in my previous post.&amp;nbsp; The segment FLASH_ROUTINE&amp;nbsp; is defined there, and also the RAM address where it is re-located to (0x200).&amp;nbsp; This is assumed to be the bottom of the stack for the sample code.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;And contrary to the comment within the .c file, the RAM requirement is actually 10 bytes - a COP reset was later&amp;nbsp;added within the routine, but the byte count not updated.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards,&lt;/DIV&gt;&lt;DIV&gt;Mac&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;Message Edited by bigmac on &lt;SPAN class="date_text"&gt;2008-10-21&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;08:39 AM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 21 Oct 2008 05:14:55 GMT</pubDate>
    <dc:creator>bigmac</dc:creator>
    <dc:date>2008-10-21T05:14:55Z</dc:date>
    <item>
      <title>QG8 - Programming a byte in Flash (C based)</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/QG8-Programming-a-byte-in-Flash-C-based/m-p/194502#M15427</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;Hi Folks,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I've been searching a while in the archives to see if there is any&lt;/DIV&gt;&lt;DIV&gt;code on the forum to program a byte in a QG8 written in C.&amp;nbsp; Didn't&lt;/DIV&gt;&lt;DIV&gt;find any.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I saw some nice code from Peg in assembly, but there's a lot&lt;/DIV&gt;&lt;DIV&gt;of stack manipulation (to keep things in Ram).&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I only need to keep 1 or 2 bytes of Flash (although I know I&lt;/DIV&gt;&lt;DIV&gt;need to 'waste' a page worth's of space to do it)!&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Just wondered if there was any code floating around.&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;Tim&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Oct 2008 03:47:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/QG8-Programming-a-byte-in-Flash-C-based/m-p/194502#M15427</guid>
      <dc:creator>UtopiaTim</dc:creator>
      <dc:date>2008-10-17T03:47:36Z</dc:date>
    </item>
    <item>
      <title>Re: QG8 - Programming a byte in Flash (C based)</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/QG8-Programming-a-byte-in-Flash-C-based/m-p/194503#M15428</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi,&lt;/DIV&gt;&lt;DIV&gt;Here is a collection of Flash EPROM routines for the 9S08QG.&lt;/DIV&gt;&lt;DIV&gt;They are not guaranteed in any way, but believed to be OK.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards,&lt;/DIV&gt;&lt;DIV&gt;Ake&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Oct 2008 15:07:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/QG8-Programming-a-byte-in-Flash-C-based/m-p/194503#M15428</guid>
      <dc:creator>Ake</dc:creator>
      <dc:date>2008-10-17T15:07:54Z</dc:date>
    </item>
    <item>
      <title>Re: QG8 - Programming a byte in Flash (C based)</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/QG8-Programming-a-byte-in-Flash-C-based/m-p/194504#M15429</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Thanks Ake!!&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Tim&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Oct 2008 19:29:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/QG8-Programming-a-byte-in-Flash-C-based/m-p/194504#M15429</guid>
      <dc:creator>UtopiaTim</dc:creator>
      <dc:date>2008-10-17T19:29:24Z</dc:date>
    </item>
    <item>
      <title>Re: QG8 - Programming a byte in Flash (C based)</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/QG8-Programming-a-byte-in-Flash-C-based/m-p/194505#M15430</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;Hello Tim,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The previously posted code above does&amp;nbsp;require rather a lot of RAM that is permanently allocated to the flash programming function.&amp;nbsp; This may make it less suitable for low end devices such as the 'QG8.&amp;nbsp; It would also appear that the code does not disable interrupts whilst flash memory is inaccessible, which could be problematic (since the interrupt vectors are located within flash).&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Provided burst programming is not required, which is&amp;nbsp;likely not an issue if you need to program only a few bytes, the amount of permanently allocated RAM may be considerably reduced, to better suit smaller devices.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The following&amp;nbsp;thread provides some discussion about some of these issues.&lt;/DIV&gt;&lt;DIV&gt;&lt;A href="http://forums.freescale.com/freescale/board/message?board.id=8BITCOMM&amp;amp;thread.id=9434" target="_blank"&gt;&lt;FONT color="#017BBA"&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;A href="http://forums.freescale.com/freescale/board/message?board.id=8BITCOMM&amp;amp;thread.id=9434" target="test_blank"&gt;http://forums.freescale.com/freescale/board/message?board.id=8BITCOMM&amp;amp;thread.id=9434&lt;/A&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#017BBA"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The attached code might also be of interest.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards,&lt;/DIV&gt;&lt;DIV&gt;Mac&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Oct 2008 14:00:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/QG8-Programming-a-byte-in-Flash-C-based/m-p/194505#M15430</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2008-10-20T14:00:23Z</dc:date>
    </item>
    <item>
      <title>Re: QG8 - Programming a byte in Flash (C based)</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/QG8-Programming-a-byte-in-Flash-C-based/m-p/194506#M15431</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Thanks Mac,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;That's one thread that I hadn't seen.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;Also, thanks for the code - I'll be trying it out in a while.&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;Tim&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Oct 2008 19:44:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/QG8-Programming-a-byte-in-Flash-C-based/m-p/194506#M15431</guid>
      <dc:creator>UtopiaTim</dc:creator>
      <dc:date>2008-10-20T19:44:47Z</dc:date>
    </item>
    <item>
      <title>Re: QG8 - Programming a byte in Flash (C based)</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/QG8-Programming-a-byte-in-Flash-C-based/m-p/194507#M15432</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Hi Mac,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;In S08_Flash.c, the 3rd &amp;amp; 4th&amp;nbsp;line references:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;extern char __SEG_START_FLASH_ROUTINE[];&lt;/DIV&gt;&lt;DIV&gt;extern char __SEG_SIZE_FLASH_ROUTINE[];&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Where&amp;nbsp;are these&amp;nbsp;defined?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;When I run the program, the srcPtr and the dstPtr both = 0xe198.&lt;/DIV&gt;&lt;DIV&gt;I figure the dstPtr needs to point to ram.&amp;nbsp; Where is that defined?&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;Tim&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Oct 2008 04:20:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/QG8-Programming-a-byte-in-Flash-C-based/m-p/194507#M15432</guid>
      <dc:creator>UtopiaTim</dc:creator>
      <dc:date>2008-10-21T04:20:01Z</dc:date>
    </item>
    <item>
      <title>Re: QG8 - Programming a byte in Flash (C based)</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/QG8-Programming-a-byte-in-Flash-C-based/m-p/194508#M15433</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Hello Tim,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Sorry, I omitted the PRM file in my previous post.&amp;nbsp; The segment FLASH_ROUTINE&amp;nbsp; is defined there, and also the RAM address where it is re-located to (0x200).&amp;nbsp; This is assumed to be the bottom of the stack for the sample code.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;And contrary to the comment within the .c file, the RAM requirement is actually 10 bytes - a COP reset was later&amp;nbsp;added within the routine, but the byte count not updated.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards,&lt;/DIV&gt;&lt;DIV&gt;Mac&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;Message Edited by bigmac on &lt;SPAN class="date_text"&gt;2008-10-21&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;08:39 AM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Oct 2008 05:14:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/QG8-Programming-a-byte-in-Flash-C-based/m-p/194508#M15433</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2008-10-21T05:14:55Z</dc:date>
    </item>
  </channel>
</rss>

