<?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: How do I progaram default values into eeprom? in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/How-do-I-progaram-default-values-into-eeprom/m-p/172409#M11735</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;"#pragma CONST_SEG" applies to constants only, so make the array constant or use #pragma DATA_SEG".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;
#pragma CONST_SEG EEPROM_DATA

&lt;SPAN&gt;const&lt;/SPAN&gt; uint8_t Defaults[16] = {24,24,24,24,24,0,10,5,27,30,5,0,0,0,0,0};

#pragma CONST_SEG DEFAULT&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also in the prm, READ_WRITE segments are initialized during startup, so it should be used for RAM only. For flash or eeprom use READ_ONLY instead, that means that the content gets stored in there during programming time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;
EEPROM = &lt;SPAN&gt;READ_ONLY&lt;/SPAN&gt; 0x1780 TO 0x17FF;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&amp;nbsp;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 Oct 2020 09:20:49 GMT</pubDate>
    <dc:creator>CompilerGuru</dc:creator>
    <dc:date>2020-10-29T09:20:49Z</dc:date>
    <item>
      <title>How do I progaram default values into eeprom?</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/How-do-I-progaram-default-values-into-eeprom/m-p/172408#M11734</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am trying to program the eeprom in a MC9S08 micro but with no success.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It has something to do with the Linker file?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;/* This is a linker parameter file for the mc9s08sl8 */&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;NAMES END /* CodeWarrior will pass all the needed files to the linker by command line. But here you may add your own files too. */&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;SEGMENTS /* Here all RAM/ROM areas of the device are listed. Used in PLACEMENT below. */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Z_RAM = READ_WRITE 0x0080 TO 0x00FF;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;RAM = READ_WRITE 0x0100 TO 0x027F;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ROM = READ_ONLY 0xE000 TO 0xFFAD;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;EEPROM = READ_WRITE 0x1780 TO 0x17FF;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;/* INTVECTS = READ_ONLY 0xFFC0 TO 0xFFFF; Reserved for Interrupt Vectors */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;END&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;PLACEMENT /* Here all predefined and user segments are placed into the SEGMENTS defined above. */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;DEFAULT_RAM /* non-zero page variables */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;INTO RAM;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;_PRESTART, /* startup code */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;STARTUP, /* startup data structures */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ROM_VAR, /* constant variables */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;STRINGS, /* string literals */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;VIRTUAL_TABLE_SEGMENT, /* C++ virtual table segment */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;DEFAULT_ROM,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;COPY /* copy down information: how to initialize variables */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;INTO ROM;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;_DATA_ZEROPAGE, /* zero page variables */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MY_ZEROPAGE INTO Z_RAM;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;EEPROM_DATA INTO EEPROM;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;END&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;STACKSIZE 0x50&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is my code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;/*--- Default parameter values ---*/&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#pragma CONST_SEG EEPROM_DATA&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;uint8_t Defaults[16] = {24,24,24,24,24,0,10,5,27,30,5,0,0,0,0,0};&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#pragma CONST_SEG DEFAULT&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can anybody help me solve this problem?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Feb 2010 00:22:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/How-do-I-progaram-default-values-into-eeprom/m-p/172408#M11734</guid>
      <dc:creator>btbhass</dc:creator>
      <dc:date>2010-02-03T00:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: How do I progaram default values into eeprom?</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/How-do-I-progaram-default-values-into-eeprom/m-p/172409#M11735</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;"#pragma CONST_SEG" applies to constants only, so make the array constant or use #pragma DATA_SEG".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;
#pragma CONST_SEG EEPROM_DATA

&lt;SPAN&gt;const&lt;/SPAN&gt; uint8_t Defaults[16] = {24,24,24,24,24,0,10,5,27,30,5,0,0,0,0,0};

#pragma CONST_SEG DEFAULT&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also in the prm, READ_WRITE segments are initialized during startup, so it should be used for RAM only. For flash or eeprom use READ_ONLY instead, that means that the content gets stored in there during programming time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;
EEPROM = &lt;SPAN&gt;READ_ONLY&lt;/SPAN&gt; 0x1780 TO 0x17FF;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&amp;nbsp;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:20:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/How-do-I-progaram-default-values-into-eeprom/m-p/172409#M11735</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2020-10-29T09:20:49Z</dc:date>
    </item>
    <item>
      <title>Re: How do I progaram default values into eeprom?</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/How-do-I-progaram-default-values-into-eeprom/m-p/172411#M11737</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your setup is correct, it works here, if copied to one of my test project. It generates following line into S19 file:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;
S11317801818181818000A051B1E05000000000090&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since my code does not use &lt;FONT face="courier new,courier"&gt;EEPROM_DATA&lt;/FONT&gt;, I just needed to assure the linker includes that object into the final binary:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;
ENTRIES  EEPROM_DATAEND&lt;/PRE&gt;&lt;P&gt;which I don't think would be an issue with your setup. Just in case.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Pavel&lt;/P&gt;&lt;BR /&gt;&amp;nbsp;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:20:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/How-do-I-progaram-default-values-into-eeprom/m-p/172411#M11737</guid>
      <dc:creator>ok2ucx</dc:creator>
      <dc:date>2020-10-29T09:20:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I progaram default values into eeprom?</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/How-do-I-progaram-default-values-into-eeprom/m-p/172412#M11738</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P align="left"&gt;Thank you for your help. Adding the lines ENTRIES EEPROM_DATA END to the the end of the linker file solved the problem. It now programs the eeprom with the default values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="message-edit-history"&gt;&lt;SPAN class="edit-author"&gt;Message Edited by btbhass on&lt;/SPAN&gt; &lt;SPAN class="local-date"&gt;2010-02-04&lt;/SPAN&gt; &lt;SPAN class="local-time"&gt;09:26 PM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Feb 2010 05:20:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/How-do-I-progaram-default-values-into-eeprom/m-p/172412#M11738</guid>
      <dc:creator>btbhass</dc:creator>
      <dc:date>2010-02-05T05:20:23Z</dc:date>
    </item>
  </channel>
</rss>

