<?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: Linker defined objects for checksums ? in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-defined-objects-for-checksums/m-p/152613#M8400</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Must I understand that there is no trick ?&lt;BR /&gt;&lt;BR /&gt;Thanks for the feature request process.&lt;BR /&gt;&lt;BR /&gt;Pierre AFD&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 13 Feb 2009 17:32:00 GMT</pubDate>
    <dc:creator>PierreAFD</dc:creator>
    <dc:date>2009-02-13T17:32:00Z</dc:date>
    <item>
      <title>Linker defined objects for checksums ?</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-defined-objects-for-checksums/m-p/152611#M8398</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is there a trick to obtain a symbol for a linker computed checksum ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I put the checksum in a dedicated placement and section, then I define a variable in the placement : result is that I get an overlapping warning at link and at program times.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I do not declare a variable in the placement, it gets removed, so no reference possible with the __SEG_X_DEF/__SEG_X_REF&amp;nbsp; mechanism.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Do you have a clean trick ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If no trick is possible, then Freescale poeple, please, consider this as a feature request.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It would also be nice to be able to obtain references to sections, not only to placements, even if they are not empty.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;PierreAFD&lt;/SPAN&gt;&lt;BR /&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Feb 2009 17:21:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-defined-objects-for-checksums/m-p/152611#M8398</guid>
      <dc:creator>PierreAFD</dc:creator>
      <dc:date>2009-02-13T17:21:34Z</dc:date>
    </item>
    <item>
      <title>Re: Linker defined objects for checksums ?</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-defined-objects-for-checksums/m-p/152612#M8399</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;The appropriate process to ask for a feature request is to submit an SR though our on-line support web Site.&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;Click &lt;A href="https://www.freescale.com/webapp/servicerequest.create_SR.framework?regFlag=fromOpenSR" rel="nofollow" target="_blank"&gt;here&lt;/A&gt; to submit a service request.&lt;BR /&gt;&lt;BR /&gt;CrasyCat&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Feb 2009 17:29:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-defined-objects-for-checksums/m-p/152612#M8399</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2009-02-13T17:29:46Z</dc:date>
    </item>
    <item>
      <title>Re: Linker defined objects for checksums ?</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-defined-objects-for-checksums/m-p/152613#M8400</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Must I understand that there is no trick ?&lt;BR /&gt;&lt;BR /&gt;Thanks for the feature request process.&lt;BR /&gt;&lt;BR /&gt;Pierre AFD&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Feb 2009 17:32:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-defined-objects-for-checksums/m-p/152613#M8400</guid>
      <dc:creator>PierreAFD</dc:creator>
      <dc:date>2009-02-13T17:32:00Z</dc:date>
    </item>
    <item>
      <title>Re: Linker defined objects for checksums ?</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-defined-objects-for-checksums/m-p/152614#M8401</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;Only way I know to access the data stored there is using a macro reading the content of this specific address.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Something like:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; #define&amp;nbsp;checksum (*((volatile char *) 0x0600))&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;CrasyCat&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Feb 2009 18:11:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-defined-objects-for-checksums/m-p/152614#M8401</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2009-02-13T18:11:44Z</dc:date>
    </item>
    <item>
      <title>Re: Linker defined objects for checksums ?</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-defined-objects-for-checksums/m-p/152615#M8402</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Try looking at FAQ-28651, which describes how to insert a serial number into Flash. You might be able to modify this technique to suit your need.&lt;BR /&gt;&lt;BR /&gt;---Tom&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Feb 2009 23:06:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-defined-objects-for-checksums/m-p/152615#M8402</guid>
      <dc:creator>J2MEJediMaster</dc:creator>
      <dc:date>2009-02-13T23:06:32Z</dc:date>
    </item>
    <item>
      <title>Re: Linker defined objects for checksums ?</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-defined-objects-for-checksums/m-p/152616#M8403</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;Thank you for this advice, but creating a variable to a precise adress is not the problem.&lt;BR /&gt;&lt;BR /&gt;My problem is that I declare a variable that I want to make the linker initialize : a checksum.&lt;BR /&gt;&lt;BR /&gt;In the code :&lt;BR /&gt;#pragma CONST_SEG CHECKSUM_PLACE&lt;BR /&gt;const int AppliCheckSum;&lt;BR /&gt;#pragma CONST_SEG DEFAULT&lt;BR /&gt;&lt;BR /&gt;then in the prm :&lt;BR /&gt;CHECKSUM_SECT&amp;nbsp;&amp;nbsp;&amp;nbsp; =READ_ONLY&amp;nbsp;&amp;nbsp;&amp;nbsp; 0xFBBE &amp;nbsp;&amp;nbsp; TO&amp;nbsp;&amp;nbsp;&amp;nbsp; 0xFBBF&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;BR /&gt;CHECKSUM_PLACE&amp;nbsp;&amp;nbsp;&amp;nbsp; INTO&amp;nbsp;&amp;nbsp;&amp;nbsp; CHECKSUM_SECT&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;BR /&gt;&lt;BR /&gt;CHECKSUM&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CHECKSUM_ENTRY&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; METHOD_CRC_CCITT&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; OF&amp;nbsp;&amp;nbsp;&amp;nbsp; READ_ONLY&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x9600&amp;nbsp;&amp;nbsp;&amp;nbsp; TO&amp;nbsp;&amp;nbsp;&amp;nbsp; 0xFBBD&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; INTO&amp;nbsp;&amp;nbsp;&amp;nbsp; READ_ONLY&amp;nbsp;&amp;nbsp;&amp;nbsp; 0xFBBE&amp;nbsp;&amp;nbsp;&amp;nbsp; SIZE&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; UNDEFINED&amp;nbsp;&amp;nbsp;&amp;nbsp; 0xFF&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; END&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;END&lt;BR /&gt;=&amp;gt; the linker detects overlapping and warns.&lt;BR /&gt;&lt;BR /&gt;Moreover, the programming tools also warn, but behave differently : P&amp;amp;E programmer puts the checksum value, softec do not !! I am scared that a fix from one will also fix (trash) my code.&lt;BR /&gt;&lt;BR /&gt;A solution would be not to declare a variable in the segment and, at run time, create a pointer using __SEG_X_DEF, but since the section is empty the linker gets rid of it and no __SEG_X_DEF possible.&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Feb 2009 23:28:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-defined-objects-for-checksums/m-p/152616#M8403</guid>
      <dc:creator>PierreAFD</dc:creator>
      <dc:date>2009-02-13T23:28:31Z</dc:date>
    </item>
    <item>
      <title>Re: Linker defined objects for checksums ?</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-defined-objects-for-checksums/m-p/152617#M8404</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;This snippet does place two values at the same address, so no surprise different values win for different programmers. Probably they should not program the app at all.&lt;BR /&gt;&lt;BR /&gt;AppliCheckSum does define a 0 value, it does not just give you an address. In C &lt;BR /&gt;no objects can have no address, they are always at least one byte. Therefore what you end up with&lt;BR /&gt;is that 0xFBBE contains two values, once the initialization value of AppliCheckSum (0) and once the checksum.&lt;BR /&gt;I would definitely take the warning seriously and do one of those things:&lt;BR /&gt;- access the checksum with the address, just as CrazyCat correctly suggested.&lt;BR /&gt;&amp;nbsp; I see that this means that the C code has to know the 0xFBBE address as well, so addresses are not just in the prm file anymore.&lt;BR /&gt;- define a 0 sized object. This is only possible in assembly, not in C.&lt;BR /&gt;&amp;nbsp; Something like (not tested)&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; XDEF AppliCheckSum&lt;BR /&gt;CHECKSUM_PLACE: SECTION&lt;BR /&gt;AppliCheckSum: EQU *&lt;BR /&gt;; intentionally empty section&lt;BR /&gt;&lt;BR /&gt;nextSection: SECTION&lt;BR /&gt;&amp;nbsp;&amp;nbsp; ;....&lt;BR /&gt;&lt;BR /&gt;And then in the C code, just use a declaration&lt;BR /&gt;extern const int AppliCheckSum;&lt;BR /&gt;&lt;BR /&gt;I personally would just use a "*(const unsigned int*)0xFBBE" in the C code because it is much simpler.&lt;BR /&gt;And then document the referral in the prm file for anyone who might change the address in the future.&lt;BR /&gt;&lt;BR /&gt;Preprocessing the prm file would also be a possibility to have a single shared address, but I think this does complicate the setup more than it helps.&lt;BR /&gt;&lt;BR /&gt;Daniel&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 Feb 2009 01:01:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-defined-objects-for-checksums/m-p/152617#M8404</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2009-02-15T01:01:57Z</dc:date>
    </item>
    <item>
      <title>Re: Linker defined objects for checksums ?</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-defined-objects-for-checksums/m-p/152618#M8405</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;I agree with all your statments.&lt;BR /&gt;&lt;BR /&gt;The point that made me post is that I have to write the same information (the address) at two places : code and prm.&lt;BR /&gt;Since the prm will probably change, I'll have, as&amp;nbsp; you say, to document and a maintain both informations by hands.&lt;BR /&gt;This makes me sad since there are many things possible with the linker, it misses just one tiny thing for me ...&lt;BR /&gt;&lt;BR /&gt;Concerning the "0 value" if you have in code&amp;nbsp; :&lt;BR /&gt;&lt;BR /&gt;__SEG_END_DEF(CHECKSUM_PLACE);&lt;BR /&gt;&lt;BR /&gt;#pragma CONST_SEG CHECKSUM_PLACE&lt;BR /&gt;/* No symbol defined */&lt;BR /&gt;#pragma CONST_SEG DEFAULT&lt;BR /&gt;const int *PointertoChecksum = __SEG_END_REF(CHECKSUM_PLACE);&lt;BR /&gt;&lt;BR /&gt;and in the prm :&lt;BR /&gt;CHECKSUM_SECT&amp;nbsp;&amp;nbsp;&amp;nbsp; =READ_ONLY&amp;nbsp;&amp;nbsp;&amp;nbsp; 0xFBBC&amp;nbsp;&amp;nbsp;&amp;nbsp; TO&amp;nbsp;&amp;nbsp;&amp;nbsp; 0xFBBF&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;CHECKSUM_PLACE&amp;nbsp;&amp;nbsp;&amp;nbsp; INTO&amp;nbsp;&amp;nbsp;&amp;nbsp; CHECKSUM_SECT&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;BR /&gt;&lt;BR /&gt;Then :&lt;BR /&gt;at link : "WARNING L4024: No information available for segment 'CHECKSUM_PLACE'"&lt;BR /&gt;at runtime Hiwave indicates :&lt;BR /&gt;PointertoChecksum = 0&lt;BR /&gt;__SEG_END_CHECKSUM_PLACE = 0, size 0&lt;BR /&gt;__SEG_END_CHECKSUM_PLACE[0]=0 size 1 ???????????&lt;BR /&gt;&lt;BR /&gt;If this pointer was well initialized (PointertoChecksum&amp;nbsp; = 0xFBBF) despite the fact that the CHECKSUM_PLACE is empty, then everything would be fine : no overlapped symbols, and in the code I am sure that I have the real address of my data, whatever happened to the prm.&lt;BR /&gt;Perhaps this is due to an optimization ?&lt;BR /&gt;&lt;BR /&gt;Thanks for the 0 sized object trick. I'ts the kind of solution I like, but I cannot implement...&lt;BR /&gt;&lt;BR /&gt;My prm is generated using a spreadsheet.&lt;BR /&gt;Maybe if I can launch a macro inside the sheet from command line, I will include the "gear" that my "mechanic" lacks using makefile, this way I will be able to maintain consistency between adresses in code and prm.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Pierre&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Feb 2009 18:30:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-defined-objects-for-checksums/m-p/152618#M8405</guid>
      <dc:creator>PierreAFD</dc:creator>
      <dc:date>2009-02-16T18:30:11Z</dc:date>
    </item>
  </channel>
</rss>

