How to automatically swap Project.lcf files?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to automatically swap Project.lcf files?

717 Views
ignisuti
Contributor IV

I have two different Project.lcf files: One is for building witout a bootloader (for development) and the other is for building with a bootloader (for production). 

 

Can I setup something that will swap out these two files (or just the code in the file) based on a flag like this?

#define DEVELOPMENT_BUILD  ( FALSE )

 

I've tried using a something like the following, but the LCF file seems to have it's own syntax and doesn't recognize these commands.

#if( DEVELOPMENT_BUILD == TRUE )....#else....#endif /* #if( DEVELOPMENT_BUILD == TRUE ) */

 

Note: I'm using CW 10.1 with a mcf51cn128 MCU.

Labels (1)
0 Kudos
5 Replies

437 Views
CrasyCat
Specialist III

Hello

 

Coldfire linker file syntax does not support preprocessing nor conditional directives.

 

If you want to get two variant of the project one using one .lcf file and the other one using another one I would suggest you to define 2 Build configurations.

 

One for the DEVELOPMENT_BUILD and another one for the other build.

Then in the properties dialog for each build configuration you can specify a different lcf file.

 

In order to create a new Build configuration for your project:

  - Click right on the project name in the CodeWarrior Projects view

  - Select Build Configuration > Manage.

  - Click on New and define a new name for your build configuration. You can copy settings from the initial configuration.

 

You can select which Build Configuration needs to be build either from the drop down list next to the Build button in the tool bar or changing the Active Configuration for the project.

 

I hope this helps.

 

CrasyCat

0 Kudos

437 Views
ignisuti
Contributor IV

Thanks for the suggestion CrasyCat.

 

I understand everything except for this instruction: 

"Then in the properties dialog for each build configuration you can specify a different lcf file."

 

Can you please provide more details?

1.) How do I get to the properties dialog for the build configuration?

2.) How do I specify a certain lcf file?

0 Kudos

437 Views
CrasyCat
Specialist III

Hello

 

In order to open the project's Properties dialog:

   - Click right on the project name in the CodeWarrior Projects view

  - Select Properties.

  - Switch to C/C++ Build > Settings page.

  - On the right hand side of the window you see a combo box named Build Configuration.

     Select the build configuration you want to change.  

     NOTE: Changes made with build Configuration set to [All Configurations] will apply to all build configuration.

 

  - To change the name of the .lcf file go to the Coldfire Linker > Input panel and change Link Command File (.lcf).

     You can use ${ProjDirPath} to specify a path relative to your project directory. The project directory is where you

     did originally create the project (i.e. where the file .project is located).

 

I hope this helps.

 

CrasyCat

0 Kudos

437 Views
G_A_
Contributor I

Hi CrasyCat,

 

Is it possible to automatically swap Project.lcf files 

using Codewarrior IDE version 5.9.0?

 

I hope it is...

 

GA

0 Kudos

437 Views
CrasyCat
Specialist III

Hello

 

Yes this is possible.

 

1- First create a new build target:

        - Inside of the MCP window switch to the Targets tab

        - Select Project > Create Target

        - In the New target dialog specify a name for the new target (for example MyTarget) and check clone existing target.

          Then Select the existing build target.

       - Click OK.

2- Change settings for the new target

      - Inside of the targets tab, click on the red icons in front of the new target name.

      - Open Target settings dialog (Press ALT + F7).

      - Change name of linker file. This depends on the micro you are targeting. So I cannot be more specific on

        how to achieve that as you did not specify your target controller.

 

Using Project > Set Default Target you can switch between the available build target and specify which one you want to build.

 

I hope this helps.

 

CrasyCat

0 Kudos