Home > User Support > CoverageMaster winAMS FAQ

CoverageMaster winAMS FAQ

Test Data Settings

001_01: Can #define symbol names defined in header files be used in test CSVs?

Question:

Can I use numbers, variable names, structure members, etc. defined as #define symbols in header files in test CSVs?

Answer:

#define symbol names can be used when linked with CasePlayer2. Since the #define symbol information is processed by the compiler's preprocessor, it is embedded in the code during compilation and not included in the object file as symbol information. Instead the #define information is brought into CoverageMaster as #define list information from the analysis result of CasePlayer2. This is the "Cp2Define.dat" file that is generated in the CoverageMaster project folder. For example, the following in a source file

#define FALSE 0
#define TRUE 1

Will be generated as

13,"FALSE","0"
13,"TRUE","1"

in the "Cp2Define.dat" file. This allows WinAMS to use the symbols "FALSE" and "TRUE" in the test CSV. To do this, make sure the following Analysis Settings are enabled in CasePlayer2 as shown below.

- Enable advanced mode
- #define List
- Create WinAMS analysis data

The "Cp2Define.dat" file is created/updated by reading the information from the linked CasePlayer2 analysis results at the time of starting WinAMS. Therefore, please note that you need to restart WinAMS after executing "Re-create all Documents" in CasePlayer2 for the information to be updated.

The #define definition that can be used in CoverageMaster has the following conditions.

Examples of definitions that can be used:

Numeric definitions
#define ABC (100) /* Can use ABC in test data instead of 100 */

Global variable definitions
#define G_VAR1 g_var1 /* g_var1 is a global variable */

Array element definitions
#define G_A0 g_ary[0] /* g_ary is an array type global variable */

Global variable bitfield or member definitions
#define BIT1 g_st.bit1 /* g_st is a bit field global variable */
#define MEMM g_ptr->m /* g_ptr is a structure pointer type global variable */

I/O address with type cast definitions
#define B_LED (*(volatile unsigned short*) 0x00080000) /* 0x00080000#U2#2 */
#define R_LED ((volatile unsigned short*) 0x00080020) /* 0x00080020#U2#2 */

Register map definitions
#define P1 (*(volatile struct p1*) 0x00080100)

Examples of definitions that can't be used:

Arithmetic expression in numeric definitions
#define ABC (100*2) /* Can't use if an arithmetic expression */

File-scope static variable definitions
#define S_VAR1 s_var1 /* Can't use if s_var1 is a file-scope static variable */

Function or macro function definitions
#define MFUNC(a) func(a)

Global variable with type cast definitions
#define G_CPTR (char*) g_ptr

Definitions that use function-scope local symbols
For example, function-scope static variables, function-scope local structure register map etc.


Related Technical Tips Search

Other technical tips in GAIO's web site can be searched for using the links below.

Search key word link: #define Symbols
Technical Tips Google Search


Information Links