<?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: Re: Relocating code for bootloader on MPC5643L in CodeWarrior Development Tools</title>
    <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Relocating-code-for-bootloader-on-MPC5643L/m-p/258551#M268</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: courier new,courier;"&gt;Hi Markus,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 10pt;"&gt;You can change your code as follows to avoid that error:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 10pt;"&gt;1. define the application function pointer &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 10pt;"&gt;typedef void (*funcptr)(void);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 10pt;"&gt;#pragma push /* Save the current state */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 10pt;"&gt;#pragma section sconst_type ".__bootvectorarea"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 10pt;"&gt;const funcptr my_application = __startup;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 10pt;"&gt;#pragma pop&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 10pt;"&gt;2. add items to linker command file&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 10pt;"&gt;bootvector:&amp;nbsp; org = 0x00040000&amp;nbsp;&amp;nbsp;&amp;nbsp; len = 0x10&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 10pt;"&gt;.__bootvectorarea LOAD(ADDR(bootvector)): {} &amp;gt; bootvector&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 10pt;"&gt;FORCEACTIVE { "my_application"}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 10pt;"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;&lt;SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: courier new,courier;"&gt;Kevin&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: calibri,verdana,arial,sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 07 Mar 2014 03:28:11 GMT</pubDate>
    <dc:creator>toucan</dc:creator>
    <dc:date>2014-03-07T03:28:11Z</dc:date>
    <item>
      <title>Relocating code for bootloader on MPC5643L</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Relocating-code-for-bootloader-on-MPC5643L/m-p/258548#M265</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;maybe someone can help with this this issue.&lt;/P&gt;&lt;P&gt;I am implementing a bootloader for MPC5643L. I am using CodeWarrior 10.5.&lt;/P&gt;&lt;P&gt;I've already tried a lot of solutions from this forum and the great search engine but it always throws me an linker error.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I implemented the code as follows:&lt;/P&gt;&lt;PRE class="c++" name="code"&gt;__declspec(section ".init") extern void __startup(int argc, char **argv, char **envp);&amp;nbsp; #pragma section code_type ".bootvector" data_mode=far_abs __declspec(section ".bootvector") __asm void jumpToStartup(void);&amp;nbsp; __asm void jumpToStartup(void) { &amp;nbsp;&amp;nbsp;&amp;nbsp; b __startup; }&amp;nbsp;&amp;nbsp; &lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I added the following line into the MEMORY block:&lt;/P&gt;&lt;PRE class="c++" name="code"&gt;bootvector: org = 0x40004, len = 0x8 &lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I added the following code to the SECTIONS block:&lt;/P&gt;&lt;PRE class="c++" name="code"&gt;GROUP : { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .bootvector : {} &amp;nbsp;&amp;nbsp;&amp;nbsp; } &amp;gt; bootvector &lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also tried the upper statement without the GROUP definition - same result.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I try to compile it I always get the linker error:&lt;/P&gt;&lt;P&gt;Linker command file output section '.bootvector' has a type or input which is incompatible with section '.bootvector' in file 'Boot_c.obj'. Change the type or add an input for this section.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I am doing wrong here ?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Markus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Feb 2014 19:00:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Relocating-code-for-bootloader-on-MPC5643L/m-p/258548#M265</guid>
      <dc:creator>markusa</dc:creator>
      <dc:date>2014-02-25T19:00:10Z</dc:date>
    </item>
    <item>
      <title>Re: Relocating code for bootloader on MPC5643L</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Relocating-code-for-bootloader-on-MPC5643L/m-p/258549#M266</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Markus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've checked with colleague and see below their comments.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;++++++++++++++++++++&lt;/P&gt;&lt;P&gt;The space occupied by the RCHW and application start address should be aligned at 16 bytes boundary.&amp;nbsp; &lt;/P&gt;&lt;P&gt;You need to make bootvector section aligned at 16 bytes boundary. &lt;/P&gt;&lt;P&gt;++++++++++++++++++++&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Pascal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Mar 2014 10:35:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Relocating-code-for-bootloader-on-MPC5643L/m-p/258549#M266</guid>
      <dc:creator>trytohelp</dc:creator>
      <dc:date>2014-03-05T10:35:06Z</dc:date>
    </item>
    <item>
      <title>Re: Relocating code for bootloader on MPC5643L</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Relocating-code-for-bootloader-on-MPC5643L/m-p/258550#M267</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Pascal,&lt;/P&gt;&lt;P&gt;thank you for your response.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My bootloader progam doesn't use the BAM (and therefore the RCHW) to jump into my application.&lt;/P&gt;&lt;P&gt;But even if I relocate the section 'bootvector' to an 0x10 aligned address (e.g. 0x40000 or 0x40010) I get the following&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Linker error: Linker command file output section '.bootvector' has a type or input which is incompatible with section '.bootvector' in file 'Boot_c.obj'. Change the type or add an input for this section.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My bootloader works as follows:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;bootloader is programmed (via JTAG programmer) to the target - the bootloader uses the BAM to boot and already works&lt;/LI&gt;&lt;LI&gt;the bootloader checks, if there is an valid application in an defined application flash memory area and tries to jump to the application entry point if there is an valid application&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I try to implement a branch instruction at address 0x40004 which points to the start of my application.&lt;/P&gt;&lt;P&gt;The bootloader uses a function pointer to jump to address 0x40004 and therefore should jump again to the start of my application.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Markus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Mar 2014 12:37:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Relocating-code-for-bootloader-on-MPC5643L/m-p/258550#M267</guid>
      <dc:creator>markusa</dc:creator>
      <dc:date>2014-03-05T12:37:08Z</dc:date>
    </item>
    <item>
      <title>Re: Re: Relocating code for bootloader on MPC5643L</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Relocating-code-for-bootloader-on-MPC5643L/m-p/258551#M268</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: courier new,courier;"&gt;Hi Markus,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 10pt;"&gt;You can change your code as follows to avoid that error:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 10pt;"&gt;1. define the application function pointer &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 10pt;"&gt;typedef void (*funcptr)(void);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 10pt;"&gt;#pragma push /* Save the current state */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 10pt;"&gt;#pragma section sconst_type ".__bootvectorarea"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 10pt;"&gt;const funcptr my_application = __startup;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 10pt;"&gt;#pragma pop&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 10pt;"&gt;2. add items to linker command file&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 10pt;"&gt;bootvector:&amp;nbsp; org = 0x00040000&amp;nbsp;&amp;nbsp;&amp;nbsp; len = 0x10&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 10pt;"&gt;.__bootvectorarea LOAD(ADDR(bootvector)): {} &amp;gt; bootvector&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 10pt;"&gt;FORCEACTIVE { "my_application"}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 10pt;"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;&lt;SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: courier new,courier;"&gt;Kevin&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: calibri,verdana,arial,sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Mar 2014 03:28:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Relocating-code-for-bootloader-on-MPC5643L/m-p/258551#M268</guid>
      <dc:creator>toucan</dc:creator>
      <dc:date>2014-03-07T03:28:11Z</dc:date>
    </item>
    <item>
      <title>Re: Relocating code for bootloader on MPC5643L</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Relocating-code-for-bootloader-on-MPC5643L/m-p/258552#M269</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;not exactly what I'm looking for but I'll give it a try - thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My bootloader already uses a function pointer to jump to the start of the application (currently 0x40004 resp. 0x40010) so it would be nice if either the start of the application or a branch instruction to the start of the application would be located at this address.&lt;/P&gt;&lt;P&gt;With the solution above I now have a function pointer to a function pointer.&lt;/P&gt;&lt;P&gt;It's a common question for me how to locate a function to a designated memory address without this linker error.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Mar 2014 16:02:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Relocating-code-for-bootloader-on-MPC5643L/m-p/258552#M269</guid>
      <dc:creator>markusa</dc:creator>
      <dc:date>2014-03-11T16:02:12Z</dc:date>
    </item>
  </channel>
</rss>

