<?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: pass variables in to the command line compiler in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/pass-variables-in-to-the-command-line-compiler/m-p/175115#M5622</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;I don't know what processor you're targeting, but I can try to generalize. Look in the CodeWarrior Targeting Manual for the processor and consult the chapter titled Command-Line Tools. This chapter has information on what is possible using the command line tools.&lt;BR /&gt;&lt;BR /&gt;---Tom&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 22 Jul 2008 22:09:50 GMT</pubDate>
    <dc:creator>J2MEJediMaster</dc:creator>
    <dc:date>2008-07-22T22:09:50Z</dc:date>
    <item>
      <title>pass variables in to the command line compiler</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/pass-variables-in-to-the-command-line-compiler/m-p/175114#M5621</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'd like to pass in a variable (e.g. 'my_variable') to the compiler via the command line.&amp;nbsp; I can't seem to get it.&amp;nbsp; Here's the general idea of what I'd like to do:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;C:\CmdIDE.exe myproject.mcp /b my_variable=3&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried setting it as an environment variable -env"my_variable=3", but that didn't seem to work either.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If possible, please reply with the correct command.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jul 2008 20:49:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/pass-variables-in-to-the-command-line-compiler/m-p/175114#M5621</guid>
      <dc:creator>mayfly</dc:creator>
      <dc:date>2008-07-22T20:49:24Z</dc:date>
    </item>
    <item>
      <title>Re: pass variables in to the command line compiler</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/pass-variables-in-to-the-command-line-compiler/m-p/175115#M5622</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;I don't know what processor you're targeting, but I can try to generalize. Look in the CodeWarrior Targeting Manual for the processor and consult the chapter titled Command-Line Tools. This chapter has information on what is possible using the command line tools.&lt;BR /&gt;&lt;BR /&gt;---Tom&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jul 2008 22:09:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/pass-variables-in-to-the-command-line-compiler/m-p/175115#M5622</guid>
      <dc:creator>J2MEJediMaster</dc:creator>
      <dc:date>2008-07-22T22:09:50Z</dc:date>
    </item>
    <item>
      <title>Re: pass variables in to the command line compiler</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/pass-variables-in-to-the-command-line-compiler/m-p/175116#M5623</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;We are working with MC9S08DZ60 microcontrollers but if anyone can provide a working solution for any of the 8/16 bit microcontrollers we would appreciate it.&lt;BR /&gt;&lt;BR /&gt;I should have mentioned that I had already referred to the HC(S)08 compiler reference manual but the solution did not present itself to me.&amp;nbsp; So if someone has experience using the command line for compiling, I'd really like to hear how we can pass in a variable through the command line (not through the prm file or some other kludgy way).&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2008 02:43:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/pass-variables-in-to-the-command-line-compiler/m-p/175116#M5623</guid>
      <dc:creator>mayfly</dc:creator>
      <dc:date>2008-07-23T02:43:32Z</dc:date>
    </item>
    <item>
      <title>Re: pass variables in to the command line compiler</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/pass-variables-in-to-the-command-line-compiler/m-p/175117#M5624</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;The ide does not just build all files, it also maintains the state of which files have been built with which options.&lt;BR /&gt;Just adding some options in some build setups is therefore problematic, at least if not all the code should be always rebuilt.&lt;BR /&gt;What are you trying to archive? What you can do with the cmdide build driver is to select a particular build target, and then that build target can contain any kind build target specific options.&lt;BR /&gt;Otherwise there is always the way to build with makefiles instead of using the ide, then you obviously have full control over the build process. With the ide, one way would also be to create an header file which is then included in the build process, the ide can then use the modification date of that file to properly rebuild the dependent files.&lt;BR /&gt;&lt;BR /&gt;Daniel&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2008 03:55:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/pass-variables-in-to-the-command-line-compiler/m-p/175117#M5624</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2008-07-23T03:55:15Z</dc:date>
    </item>
    <item>
      <title>Re: pass variables in to the command line compiler</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/pass-variables-in-to-the-command-line-compiler/m-p/175118#M5625</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I'm going to assume that when you said "archive" you actually meant "achieve".&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Sorry if it was not clear in my earlier posts, but we would like to call the compiler from a different program and pass the compiler a variable that could be passed on to the main program.&amp;nbsp; So, not exactly, but close enough in concept to, something like main(argc, argv) where we could pass in some variables from the command line via argc/argv when the program is called.&lt;BR /&gt;&lt;BR /&gt;Have to go.&amp;nbsp; Will add later.&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2008 05:16:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/pass-variables-in-to-the-command-line-compiler/m-p/175118#M5625</guid>
      <dc:creator>mayfly</dc:creator>
      <dc:date>2008-07-23T05:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: pass variables in to the command line compiler</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/pass-variables-in-to-the-command-line-compiler/m-p/175119#M5626</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;cont'd...&lt;BR /&gt;One of the advantages of the IDE is that it keeps track of all the files, etc, so you don't have to worry about maintaining makefiles, etc (which I really don't want to have to do just because I simply just want to pass a variable to the compiler).&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;One workaround is to create a batch file that saves the variable to a *.c file then call the CmdIDE.exe that contains that *.c file within the project.&amp;nbsp; It works, but I don't really like this method.&amp;nbsp; I would just rather pass the variable as a compiler argument.&amp;nbsp; Can anyone help?&lt;BR /&gt;&lt;BR /&gt;Here is a sample batch file as described above &amp;lt;mybatch.bat&amp;gt;:&lt;BR /&gt;//------------------------------------------&lt;BR /&gt;@echo off&lt;BR /&gt;&lt;BR /&gt;rem The [%1] argument gives the path &amp;amp; filename for the file you want to define the variable in (e.g. "C\myfile.c")&lt;BR /&gt;rem The [%2] is your intended value of the variable&lt;BR /&gt;rem Also, this batch file assumes that &amp;lt;myfile.h&amp;gt; contains: extern const unsigned int myvariable;&lt;BR /&gt;rem Example: mybatch.bat "c:\test directory\myfile.c" 4&lt;BR /&gt;&lt;BR /&gt;if exist %1 del %1&lt;BR /&gt;echo #include "myfile.h" &amp;gt;&amp;gt; %1&lt;BR /&gt;echo const unsigned int myvariable %2 &amp;gt;&amp;gt; %1&lt;BR /&gt;&lt;BR /&gt;&amp;lt;COMPILER_PATH&amp;gt;CmdIDE.exe /f n /b /c /q &amp;lt;PROJECT_PATH&amp;gt;my_project.mcp&lt;BR /&gt;//------------------------------------------------&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2008 07:49:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/pass-variables-in-to-the-command-line-compiler/m-p/175119#M5626</guid>
      <dc:creator>mayfly</dc:creator>
      <dc:date>2008-07-23T07:49:58Z</dc:date>
    </item>
  </channel>
</rss>

