<?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: Serial number inclusion</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Serial-number-inclusion/m-p/173185#M11792</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello Tim,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I presume you are actually using the CW compiler.&amp;nbsp; If so, the following method seems to produce the expected result.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Firstly you need to define a specific segment within the .PRM file to contain the serial number value, that is not used by any other code.&amp;nbsp; For example, the following would be suitable for a QG8 device (obviously not&amp;nbsp;the device&amp;nbsp;you are using)&amp;nbsp;-&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SER_NUM&amp;nbsp;=&amp;nbsp; READ_ONLY&amp;nbsp;&amp;nbsp;&amp;nbsp; 0xE000 TO 0xE00F;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ROM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;=&amp;nbsp; READ_ONLY&amp;nbsp;&amp;nbsp;&amp;nbsp; 0xE010 TO 0xFFAD;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The serial number array&amp;nbsp;could then be defined as follows -&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;const unsigned char serial_number[5] @0xE000 = {0x00,0x00,0x03,0xe9,0xf3};&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards,&lt;/DIV&gt;&lt;DIV&gt;Mac&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 16 Jul 2008 21:46:16 GMT</pubDate>
    <dc:creator>bigmac</dc:creator>
    <dc:date>2008-07-16T21:46:16Z</dc:date>
    <item>
      <title>Serial number inclusion</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Serial-number-inclusion/m-p/173183#M11790</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;The project that I am currently working on requires a serial number&lt;/DIV&gt;&lt;DIV&gt;to be transferred out of the unit via USB.&amp;nbsp; All of the USB stuff is done, and&lt;/DIV&gt;&lt;DIV&gt;a serial number that I place in RAM using the following code works great.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #6633FF; font-family: 'Courier New'; font-size: 2;"&gt;unsigned char serial_number[5] = {0x00,0x00,0x03,0xe9,0xf3};&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I know that P&amp;amp;E has a program that I can use to serialize the unit, but I am&lt;/DIV&gt;&lt;DIV&gt;at a loss as how to set up the location in flash.&amp;nbsp; It would have to be a&lt;/DIV&gt;&lt;DIV&gt;'hard wired' location that I know the actual addresses of.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;How can I set that up in C?&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&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>Tue, 15 Jul 2008 20:50:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Serial-number-inclusion/m-p/173183#M11790</guid>
      <dc:creator>UtopiaTim</dc:creator>
      <dc:date>2008-07-15T20:50:59Z</dc:date>
    </item>
    <item>
      <title>Re: Serial number inclusion</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Serial-number-inclusion/m-p/173184#M11791</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi,&lt;/DIV&gt;&lt;DIV&gt;In CodeWarrior's version of C, you write&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;const &lt;FONT color="#6633FF" face="Courier New" size="2"&gt;unsigned char serial_number[5] = {0x00,0x00,0x03,0xe9,0xf3};&lt;/FONT&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;to get the string in readonly memoory.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I am not sure if this can be done with the P&amp;amp;E C-compiler.&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;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Jul 2008 14:01:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Serial-number-inclusion/m-p/173184#M11791</guid>
      <dc:creator>Ake</dc:creator>
      <dc:date>2008-07-16T14:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: Serial number inclusion</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Serial-number-inclusion/m-p/173185#M11792</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello Tim,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I presume you are actually using the CW compiler.&amp;nbsp; If so, the following method seems to produce the expected result.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Firstly you need to define a specific segment within the .PRM file to contain the serial number value, that is not used by any other code.&amp;nbsp; For example, the following would be suitable for a QG8 device (obviously not&amp;nbsp;the device&amp;nbsp;you are using)&amp;nbsp;-&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SER_NUM&amp;nbsp;=&amp;nbsp; READ_ONLY&amp;nbsp;&amp;nbsp;&amp;nbsp; 0xE000 TO 0xE00F;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ROM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;=&amp;nbsp; READ_ONLY&amp;nbsp;&amp;nbsp;&amp;nbsp; 0xE010 TO 0xFFAD;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The serial number array&amp;nbsp;could then be defined as follows -&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;const unsigned char serial_number[5] @0xE000 = {0x00,0x00,0x03,0xe9,0xf3};&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards,&lt;/DIV&gt;&lt;DIV&gt;Mac&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Jul 2008 21:46:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Serial-number-inclusion/m-p/173185#M11792</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2008-07-16T21:46:16Z</dc:date>
    </item>
    <item>
      <title>Re: Serial number inclusion</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Serial-number-inclusion/m-p/173186#M11793</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;Thanks for the info.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I set up the .PRM file with the addresses that I wanted to be able to store&lt;/DIV&gt;&lt;DIV&gt;the data to, but under the definitions that you suggested, I don't want the&lt;/DIV&gt;&lt;DIV&gt;compiler to pre-assign values, I want the P&amp;amp;E serializer program to be able&lt;/DIV&gt;&lt;DIV&gt;to write directly to the flash with the serial number they provide (through their&lt;/DIV&gt;&lt;DIV&gt;program).&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Of course, I want to be able to reference it in the software, perhaps I only&lt;/DIV&gt;&lt;DIV&gt;need to do the following??&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;const unsigned char serial_number[5] @ 0xFF00;&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>Thu, 17 Jul 2008 02:53:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Serial-number-inclusion/m-p/173186#M11793</guid>
      <dc:creator>UtopiaTim</dc:creator>
      <dc:date>2008-07-17T02:53:46Z</dc:date>
    </item>
    <item>
      <title>Re: Serial number inclusion</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Serial-number-inclusion/m-p/173187#M11794</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello Tim,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Using FCS for testing purposes, it would appear that the compiler does initialise each element of the array to 0x00 by default&amp;nbsp;- not what you require.&amp;nbsp; You might try explicit initialisation to a value of 0xFF, the unprogrammed flash state, and see if this can be made to work in conjunction with the serialize utility.&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;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jul 2008 07:46:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Serial-number-inclusion/m-p/173187#M11794</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2008-07-17T07:46:07Z</dc:date>
    </item>
    <item>
      <title>Re: Serial number inclusion</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Serial-number-inclusion/m-p/173188#M11795</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;This should work:&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;unsigned char serial_number[5] @ 0xFF00;&lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;&amp;nbsp;or the ANSI-C version:&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;#define serial_number (*(const unsigned char*)0xFF00)&lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&lt;/DIV&gt;Daniel&lt;BR /&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:21:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Serial-number-inclusion/m-p/173188#M11795</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2020-10-29T09:21:36Z</dc:date>
    </item>
    <item>
      <title>Re: Serial number inclusion</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Serial-number-inclusion/m-p/173189#M11796</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 &amp;amp; all,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;That's how I did it - initialized it to ff's, &amp;amp; then the P&amp;amp;E standalone serialize program&lt;/DIV&gt;&lt;DIV&gt;could program those ff's to the new serial number. (given the absolute address in memory, etc)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks again to all!&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>Thu, 17 Jul 2008 12:29:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Serial-number-inclusion/m-p/173189#M11796</guid>
      <dc:creator>UtopiaTim</dc:creator>
      <dc:date>2008-07-17T12:29:58Z</dc:date>
    </item>
  </channel>
</rss>

