This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

"Configurations" in IAR

Other Parts Discussed in Thread: CC2540

Some of the example projects have various configurations which can be selected, which affect the build.

I cant find where the differences in the configurations are stored. In IAR there is an "Edit Configurations" selection which does not appear to enable editing of configurations at all, only creating new based on existing.

Presumably a configuration has a number of defines and other settings associated with it. How do you edit these? More specifically I am trying to find what the differences are between the SimpleBLEPeripheral-CC2540 and SimpleBLEPeripheral-CC2540MINIDK configurations.

  • Hi,

    There may be several places where these can be found, for example:

    1. Several source files excluded from build in one particular configuration
    2. Project options -> C/C++ Compiler -> Preprocessor -> Defined symbols
    3. Etc..
    There may be too much of these diffs.
    you may also try to diff compare two clean projects (as folders and files) with winmerge.
  • I think he is trying to change the configuration so that the greyed out folder with the x beside it is available .

    If that is the case then:

    1. Project Menu -> Edit Configurations

    2. Edit Configuration Menu -> ADD -> check release

    3. In the Workspace Files -> HAL -> Target

    4. Right Click on the Target Folder you want to Add -> Options

    5. In the Options for node "..." check or uncheck the box "Exclude in Build" in the top Left.

    That's all there is to it.  You can do this for any file or folder.

    Thanks,

  • Unfortunately, comparing configurations within the IAR IDE requires lots of switching back and forth between configurations and the multitude of configuration categories and tabs.

    A better way exists to compare configurations, albeit with a few manual steps:

    IAR keeps the configurations in an xml file with .ewp extension, SimpleBLEPeripheral.ewp for example.  Each configuration is contained in a block marked by  <configuration> and  </configuration>

    Using a text editor, extract the configurations that interest you, each into a separate text file, then simply diff the text files (e.g. winmerge).

    For example, comparing "CC2540F128DK-MINI Keyfob" to "CC2540" shows the main difference to be:

    < <state>HAL_LCD=FALSE</state>
    < <state>HAL_LED=TRUE</state>
    < <state>CC2540_MINIDK</state>
    ---
    > <state>HAL_LCD=TRUE</state>
    > <state>HAL_LED=FALSE</state>

  • Richard, thanks that goes a long way towards answering my question. But how were the configurations generated in the first place? For example in one of them the define "CC2540_MINIDK" exists and in the other it does not. But how did the original author of the code specify this? There seems to be no place to edit a certain configuration to add a define. I suspect the correct method is not by editing the XML file or is it?

  • Hello Andy,

    I guess my symbolic description was too vague.  Considering your experience with IAR and BLE, I will make it a bit more verbose.

    From your comments, you know how to find the place to edit a configuration.  That same place also allows you to add a new configuration.  If you add a configuration, it will show up just like the "CC2540_MINIDK".  Load the Keyfob example and then add a new configuration. Call it CC2540_CUSTOM.

    Now let's say what you really wanted was to have the MINIDK with all the USB functionality.  When you look at the TARGET folder, you only see the the CC2540EM.  So now you right click on target and add a folder.  Call it CC2540_USB. It is empty!  So now you have to add more folders to it so that it has all the folders just like the hostTestRelease.  Then in each folder, you right click and add the files.  Where do you get the files?  Well you look in the BLE folder and add all the files to the appropriate folders.  The simplest way would be to look at where they are in another instance of IAR and see what directories they are in.

    This is all done manually.  If you want to set up a custom configuration, you add folders and files to your TARGET.  Then, when you right click on the target you see the Option.  This option brings up a window that has a box in the top left that says exclude from build.

    So, after you have added all the files and folders for a CC2540_USB target, you will notice that both the CC2540EM and CC2540_USB folders are orange.  Now if you right click on the CC2540EM folder, go to options and click Exclude from Build, you will notice that it is greyed out and has an x in the box.

    If you now change you configuration back to CC2540_MINIDK, you will have to right click on the CC2540_USB target folder and click on Exlude from Build.  If you change back to CC2540_CUSTOM configuration the folder your excluded will be greyed out.  You will have to go to every configuration and do the same Exclude from Build.

    Any changes you make requires a lot of manual work.  There is a reason why there are so many Keyfob Find My Key and other similar Proximity apps out there.  That's because you don't have to make any changes, you just use the examples.

    Now look back at my original post, does it make more sense now?  Are there any other ways of doing this? Yes. As you gain more experience and start to manually manipulate the code, files and configurations, those other methods may make the above look tedious.

    Thanks,

  • Thanks.

    I dont understand some of the above, but what I do understand is that different configurations allow you to include different sets of files in the build.

    But my original question can be easily asked in this way:

    In the configuration CC2540DK-MINI keyfob, there is a define called "CC2540_MINIDK" which is set to 1 in this configuration but is not set in other configurations as Richard has mentioned above.

    If you open the project and select this configuration and do a "find in files" it does not show anywhere that this define is set to 1. Where is this define "defined"?

    So in addition to allowing you to include/exclude files on a per-configuration basis is there somewhere you can set or not set defines which control compilation? If so, where?

  • In the workspace window, select the top-level project (not a file), right-click the project, select "options"

    Select "C/C++ compiler", then select the "Preprocessor" tab

    Note that the options are limited to a single file if you select a file rather than the project

  • Excellent answer Richard, Thanks!