Preprocessor include macros don't work

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Preprocessor include macros don't work

跳至解决方案
1,215 次查看
laszlomonda
Contributor V

Hi there,

 

I'd like to use the preprocessor include macros feature of KDS to be able to build different firmware images on a per build profile basis for the various versions of our prototypes. Please see the following screenshot:

 

173367_173367.pngScreenshot from 2016-12-23 04-02-05.png

 

For some reason this doesn't work because:

  1. The exact same firmware image gets built as without the macro.
  2. In source code code editor the PROTOTYPE_VERSION_7 macro section gets grayed out instead of the else clause.

 

I'd be really grateful if someone could help me.

 

Thanks in advance!

 

- Laci

标签 (1)
0 项奖励
回复
1 解答
770 次查看
BlackNight
NXP Employee
NXP Employee

Hi Laci,

add your preprocessor symbols under the -D compiler (C, C++, assembler):

pastedImage_1.png

The other thing to know is: Eclipse uses the Indexer data base to gray out the sources. Depending on your project, I recommend you disable heuristics and rebuild the index, see Fixing the Eclipse Index | MCU on Eclipse 

I hope this helps,

Erich

在原帖中查看解决方案

0 项奖励
回复
3 回复数
770 次查看
laszlomonda
Contributor V

Hi Erich, and Jennie,

Thank you so much for your help! Erich's instructions totally solved my problem.

Now I have only one question left: What is the preprocessor include macros feature of KDS supposed to do? It seems to me that it doesn't work.

Have a nice day,

Laci

0 项奖励
回复
770 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Laci,

In addition,  you can refer this article section2.1 with demo code:

How to support multiple targets in CodeWarrior(Classic, Eclipse)/KDS 

I referred Erich's article when writing this section
https://mcuoneclipse.com/2012/03/20/fixing-the-eclipse-index/

Hope this helps!


Have a great day,
Jennie Zhang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复
771 次查看
BlackNight
NXP Employee
NXP Employee

Hi Laci,

add your preprocessor symbols under the -D compiler (C, C++, assembler):

pastedImage_1.png

The other thing to know is: Eclipse uses the Indexer data base to gray out the sources. Depending on your project, I recommend you disable heuristics and rebuild the index, see Fixing the Eclipse Index | MCU on Eclipse 

I hope this helps,

Erich

0 项奖励
回复