Ruben Valls Blasco

Compiler doesn't refresh #defines when changing between Targets

Discussion created by Ruben Valls Blasco on Apr 18, 2012
Latest reply on Apr 19, 2012 by Tom Thompson

Hi all!

I am having troubles when changing the target of a project and having defined several names to identify each one:

 

I have two targets, and each one has two diferent paths (one with "{Project}\Target 1" and the other with "{Project}\Target 2"). Inside of each of this folders, exists two files with the same name ("options.h"), so each target has its own options. I have defined in one file "AT24C1024" and in the other "AT24C512".

 

Finally, in a common file I have the following:

#if defined(AT24C1024)
   #define MEMORY_PAGE_SIZE AT24C1024_PAGESIZE
   #define MEMORY_NUM_PAGES AT24C1024_NUMPAGES
   #define MEMORY_DIR_LEN AT24C1024_DIR_LEN
#elif defined(AT24C512)
   #define MEMORY_PAGE_SIZE AT24C512_PAGESIZE
   #define MEMORY_NUM_PAGES AT24C512_NUMPAGES
   #define MEMORY_DIR_LEN AT24C512_DIR_LEN

#endif

so I can use from now MEMORY_PAGE_SIZE independently of the options.h file I am using.

 

Everything works fine, until I change the target. When changing the target, the correct option (either AT24C1024 or AT24C512) is highlighted, but if I do "Go to Macro declaration" for the MEMORY_PAGE_SIZE, it points to the wrong one. This is happening even if I compile the target without cleaning it before, generating invalid binary files (I have got the option "Generate Browser Data From" set to "Compiler").

 

There is any workaround, patch or something?

I am using CodeWarrior Classic IDE, v. 7.2.2, but it also happened to me with v. 7.1, both of them targeting Coldfire V2 (MCF52233 derivative)

 

NOTE: Using the pre-processor panel to define the target options instead of different files in different paths has the same behaviour.

 

Thanks in advance,

Ruben

Outcomes