<?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: Flash programming in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-programming/m-p/168890#M1116</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Freescale has a flash driver software here: &lt;A href="http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=K60&amp;amp;nodeId=01624698C9&amp;amp;fpsp=1&amp;amp;tab=Design_Tools_Tab#" rel="nofollow" target="_blank"&gt;http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=K60&amp;amp;nodeId=01624698C9&amp;amp;fpsp=1&amp;amp;tab=Design_Tools_Tab#&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You should use the API that is provided there because it is maintained by Freescale and common for many different platforms.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 15 Oct 2011 10:14:20 GMT</pubDate>
    <dc:creator>Dekiru</dc:creator>
    <dc:date>2011-10-15T10:14:20Z</dc:date>
    <item>
      <title>Flash programming</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-programming/m-p/168886#M1112</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;nbsp;﻿&lt;/P&gt;&lt;P class="MsoNormal"&gt;Hello,&lt;/P&gt;&lt;P class="MsoNormal"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="MsoNormal"&gt;I have to be able to load onto the { K60, K40, K10 } devices I'm working on 2 applications.&lt;/P&gt;&lt;P class="MsoNormal"&gt;The first is a &lt;U&gt;loader&lt;/U&gt; that will use 16K starting at address 0;&lt;/P&gt;&lt;P class="MsoNormal"&gt;The other is the &lt;U&gt;main application&lt;/U&gt; starting at the end address of the loader.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal"&gt;My hardware does not include FlexNVM. The loader application should be able to get external data (from a UART or from a file system loaded on the SD card) and program the main application section on flash.&lt;/P&gt;&lt;P class="MsoNormal"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="MsoNormal"&gt;I need some guidance here, what to read, how to approach this..&lt;/P&gt;&lt;P class="MsoNormal"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="MsoNormal"&gt;Thanks,&lt;/P&gt;&lt;P class="MsoNormal"&gt;Eitan.&lt;/P&gt;&lt;P class="MsoNormal"&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Sep 2011 15:30:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-programming/m-p/168886#M1112</guid>
      <dc:creator>eitanm</dc:creator>
      <dc:date>2011-09-22T15:30:38Z</dc:date>
    </item>
    <item>
      <title>Re: Flash programming</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-programming/m-p/168887#M1113</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Eitan,&lt;/P&gt;&lt;P&gt;Did you get any help with this as yet?&amp;nbsp; I'm in a similar situation now. I need to be able to program the upper half of the flash while my application isin the lower half.&amp;nbsp; I cannot find any library support that writes to FLASH on the K60 part.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mike B&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Oct 2011 17:23:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-programming/m-p/168887#M1113</guid>
      <dc:creator>FirmEE</dc:creator>
      <dc:date>2011-10-14T17:23:17Z</dc:date>
    </item>
    <item>
      <title>Re: Flash programming</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-programming/m-p/168888#M1114</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actual erase/write to flash is the 'easy part'; code below.&amp;nbsp; The hard part is setting up the tools to understand the bootloader/application-space setup, determining 'validness' of application image, and other such implementation details.&amp;nbsp; One thing to keep in mind:&amp;nbsp; You can't erase/write the 'bank' you're running in!&amp;nbsp; For applications that truly 'ping pong' between two half-flash-sized full memory code images, the latest 1.2 (and higher) silicon implements a fairly robust flash control mechanism for updating the 'opposite bank' with hooks to recover failed attempts.&amp;nbsp; For the case with 16K 'low boot', rest 'APP' -- that matches my world, and for that the IAR linker provides some help in that I allow it to link the bootloader code to RAM addresses and its startup copies it all out there and runs from there, freeing any concern over Flash bank execution restrictions.&amp;nbsp; I use the IAR linker also to fill unused Flash space with SVC 0xDF interrupts, and place a CRC32 at the end which I check using the Kinetis CRC module.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;--ERGII&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;static int fnFlashNow(uint8_t ucCommand, uint32_t ptrWord, uint32_t ulWord)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; do{&lt;/P&gt;&lt;P&gt;&amp;nbsp; }while (!(FTFL_FSTAT &amp;amp; FTFL_FSTAT_CCIF_MASK)); // wait for previous commands to complete&lt;/P&gt;&lt;P&gt;&amp;nbsp; if (FTFL_FSTAT &amp;amp; (FTFL_FSTAT_ACCERR_MASK | FTFL_FSTAT_FPVIOL_MASK)) { // check for errors in previous command&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FTFL_FSTAT = (FTFL_FSTAT_ACCERR_MASK | FTFL_FSTAT_FPVIOL_MASK); // clear old errors&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;}&lt;/P&gt;&lt;P&gt;&amp;nbsp; switch (FTFL_FCCOB0 = ucCommand) { // enter the command sequence&lt;/P&gt;&lt;P&gt;&amp;nbsp; case FCMD_ERASE_ALL_BLOCKS: // single command word required with the erase all blocks command&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;/P&gt;&lt;P&gt;&amp;nbsp; case FCMD_SWAP_CONTROL:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FTFL_FCCOB6 = 0xFF; //Clear these status bytes, in case of fault&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FTFL_FCCOB7 = 0xFF;&lt;/P&gt;&lt;P&gt;&amp;nbsp; case FCMD_PROGRAM_SECTION:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if( ucCommand == FCMD_PROGRAM_SECTION )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;ulWord &amp;gt;&amp;gt;= 3; //Convert to dual-dword count&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FTFL_FCCOB4 = (u8_t)(ulWord &amp;gt;&amp;gt; 8);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FTFL_FCCOB5 = (u8_t)(ulWord);&lt;/P&gt;&lt;P&gt;&amp;nbsp; case FCMD_ERASE_FLASH_SECTOR:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FTFL_FCCOB1 = (u8_t)(((CAST_POINTER_ARITHMETIC)ptrWord) &amp;gt;&amp;gt; 16);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FTFL_FCCOB2 = (u8_t)(((CAST_POINTER_ARITHMETIC)ptrWord) &amp;gt;&amp;gt; 8);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FTFL_FCCOB3 = (u8_t)((CAST_POINTER_ARITHMETIC)ptrWord);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; Disable_Interrupt(); // protect this region from interrupts&lt;/P&gt;&lt;P&gt;&amp;nbsp; FTFL_FSTAT = FTFL_FSTAT_CCIF_MASK; // launch the command - this clears the FTFL_STAT_CCIF flag (register is FTFL_FSTAT)&lt;/P&gt;&lt;P&gt;&amp;nbsp; while (!(FTFL_FSTAT &amp;amp; FTFL_FSTAT_CCIF_MASK)) {} // wait for the command to terminate&lt;/P&gt;&lt;P&gt;&amp;nbsp; return (FTFL_FSTAT &amp;amp; (FTFL_FSTAT_ACCERR_MASK | FTFL_FSTAT_FPVIOL_MASK&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; |&amp;nbsp;&amp;nbsp;FTFL_FSTAT_MGSTAT0_MASK)); // if there was an error this will be non-zero&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And a block copy of one memory area to flash is just:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;bool_t fnCopyBoot( uint32_t srcptr, uint32_t dstptr )&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; uint16_t file_length = APP_START; //This example moves a whole bootloader image size&lt;/P&gt;&lt;P&gt;&amp;nbsp; uint16_t usBlockSize = BLOCK_SIZE;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //This is 2K, of course&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; while (file_length) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (file_length &amp;lt; BLOCK_SIZE) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; usBlockSize = (u16_t)file_length; // last block smaller than full block size&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Memcpy_long((uint32_t *)&amp;amp;FlashRAM, (uint32_t *)srcptr, (uint32_t)usBlockSize); //Copy current code to burn-RAM&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; if( fnFlashNow(FCMD_ERASE_FLASH_SECTOR, dstptr, usBlockSize) ) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return FALSE; // error&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fnFlashNow(FCMD_PROGRAM_SECTION, dstptr, usBlockSize);&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; srcptr += usBlockSize;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dstptr += usBlockSize;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; file_length -= usBlockSize;&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; return TRUE;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Oct 2011 21:15:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-programming/m-p/168888#M1114</guid>
      <dc:creator>egoodii</dc:creator>
      <dc:date>2011-10-14T21:15:14Z</dc:date>
    </item>
    <item>
      <title>Re: Flash programming</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-programming/m-p/168889#M1115</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Eitan&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The uTasker serial loader includes all required support for SREC and USB boot loading:&lt;/P&gt;&lt;P&gt;- &lt;A href="http://www.utasker.com/docs/uTasker/uTaskerSerialLoader.PDF" rel="nofollow" target="_blank"&gt;http://www.utasker.com/docs/uTasker/uTaskerSerialLoader.PDF&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It can be seen here too:&lt;/P&gt;&lt;P&gt;- &lt;A href="http://www.youtube.com/watch?v=H4TYM9jY2-g" rel="nofollow" target="_blank"&gt;http://www.youtube.com/watch?v=H4TYM9jY2-g&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Oct 2011 04:58:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-programming/m-p/168889#M1115</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2011-10-15T04:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: Flash programming</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-programming/m-p/168890#M1116</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Freescale has a flash driver software here: &lt;A href="http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=K60&amp;amp;nodeId=01624698C9&amp;amp;fpsp=1&amp;amp;tab=Design_Tools_Tab#" rel="nofollow" target="_blank"&gt;http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=K60&amp;amp;nodeId=01624698C9&amp;amp;fpsp=1&amp;amp;tab=Design_Tools_Tab#&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You should use the API that is provided there because it is maintained by Freescale and common for many different platforms.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Oct 2011 10:14:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-programming/m-p/168890#M1116</guid>
      <dc:creator>Dekiru</dc:creator>
      <dc:date>2011-10-15T10:14:20Z</dc:date>
    </item>
    <item>
      <title>Re: Flash programming</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-programming/m-p/168891#M1117</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much for posting the links to the driver software.&lt;/P&gt;&lt;P&gt;I have downloaded it and tried the demos, they do exctly what im looking for except one thing.&lt;/P&gt;&lt;P&gt;The demo code is designed to run from ram.&lt;/P&gt;&lt;P&gt;Does anyone have any experience with the IAR compiler on how can i make all the driver functions relocatable?&lt;/P&gt;&lt;P&gt;The scenario im working with is a K60 with MQX running.&lt;/P&gt;&lt;P&gt;I have a routine that allows me to upload a new FW file to the spi flash chip i have one the custom board.&lt;/P&gt;&lt;P&gt;What i need to accomplish is read the data from the spi flash and program the K60 Flash with the new image.&lt;/P&gt;&lt;P&gt;this requires all the driver functions to be run from RAM.&lt;/P&gt;&lt;P&gt;I was reading the IAR documents regarding the code placement in ROM and then moving it to RAM but still can't figure it out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have also read all the posts on here regarding the topic and&amp;nbsp;&lt;A href="https://community.freescale.com/message/73480#73480" title="https://community.freescale.com/message/73480#73480"&gt;https://community.freescale.com/message/73480#73480&lt;/A&gt; give a general idea on how to accomplish this if you are doing everything from within one function.&lt;/P&gt;&lt;P&gt;I want to utilize the driver provided by Freescale to write to K60 flash thus i need to figure out how to put it all from ROM to RAM and then run the functions i need from ram.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help or example code would be really appriciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Oct 2011 07:14:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-programming/m-p/168891#M1117</guid>
      <dc:creator>igor-imx</dc:creator>
      <dc:date>2011-10-18T07:14:05Z</dc:date>
    </item>
    <item>
      <title>Re: Flash programming</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-programming/m-p/168892#M1118</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just to add to the above, i found the how-to but for the different tool chain here :&lt;A href="http://www.tasking.com/support/c166-classic/AN019-13_v8.PDF" rel="nofollow" target="_self"&gt;http://www.tasking.com/support/c166-classic/AN019-13_v8.PDF&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It examplains the exact behavior that im trying to achive.&lt;/P&gt;&lt;P&gt;Hope there are some IAR gurus on here to help out with this&amp;nbsp;&lt;IMG alt=":smileywink:" class="emoticon emoticon-smileywink" id="smileywink" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif" title="Smiley Wink" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Oct 2011 07:59:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-programming/m-p/168892#M1118</guid>
      <dc:creator>igor-imx</dc:creator>
      <dc:date>2011-10-18T07:59:55Z</dc:date>
    </item>
    <item>
      <title>Re: Flash programming</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-programming/m-p/168893#M1119</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Igordlx,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;MQX includes the flashx driver. In your case with MQX, perhaps is the best option.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yo&amp;nbsp;should run flash routines in one flash bank if you are writting to the other flash bank, otherwise, you must run the flash routines in RAM.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Luis&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Oct 2011 21:00:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-programming/m-p/168893#M1119</guid>
      <dc:creator>LuisCasado</dc:creator>
      <dc:date>2011-10-18T21:00:11Z</dc:date>
    </item>
    <item>
      <title>Re: Flash programming</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-programming/m-p/168894#M1120</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Luis&lt;/P&gt;&lt;P&gt;Thank you for your post.&lt;/P&gt;&lt;P&gt;In my scenario i will be overwring the whole K60 flash which effectively contains MQX as well so i know have to run the upgrade functions from ram.&lt;/P&gt;&lt;P&gt;My promlem is that i still can't seem to figure out how to do exactly that:&lt;/P&gt;&lt;P&gt;1. link certain code at the certain ROM location&lt;/P&gt;&lt;P&gt;2. Copy it to ram when it needs to get executed&lt;/P&gt;&lt;P&gt;3. Execute it from RAM to upgrade the rom&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you have any example linker files and/or code that does this, share it on here please.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Igor&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Oct 2011 21:22:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-programming/m-p/168894#M1120</guid>
      <dc:creator>igor-imx</dc:creator>
      <dc:date>2011-10-18T21:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: Flash programming</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-programming/m-p/168895#M1121</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So i read IAR documentation more and in one of the sections:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="section"&gt;&lt;DIV class="section"&gt;&lt;DIV class="layoutArea"&gt;&lt;DIV class="column"&gt;&lt;P&gt;&lt;SPAN&gt;Sometimes, an application copies pieces of code from flash/ROM to RAM. This can be easily achieved by ILINK for whole code regions. However, for individual functions, the&lt;/SPAN&gt; &lt;SPAN&gt;__ramfunc&lt;/SPAN&gt; &lt;SPAN&gt;keyword can be used, see&lt;/SPAN&gt; &lt;SPAN&gt;Execution in RAM,&lt;/SPAN&gt; &lt;SPAN&gt;page 32.&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="section"&gt;&lt;DIV class="layoutArea"&gt;&lt;DIV class="column"&gt;&lt;P&gt;&lt;SPAN&gt;Part 1. Using the build tools&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="section"&gt;&lt;DIV class="section"&gt;&lt;DIV class="layoutArea"&gt;&lt;DIV class="column"&gt;&lt;P&gt;&lt;SPAN&gt;81&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="section"&gt;&lt;DIV class="section"&gt;&lt;DIV class="layoutArea"&gt;&lt;DIV class="column"&gt;&lt;P&gt;&lt;SPAN&gt;Linking considerations&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="layoutArea"&gt;&lt;DIV class="column"&gt;&lt;P&gt;&lt;SPAN&gt;List the code sections that should be initialized in an&lt;/SPAN&gt; &lt;SPAN&gt;initialize&lt;/SPAN&gt; &lt;SPAN&gt;directive and then place the initializer and initialized sections in ROM and RAM, respectively.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In the linker configuration file, it can look like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;/* Split the .textrw section into a readonly and a readwrite section */ initialize by copy { section .textrw };&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN&gt;/* Place both in a block */ define block RamCode { section .textrw }; define block RamCodeInit { section .textrw_init };&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN&gt;/* Place them in ROM and RAM */ place in ROM { block RamCodeInit }; place in RAM { block RamCode };&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;The block definitions makes it possible to refer to the start and end of the blocks from the application.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and i have did just that.&lt;/P&gt;&lt;P&gt;Now, in the other section it says in regards to the #pragma location:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Use this pragma directive to specify the location—the absolute address—of the global or static variable whose declaration follows the pragma directive. The variable must be declared&lt;/SPAN&gt; &lt;SPAN&gt;__no_init.&lt;/SPAN&gt; &lt;SPAN&gt;Alternatively, the directive can take a string specifying a section for placing either a variable or a function whose declaration follows the pragma directive. Do not place variables declared as&lt;/SPAN&gt; &lt;SPAN&gt;__no_init&lt;/SPAN&gt; &lt;SPAN&gt;and variables declared as&lt;/SPAN&gt; &lt;SPAN&gt;const&lt;/SPAN&gt; &lt;SPAN&gt;in the same named section.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 14px;"&gt;I then created a test function and place #pragma location directive at the start of the file like below:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#pragma location = "RAMCODE"&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 14px;"&gt;void int test(void)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 14px;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 14px;"&gt;uint32 iTest = 0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 14px;"&gt;iTest++;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 14px;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 14px;"&gt;however when the debugger hits the breakpoint set inside the test function i can't step through it.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 14px;"&gt;What am i doing wrong here?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 14px;"&gt;Basicall all im trying to do it to run the test function from ram instead of ROM&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 14px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 14px;"&gt;Best Regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 14px;"&gt;Igor&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 14px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:16:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-programming/m-p/168895#M1121</guid>
      <dc:creator>igor-imx</dc:creator>
      <dc:date>2020-10-29T09:16:28Z</dc:date>
    </item>
    <item>
      <title>Re: Flash programming</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-programming/m-p/168896#M1122</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is another link Exactyly what im trying to accomplish solved but with Keil tools for different micro.&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.keil.com/appnotes/files/apnt_138.pdf" rel="nofollow" target="_self"&gt;http://www.keil.com/appnotes/files/apnt_138.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Any idea how to do this with K60 and IAR ???&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanx&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Igor&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Oct 2011 02:59:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-programming/m-p/168896#M1122</guid>
      <dc:creator>igor-imx</dc:creator>
      <dc:date>2011-10-19T02:59:01Z</dc:date>
    </item>
    <item>
      <title>Re: Flash programming</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-programming/m-p/168897#M1123</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So i managed to accomplish running the upgrade function as well as several dunctions from the Flash Access API from RAM by utilizing the overlays in IAR linker.&lt;/P&gt;&lt;P&gt;However, no i have another issue.&lt;/P&gt;&lt;P&gt;After i write the new image to the Program Flash of the K60, it &amp;nbsp;doesn't start up after the upgrade and when i try to flash the K60 using the debugger, it says that the processor has security enabled and that it needs to wipe the whole program flash first.&lt;/P&gt;&lt;P&gt;I have verified that the image that is getting writen to the program flash is correct and all the offsets are correct as well.&lt;/P&gt;&lt;P&gt;Do i need to do something more than just upload and write the binary file producted by IAR into the program flash?&lt;/P&gt;&lt;P&gt;Any ideas on what to look for?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Oct 2011 01:11:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-programming/m-p/168897#M1123</guid>
      <dc:creator>igor-imx</dc:creator>
      <dc:date>2011-10-24T01:11:48Z</dc:date>
    </item>
    <item>
      <title>Re: Flash programming</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-programming/m-p/168898#M1124</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please disregard the previous post, that was an error on my side.&lt;/P&gt;&lt;P&gt;I finally got end to end FW upgrade though the web working solid and fast.&amp;nbsp;&lt;IMG alt=":smileyvery-happy:" class="emoticon emoticon-smileyvery-happy" id="smileyvery-happy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-very-happy.gif" title="Smiley Very Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Oct 2011 11:36:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-programming/m-p/168898#M1124</guid>
      <dc:creator>igor-imx</dc:creator>
      <dc:date>2011-10-24T11:36:00Z</dc:date>
    </item>
    <item>
      <title>Re: Flash programming</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-programming/m-p/168899#M1125</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,Igordlx&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i guess that you have got FW upgrade through the tftp.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just now i am using the same mode to boot &amp;nbsp;and faceing a serious problem. &amp;nbsp;In the FNET, when the app program upgraded , the &amp;nbsp;PC will jump &amp;nbsp;to entrance of the app , &amp;nbsp;but the hard fault Interrupt was occurced. what can i do,please tell me.THX&lt;IMG alt=":smileysad:" class="emoticon emoticon-smileysad" id="smileysad" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-sad.gif" title="Smiley Sad" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Oct 2011 12:54:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-programming/m-p/168899#M1125</guid>
      <dc:creator>Tim_X</dc:creator>
      <dc:date>2011-10-28T12:54:34Z</dc:date>
    </item>
    <item>
      <title>Re: Flash programming</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-programming/m-p/168900#M1126</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Igordlx,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to do same job like you done on K60, I try to copy from an SPI flash a firmware and put it in program flash of K60 from where to run the code !&lt;/P&gt;&lt;P&gt;I have managed to do entire new SPI Flash read and writte an flash LongWord Writtening because I don't want to use MQX drivers. Can u share yours code with me to see what u made! I want to copy the content of the spi flash in ram and from there to writte the hole block memory !&lt;/P&gt;&lt;P&gt;Thank You,&lt;/P&gt;&lt;P&gt;Alexandru Nan&lt;/P&gt;&lt;P&gt;Embedded Software Engineer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2012 15:01:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-programming/m-p/168900#M1126</guid>
      <dc:creator>Nana</dc:creator>
      <dc:date>2012-06-14T15:01:35Z</dc:date>
    </item>
    <item>
      <title>Re: Flash programming</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-programming/m-p/168901#M1127</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Igor-imx,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you use flash swap feature?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My current task - have possibility to update the K60's firmware via WEB and swap active and uploaded fw images. Can you provide me with some examples, how to do that?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Mar 2013 15:24:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Flash-programming/m-p/168901#M1127</guid>
      <dc:creator>artur73</dc:creator>
      <dc:date>2013-03-13T15:24:24Z</dc:date>
    </item>
  </channel>
</rss>

