<?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: How to use TARGETPROC and TARGETCHIP? in LPCXpresso IDE</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE/How-to-use-TARGETPROC-and-TARGETCHIP/m-p/541959#M7628</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by RA1981 on Sat Jul 16 07:08:43 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hmmm... But that means that these symbols have to be defined in the linker scripts on each project manually. Of course, sometimes the scripts must be modified, but I always try to avoid that if possible - I think the IDE should do as much as possible for the user.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The Keil compiler defined preprocessor symbols according to the selected target. Symbol name was the selected target itself.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So, instead of comparing symbols against each other the approach is to check if the symbol is defined:&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;#ifdef LPC1114
...
#else if defined LPC1343
...
else if defined LPC1768
...
#endif
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;@CodeRed:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Is this possible for one of the next releases?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ralf&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Jun 2016 01:49:23 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-16T01:49:23Z</dc:date>
    <item>
      <title>How to use TARGETPROC and TARGETCHIP?</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/How-to-use-TARGETPROC-and-TARGETCHIP/m-p/541956#M7625</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by RA1981 on Sat Jul 16 00:08:54 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;this question is based on this thread:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://" rel="nofollow noopener noreferrer" target="_blank"&gt;http://knowledgebase.nxp.com/showthread.php?t=1687&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Based on that thread I tried to use the TARGETCHIP macro (using LPCx 4):&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;#if TARGETCHIP == LPC1114_301&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;SPAN&gt;but it doesn't work, throws a expression syntax warning and the expression is taken regardless of the value!!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Using quotation marks around LPC1114_301 gives a error "token ""LPC1114_301"" is not valid in preprocessor expressions".&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;What am I doing wrong?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Another thing is, as suggested in the above mentioned thread, it would be great if CodeRed implements the symbols TARGETDEVICE (LPCxxxx) and TARGETREV (e.g.302) if possible.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ralf&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:49:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/How-to-use-TARGETPROC-and-TARGETCHIP/m-p/541956#M7625</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:49:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to use TARGETPROC and TARGETCHIP?</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/How-to-use-TARGETPROC-and-TARGETCHIP/m-p/541957#M7626</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 Sat Jul 16 00:56:31 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;C preprocessor comparison operations will only work with integers - you cannot use strings. Therefore, I suggest you do something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- In the Compiler symbols page, use ${TargetChip}=1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- In your source, test for the chip 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;
#if LPC1768 == 1
...
#end
OR
#ifdef LPC1114_301
...
#endif
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:49:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/How-to-use-TARGETPROC-and-TARGETCHIP/m-p/541957#M7626</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to use TARGETPROC and TARGETCHIP?</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/How-to-use-TARGETPROC-and-TARGETCHIP/m-p/541958#M7627</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 Sat Jul 16 01:05:49 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I had another thought on this...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Using &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- TARGETPROC=${TargetProc}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;then this works:&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 LPC1768 1
#define LPC1114_301 2

#if TARGETCHIP == LPC1768
#warning LPC1768
#else
#warning LPC1114_301
#endif
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, I think this (comparison against another preprocessor symbol) is a GCC extension and so wouldn't work across other compiler.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:49:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/How-to-use-TARGETPROC-and-TARGETCHIP/m-p/541958#M7627</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to use TARGETPROC and TARGETCHIP?</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/How-to-use-TARGETPROC-and-TARGETCHIP/m-p/541959#M7628</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by RA1981 on Sat Jul 16 07:08:43 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hmmm... But that means that these symbols have to be defined in the linker scripts on each project manually. Of course, sometimes the scripts must be modified, but I always try to avoid that if possible - I think the IDE should do as much as possible for the user.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The Keil compiler defined preprocessor symbols according to the selected target. Symbol name was the selected target itself.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So, instead of comparing symbols against each other the approach is to check if the symbol is defined:&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;#ifdef LPC1114
...
#else if defined LPC1343
...
else if defined LPC1768
...
#endif
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;@CodeRed:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Is this possible for one of the next releases?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ralf&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:49:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/How-to-use-TARGETPROC-and-TARGETCHIP/m-p/541959#M7628</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to use TARGETPROC and TARGETCHIP?</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/How-to-use-TARGETPROC-and-TARGETCHIP/m-p/541960#M7629</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 Jul 16 20:02:11 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: RA1981&lt;/STRONG&gt;&lt;BR /&gt;Hmmm... But that means that these symbols have to be defined in the linker scripts on each project manually.&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Ralf&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You don't need to change the linker script. Those are environment variables not preprocessor symbols. So you need to convert the env variable to a preprocessor symbol like TheFallGuy has shown. This can be done through the IDE which defines the symbol via the command line.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:49:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/How-to-use-TARGETPROC-and-TARGETCHIP/m-p/541960#M7629</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:49:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to use TARGETPROC and TARGETCHIP?</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/How-to-use-TARGETPROC-and-TARGETCHIP/m-p/541961#M7630</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 Sun Jul 17 13:31:21 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;RA1981: You can already do this. Just add&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;${TargetProc}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;to the Compiler symbols. This is very similar to what was suggest by TheFallGuy in his first posting, except he assigned it a value (=1)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;atomicdog: These are not environment variables. They are IDE internal variables that you can make available to the compiler and other tools. Hope that is clear.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:49:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/How-to-use-TARGETPROC-and-TARGETCHIP/m-p/541961#M7630</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:49:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to use TARGETPROC and TARGETCHIP?</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/How-to-use-TARGETPROC-and-TARGETCHIP/m-p/541962#M7631</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by RA1981 on Sun Jul 17 22:56:11 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;@CodeRed:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you for clarification.&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;Just add "${TargetProc}" to the Compiler symbols&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a way to modify the project template to get this symbol automatically in new projects?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;@Atomicdog &amp;amp; TheFallGuy:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you for showing up the possible solutions. This is really close to what I want :)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ralf&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:49:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/How-to-use-TARGETPROC-and-TARGETCHIP/m-p/541962#M7631</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:49:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to use TARGETPROC and TARGETCHIP?</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/How-to-use-TARGETPROC-and-TARGETCHIP/m-p/541963#M7632</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by RA1981 on Fri Jul 29 11:24:15 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I saw that the LPC13xx/17xx chips don't have a revision identifier. I&amp;nbsp; don't know if it's because they are all currently at the first revision&amp;nbsp; or if it's a break in the line =&amp;gt; LPC11xx/13xx have a device ID&amp;nbsp; register, LPC17xx don't have it (bootloader API must be used).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;However, TARGETCHIP now result in different symbols (with and without revision, depending on the used chip).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, I ask again to CodeRed (didn't get a answer last time, even a 'no' is okay):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Is it possible that you implement two additional symbols which reflect&amp;nbsp; the used target and revision separately? Something like TARGETREV and&amp;nbsp; TARGETMCU?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For all of you which like the idea to have it separated I attached a&amp;nbsp; device header file which does it (rename it to device.h). It covers LPC11xx/13xx/17xx devices&amp;nbsp; and defines TARGETFAM, TARGETMCU and TARGETREV, e.g. LPC13XX, LPC1343&amp;nbsp; and 302. For devices which don't have a revision number TARGETREV will&amp;nbsp; expand to 000.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The corresponding device header file is also included.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Note: I couldn't fully test it, so please report any bugs found.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyone knows a way to customize the project and file templates so that&amp;nbsp; the symbols mentioned in the answers above are created automatically? (previous question also not answered by CodeRed ;))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Customizing the C template file would be also good to include the&amp;nbsp; "device.h" instead of the corresponding chip header file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ralf&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:49:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/How-to-use-TARGETPROC-and-TARGETCHIP/m-p/541963#M7632</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:49:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to use TARGETPROC and TARGETCHIP?</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/How-to-use-TARGETPROC-and-TARGETCHIP/m-p/541964#M7633</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 Sat Jul 30 01:26:11 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;So, I ask again to CodeRed (didn't get a answer last time, even a 'no' is okay):&lt;BR /&gt;Is it possible that you implement two additional symbols which reflect&amp;nbsp;&amp;nbsp; the used target and revision separately? Something like TARGETREV and&amp;nbsp;&amp;nbsp; TARGETMCU?&lt;BR /&gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;SPAN&gt;Sorry, but no.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:49:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/How-to-use-TARGETPROC-and-TARGETCHIP/m-p/541964#M7633</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:49:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to use TARGETPROC and TARGETCHIP?</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/How-to-use-TARGETPROC-and-TARGETCHIP/m-p/541965#M7634</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by RA1981 on Sat Jul 30 05:02:35 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;Sorry, but no. &lt;/SPAN&gt;&lt;HR /&gt;&lt;SPAN&gt; That's okay :)&amp;nbsp; Regards,&amp;nbsp; Ralf&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:49:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/How-to-use-TARGETPROC-and-TARGETCHIP/m-p/541965#M7634</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:49:27Z</dc:date>
    </item>
  </channel>
</rss>

