Step 1 - Adjust a Compiler Configuration FileFirst a warning - for C and C++ software, correctly specifying the preprocessor flags is the most conceptually and technically challenging part of loading in your code.
TheoryWhen you compile your source code, your makefile, build script or IDE passes a series of -I, -D and -U flags to your compiler, along with a list of source files. These flags are used by the compiler to determine where to look for header files, and what macro definitions to use in analyzing your code.
These macros are used in conjunction with #ifdef statements to control which portions of your source code are processed, and which are ignored by the analyzer's built-in preprocessor. For example, if you have entered `-Dfoo' in the PP Flags field, and your code contains a `#ifndef foo', the code following will be skipped until the corresponding #endif is reached. Later, in step 2, you'll specify the flags that are passed by your build script or makefile.
In addition to these explicitly passed preprocessor flags, your compiler also uses some implicit -I, -D and -U flags of its own, which are necessary for locating and accurately analyzing the system header files.
The Imagix 4D analyzer is compiler-independent. By specifying where to find the compiler-specific header files, and what macro definitions to use in analyzing them, the Imagix 4D analyzer is able to match the behavior of your compiler.
AlternativesThere are two ways to set up the analyzer to do this. The first is to add these implicit, compiler-added -I, -D and -U flags when you specify (in step 2) the regular -I, -D and -U flags that are explicitly passed to your compiler.
The second, strongly recommended, approach is to make use of Imagix 4D's compiler configuration files (.inc files). In this approach, you specify system header file locations and macro definitions in a configuration file, and then use the Data Sources dialog (Project > Data Sources) to specify which configuration file to use.
These configuration files are located in the ../imagix/user/cc_cfg directory. There, you will find a series of .inc files. The base name of the file indicates the compiler and the target platform supported by that particular configuration file.
You can add configuration files of your own, as well as modify any of the supplied configuration files. Typically, you'll need to change the system include directory locations defined in the supplied files to reflect where the system header files are actually installed in your environment.
There are several advantages to using the compiler configuration file approach rather than simply adding the implicit, compiler-added -I, -D and -U flags to the regular -I, -D and -U flags. First, if there's already a configuration for your compile environment, it saves you some work. Secondly, you only need to specify the information once for your environment, rather than each time you create a new project. And finally, it makes iteratively fine-tuning your settings easier.
1a. Select a compiler configuration fileGo to the ../imagix/user/cc_cfg directory. Look for a configuration file that matches your environment.
If you're using a gcc-based compiler, running the ../imagix/bin/imagix-gnu utility will automatically query your compiler and build a configuration file specifically tailored for your compiler / environment.
If you don't find a good match, create one with a name that represents your compiler and target. Although you could start with an empty file, typically there will be an existing configuration file for a similar compiler / target that you can copy and then modify.
1b. Adjust the paths for the systems header filesOnce you have chosen or created the configuration file, modify it so that the include directory locations match your environment. Near the beginning of each .inc file is a line or set of lines where the header file locations are specified. Here's a simple example from the arm_cross.inc file:
1c. Make any other adjustmentsIn the opening sections of many of the configuration files are a number of defines to match specific processors and compiler options. Here's an example from part way into the renesas_rx.inc file:
Later, in step 3, you may need to fine-tune the .inc file through a process of reviewing the analysis results and reading your compiler's documentation. More detailed information about customizing a compiler configuration file can be found in the readme.txt file in the ../imagix/user/cc_cfg directory.