Project Configurations
ProjectConfigurations.png

Project Configurations are a feature of MPLAB® X IDE that effectively enables "projects within projects". Project Configurations address many different scenarios that often come up in the world of embedded development.

Conditionally Compiled Code

There are numerous instances when conditionally compiled code can make our lives easier:

  • Single code base to support multiple related products, differing only in which features are available:
    • Incremental feature sets (e.g. low-end version and high-end version of a product)
    • Different interface (e.g. same product using a different sensor, display module, etc.)
  • Single code base with "tweaks" for different end customers
    • Different parameters (e.g. alarm/siren patterns, lighting level, speed, calibration, etc.)
    • Language differences (e.g. European vs. Brazilian Portuguese, English vs. Chinese, etc.)
  • Blocks of code that are only used for debugging or testing

The traditional way this is handled is to use #ifdef directives to test for the presence or absence of a #define. While this works reasonably well, Project Configurations can greatly enhance this mechanism by tying it into the IDE itself and making it even easier to switch between the different variations of the code.

Target Device, Tools, Tool Settings

Sometimes, the difference between a low-end and high-end version of an end product include a different target microcontroller (to accommodate additional memory, I/O, etc.). Project Configurations make this easy because you can change every characteristic of your project inside of each configuration.

  • Different Target Devices
  • Different Compiler Settings
  • Different Compilers
  • Different Debug Tools

In some development environments, you might frequently switch between a tool like the MPLAB® REAL ICE™ In Circuit Emulator and the simulator built into MPLAB X IDE. You could setup two configurations within your project that are identical in every way except for the selected debug tool. Then you can use project configurations to quickly swap tools without having to open the project properties window.

Per File Configuration

In some instances, it might be convenient to operate at the file level. Project Configurations allow you to:

  • Include or Exclude entire files from a project configuration
  • Set compiler options for individual files (e.g. override the project's memory model or optimization level for an individual file)

Including or excluding entire files just takes the conditional compilation concept to a higher level. While this could be done with #ifdef directives, the project configuration method is cleaner and more elegant.

20th Annual
Microchip MASTERs Conference 2016
Register now - Deadline: July 29

JW Marriott Desert Ridge Resort-Phoenix, AZ

© 2016 Microchip Technology, Inc.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.