<?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 C equivalent to ORG in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/C-equivalent-to-ORG/m-p/135525#M1722</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;Peg suggested I search for answers to my questions here, as the answers may be tool dependent.&amp;nbsp; OK, I'm using Codewarrior IDE v5.7.0, and just switched successfully from USB to demo board, to USB-Cyclone Pro-demo board (application hardware I designed arrives next week, but I've hooked a prototype to the demo board).&amp;nbsp; &amp;nbsp;But I'm not sure of the terms.&amp;nbsp; In the 8-bit microcontrollers forum, I posted:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;"I've spent years programming HC05 in asm.&amp;nbsp; New to C and Flash, using S08QG8.&amp;nbsp; I need to store a calibration value in flash.&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;With help from this forum [8-bit uC], I have it written to second to last page, 0xFC00.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Memory write protection starts at last page and works toward lower pages, right?&amp;nbsp; So with a flash writer in my application, I sure want to protect program memory!&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I want to write the calibration value at 0xE000, and make sure the complier/linker&amp;nbsp;starts the application program at 0xE200, the second page of flash.&amp;nbsp; I've studied Segments and Sections in the linker prm file but don't see how to force that.&amp;nbsp; Any suggestions?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Writing this, I've come to realize each debug session will probably overwrite the calibration value through mass erase.&amp;nbsp; I think that can be delt with, have used command files.&amp;nbsp; Will a w(rite bytes, words, etc) post load command actually write to flash, so I can debug normal operation?"&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Search terms "calibrate", "calibration", and "eeprom flash" turned up some interesting things, but I have not found anything specific to the compliler / linker, yet.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks Alban for your reply in microcontrollers.&amp;nbsp; I'm a little confused about what is meant by "emplacement".&amp;nbsp; I think you are working with a different memory map too.&amp;nbsp; I'll be sure to study the QG8 memory map and flash page specs real close!&amp;nbsp; OK, I see the PLACEMENT part of the PRM file.&amp;nbsp; I think you are saying break the segment named ROM into ROMsomething and ROMsomethingelse (ROM1 looks like config register space or something).&amp;nbsp; Then the new INTO, maybe the #pragmas you suggest.&amp;nbsp; But&amp;nbsp;the calibration value writer I adapted from the uC forum accepts an absolute address, and I was going to figure how to&amp;nbsp;read the calibration value back that way (C pointer to absolute address?&amp;nbsp; In line assembly,&amp;nbsp;MOV firstbyte, TPMC0VH, nextbyte to ...L?&amp;nbsp; If FFFF your erased, not calibrated!)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;It is a simple application, perfect for finally forcing me to learn a little C.&amp;nbsp; Display peak absolute value of magnetic strength a hall sensor is exposed to, DC-400 hz, 0.1-1.5T.&amp;nbsp; Auto zero and normal operation are easy.&amp;nbsp; So should binary to LED segments conversion and multiplexing.&amp;nbsp; Self calibration-searching for sensor stimulation that&amp;nbsp;measures strength of a DC calibration field, is the tricky part, but nearly operational.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I'll post a reply to this one, if I get into trouble!&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 02 Jun 2007 02:40:52 GMT</pubDate>
    <dc:creator>DSbob</dc:creator>
    <dc:date>2007-06-02T02:40:52Z</dc:date>
    <item>
      <title>C equivalent to ORG</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/C-equivalent-to-ORG/m-p/135525#M1722</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;Peg suggested I search for answers to my questions here, as the answers may be tool dependent.&amp;nbsp; OK, I'm using Codewarrior IDE v5.7.0, and just switched successfully from USB to demo board, to USB-Cyclone Pro-demo board (application hardware I designed arrives next week, but I've hooked a prototype to the demo board).&amp;nbsp; &amp;nbsp;But I'm not sure of the terms.&amp;nbsp; In the 8-bit microcontrollers forum, I posted:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;"I've spent years programming HC05 in asm.&amp;nbsp; New to C and Flash, using S08QG8.&amp;nbsp; I need to store a calibration value in flash.&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;With help from this forum [8-bit uC], I have it written to second to last page, 0xFC00.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Memory write protection starts at last page and works toward lower pages, right?&amp;nbsp; So with a flash writer in my application, I sure want to protect program memory!&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I want to write the calibration value at 0xE000, and make sure the complier/linker&amp;nbsp;starts the application program at 0xE200, the second page of flash.&amp;nbsp; I've studied Segments and Sections in the linker prm file but don't see how to force that.&amp;nbsp; Any suggestions?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Writing this, I've come to realize each debug session will probably overwrite the calibration value through mass erase.&amp;nbsp; I think that can be delt with, have used command files.&amp;nbsp; Will a w(rite bytes, words, etc) post load command actually write to flash, so I can debug normal operation?"&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Search terms "calibrate", "calibration", and "eeprom flash" turned up some interesting things, but I have not found anything specific to the compliler / linker, yet.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks Alban for your reply in microcontrollers.&amp;nbsp; I'm a little confused about what is meant by "emplacement".&amp;nbsp; I think you are working with a different memory map too.&amp;nbsp; I'll be sure to study the QG8 memory map and flash page specs real close!&amp;nbsp; OK, I see the PLACEMENT part of the PRM file.&amp;nbsp; I think you are saying break the segment named ROM into ROMsomething and ROMsomethingelse (ROM1 looks like config register space or something).&amp;nbsp; Then the new INTO, maybe the #pragmas you suggest.&amp;nbsp; But&amp;nbsp;the calibration value writer I adapted from the uC forum accepts an absolute address, and I was going to figure how to&amp;nbsp;read the calibration value back that way (C pointer to absolute address?&amp;nbsp; In line assembly,&amp;nbsp;MOV firstbyte, TPMC0VH, nextbyte to ...L?&amp;nbsp; If FFFF your erased, not calibrated!)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;It is a simple application, perfect for finally forcing me to learn a little C.&amp;nbsp; Display peak absolute value of magnetic strength a hall sensor is exposed to, DC-400 hz, 0.1-1.5T.&amp;nbsp; Auto zero and normal operation are easy.&amp;nbsp; So should binary to LED segments conversion and multiplexing.&amp;nbsp; Self calibration-searching for sensor stimulation that&amp;nbsp;measures strength of a DC calibration field, is the tricky part, but nearly operational.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I'll post a reply to this one, if I get into trouble!&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Jun 2007 02:40:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/C-equivalent-to-ORG/m-p/135525#M1722</guid>
      <dc:creator>DSbob</dc:creator>
      <dc:date>2007-06-02T02:40:52Z</dc:date>
    </item>
    <item>
      <title>Re: C equivalent to ORG</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/C-equivalent-to-ORG/m-p/135526#M1723</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;I assume you want to define a constant and allocate it at an absolute address.&lt;/DIV&gt;&lt;DIV&gt;Am I right?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If you are using CodeWarrior compiler you can use the @ operator in this purpose.&lt;/DIV&gt;&lt;DIV&gt;For example following instruction will allocate a 2 byte object at address 0xFFA0 and initialize it with 0x10.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; const int toto @0xFFA0 = 0x10 ;&lt;BR /&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If you wish to tell that he application should start at a specific address:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; - Create a function which will be used as application entry point.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Make sure you do not define the function as static in the ANSI C source file.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; - Place the function in a user defined code section using pragma CODE_SEG&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Example&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #pragma CODE_SEG MyEntrySection&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; void MyEntryCode(void) {&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Insert Code Here*/&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #pragma CODE_SEG MyEntrySection&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; - In the PRM file indicate you want to use the function MyEntryCode as application entry code.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; This is done using the command INIT&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INIT MyEntryCode&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;- As you want your code to start at address 0xE200, modify the line&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ROM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; =&amp;nbsp; READ_ONLY&amp;nbsp;&amp;nbsp;&amp;nbsp; 0xE000 TO 0xFFAD;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; into&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ROM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; =&amp;nbsp; READ_ONLY&amp;nbsp;&amp;nbsp;&amp;nbsp; 0xE200 TO 0xFFAD;&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;- Finally place the function at the appropriate location. As the function is the application entry point, it will&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; be placed in predefined section .init&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;So modify the line&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DEFAULT_ROM, ROM_VAR, STRINGS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INTO&amp;nbsp; ROM;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; into&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .init, DEFAULT_ROM, ROM_VAR, STRINGS INTO&amp;nbsp; ROM;&amp;nbsp;&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;That should be it.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;CrasyCat&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Jun 2007 17:24:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/C-equivalent-to-ORG/m-p/135526#M1723</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2007-06-04T17:24:08Z</dc:date>
    </item>
    <item>
      <title>Re: C equivalent to ORG</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/C-equivalent-to-ORG/m-p/135527#M1724</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;CrasyCat,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Your assumption is not quite correct.&amp;nbsp; Actually I do start with a constant, but that gets stored and altered in volatile memory, actually a timer register.&amp;nbsp; The timer register result is the number&amp;nbsp;that the uC&amp;nbsp;stores in its own NV memory, as the calibration value, preferrably without aid of a debugger.&amp;nbsp; In production it is not constant at all but varies by sensor sensitivity.&amp;nbsp; But in a given product, the sensor is stable enough to assume the value valid for a year or so.&amp;nbsp; I have all that coded and operational.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;From the S08QG datasheet "block protection begins at any 512 byte boundary below the last address of FLASH [and working toward lower addresses]".&amp;nbsp; That is my reason for wanting to store the value in the first 512 byte NV page.&amp;nbsp; So the firmware can be protected, and can write the calibration value it finds.&amp;nbsp; That is why executable code should not start until the second block from the lowest ROM address, where it can be protected.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;That was the hardware part of my original post.&amp;nbsp; Between your answer, CrasyCat, and Alban's to my original post in 8-bit uC forum, I think the answer to the subject is clear enough.&amp;nbsp; I'm putting out a fire, may take days to try it.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks all.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Jun 2007 01:20:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/C-equivalent-to-ORG/m-p/135527#M1724</guid>
      <dc:creator>DSbob</dc:creator>
      <dc:date>2007-06-05T01:20:23Z</dc:date>
    </item>
  </channel>
</rss>

