Eclipse based IDE’s have typically one limitation: the IDE has not much scripting capabilities. Yes, I can use things like JUnit for testing, but if it comes to build and debug C/C++ applications, then support gets really rare. An exception to this is CodeWarrior for MCU which features a command line version of the IDE which can be used for test automation as I used it in one of my tutorials. What I missed so far is to have a command line interface for Processor Expert to generate code. This is now possible with CodeWarrior for MCU10.5 :-).
Eclipse Command Line Options
Inside the CodeWarrior Eclipse folder, there three executables I can use for Eclipse as a command line version:
- cwide.exe: this is what I typically launch from a shortcut. It can be used with command arguments too.
- cwidec.exe: similar to cwide.exe, but it waits until the IDE closes. Useful for batch processing, see CodeWarrior Flash Programming from a DOS Shell
- ecd.exe: this is used to build projects from the command line.
ecd.exe is used to generate make files and build projects. The command is described in the online help under
CodeWarrior for Microcontrollers V10.x > Common Manuals > CodeWarrior Common Features Guide > IDE Extensions
cwide.exe and cwidec.exe
The cwide.exe and cwidec.exe can be started to execute a debugger shell script (CodeWarrior Flash Programming from a DOS Shell), e.g.
cwide.exe -vmargsplus -Dcw.script=D:\my_script.tcl
The cwidec.exe and cwide.exe (or any Eclipse) have an -application option which let me execute Processor Expert from the command line:
- -application <plugin>: executes a plugin. For Processor Expert com.freescale.processorexpert.core.PExApplication has to be used.
-application is one of the Eclipse platform runtime/command line options described here.
The Processor Expert plugin accpets two options:
- -generateAll: generates Processor Expert code for all projects in the workspace.
- -generate <projectName>: only generates for the given project.
The command line accepts any other Eclipse standard command line arguments. Common ones are:
- -noSplash: do not show splash screen
- -data: workspace to be used
- -showlocation: show workspace in title bar
Generating Processor Expert Code from Command Line
To generate Processor Expert code for my project ‘Frdm’ present in my workspace located in c:\tmp\wsp_10.5, I use the following command line
cwidec.exe -noSplash -data c:\tmp\wsp_10.5 -application com.freescale.processorexpert.core.PExApplication -generate Frdm
This will give something like this:
💡 There are several warnings I can ignore, as my code is properly generated 😉
With this, I can automate Processor Expert code generation :-).
With the -application Option I can now automatically generate and build Processor Expert projects from batch files. This is very useful for testing and automated building: I can check out my projects from a version control system, generate code, build it, download it, and debug it, all automated 🙂
Happy Generating 🙂