<?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中的主题 Re: Determine chip's flash memory size at compile time</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE/Determine-chip-s-flash-memory-size-at-compile-time/m-p/588141#M27985</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by atomicdog on Sat Nov 05 15:07:46 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: FlySnake&lt;/STRONG&gt;&lt;BR /&gt;Yes, it's there. Since LPCXpresso generate ld scripts on-the-fly I tried to disable "Manage linker script" and add these generated scripts manually - nothing changed. &lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried it on a basic/default test program and it works fine. I didn't change any linker options. what error do you get when you use the extern declaration?&lt;/SPAN&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: FlySnake&lt;/STRONG&gt;&lt;BR /&gt;But, 1 question: should the compiler see linker's variable at all?&lt;/SPAN&gt;&lt;HR /&gt;&lt;SPAN&gt; It's a feature of the GNU linker (&lt;/SPAN&gt;&lt;A href="http://http://sourceware.org/binutils/docs-2.21/ld/Source-Code-Reference.html#Source-Code-Reference" rel="nofollow noopener noreferrer" target="_blank"&gt;ld&lt;/A&gt;&lt;SPAN&gt;). All the compiler sees is the extern declaration and so it then relies on the linker to find that symbol. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;extern size_t __top_MFlash32;
const size_t flash = (size_t)&amp;amp;__top_MFlash32;

int main(void) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; printf("Hello World: %d\n",flash);
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; //uintptr_t *ptr = &amp;amp;__top_MFlash32;
&amp;nbsp;&amp;nbsp;&amp;nbsp; // Enter an infinite loop, just incrementing a counter
&amp;nbsp;&amp;nbsp;&amp;nbsp; volatile static int i = 0 ;
&amp;nbsp;&amp;nbsp;&amp;nbsp; while(1) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i++ ;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0 ;
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 22:47:42 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T22:47:42Z</dc:date>
    <item>
      <title>Determine chip's flash memory size at compile time</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Determine-chip-s-flash-memory-size-at-compile-time/m-p/588132#M27976</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by FlySnake on Fri Nov 04 13:20:36 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I need to determine chip's memory size at the compile time to know how much of that flash memory I can use to store user's data (we can use different chips in production and it's bad thing to edit sources for each of them). Is there special "built-in" symbol defined to check it and set constants in program with appropriate values ("size of available flash") ? &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Sorry if this is stupid question and thx in advance :)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:47:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Determine-chip-s-flash-memory-size-at-compile-time/m-p/588132#M27976</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:47:36Z</dc:date>
    </item>
    <item>
      <title>Re: Determine chip's flash memory size at compile time</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Determine-chip-s-flash-memory-size-at-compile-time/m-p/588133#M27977</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Ex-Zero on Fri Nov 04 13:52:15 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: FlySnake&lt;/STRONG&gt;&lt;BR /&gt;...chip's memory size at the compile time&lt;/SPAN&gt;&lt;HR /&gt;&lt;SPAN&gt;&amp;nbsp; Are we talking about Flash/RAM consumption?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;A href="http://"&gt;http://support.code-red-tech.com/CodeRedWiki/FlashRamSize&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:47:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Determine-chip-s-flash-memory-size-at-compile-time/m-p/588133#M27977</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:47:37Z</dc:date>
    </item>
    <item>
      <title>Re: Determine chip's flash memory size at compile time</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Determine-chip-s-flash-memory-size-at-compile-time/m-p/588134#M27978</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by FlySnake on Fri Nov 04 14:29:56 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: Zero&lt;/STRONG&gt;&lt;BR /&gt;Are we talking about Flash/RAM consumption?&lt;BR /&gt; &lt;A href="http://" rel="nofollow noopener noreferrer" target="_blank"&gt;http://support.code-red-tech.com/CodeRedWiki/FlashRamSize&lt;/A&gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;SPAN&gt;No, I want something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;#define FLASH512

...
 
#if defined (FLASH512)
const uint8_t max_flash_sector=29; // 29 sectors available
#elif defined (FLASH256)
const uint8_t max_flash_sector=21; // 21 sector available
...
...&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;SPAN&gt;but without #define FLASH512 and use some other symbol from build options. I can just forget about these manually added macros 3 months later when switch to another chip&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:47:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Determine-chip-s-flash-memory-size-at-compile-time/m-p/588134#M27978</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:47:38Z</dc:date>
    </item>
    <item>
      <title>Re: Determine chip's flash memory size at compile time</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Determine-chip-s-flash-memory-size-at-compile-time/m-p/588135#M27979</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by atomicdog on Fri Nov 04 19:09:22 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I believe you can use the linker variable [B][I]__top_MFlash32[/I][/B] in your code by taking its address.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;&amp;amp;[B][I]__top_MFlash32[/I][/B]&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:47:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Determine-chip-s-flash-memory-size-at-compile-time/m-p/588135#M27979</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:47:38Z</dc:date>
    </item>
    <item>
      <title>Re: Determine chip's flash memory size at compile time</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Determine-chip-s-flash-memory-size-at-compile-time/m-p/588136#M27980</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by FlySnake on Sat Nov 05 10:17:21 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;It doesn't work :(&lt;/SPAN&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;error: '__top_MFlash32' undeclared (first use in this function)&lt;/SPAN&gt;&lt;HR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:47:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Determine-chip-s-flash-memory-size-at-compile-time/m-p/588136#M27980</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:47:39Z</dc:date>
    </item>
    <item>
      <title>Re: Determine chip's flash memory size at compile time</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Determine-chip-s-flash-memory-size-at-compile-time/m-p/588137#M27981</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by atomicdog on Sat Nov 05 10:39:31 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: FlySnake&lt;/STRONG&gt;&lt;BR /&gt;It doesn't work &lt;SPAN class="lia-unicode-emoji" title=":disappointed_face:"&gt;&lt;LI-EMOJI id="lia_disappointed-face" title=":disappointed_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sorry, I forget you need to declare it also.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;extern uint32_t __top_MFlash32;

const uint32_t top = (uint32_t)&amp;amp;__top_MFlash32;&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:47:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Determine-chip-s-flash-memory-size-at-compile-time/m-p/588137#M27981</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:47:39Z</dc:date>
    </item>
    <item>
      <title>Re: Determine chip's flash memory size at compile time</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Determine-chip-s-flash-memory-size-at-compile-time/m-p/588138#M27982</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by FlySnake on Sat Nov 05 12:51:14 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;It still doesn't work. Switching the library type (semihost/nohost) doesn't help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;undefined reference to `__top_MFlash32'&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Moreover I cannot find where this variable defined (recursive search text in lpcxpreso install dir)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:47:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Determine-chip-s-flash-memory-size-at-compile-time/m-p/588138#M27982</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:47:40Z</dc:date>
    </item>
    <item>
      <title>Re: Determine chip's flash memory size at compile time</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Determine-chip-s-flash-memory-size-at-compile-time/m-p/588139#M27983</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by atomicdog on Sat Nov 05 13:10:41 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: FlySnake&lt;/STRONG&gt;&lt;BR /&gt;It still doesn't work. Switching the library type (semihost/nohost) doesn't help.&lt;BR /&gt;&lt;BR /&gt;Moreover I cannot find where this variable defined (recursive search text in lpcxpreso install dir)&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It's defined in the *[I]_mem.ld[/I] linker script.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:47:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Determine-chip-s-flash-memory-size-at-compile-time/m-p/588139#M27983</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:47:40Z</dc:date>
    </item>
    <item>
      <title>Re: Determine chip's flash memory size at compile time</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Determine-chip-s-flash-memory-size-at-compile-time/m-p/588140#M27984</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by FlySnake on Sat Nov 05 13:58:52 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes, it's there. Since LPCXpresso generate ld scripts on-the-fly I tried to disable "Manage linker script" and add these generated scripts manually - nothing changed. But, 1 question: should the compiler see linker's variable at all?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:47:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Determine-chip-s-flash-memory-size-at-compile-time/m-p/588140#M27984</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:47:41Z</dc:date>
    </item>
    <item>
      <title>Re: Determine chip's flash memory size at compile time</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Determine-chip-s-flash-memory-size-at-compile-time/m-p/588141#M27985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by atomicdog on Sat Nov 05 15:07:46 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: FlySnake&lt;/STRONG&gt;&lt;BR /&gt;Yes, it's there. Since LPCXpresso generate ld scripts on-the-fly I tried to disable "Manage linker script" and add these generated scripts manually - nothing changed. &lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried it on a basic/default test program and it works fine. I didn't change any linker options. what error do you get when you use the extern declaration?&lt;/SPAN&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: FlySnake&lt;/STRONG&gt;&lt;BR /&gt;But, 1 question: should the compiler see linker's variable at all?&lt;/SPAN&gt;&lt;HR /&gt;&lt;SPAN&gt; It's a feature of the GNU linker (&lt;/SPAN&gt;&lt;A href="http://http://sourceware.org/binutils/docs-2.21/ld/Source-Code-Reference.html#Source-Code-Reference" rel="nofollow noopener noreferrer" target="_blank"&gt;ld&lt;/A&gt;&lt;SPAN&gt;). All the compiler sees is the extern declaration and so it then relies on the linker to find that symbol. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;extern size_t __top_MFlash32;
const size_t flash = (size_t)&amp;amp;__top_MFlash32;

int main(void) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; printf("Hello World: %d\n",flash);
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; //uintptr_t *ptr = &amp;amp;__top_MFlash32;
&amp;nbsp;&amp;nbsp;&amp;nbsp; // Enter an infinite loop, just incrementing a counter
&amp;nbsp;&amp;nbsp;&amp;nbsp; volatile static int i = 0 ;
&amp;nbsp;&amp;nbsp;&amp;nbsp; while(1) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i++ ;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0 ;
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:47:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Determine-chip-s-flash-memory-size-at-compile-time/m-p/588141#M27985</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:47:42Z</dc:date>
    </item>
    <item>
      <title>Re: Determine chip's flash memory size at compile time</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Determine-chip-s-flash-memory-size-at-compile-time/m-p/588142#M27986</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by FlySnake on Sun Nov 06 05:31:42 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;./src/main.o:(.rodata.flash+0x0): undefined reference to `__top_MFlash32'
collect2: ld returned 1 exit status&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;SPAN&gt;I tried to create such new empty project too. CMSIS 2.00 and Redlib (semihost), no additional settings. &lt;/SPAN&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;/opt/lpcxpresso_4.0.6_131/lpcxpresso/tools/arm-none-eabi/bin/ld --version&lt;BR /&gt;GNU ld (Red Suite 2010Q4 by Code Red) 2.20.51.20100809&lt;/SPAN&gt;&lt;HR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;/opt/lpcxpresso_4.0.6_131/lpcxpresso/tools/arm-none-eabi/bin/gcc --version&lt;BR /&gt;gcc (Red Suite 2010Q4 by Code Red) 4.5.1&lt;/SPAN&gt;&lt;HR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:47:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Determine-chip-s-flash-memory-size-at-compile-time/m-p/588142#M27986</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:47:42Z</dc:date>
    </item>
    <item>
      <title>Re: Determine chip's flash memory size at compile time</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Determine-chip-s-flash-memory-size-at-compile-time/m-p/588143#M27987</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by atomicdog on Sun Nov 06 11:30:39 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Maybe there is a difference in the default project setting for Linux and Windows?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I attached a test (CMSIS-2/RedLib/Semihost) project zip. I'm not sure if Linux/LPCxpresso will import a project from windows/LPCxpresso&amp;nbsp; though. This feature has been around for a long time so the version number shouldn't matter.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Is the __top_MFlash32 symbol in the disassembly or map file?&lt;/SPAN&gt;&lt;BR /&gt;&lt;DIV class="j-rte-table"&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca" style="border:1px solid black;background-color:#cacaca;"&gt; &lt;PRE&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;stdint.h&amp;gt;

extern size_t __top_MFlash32;
const size_t flash = (size_t)&amp;amp;__top_MFlash32;

int main(void) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; printf("Hello World: %d\n",flash);
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; // Enter an infinite loop, just incrementing a counter
&amp;nbsp;&amp;nbsp;&amp;nbsp; volatile static int i = 0 ;
&amp;nbsp;&amp;nbsp;&amp;nbsp; while(1) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i++ ;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0 ;
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;DIV class="j-rte-table"&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca" style="border:1px solid black;background-color:#cacaca;"&gt; &lt;PRE&gt;**** Build of configuration Debug for project ld_var_test ****

make all 
Building file: ../src/cr_startup_lpc11u.c
Invoking: MCU C Compiler
arm-none-eabi-gcc -D__REDLIB__ -DDEBUG -D__CODE_RED -D__USE_CMSIS=CMSISv2p00_LPC11Uxx -I"C:\Users\John\Documents\LPCXpresso_4.0.5_123\workspace\CMSISv2p00_LPC11Uxx\inc" -O0 -Os -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=cortex-m0 -mthumb -MMD -MP -MF"src/cr_startup_lpc11u.d" -MT"src/cr_startup_lpc11u.d" -o"src/cr_startup_lpc11u.o" "../src/cr_startup_lpc11u.c"
Finished building: ../src/cr_startup_lpc11u.c
 
Building file: ../src/main.c
Invoking: MCU C Compiler
arm-none-eabi-gcc -D__REDLIB__ -DDEBUG -D__CODE_RED -D__USE_CMSIS=CMSISv2p00_LPC11Uxx -I"C:\Users\John\Documents\LPCXpresso_4.0.5_123\workspace\CMSISv2p00_LPC11Uxx\inc" -O0 -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=cortex-m0 -mthumb -MMD -MP -MF"src/main.d" -MT"src/main.d" -o"src/main.o" "../src/main.c"
Finished building: ../src/main.c
 
Building target: ld_var_test.axf
Invoking: MCU Linker
arm-none-eabi-gcc -nostdlib -L"C:\Users\John\Documents\LPCXpresso_4.0.5_123\workspace\CMSISv2p00_LPC11Uxx\Debug" -Xlinker -Map=ld_var_test.map -Xlinker --gc-sections -mcpu=cortex-m0 -mthumb -T "ld_var_test_Debug.ld" -o"ld_var_test.axf"&amp;nbsp; ./src/cr_startup_lpc11u.o ./src/main.o&amp;nbsp;&amp;nbsp; -lCMSISv2p00_LPC11Uxx
Finished building target: ld_var_test.axf
 
make --no-print-directory post-build
Performing post-build steps
arm-none-eabi-size ld_var_test.axf; # arm-none-eabi-objcopy -O binary ld_var_test.axf ld_var_test.bin ; checksum -p LPC11U14_201 -d ld_var_test.bin;
&amp;nbsp;&amp;nbsp; text&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bss&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dec&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; hex&amp;nbsp;&amp;nbsp;&amp;nbsp; filename
&amp;nbsp; 12136&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 340&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12476&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 30bc&amp;nbsp;&amp;nbsp;&amp;nbsp; ld_var_test.axf&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:47:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Determine-chip-s-flash-memory-size-at-compile-time/m-p/588143#M27987</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:47:43Z</dc:date>
    </item>
    <item>
      <title>Re: Determine chip's flash memory size at compile time</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Determine-chip-s-flash-memory-size-at-compile-time/m-p/588144#M27988</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by TheFallGuy on Sun Nov 06 16:06:49 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Flysnake, please post your project so we can see what you are doing wrong.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:47:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Determine-chip-s-flash-memory-size-at-compile-time/m-p/588144#M27988</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:47:43Z</dc:date>
    </item>
    <item>
      <title>Re: Determine chip's flash memory size at compile time</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Determine-chip-s-flash-memory-size-at-compile-time/m-p/588145#M27989</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by FlySnake on Mon Nov 07 01:54:26 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;atomicdog, thank you, I tried your project, but I'm using LPC1768 and I changed settings for it: CMSIS (includes and lib path), MCU type and startup file from empty LPC17 project.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This is what I get:&lt;/SPAN&gt;&lt;BR /&gt;&lt;DIV class="j-rte-table"&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca" style="border:1px solid black;background-color:#cacaca;"&gt; &lt;PRE&gt;**** Build of configuration Debug for project ld_var_test ****

make all 
Building file: ../src/cr_startup_lpc176x.c
Invoking: MCU C Compiler
arm-none-eabi-gcc -D__REDLIB__ -DDEBUG -D__CODE_RED -D__USE_CMSIS=CMSISv2p00_LPC11Uxx -I"/home/flysnake/Documents/Projects/LPC4Workspace/CMSISv2p00_LPC17xx/inc" -O0 -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=cortex-m3 -mthumb -MMD -MP -MF"src/cr_startup_lpc176x.d" -MT"src/cr_startup_lpc176x.d" -o"src/cr_startup_lpc176x.o" "../src/cr_startup_lpc176x.c"
./src/main.o:(.rodata.flash+0x0): undefined reference to `__top_MFlash32'
Finished building: ../src/cr_startup_lpc176x.c
 
Building file: ../src/main.c
Invoking: MCU C Compiler
arm-none-eabi-gcc -D__REDLIB__ -DDEBUG -D__CODE_RED -D__USE_CMSIS=CMSISv2p00_LPC11Uxx -I"/home/flysnake/Documents/Projects/LPC4Workspace/CMSISv2p00_LPC17xx/inc" -O0 -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=cortex-m3 -mthumb -MMD -MP -MF"src/main.d" -MT"src/main.d" -o"src/main.o" "../src/main.c"
collect2: ld returned 1 exit status
make: *** [ld_var_test.axf] Error 1
Finished building: ../src/main.c&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;SPAN&gt;Looks like the same error: undefined reference to `__top_MFlash32' &lt;SPAN class="lia-unicode-emoji" title=":disappointed_face:"&gt;&lt;LI-EMOJI id="lia_disappointed-face" title=":disappointed_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;__top_MFlash512 is present in map file:&lt;/SPAN&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&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; 0x00080000&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; __top_MFlash512 = 0x80000&lt;/SPAN&gt;&lt;HR /&gt;&lt;SPAN&gt;Here is my test 'vanilla' project for LPC1768. Required CMSISv2p00_LPC17xx in workspace&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:47:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Determine-chip-s-flash-memory-size-at-compile-time/m-p/588145#M27989</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:47:44Z</dc:date>
    </item>
    <item>
      <title>Re: Determine chip's flash memory size at compile time</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Determine-chip-s-flash-memory-size-at-compile-time/m-p/588146#M27990</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by CodeRedSupport on Mon Nov 07 04:57:00 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;There is no current way of determining this automatically, from code. The problem is that the name of the symbol for the top of flash is not consistent. It is Mflash32 for 32k parts and Mflash512 for 512k parts, etc.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I suggest that you use the BuildMacros&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://"&gt;http://support.code-red-tech.com/CodeRedWiki/BuildMacros&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and then conditionally compile your code to define the flash size for that part.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:47:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Determine-chip-s-flash-memory-size-at-compile-time/m-p/588146#M27990</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:47:45Z</dc:date>
    </item>
    <item>
      <title>Re: Determine chip's flash memory size at compile time</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Determine-chip-s-flash-memory-size-at-compile-time/m-p/588147#M27991</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by FlySnake on Tue Nov 08 00:14:03 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm inattentive, of course for 32K parts this var is MFLash32 and for 512K part which I have this is MFlash512&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:47:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Determine-chip-s-flash-memory-size-at-compile-time/m-p/588147#M27991</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:47:45Z</dc:date>
    </item>
  </channel>
</rss>

