<?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: Download a function into ram and excute it on hcs12 in S12 / MagniV Microcontrollers</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Download-a-function-into-ram-and-excute-it-on-hcs12/m-p/753831#M15142</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;The data are always downloaded into Flash and then copied to RAM during startup.&lt;/P&gt;&lt;P&gt;The data would be lost after power-on reset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 05 Dec 2017 12:12:48 GMT</pubDate>
    <dc:creator>danielmartynek</dc:creator>
    <dc:date>2017-12-05T12:12:48Z</dc:date>
    <item>
      <title>Download a function into ram and excute it on hcs12</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Download-a-function-into-ram-and-excute-it-on-hcs12/m-p/753830#M15141</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Our customer has a request on our bootloader, that is, the flash diver must not stored into the flash, it should download from can cummunication and then excute it to do flash download operation. I had noted that our community have some question about how to excute a function on ram, but they were all store into the flash, and when needed or program start, copy to ram, they are still store in flash.&amp;nbsp; what I need is when: excute compile, I can get a section of target file in ram. not place in flash.&amp;nbsp; and i have tried to do this, so I modified the prm file: use the ram as read-only type and place function in it, but I couldn't find any code in the ram place in the s19 file.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The test main.c is like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#include &amp;lt;hidef.h&amp;gt; /* common defines and macros */&lt;BR /&gt;#include "derivative.h" /* derivative-specific definitions */&lt;/P&gt;&lt;P&gt;#define TEST_OLD PT1AD_PT1AD3&lt;BR /&gt;#define TEST_TEMP PTR_PTR4 &lt;BR /&gt;#define TEST_NEW PORTB_PB3&lt;/P&gt;&lt;P&gt;#define TEST_IO TEST_NEW&lt;/P&gt;&lt;P&gt;#pragma CODE_SEG ROM_INTO_RAM2 &lt;BR /&gt;void Test(void)&lt;BR /&gt;{&lt;BR /&gt; static volatile unsigned int test_cnt;&lt;BR /&gt; &lt;BR /&gt; test_cnt ++;&lt;BR /&gt; if (test_cnt &amp;gt; 40000)&lt;BR /&gt; {&lt;BR /&gt; test_cnt = 0;&lt;BR /&gt; TEST_IO = TRUE;&lt;BR /&gt; }&lt;BR /&gt; /*TEST_IO = FALSE;*/&lt;BR /&gt;}&lt;BR /&gt;#pragma CODE_SEG DEFAULT &lt;BR /&gt; &lt;BR /&gt;void main(void) &lt;BR /&gt;{&lt;BR /&gt; /* put your own code here */&lt;BR /&gt; unsigned int cnt2;&lt;BR /&gt; EnableInterrupts;&lt;BR /&gt; &lt;BR /&gt; DDR1AD_DDR1AD3 = TRUE;&lt;BR /&gt; DDRR_DDRR4 = TRUE;&lt;BR /&gt; DDRB_DDRB3 = TRUE;&lt;BR /&gt; &lt;BR /&gt; for(;;) &lt;BR /&gt; {&lt;BR /&gt; Test();&lt;BR /&gt; &lt;BR /&gt; if (cnt2 ++ &amp;gt; 30000)&lt;BR /&gt; {&lt;BR /&gt; cnt2 = 0;&lt;BR /&gt; TEST_IO = FALSE;&lt;BR /&gt; }&lt;BR /&gt; _FEED_COP(); /* feeds the dog */&lt;BR /&gt; } /* loop forever */&lt;BR /&gt; /* please make sure that you never leave main */&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and the prm file is as below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* This is a linker parameter file for the MC9S12HY64 */&lt;BR /&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;/P&gt;&lt;P&gt;SEGMENTS /* Here all RAM/ROM areas of the device are listed. Used in PLACEMENT below. */&lt;/P&gt;&lt;P&gt;/* Register space */&lt;BR /&gt;/* IO_SEG = PAGED 0x0000 TO 0x03FF; intentionally not defined */&lt;/P&gt;&lt;P&gt;/* RAM */&lt;BR /&gt; RAM = READ_WRITE 0x3000 TO 0x3EFF;&lt;BR /&gt; &lt;BR /&gt; RAM2 = READ_ONLY 0x3F00 TO 0x3FFF;&lt;/P&gt;&lt;P&gt;/* D-Flash */&lt;BR /&gt; DFLASH = READ_ONLY 0x010400 TO 0x0113FF;&lt;/P&gt;&lt;P&gt;/* non-paged FLASHs */&lt;BR /&gt; ROM_1400 = READ_ONLY 0x1400 TO 0x2FFF;&lt;BR /&gt; ROM_4000 = READ_ONLY 0x4000 TO 0x7FFF;&lt;BR /&gt; ROM_C000 = READ_ONLY 0xC000 TO 0xFEFF;&lt;BR /&gt; /* VECTORS = READ_ONLY 0xFF00 TO 0xFFFF; intentionally not defined: used for VECTOR commands below */&lt;BR /&gt; //OSVECTORS = READ_ONLY 0xFF80 TO 0xFFFF; /* OSEK interrupt vectors (use your vector.o) */&lt;/P&gt;&lt;P&gt;/* paged FLASH: 0x8000 TO 0xBFFF; addressed through PPAGE */&lt;BR /&gt; PAGE_0C = READ_ONLY 0x0C8000 TO 0x0C93FF;&lt;BR /&gt; PAGE_0C_B000 = READ_ONLY 0x0CB000 TO 0x0CBFFF;&lt;BR /&gt; PAGE_0E = READ_ONLY 0x0E8000 TO 0x0EBFFF;&lt;BR /&gt;/* PAGE_0D = READ_ONLY 0x0D8000 TO 0x0DBFFF; not used: equivalent to ROM_4000 */&lt;BR /&gt;/* PAGE_0F = READ_ONLY 0x0F8000 TO 0x0FBEFF; not used: equivalent to ROM_C000 */&lt;BR /&gt;END&lt;/P&gt;&lt;P&gt;PLACEMENT /* here all predefined and user segments are placed into the SEGMENTS defined above. */&lt;BR /&gt; _PRESTART, /* Used in HIWARE format: jump to _Startup at the code start */&lt;BR /&gt; STARTUP, /* startup data structures */&lt;BR /&gt; ROM_VAR, /* constant variables */&lt;BR /&gt; STRINGS, /* string literals */&lt;BR /&gt; VIRTUAL_TABLE_SEGMENT, /* C++ virtual table segment */&lt;BR /&gt; //.ostext, /* OSEK */&lt;BR /&gt; NON_BANKED, /* runtime routines which must not be banked */&lt;BR /&gt; COPY /* copy down information: how to initialize variables */&lt;BR /&gt; /* in case you want to use ROM_4000 here as well, make sure&lt;BR /&gt; that all files (incl. library files) are compiled with the&lt;BR /&gt; option: -OnB=b */&lt;BR /&gt; INTO ROM_C000/*, ROM_1400, ROM_4000*/;&lt;/P&gt;&lt;P&gt;DEFAULT_ROM INTO PAGE_0C, PAGE_0C_B000, PAGE_0E;&lt;BR /&gt; &lt;BR /&gt; ROM_INTO_RAM2 INTO RAM2;&lt;BR /&gt; //.stackstart, /* eventually used for OSEK kernel awareness: Main-Stack Start */&lt;BR /&gt; SSTACK, /* allocate stack first to avoid overwriting variables on overflow */&lt;BR /&gt; //.stackend, /* eventually used for OSEK kernel awareness: Main-Stack End */&lt;BR /&gt; DEFAULT_RAM INTO RAM;&lt;/P&gt;&lt;P&gt;//.vectors INTO OSVECTORS; /* OSEK */&lt;BR /&gt;END&lt;/P&gt;&lt;P&gt;ENTRIES /* keep the following unreferenced variables */&lt;BR /&gt; /* OSEK: always allocate the vector table and all dependent objects */&lt;BR /&gt; //_vectab OsBuildNumber _OsOrtiStackStart _OsOrtiStart&lt;BR /&gt;END&lt;/P&gt;&lt;P&gt;STACKSIZE 0x100&lt;/P&gt;&lt;P&gt;VECTOR 0 _Startup /* reset vector: this is the default entry point for a C/C++ application. */&lt;BR /&gt;//VECTOR 0 Entry /* reset vector: this is the default entry point for an Assembly application. */&lt;BR /&gt;//INIT Entry /* for assembly applications: that this is as well the initialization entry point */&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Dec 2017 06:45:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Download-a-function-into-ram-and-excute-it-on-hcs12/m-p/753830#M15141</guid>
      <dc:creator>hongjianzhang</dc:creator>
      <dc:date>2017-12-01T06:45:21Z</dc:date>
    </item>
    <item>
      <title>Re: Download a function into ram and excute it on hcs12</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Download-a-function-into-ram-and-excute-it-on-hcs12/m-p/753831#M15142</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;The data are always downloaded into Flash and then copied to RAM during startup.&lt;/P&gt;&lt;P&gt;The data would be lost after power-on reset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Dec 2017 12:12:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Download-a-function-into-ram-and-excute-it-on-hcs12/m-p/753831#M15142</guid>
      <dc:creator>danielmartynek</dc:creator>
      <dc:date>2017-12-05T12:12:48Z</dc:date>
    </item>
    <item>
      <title>Re: Download a function into ram and excute it on hcs12</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Download-a-function-into-ram-and-excute-it-on-hcs12/m-p/753832#M15143</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;A _jive_internal="true" class="" data-content-finding="Community" data-userid="265908" data-username="hongjianzhang" href="https://community.nxp.com/people/hongjianzhang" style="color: #3d9ce7; background-color: #ffffff; border: 0px; font-weight: 600; font-size: 13.3333px;"&gt;hongjian zhang&lt;/A&gt;&lt;SPAN style="color: #646464; background-color: #ffffff; font-size: 13.3333px;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;请问你的问题解决了吗？我现在也遇到这个问题不知如何下手。&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jul 2019 03:20:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Download-a-function-into-ram-and-excute-it-on-hcs12/m-p/753832#M15143</guid>
      <dc:creator>oceansea</dc:creator>
      <dc:date>2019-07-24T03:20:09Z</dc:date>
    </item>
    <item>
      <title>Re: Download a function into ram and excute it on hcs12</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Download-a-function-into-ram-and-excute-it-on-hcs12/m-p/753833#M15144</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;没有，现在公司的其他人已经搞出来了，我就没再深入，大致就是编译成地址无关代码的方法&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;prayer_hong@163.com&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Jul 2019 14:40:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Download-a-function-into-ram-and-excute-it-on-hcs12/m-p/753833#M15144</guid>
      <dc:creator>hongjianzhang</dc:creator>
      <dc:date>2019-07-25T14:40:13Z</dc:date>
    </item>
  </channel>
</rss>

