Go Reference! Or: Subprojects in eclipse and MCU10.2

I admit: I’m a big fan of eclipse.
But there is one thing I have missed from the ‘classic’ non-eclipse CodeWarrior for MCU: the ability to create hierarchical builds with subprojects.

It was sooooo simple and easy in classic CodeWarrior:

  • I need to build a batch of projects in one step?
    I have it organized as subprojects, and go!
  • I need a boot loader library included with my project, build it as part of my application build, plus I want to re-build my custom ANSI library for the small memory model?
    I have it included as subprojects, set it up to be linked with my application project, done!


I value a feature probably the most, once I do not have it any more. I considered subprojects as such a basic thing that I was surprised to realize that it does not exist in eclipse. I searched the internet for “eclipse subproject” and found out that I’m not alone. There are some bits and pieces as outlined in this eclipse community thread, but not to the level and comfort as in classic CodeWarrior. Yes, I can use make files to do everything I want. But using the comfort of managed make this sounded like Stone Age to me? There must be something better…

Good news: As I can read in Jim’s continuous improvements  and mentioned in my post on the MCU10.2 release, Freescale has implemented subprojects in MCU10.2 :-):

The feature extends on what is in eclipse and MCU10.1 known as Project References:

Project References in Eclipse

Project References in Eclipse

Using Project References I can refer to other projects. If I open the master project, eclipse can open the referenced projects too (you get a dialog to confirm this). If I build the master project then it will build the referenced projects too. But that’s it. I have no other control.

I need more:

  • I want to have control over the build order. I want to change the order the referenced projects are built.
  • I have projects with multiple build configurations (e.g. Release and Debug). I want to build either Release or Debug, or both, or any set or combination.
  • I want to open and import referenced projects even if they are not part of my workspace yet.
  • I want an easy way to manage my referenced projects.

This is now possible with MCU10.2. Creating referenced projects or subprojects is really easy: I can drag&drop a project over another one in the CodeWarrior Projects View and it creates a virtual folder named ‘Referenced Projects’:

Referenced Projects in MCU10.2

Referenced Projects in MCU10.2

I can configure the subprojects (named ‘Referenced Projects’) as References in the C/C++ Build settings. I can change the build order (move up/down), enable/disable build configurations, and decide if build has to apply to the referenced subprojects, and how:

C/C++ Build References Settings

C/C++ Build References Settings

Much easier is to use the context menu in the project. That way I do not need to open the project settings as the context menu gives me access to it:

Referenced Projects Context Menu

Referenced Projects Context Menu

The really cool thing is that I can open and import a referenced project which is not in the workspace yet!

Importing referenced projects into workspace

Importing referenced projects into workspace

Another trick is to select multiple referenced projects and open or close them all together.

Last but not least: I want to link the result of a subproject, such as a library produced by the subproject. For this, MCU10.2 provides the variable ${ReferencedConfigurationsOutput} which can be used in the linker settings: This will link the output of my referenced projects into my application:

Linking the output of a subproject

Linking the output of a subproject

Happy referencing with subprojects 🙂

3 thoughts on “Go Reference! Or: Subprojects in eclipse and MCU10.2

  1. Hello.This post was extremely interesting, especially because I was searching for thoughts on this matter last week.

    Like

  2. Pingback: MQX Eclipse Working Sets | MCU on Eclipse

  3. Enjoyed reading this, very good stuff, thanks . “Talk sense to a fool and he calls you foolish.” by Euripides.

    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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.