<?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>LPC Microcontrollers中的主题 (IAR) Using Flash Data Blocks with SPIFI while Running XIP Code on the Same Part</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/IAR-Using-Flash-Data-Blocks-with-SPIFI-while-Running-XIP-Code-on/m-p/588064#M21743</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background: white;"&gt;There's not a whole lot of guidance on how to do this from the spifilib documentation, so I decided I would release what I've done to create usable data blocks with SPIFI while executing code on the same external Flash part. &amp;nbsp;I, too, saw the following lines in &lt;STRONG&gt;lpclibspifi_1.03_68.pdf&lt;/STRONG&gt;, with no actual link on how to relocate the spifilib to RAM:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;SPAN style="color: #51626f; background: white;"&gt;If you are using a SPIFI FLASH device as a execute-in-place memory for your LPC device, you can’t use the SPIFI&lt;BR /&gt;library if it’s located in SPIFI FLASH. To use the library in this case, the library needs to be relocated to another&lt;BR /&gt;memory (like IRAM) and the functions executed from there. The page below describes how to setup and use the&lt;BR /&gt;library in this type of system.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Copyright (C) 2014 NXP Semiconductors. All rights reserved.&amp;nbsp;&lt;STRONG&gt;&amp;lt;- Link to nothing&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background: white;"&gt;NXP - will you please address this? There's no documentation for anything besides those using LPCXpresso IDE.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background: white;"&gt;&lt;STRONG&gt;Relocating spifilib to RAM (IAR)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background: white;"&gt;I pretty much just had to brute force this. &amp;nbsp;I added &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;__ramfunc &lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;to relocate&amp;nbsp;&lt;STRONG&gt;all the functions&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;. &amp;nbsp;I also removed all the &lt;/SPAN&gt;const&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt; modifiers from all the variables used so that they would be placed in RAM. &amp;nbsp;I attached a .zip containing my modified spifilib to place everything needed to run spifilib in RAM.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background: white; font-family: arial, helvetica, sans-serif;"&gt;&lt;EM&gt;Note: I only updated the structs used for my part only, so you will need to update&amp;nbsp;spifilib_fam_standard_cmd.c for your part.&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: #51626f; background: white;"&gt;Creating Data&lt;/SPAN&gt;&lt;SPAN style="color: #51626f; background: white;"&gt; Blocks&amp;nbsp;&lt;SPAN style="color: #3d3d3d;"&gt;&lt;STRONG&gt;(IAR ILINK and Winbond W25Q80BV)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background: white;"&gt;I created two different data sections for the NVM data I wished to store in NVM in my IAR ILINK .icf file&lt;/SPAN&gt;&lt;SPAN style="color: #51626f; background: white;"&gt;. &amp;nbsp;I also created some HAL files to handle setting up spifilib and created the &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;nvmData&lt;/SPAN&gt; module to create seperate mock data structures to be placed in seperate data subblocks. &amp;nbsp;The data partition replaces the last data block on the&amp;nbsp;&lt;SPAN style="color: #3d3d3d;"&gt;W25Q80BV and uses subblocks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: #3d3d3d; background: white;"&gt;Vector&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; background: white;"&gt; Table&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; background: white;"&gt;I did not relocate my vector table to RAM since all these operations are polled. &amp;nbsp;Because my application does not demand any other peripherals to be running while accessing Flash, I simply disabled interrupts for all SPIFI data operations.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background: white;"&gt;Feel free to critique the code or add your own suggestions. &amp;nbsp;Note that you may have some compiling/running problems as I had to just scrape the code from my project. &amp;nbsp;If you find any problems, please update the files and repost.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background: white;"&gt;See the original root of the reason I posted this solution here:&lt;BR /&gt;&lt;A _jive_internal="true" data-containerid="11497" data-containertype="14" data-objectid="433206" data-objecttype="1" href="https://community.nxp.com/thread/433206"&gt;Erasing SPIFI data block causes hard fault after reset (can't run to main)&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-337901"&gt;lpclibspifi_IAR_runfromRAM.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-337901"&gt;lpc18xx_43xx_spifi_heap_nvmData.icf.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-337901"&gt;spifiHAL.c.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-337901"&gt;nvmData.h.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-337901"&gt;nvmData.c.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-337901"&gt;spifiHAL.h.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 02 Sep 2016 14:32:42 GMT</pubDate>
    <dc:creator>cheuschkel</dc:creator>
    <dc:date>2016-09-02T14:32:42Z</dc:date>
    <item>
      <title>(IAR) Using Flash Data Blocks with SPIFI while Running XIP Code on the Same Part</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/IAR-Using-Flash-Data-Blocks-with-SPIFI-while-Running-XIP-Code-on/m-p/588064#M21743</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background: white;"&gt;There's not a whole lot of guidance on how to do this from the spifilib documentation, so I decided I would release what I've done to create usable data blocks with SPIFI while executing code on the same external Flash part. &amp;nbsp;I, too, saw the following lines in &lt;STRONG&gt;lpclibspifi_1.03_68.pdf&lt;/STRONG&gt;, with no actual link on how to relocate the spifilib to RAM:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;SPAN style="color: #51626f; background: white;"&gt;If you are using a SPIFI FLASH device as a execute-in-place memory for your LPC device, you can’t use the SPIFI&lt;BR /&gt;library if it’s located in SPIFI FLASH. To use the library in this case, the library needs to be relocated to another&lt;BR /&gt;memory (like IRAM) and the functions executed from there. The page below describes how to setup and use the&lt;BR /&gt;library in this type of system.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Copyright (C) 2014 NXP Semiconductors. All rights reserved.&amp;nbsp;&lt;STRONG&gt;&amp;lt;- Link to nothing&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background: white;"&gt;NXP - will you please address this? There's no documentation for anything besides those using LPCXpresso IDE.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background: white;"&gt;&lt;STRONG&gt;Relocating spifilib to RAM (IAR)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background: white;"&gt;I pretty much just had to brute force this. &amp;nbsp;I added &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;__ramfunc &lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;to relocate&amp;nbsp;&lt;STRONG&gt;all the functions&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;. &amp;nbsp;I also removed all the &lt;/SPAN&gt;const&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt; modifiers from all the variables used so that they would be placed in RAM. &amp;nbsp;I attached a .zip containing my modified spifilib to place everything needed to run spifilib in RAM.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background: white; font-family: arial, helvetica, sans-serif;"&gt;&lt;EM&gt;Note: I only updated the structs used for my part only, so you will need to update&amp;nbsp;spifilib_fam_standard_cmd.c for your part.&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: #51626f; background: white;"&gt;Creating Data&lt;/SPAN&gt;&lt;SPAN style="color: #51626f; background: white;"&gt; Blocks&amp;nbsp;&lt;SPAN style="color: #3d3d3d;"&gt;&lt;STRONG&gt;(IAR ILINK and Winbond W25Q80BV)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background: white;"&gt;I created two different data sections for the NVM data I wished to store in NVM in my IAR ILINK .icf file&lt;/SPAN&gt;&lt;SPAN style="color: #51626f; background: white;"&gt;. &amp;nbsp;I also created some HAL files to handle setting up spifilib and created the &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;nvmData&lt;/SPAN&gt; module to create seperate mock data structures to be placed in seperate data subblocks. &amp;nbsp;The data partition replaces the last data block on the&amp;nbsp;&lt;SPAN style="color: #3d3d3d;"&gt;W25Q80BV and uses subblocks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: #3d3d3d; background: white;"&gt;Vector&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; background: white;"&gt; Table&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; background: white;"&gt;I did not relocate my vector table to RAM since all these operations are polled. &amp;nbsp;Because my application does not demand any other peripherals to be running while accessing Flash, I simply disabled interrupts for all SPIFI data operations.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background: white;"&gt;Feel free to critique the code or add your own suggestions. &amp;nbsp;Note that you may have some compiling/running problems as I had to just scrape the code from my project. &amp;nbsp;If you find any problems, please update the files and repost.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background: white;"&gt;See the original root of the reason I posted this solution here:&lt;BR /&gt;&lt;A _jive_internal="true" data-containerid="11497" data-containertype="14" data-objectid="433206" data-objecttype="1" href="https://community.nxp.com/thread/433206"&gt;Erasing SPIFI data block causes hard fault after reset (can't run to main)&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-337901"&gt;lpclibspifi_IAR_runfromRAM.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-337901"&gt;lpc18xx_43xx_spifi_heap_nvmData.icf.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-337901"&gt;spifiHAL.c.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-337901"&gt;nvmData.h.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-337901"&gt;nvmData.c.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-337901"&gt;spifiHAL.h.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Sep 2016 14:32:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/IAR-Using-Flash-Data-Blocks-with-SPIFI-while-Running-XIP-Code-on/m-p/588064#M21743</guid>
      <dc:creator>cheuschkel</dc:creator>
      <dc:date>2016-09-02T14:32:42Z</dc:date>
    </item>
  </channel>
</rss>

