<?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>S12 / MagniV Microcontrollers中的主题 HCS12 + Fixed address for two functions</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/HCS12-Fixed-address-for-two-functions/m-p/249010#M9647</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, I am using a HCS12DP512 MCU and I have a question regarding the Complier/Linker.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I`m trying to allocate two functions to the same specific address.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ideally, it would like to do something like:&lt;/P&gt;&lt;P&gt;void t1(void) @0x9000&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; putchar('1');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;void t2(void) @0x9000&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; putchar('2');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By default, one of the function would be included in my program. Then at &lt;STRONG&gt;run time&lt;/STRONG&gt;, the user could send just the S-Record for one of this function with the bootloader in my MCU.&lt;/P&gt;&lt;P&gt;That would be useful when there is not enough room in the FLASH (code page). I could use this feature to have unit testing or debugging function in the field.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I achieve this with CodeWarrior IDE for HCS12 ?&lt;/P&gt;&lt;P&gt;I know I can create a user segment in the PRM file but It seems the LINKER will place both functions one after the other.&lt;/P&gt;&lt;P&gt;I really want to force these two fonctions at one specifc address.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is that possible ?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for your answer.&lt;/P&gt;&lt;P&gt;ssinfod&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Sep 2013 20:18:25 GMT</pubDate>
    <dc:creator>ssinfod</dc:creator>
    <dc:date>2013-09-24T20:18:25Z</dc:date>
    <item>
      <title>HCS12 + Fixed address for two functions</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/HCS12-Fixed-address-for-two-functions/m-p/249010#M9647</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, I am using a HCS12DP512 MCU and I have a question regarding the Complier/Linker.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I`m trying to allocate two functions to the same specific address.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ideally, it would like to do something like:&lt;/P&gt;&lt;P&gt;void t1(void) @0x9000&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; putchar('1');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;void t2(void) @0x9000&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; putchar('2');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By default, one of the function would be included in my program. Then at &lt;STRONG&gt;run time&lt;/STRONG&gt;, the user could send just the S-Record for one of this function with the bootloader in my MCU.&lt;/P&gt;&lt;P&gt;That would be useful when there is not enough room in the FLASH (code page). I could use this feature to have unit testing or debugging function in the field.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I achieve this with CodeWarrior IDE for HCS12 ?&lt;/P&gt;&lt;P&gt;I know I can create a user segment in the PRM file but It seems the LINKER will place both functions one after the other.&lt;/P&gt;&lt;P&gt;I really want to force these two fonctions at one specifc address.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is that possible ?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for your answer.&lt;/P&gt;&lt;P&gt;ssinfod&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Sep 2013 20:18:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/HCS12-Fixed-address-for-two-functions/m-p/249010#M9647</guid>
      <dc:creator>ssinfod</dc:creator>
      <dc:date>2013-09-24T20:18:25Z</dc:date>
    </item>
    <item>
      <title>Re: HCS12 + Fixed address for two functions</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/HCS12-Fixed-address-for-two-functions/m-p/249011#M9648</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am afraid that I am not fully sure what you want to do with your code.&lt;/P&gt;&lt;P&gt;I suppose that you want call function at address 0x9000.&lt;/P&gt;&lt;P&gt;In default code you will use for example function “&lt;EM&gt;t1&lt;/EM&gt;”.&lt;/P&gt;&lt;P&gt;I suppose that you additionally need compiled code of function “&lt;EM&gt;t2&lt;/EM&gt;”.&amp;nbsp; This function &lt;EM&gt;t2&lt;/EM&gt; will be loaded via bootloader. Correct?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to recommend Conditional Assembly Directives:&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;//#define CHANGE&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;void t1(void) @0x9000&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;{&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;#ifdef CHANGE&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; putchar('2');&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;#else&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; putchar('1');&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;#endif&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In first run CHANGE is not defined and &lt;EM&gt;t1&lt;/EM&gt; contains command &lt;EM&gt;putchar('1');&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;When you define CHANGE and compile project again,&lt;EM&gt; t1&lt;/EM&gt; will contains command &lt;EM&gt;putchar('2');.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Function&lt;EM&gt; t1&lt;/EM&gt; stay at the same address, and you can change content of flash by bootloader.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you already mentioned, I would like to recommend create user segment for this function and size of this segment should be divisble by flash sector size. Code placement:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;#pragma CODE_SEG MY_ROM&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;void t1(void) @0x9000&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;{&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;...&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;#pragma CODE_SEG DEFAULT&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Oct 2013 13:03:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/HCS12-Fixed-address-for-two-functions/m-p/249011#M9648</guid>
      <dc:creator>RadekS</dc:creator>
      <dc:date>2013-10-07T13:03:33Z</dc:date>
    </item>
  </channel>
</rss>

