Eclipse Command Line Code Generation with Processor Expert

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:

Eclipse Executables

Eclipse Executables

  1. cwide.exe: this is what I typically launch from a shortcut. It can be used with command arguments too.
  2. 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
  3. ecd.exe: this is used to build projects from the command line.

ecd.exe

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

IDE Extension Help

IDE Extension Help

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:

  1. -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:

  1. -generateAll: generates Processor Expert code for all projects in the workspace.
  2. -generate <projectName>: only generates for the given project.

The command line accepts any other Eclipse standard command line arguments. Common ones are:

  1. -noSplash: do not show splash screen
  2. -data: workspace to be used
  3. -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:

Generating Processor Expert Code From Command Line

Generating Processor Expert Code From Command Line

💡 There are several warnings I can ignore, as my code is properly generated 😉

With this, I can automate Processor Expert code generation :-).

Summary

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 🙂

Advertisements

17 thoughts on “Eclipse Command Line Code Generation with Processor Expert

  1. Hi Erich, I am having a problem with generating the PEx components from a command line when my project uses the Segger_RTT component. The errors I receive are:

    com.freescale.processorexpert.core: Loading KDS3 project components – component “My Components/SeggerRTT UUID: version:01.022” was not found/selected from any repository!
    com.freescale.processorexpert.core: Loading KDS3 project components – component “My Components/Wait UUID: version:01.067” was not found/selected from any repository!
    com.freescale.processorexpert.core: Loading KDS3 project components – component “My Components/KinetisSDK UUID: version:01.001” was not found/selected from any repository!

    Can you recommend any changes to the command line that would allow this to work? If I launch KDS and build there, everything is fine. The only clue I have been able to find is that the .PE file refers to a variable called “home_ProcessorExpert_loc”. I have been unable to find this anywhere on my system. I have grep’d and checked system setttings, as well as KDS properties, and don’t see it.

    Thank you!

    Like

  2. Does this work with newer KDS like 3.2.0?

    For me the code generation just hangs and process never exits:

    C:\Program Files (x86)\Jenkins\workspace\Tatra\FracView-PS>”c:\Freescale\KDS_
    v3\eclipse\eclipsec.exe” –launcher.suppressErrors -nosplash –launcher.ini “c:\
    Freescale\KDS_v3\eclipse\kinetis-design-studio.ini” -data “C:\Program Files (x86
    )\Jenkins\workspace\KDS” -application com.freescale.processorexpert.core.PExAppl
    ication -generateAll
    Opening project Tatra …
    generating

    Does anyone know the solution?

    Like

      • Unfortunately, I cannot get it working with KDS 3.2.0. Tried on few computers, same result. It just hangs after “generating”. This is frustrating, as I wanted my projects to be build by Jenkins.

        Like

      • Hi Matt,
        I gave it a quick try, and it works fine on my side:

        C:\nxp\KDS_3.2.0\eclipse>eclipsec.exe -noSplash -data c:\tmp\wsp_kds_3.2.0 -application com.freescale.processorexpert.core.PExApplication -generate MyProject
        Opening project MyProject ...
        generating
        generation finished
        project closed

        C:\nxp\KDS_3.2.0\eclipse>

        Like

      • Well, I also tried to create few small projects and they generate without problems. Something is wrong with my projects, they hang during generation. Maybe I will try to recreate them from scratch and see if it helps. Thank you for your help.

        Like

    • OK, I think I found what is wrong. I don’t keep static_code directory in my repository. It seems that this is the problem. When I have static_code directory I have no problems with generating code from console. Maybe it tries to show dialog window like it does when using GUI(it shows a windows “do you want to synchronize static code” or something like that, after PE code generation)?

      Like

      • Hi Matt,
        yes, you have to have the Static_Code directory present in your repository. That directory and its files get created at project creation time, but not re-recrated if you delete it. Not sure why, but that’s why I have it always (I hope) present in the repo.

        Like

  3. Erich,

    It seams that the command you use assumes that there is a workspace with the project imported into it. I am attempting to automate my builds on a server, but I do not check my workspace into Git. I am assuming I would have to create a workspace before generating the Processor Expert code. Do you know how to generate the workspace from the command line?

    Thanks for your great site!
    Frank

    Like

What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s