<?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>LPCXpresso IDE FAQsのトピックPlacing code/rodata into different FLASH blocks</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE-FAQs/Placing-code-rodata-into-different-FLASH-blocks/m-p/473484#M102</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Most of the LPC18 and LPC43xx parts containing internal flash (such as LPC1857 and LPC4357) actually provide dual banks of flash. By default the managed linker script mechanism will place all of the application code and rodata (consts) into the first bank of FLASH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However it is also possible to place specific functions or rodata items into the second bank of FLASH as displayed in:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE style="font-family: monospace, courier; font-size: 1.1em; color: #646464; padding: 0.5em; background-color: #f0ece6;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;Project Properties -&amp;gt;&amp;nbsp; C/C++ Build -&amp;gt; MCU settings&lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This placement is controlled via macros provided in an LPCXpresso header file which can be pulled into your project using:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE style="font-family: monospace, courier; font-size: 1.1em; color: #646464; padding: 0.5em; background-color: #f0ece6;"&gt;&lt;STRONG&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;#include &amp;lt;cr_section_macros.h&amp;gt;&lt;/SPAN&gt; &lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For simplicity, the *additional* FLASH region can be referenced as Flash2 (as well as using its "formal" region name - for example MFlashB512 - which will vary depending upon part).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, to place a rodata item into this section, you can use the &lt;STRONG&gt;__RODATA&lt;/STRONG&gt; macro, thus:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: monospace, courier; font-size: 1.1em; color: #646464; padding: 0.5em; background-color: #f0ece6;"&gt;&lt;SPAN style="font-size: 12pt; font-family: courier new,courier;"&gt;&lt;STRONG&gt;__RODATA(Flash2) const int roarray[] = {10,20,30,40,50};&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or to place a function into it you can use &lt;STRONG&gt;__TEXT&lt;/STRONG&gt; macro:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE style="font-family: monospace, courier; font-size: 1.1em; color: #646464; padding: 0.5em; background-color: #f0ece6;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;__TEXT(Flash2) void systick_delay(uint32_t delayTicks) { 
 :&lt;/STRONG&gt;&lt;/SPAN&gt;
&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt; : &lt;/STRONG&gt;&lt;/SPAN&gt;
&lt;STRONG&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;}&lt;/SPAN&gt; &lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In addition the&lt;STRONG&gt; __RODATA_EXT&lt;/STRONG&gt; and &lt;STRONG&gt;__TEXT_EXT&lt;/STRONG&gt; macros can be used to place functions/rodata into a more specifically named section, for example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE style="font-family: monospace, courier; font-size: 1.1em; color: #646464; padding: 0.5em; background-color: #f0ece6;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;__TEXT_EXT(Flash2,systick_delay) void systick_delay(uint32_t delayTicks) { 
 :&lt;/STRONG&gt;&lt;/SPAN&gt;
&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt; : &lt;/STRONG&gt;&lt;/SPAN&gt;
&lt;STRONG&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;}&lt;/SPAN&gt; &lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;will be placed into the section ".text.$Flash2.systick_delay" rather than ".text.$Flash2".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H1 id="toc-hId-1904911073"&gt;Related FAQs&lt;/H1&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;&lt;A _jive_internal="true" data-containerid="11529" data-containertype="14" data-objectid="389100" data-objecttype="1" href="https://community.nxp.com/thread/389100" rel="nofollow noopener noreferrer" target="_blank"&gt;Placing data into different RAM blocks&lt;/A&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;A _jive_internal="true" data-containerid="11529" data-containertype="14" data-objectid="389078" data-objecttype="1" href="https://community.nxp.com/thread/389078" rel="nofollow noopener noreferrer" target="_blank"&gt;LPC18 / LPC43 Internal Flash Drivers&lt;/A&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 31 Mar 2016 22:33:18 GMT</pubDate>
    <dc:creator>lpcware-support</dc:creator>
    <dc:date>2016-03-31T22:33:18Z</dc:date>
    <item>
      <title>Placing code/rodata into different FLASH blocks</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE-FAQs/Placing-code-rodata-into-different-FLASH-blocks/m-p/473484#M102</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Most of the LPC18 and LPC43xx parts containing internal flash (such as LPC1857 and LPC4357) actually provide dual banks of flash. By default the managed linker script mechanism will place all of the application code and rodata (consts) into the first bank of FLASH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However it is also possible to place specific functions or rodata items into the second bank of FLASH as displayed in:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE style="font-family: monospace, courier; font-size: 1.1em; color: #646464; padding: 0.5em; background-color: #f0ece6;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;Project Properties -&amp;gt;&amp;nbsp; C/C++ Build -&amp;gt; MCU settings&lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This placement is controlled via macros provided in an LPCXpresso header file which can be pulled into your project using:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE style="font-family: monospace, courier; font-size: 1.1em; color: #646464; padding: 0.5em; background-color: #f0ece6;"&gt;&lt;STRONG&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;#include &amp;lt;cr_section_macros.h&amp;gt;&lt;/SPAN&gt; &lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For simplicity, the *additional* FLASH region can be referenced as Flash2 (as well as using its "formal" region name - for example MFlashB512 - which will vary depending upon part).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, to place a rodata item into this section, you can use the &lt;STRONG&gt;__RODATA&lt;/STRONG&gt; macro, thus:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: monospace, courier; font-size: 1.1em; color: #646464; padding: 0.5em; background-color: #f0ece6;"&gt;&lt;SPAN style="font-size: 12pt; font-family: courier new,courier;"&gt;&lt;STRONG&gt;__RODATA(Flash2) const int roarray[] = {10,20,30,40,50};&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or to place a function into it you can use &lt;STRONG&gt;__TEXT&lt;/STRONG&gt; macro:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE style="font-family: monospace, courier; font-size: 1.1em; color: #646464; padding: 0.5em; background-color: #f0ece6;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;__TEXT(Flash2) void systick_delay(uint32_t delayTicks) { 
 :&lt;/STRONG&gt;&lt;/SPAN&gt;
&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt; : &lt;/STRONG&gt;&lt;/SPAN&gt;
&lt;STRONG&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;}&lt;/SPAN&gt; &lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In addition the&lt;STRONG&gt; __RODATA_EXT&lt;/STRONG&gt; and &lt;STRONG&gt;__TEXT_EXT&lt;/STRONG&gt; macros can be used to place functions/rodata into a more specifically named section, for example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE style="font-family: monospace, courier; font-size: 1.1em; color: #646464; padding: 0.5em; background-color: #f0ece6;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;__TEXT_EXT(Flash2,systick_delay) void systick_delay(uint32_t delayTicks) { 
 :&lt;/STRONG&gt;&lt;/SPAN&gt;
&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt; : &lt;/STRONG&gt;&lt;/SPAN&gt;
&lt;STRONG&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;}&lt;/SPAN&gt; &lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;will be placed into the section ".text.$Flash2.systick_delay" rather than ".text.$Flash2".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H1 id="toc-hId-1904911073"&gt;Related FAQs&lt;/H1&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;&lt;A _jive_internal="true" data-containerid="11529" data-containertype="14" data-objectid="389100" data-objecttype="1" href="https://community.nxp.com/thread/389100" rel="nofollow noopener noreferrer" target="_blank"&gt;Placing data into different RAM blocks&lt;/A&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;A _jive_internal="true" data-containerid="11529" data-containertype="14" data-objectid="389078" data-objecttype="1" href="https://community.nxp.com/thread/389078" rel="nofollow noopener noreferrer" target="_blank"&gt;LPC18 / LPC43 Internal Flash Drivers&lt;/A&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Mar 2016 22:33:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE-FAQs/Placing-code-rodata-into-different-FLASH-blocks/m-p/473484#M102</guid>
      <dc:creator>lpcware-support</dc:creator>
      <dc:date>2016-03-31T22:33:18Z</dc:date>
    </item>
  </channel>
</rss>

