<?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のトピックRe: How to avoid CAN bootloader call the _COPY function.</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/How-to-avoid-CAN-bootloader-call-the-COPY-function/m-p/685968#M14353</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi XY,&lt;/P&gt;&lt;P&gt;Thank you for testing and results.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The “case” command might be replaced by set of “if” conditions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How did you move bootloader code from flash to RAM?&lt;/P&gt;&lt;P&gt;The first principle is defining code directly at RAM by #pragma CODE_SEG linker commands. The code is automatically loaded into RAM during startup.&lt;/P&gt;&lt;P&gt;The second principle is creating code on Flash and move it into RAM by some copy function. Te example might be for example AN4258 software.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The compiler might be configured for generating position-independent code by -Pic compiler option. However I suppose, that it will not solve this issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a great day,&lt;BR /&gt;Radek&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 15 Jun 2017 10:11:10 GMT</pubDate>
    <dc:creator>RadekS</dc:creator>
    <dc:date>2017-06-15T10:11:10Z</dc:date>
    <item>
      <title>How to avoid CAN bootloader call the _COPY function.</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/How-to-avoid-CAN-bootloader-call-the-COPY-function/m-p/685964#M14349</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am working with a MC9S12XEP100 CAN bootloader project. After compiled the project I found the bootloader used two function,&amp;nbsp;_COPY and&amp;nbsp;_CASE_CHECKED_BYTE. &amp;nbsp;These two functions are generated from&amp;nbsp;rtshc12.c.o (ansixbi.lib). Because my bootloader uses these two functions. I can't erase the&amp;nbsp;NON_BANKED segment, where these two functions located. Or my bootloader will die. That means I can't update the&amp;nbsp;&lt;SPAN&gt;NON_BANKED segment.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I want to ask is there any way to avoid my bootloader using these two functions. In order to let me update&amp;nbsp;NON_BANKED segment as well as user application.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here's some segment of my project.&lt;/SPAN&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;void CanStatusAck(UINT8 sta) &lt;BR /&gt;{&lt;BR /&gt; TxMsg.ID = UpLoadID;&lt;BR /&gt; TxMsg.DtLen = 1;&lt;BR /&gt; TxData[0] = sta;&lt;BR /&gt; TxMsg.data=(UINT8 *)&amp;amp;TxData[0];&lt;/P&gt;&lt;P&gt;/*It looks like the _COPY function is called there*/&lt;BR /&gt; (void)CanTxFrame(TxMsg);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;UINT8 CanTxFrame(CanMsg_t msg)&lt;BR /&gt;{ &lt;BR /&gt; unsigned char send_buf, sp;&lt;BR /&gt; if(msg.DtLen &amp;gt; 8)&lt;BR /&gt; return(FALSE);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(CAN0CTL0_SYNCH==0)&lt;BR /&gt; return(FALSE);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;send_buf = 0;&lt;/P&gt;&lt;P&gt;do&lt;BR /&gt; {&lt;BR /&gt;CAN0TBSEL=CAN0TFLG;&lt;BR /&gt; send_buf=CAN0TBSEL;&lt;BR /&gt; }&lt;BR /&gt;while(!send_buf); &lt;BR /&gt;CAN0TXIDR0 = (unsigned char)(msg.ID&amp;gt;&amp;gt;3);&lt;BR /&gt; CAN0TXIDR1 = (unsigned char)(msg.ID&amp;lt;&amp;lt;5);&lt;BR /&gt;&lt;BR /&gt; for(sp = 0; sp &amp;lt; msg.DtLen; sp++)&lt;BR /&gt; *((&amp;amp;CAN0TXDSR0)+sp) = msg.data[sp];&lt;BR /&gt; &lt;BR /&gt;CAN0TXDLR = msg.DtLen; &lt;BR /&gt;&lt;BR /&gt; CAN0TFLG = send_buf;&lt;BR /&gt; &lt;BR /&gt; return(TRUE);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jun 2017 14:30:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/How-to-avoid-CAN-bootloader-call-the-COPY-function/m-p/685964#M14349</guid>
      <dc:creator>xyfan</dc:creator>
      <dc:date>2017-06-13T14:30:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid CAN bootloader call the _COPY function.</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/How-to-avoid-CAN-bootloader-call-the-COPY-function/m-p/685965#M14350</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Now I am ready to use the can_bootloader to upload program ,And where to download the project of can_bootloader .Can you send the project ,&lt;SPAN style="color: #666666; background-color: rgba(255, 255, 255, 0.8); font-size: 12px;"&gt;&lt;SPAN&gt;Involved in the data to me? My email is &lt;/SPAN&gt;&lt;A class="jive-link-email-small" href="mailto:407214944@qq.com"&gt;407214944@qq.com&lt;/A&gt;&lt;SPAN&gt;.3ks!&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Jun 2017 02:39:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/How-to-avoid-CAN-bootloader-call-the-COPY-function/m-p/685965#M14350</guid>
      <dc:creator>407214944</dc:creator>
      <dc:date>2017-06-14T02:39:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid CAN bootloader call the _COPY function.</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/How-to-avoid-CAN-bootloader-call-the-COPY-function/m-p/685966#M14351</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi XY,&lt;/P&gt;&lt;P&gt;Unfortunately, I was not able replicate it on my side yet. I guess, that different compiler settings might be a reason.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;For testing purpose, you may try to add asm NOP; commands into your code. For example:&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;for(sp = 0; sp &amp;lt; msg.DtLen; sp++)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;*((&amp;amp;CAN0TXDSR0)+sp) = msg.data[sp];&lt;/P&gt;&lt;P&gt;asm NOP;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;The assembler code blocks compiler optimizations.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL start="2"&gt;&lt;LI&gt;Please try also change optimization from size to time (-Os, -Ot).&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL start="3"&gt;&lt;LI&gt;You may also try to add -Oilib: Optimize Library Functions compiler option. This enables the compiler to optimize specific known library functions by inlining.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL start="4"&gt;&lt;LI&gt;Please check whether your Compiler settings refers to the selected ANSI library. See "c:\Program Files (x86)\Freescale\CWS12v5.2\lib\hc12c\readme.txt"&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL start="5"&gt;&lt;LI&gt;In extreme case, you may copy assembler code from rtshc12.c file directly into your C function.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If nothing helps, please send us your project for review. If it is not public, you may create a ticket for us:&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-wiki-small" data-containerid="2001" data-containertype="14" data-objectid="329745" data-objecttype="102" href="https://community.nxp.com/docs/DOC-329745"&gt;https://community.nxp.com/docs/DOC-329745&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a great day,&lt;BR /&gt;Radek&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Jun 2017 13:01:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/How-to-avoid-CAN-bootloader-call-the-COPY-function/m-p/685966#M14351</guid>
      <dc:creator>RadekS</dc:creator>
      <dc:date>2017-06-14T13:01:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid CAN bootloader call the _COPY function.</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/How-to-avoid-CAN-bootloader-call-the-COPY-function/m-p/685967#M14352</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried all the possible solutions you wrote, but none of them works. I think it's when a big struck&amp;nbsp;to be sent into another function&amp;nbsp;as a&amp;nbsp;parameter that the project call the _COPY. In the code I posted earlier. When the TxMsg (it's a struct like &lt;span class="lia-inline-image-display-wrapper" image-alt="snipaste20170615_012745.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/20940i27A389A83F4578F2/image-size/large?v=v2&amp;amp;px=999" role="button" title="snipaste20170615_012745.jpg" alt="snipaste20170615_012745.jpg" /&gt;&lt;/span&gt;) being sent into CanTxFrame(TxMsg) as a parameter, the _COPY was called (by compiler). In order to&amp;nbsp;remove the parameter transfer process. I put the&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;CanTxFrame's code directly in&amp;nbsp;CanStatusAck function and it works. The _COPY function was removed from my bootloader successfully.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;But there is also another named&amp;nbsp;_CASE_CHECKED_BYTE being called when I use "case". I can't find solutions to remove&amp;nbsp;_CASE_CHECKED_BYTE yet.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you anyway.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Jun 2017 17:41:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/How-to-avoid-CAN-bootloader-call-the-COPY-function/m-p/685967#M14352</guid>
      <dc:creator>xyfan</dc:creator>
      <dc:date>2017-06-14T17:41:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid CAN bootloader call the _COPY function.</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/How-to-avoid-CAN-bootloader-call-the-COPY-function/m-p/685968#M14353</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi XY,&lt;/P&gt;&lt;P&gt;Thank you for testing and results.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The “case” command might be replaced by set of “if” conditions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How did you move bootloader code from flash to RAM?&lt;/P&gt;&lt;P&gt;The first principle is defining code directly at RAM by #pragma CODE_SEG linker commands. The code is automatically loaded into RAM during startup.&lt;/P&gt;&lt;P&gt;The second principle is creating code on Flash and move it into RAM by some copy function. Te example might be for example AN4258 software.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The compiler might be configured for generating position-independent code by -Pic compiler option. However I suppose, that it will not solve this issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a great day,&lt;BR /&gt;Radek&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Jun 2017 10:11:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/How-to-avoid-CAN-bootloader-call-the-COPY-function/m-p/685968#M14353</guid>
      <dc:creator>RadekS</dc:creator>
      <dc:date>2017-06-15T10:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid CAN bootloader call the _COPY function.</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/How-to-avoid-CAN-bootloader-call-the-COPY-function/m-p/685969#M14354</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My bootloader code was written on the flash and moved to ram by a copy function. I removed _COPY function yesterday. I changed "case" command into "if else" condition just now and the _CASE_CHECKED_BYTE was removed successfully! So these&amp;nbsp;two functions will not be called anymore. I can put the NON_BANKED segment into ROM_C000 finally. &amp;nbsp;I think the&amp;nbsp;&lt;SPAN&gt;NON_BANKED can be updated by bootloader too.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you for your help.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Jun 2017 10:52:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/How-to-avoid-CAN-bootloader-call-the-COPY-function/m-p/685969#M14354</guid>
      <dc:creator>xyfan</dc:creator>
      <dc:date>2017-06-15T10:52:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid CAN bootloader call the _COPY function.</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/How-to-avoid-CAN-bootloader-call-the-COPY-function/m-p/685970#M14355</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are welcome.&lt;/P&gt;&lt;P&gt;I am glad that it works now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a great day,&lt;BR /&gt;Radek&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Jun 2017 10:57:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/How-to-avoid-CAN-bootloader-call-the-COPY-function/m-p/685970#M14355</guid>
      <dc:creator>RadekS</dc:creator>
      <dc:date>2017-06-15T10:57:17Z</dc:date>
    </item>
  </channel>
</rss>

