<?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>MQX Software Solutions中的主题 &amp;quot;Undefined macro or opcode: extern&amp;quot;</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/quot-Undefined-macro-or-opcode-extern-quot/m-p/174473#M2192</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey all.&amp;nbsp; I have a problem that is driving me nuts.&amp;nbsp; I'm building MQX 3.6 on a CF52256 using CW 10.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My problem is this:&amp;nbsp; I want to get access to a couple of Linker-defined variables in my 'user_config.h' so I can redefine the FlashX available size in terms of those values.&amp;nbsp; Below is the simple code I'm trying to add:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;FONT color="#0000ff"&gt;extern&lt;/FONT&gt; unsigned char __FLASHX_START_ADDR[]; &lt;FONT color="#339966"&gt;// defined in .lcf file&lt;/FONT&gt;
&lt;FONT color="#0000ff"&gt;extern&lt;/FONT&gt; unsigned char __FLASHX_END_ADDR[];   &lt;FONT color="#339966"&gt;// defined in .lcf file&lt;/FONT&gt;

#define FLASHX_START_ADDR ((uint_32)__FLASHX_START_ADDR)
#define FLASHX_END_ADDR   ((uint_32)__FLASHX_END_ADDR)


&lt;FONT color="#339966"&gt;// this is the end result I'm trying to achieve&lt;/FONT&gt;
#define BSPCFG_FLASHX_SIZE      ( FLASHX_END_ADDR - FLASHX_START_ADDR )
&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem I'm having is after the PSP project has compiled the code, the Assembler pukes on those two lines at the top... the 'extern' declarations, with the following error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#ff0000"&gt;Undefined macro or opcode: extern&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That makes no sense to me whatsoever, since the BSP project will compile and assemble just fine, and it certainly uses this 'user_config.h' file all over the place.&amp;nbsp; I've compared the Assembler settings between the two projects (BSP and PSP) and find no differences.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anybody know what is going on?&amp;nbsp; Please help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Gomer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 Oct 2020 09:23:14 GMT</pubDate>
    <dc:creator>gomer</dc:creator>
    <dc:date>2020-10-29T09:23:14Z</dc:date>
    <item>
      <title>"Undefined macro or opcode: extern"</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/quot-Undefined-macro-or-opcode-extern-quot/m-p/174473#M2192</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey all.&amp;nbsp; I have a problem that is driving me nuts.&amp;nbsp; I'm building MQX 3.6 on a CF52256 using CW 10.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My problem is this:&amp;nbsp; I want to get access to a couple of Linker-defined variables in my 'user_config.h' so I can redefine the FlashX available size in terms of those values.&amp;nbsp; Below is the simple code I'm trying to add:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;FONT color="#0000ff"&gt;extern&lt;/FONT&gt; unsigned char __FLASHX_START_ADDR[]; &lt;FONT color="#339966"&gt;// defined in .lcf file&lt;/FONT&gt;
&lt;FONT color="#0000ff"&gt;extern&lt;/FONT&gt; unsigned char __FLASHX_END_ADDR[];   &lt;FONT color="#339966"&gt;// defined in .lcf file&lt;/FONT&gt;

#define FLASHX_START_ADDR ((uint_32)__FLASHX_START_ADDR)
#define FLASHX_END_ADDR   ((uint_32)__FLASHX_END_ADDR)


&lt;FONT color="#339966"&gt;// this is the end result I'm trying to achieve&lt;/FONT&gt;
#define BSPCFG_FLASHX_SIZE      ( FLASHX_END_ADDR - FLASHX_START_ADDR )
&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem I'm having is after the PSP project has compiled the code, the Assembler pukes on those two lines at the top... the 'extern' declarations, with the following error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#ff0000"&gt;Undefined macro or opcode: extern&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That makes no sense to me whatsoever, since the BSP project will compile and assemble just fine, and it certainly uses this 'user_config.h' file all over the place.&amp;nbsp; I've compared the Assembler settings between the two projects (BSP and PSP) and find no differences.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anybody know what is going on?&amp;nbsp; Please help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Gomer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:23:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/quot-Undefined-macro-or-opcode-extern-quot/m-p/174473#M2192</guid>
      <dc:creator>gomer</dc:creator>
      <dc:date>2020-10-29T09:23:14Z</dc:date>
    </item>
    <item>
      <title>Re: "Undefined macro or opcode: extern"</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/quot-Undefined-macro-or-opcode-extern-quot/m-p/174474#M2193</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gomer,&lt;/P&gt;&lt;P&gt;Here is my simple example of getting a variable from the linker script into a FSLMQX application.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In linker script I added:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ___DECAF = 0xBAD;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In FSLMQX application "C" file I added the following at top:&lt;/P&gt;&lt;P&gt;&amp;nbsp; extern uchar __DECAF[];&lt;/P&gt;&lt;P&gt;&amp;nbsp; #define LINKER_DB ((uint_32)__DECAF)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;added printf down in the code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; printf("Linker File ___DECAF = 0x%08x\n", LINKER_DB);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you recompile the FSLMQX application the output on terminal should be:&lt;/P&gt;&lt;P&gt;Linker File ___DECAF = 0x00000bad&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please note the linker script declaration has three underscore for DECAF and two in the "C" file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looking at your code it appears as though it should work but my only concern is the BSP_FLASHX_SIZE name is used elsewhere in FSLMQX so maybe you should try a different name.&lt;/P&gt;&lt;P&gt;When I tried your code I got a redfined error but when I renamed it all worked fine.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Jan 2011 02:04:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/quot-Undefined-macro-or-opcode-extern-quot/m-p/174474#M2193</guid>
      <dc:creator>DavidS</dc:creator>
      <dc:date>2011-01-11T02:04:45Z</dc:date>
    </item>
  </channel>
</rss>

