<?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: Updating user application FW using custom bootloader[XEP100] in S12 / MagniV Microcontrollers</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Updating-user-application-FW-using-custom-bootloader-XEP100/m-p/1534849#M18907</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;As I have writen, the AN4258 can be taken as a development platform where it is explained. Also prinicple when RAM is used and critical part of the flash routine is explained in attached example. Extension of the last principle is explained as a DoOnStack routine. It is up to you which of them you will implement and use.&lt;/P&gt;
&lt;P&gt;More was presented in your original&amp;nbsp; question...&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.nxp.com/t5/S12-MagniV-Microcontrollers/FW-update-using-bootloader-in-XEP100-HSC12X-series-controller/m-p/1524366/highlight/false#M18854" target="_blank"&gt;https://community.nxp.com/t5/S12-MagniV-Microcontrollers/FW-update-using-bootloader-in-XEP100-HSC12X-series-controller/m-p/1524366/highlight/false#M18854&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;Ladislav&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 10 Oct 2022 12:29:02 GMT</pubDate>
    <dc:creator>lama</dc:creator>
    <dc:date>2022-10-10T12:29:02Z</dc:date>
    <item>
      <title>Updating user application FW using custom bootloader[XEP100]</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Updating-user-application-FW-using-custom-bootloader-XEP100/m-p/1534798#M18905</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I am trying to upload application firmware to flash memory using bootloader application. I am having&amp;nbsp;MC9S12XEP100CVL controller.&lt;/P&gt;&lt;P&gt;We have bootloader and application to place in flash memory blocks.&amp;nbsp;&lt;SPAN&gt;Memory mapping of the XEP100 in terms of blocks are mentioned below&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;Global Address&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;Logical Address&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;Block&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;Size&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="47px"&gt;0x70_0000 - 0x73_FFFF&lt;/TD&gt;&lt;TD width="25%" height="47px"&gt;C08000 - CFBFFF&lt;/TD&gt;&lt;TD width="25%" height="47px"&gt;B3&lt;/TD&gt;&lt;TD width="25%" height="47px"&gt;256K&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="47px"&gt;0x74_0000 - 0x77_FFFF&lt;/TD&gt;&lt;TD width="25%" height="47px"&gt;D08000 - DFBFFF&lt;/TD&gt;&lt;TD width="25%" height="47px"&gt;B2&lt;/TD&gt;&lt;TD width="25%" height="47px"&gt;256K&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;0x78_0000 - 0x79_FFFF&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;E08000 - E7BFFF&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;B1S&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;128K&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;0x7A_0000 - 0x7B_FFFF&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;E88000 - EFBFFF&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;B1N&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;128K&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;0x7C_0000 - 0x7F_FFFF&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;F08000 - FFFF&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;B0&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;256K&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We want to arrange the memory as shown below. The bootloader code is around 18KB, and user application is around 700KB.&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;Application Type&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;Global Address&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;Logical Address&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;STRONG&gt;Description&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="69px"&gt;User application Start&lt;/TD&gt;&lt;TD width="25%" height="69px"&gt;0x7FC000&lt;/TD&gt;&lt;TD width="25%" height="69px"&gt;C000&lt;/TD&gt;&lt;TD width="25%" height="69px"&gt;ROM_C000 address range assignment for user application&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="69px"&gt;User application End&lt;/TD&gt;&lt;TD width="25%" height="69px"&gt;0x7FD7FF&lt;/TD&gt;&lt;TD width="25%" height="69px"&gt;D7FF&lt;/TD&gt;&lt;TD width="25%" height="69px"&gt;ROM_C000 address range assignment for user application&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="47px"&gt;User application vector Table[Start]&lt;/TD&gt;&lt;TD width="25%" height="47px"&gt;0x7F7F10&lt;/TD&gt;&lt;TD width="25%" height="47px"&gt;7F10&lt;/TD&gt;&lt;TD width="25%" height="47px"&gt;User application vector table range assignment&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="47px"&gt;User application vector Table[End]&lt;/TD&gt;&lt;TD width="25%" height="47px"&gt;0x7F7FFF&lt;/TD&gt;&lt;TD width="25%" height="47px"&gt;7FFF&lt;/TD&gt;&lt;TD width="25%" height="47px"&gt;User application vector table range assignment&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="47px"&gt;Bootloader Date Start&lt;/TD&gt;&lt;TD width="25%" height="47px"&gt;0x7FD800&lt;/TD&gt;&lt;TD width="25%" height="47px"&gt;D800&lt;/TD&gt;&lt;TD width="25%" height="47px"&gt;Verification Data Range assignment&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="47px"&gt;Bootloader Date End&lt;/TD&gt;&lt;TD width="25%" height="47px"&gt;0x7FD805&lt;/TD&gt;&lt;TD width="25%" height="47px"&gt;D805&lt;/TD&gt;&lt;TD width="25%" height="47px"&gt;Verification Data Range assignment&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;Bootloader Code start&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;0x7FDF00&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;DF00&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;ROM_C000 address range assignment for bootloader application&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;Bootloader code end&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;0x7FFEFF&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;FEFF&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;ROM_C000 address range assignment for bootloader application&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="47px"&gt;Bootloader vector Table[Start]&lt;/TD&gt;&lt;TD width="25%" height="47px"&gt;0x7FFF10&lt;/TD&gt;&lt;TD width="25%" height="47px"&gt;FF10&lt;/TD&gt;&lt;TD width="25%" height="47px"&gt;Bootloader vector table Range assignment&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="47px"&gt;Bootloader vector Table [End]&lt;/TD&gt;&lt;TD height="47px"&gt;0x7FFFFF&lt;/TD&gt;&lt;TD height="47px"&gt;FFFF&lt;/TD&gt;&lt;TD height="47px"&gt;Bootloader vector table Range assignment&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Memory&amp;nbsp;&lt;/STRONG&gt;&lt;STRONG&gt;Arrangement:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Currently Our bootloader application is running in block 0 which performs following application&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Erase complete flash memory.&lt;/LI&gt;&lt;LI&gt;Writing application firmware to flash memory&lt;/LI&gt;&lt;LI&gt;Switching from bootloader to user application&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN&gt;The code snippets of the .prm file for bootloader which defines the memory assignment is added below.&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ROM_4000 = READ_ONLY 0x4000 TO 0x7F0F;
ROM_C000 = READ_ONLY 0xDF00 TO 0xFEFF; [Bootloader Code]

BL_DATA = READ_ONLY 0xD800 TO 0xD805; [Bootloader - Application Verification section]&lt;/LI-CODE&gt;&lt;P&gt;The Bootloader is running in block 0 [bottom few sectors]. It uses address range [0x7FDF00 - 0x7FFFE0].&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The code snippets of the .prm file f&lt;/SPAN&gt;or user application which defines the memory assignment is added below&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;/* Non-banked FLASH */
      /* Leave space for Vector table from 0x7F10 to 0x7FFF;  */
      ROM_4000      = READ_ONLY    0x4000 TO   0x7F0F;
      
      /* Leave space for Bootloader from 0xD800 to 0xFFFF */
      /* Note: D800 to DBFF reserved for Application Verification info written by bootloader */
      ROM_C000      = READ_ONLY    0xC000 TO   0xD7FF;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;The S19 file of application includes few of the remaining addresses from the block 0.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Limitation:&lt;/STRONG&gt;&lt;STRONG&gt;&amp;nbsp;The issue is XEP100 does not allow to perform any operation like erase and write on the unused flash addresses of particular Block where the code is running.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;In our case we are using&lt;STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Block 0[256KB]&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;for bootloader application which uses around&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;12 sectors [code and verification data]&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;so we are not able to use remaining sectors of block 0 because of above mentioned limitation.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, one way is to place the user application code in other blocks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Questions:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1. What all changes we need in prm file for placing bootloader and user application?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2. Using other blocks for running the user application code.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp;- Can you please share any example code or what all things we need to take care for running user application from different blocks?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;3. finding a way to use the remaining block of the block 0.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp;- Is there any way we can write to unused sectors of block 0 where my bootloader application is running?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Can you please suggest any way to fix these issues?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Please find attached parameter [.prm] files of bootloader and user application&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2022 10:47:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Updating-user-application-FW-using-custom-bootloader-XEP100/m-p/1534798#M18905</guid>
      <dc:creator>Vaibhav_Mahajan</dc:creator>
      <dc:date>2022-10-10T10:47:44Z</dc:date>
    </item>
    <item>
      <title>Re: Updating user application FW using custom bootloader[XEP100]</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Updating-user-application-FW-using-custom-bootloader-XEP100/m-p/1534849#M18907</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;As I have writen, the AN4258 can be taken as a development platform where it is explained. Also prinicple when RAM is used and critical part of the flash routine is explained in attached example. Extension of the last principle is explained as a DoOnStack routine. It is up to you which of them you will implement and use.&lt;/P&gt;
&lt;P&gt;More was presented in your original&amp;nbsp; question...&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.nxp.com/t5/S12-MagniV-Microcontrollers/FW-update-using-bootloader-in-XEP100-HSC12X-series-controller/m-p/1524366/highlight/false#M18854" target="_blank"&gt;https://community.nxp.com/t5/S12-MagniV-Microcontrollers/FW-update-using-bootloader-in-XEP100-HSC12X-series-controller/m-p/1524366/highlight/false#M18854&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;Ladislav&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2022 12:29:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Updating-user-application-FW-using-custom-bootloader-XEP100/m-p/1534849#M18907</guid>
      <dc:creator>lama</dc:creator>
      <dc:date>2022-10-10T12:29:02Z</dc:date>
    </item>
  </channel>
</rss>

