Setting Global Symbols

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

Setting Global Symbols

跳至解决方案
2,463 次查看
tharonhall
Contributor IV

I realize that I can go to the project settings C/C++ General and Paths and Symbols and set Symbols for both C and C++ files. However, for reasons that escape me, those symbols don't appear to flow down to all of my individual C and C++ files and I have been forced to add them at the source level.

 

I need to be able to retarget my code between the 64-pin part in the FRDM board and the 100-pin part on my target board. I am assuming I may need to continue having symbols in multiple places in my project. However, can I tie something like "CPU_TYPE" to something like a global or environment variable so they all change where ever they are so they can be changed from one location in KDS?

 

Of course, if the symbols worked from the project properties level, I would only have to change it for the GNU C and GNU C++ files there, so it would only be two places to change.

 

Thanks!

 

"I'm taking what they're givin' cause I'm working through the weekend."

标签 (1)
标记 (2)
1 解答
2,237 次查看
BlackNight
NXP Employee
NXP Employee

You can use Processor Expert configuations to define a symbol/define in the generated code: Configurations with Processor Expert | MCU on Eclipse

As for 'inpinning': use 'reset to default' in the resource configuration, see Symbol defined or not, that’s the question | MCU on Eclipse

在原帖中查看解决方案

7 回复数
2,237 次查看
BlackNight
NXP Employee
NXP Employee

I'm using the Preprocessor settings for this:

pastedImage_0.png

This has the effect as having

#define ARM_MATH_CMD0

in the sources.

0 项奖励
回复
2,237 次查看
tharonhall
Contributor IV

Oh, of course. I reference that, but for whatever reason those symbols don't trickle down to all my C++ files. I have had to add them manually down at the source directory for at least some of the files for reasons that escape me. :smileysad: I agree, one would think it should work.

BTW, it's not clear to me that when I do the same settings on an individual C or C++ file if it is only for that file or for all the files in that directory.

0 项奖励
回复
2,237 次查看
BlackNight
NXP Employee
NXP Employee

The same preprocessor panel exists for the C++ compiler, maybe you have not added your define there?

And you can set options per file and folder: select that file/folder, and change the settings there.

Just be aware of the icon decorators, in case you need to see which ones have custom options and which ones not:

Icon and Label Decorators in Eclipse | MCU on Eclipse

2,237 次查看
tharonhall
Contributor IV

And not surprisingly, you are on to something Erich. Add a zero to your salary. (Leading zero, of course.)

I do see that several of my C++ files are "pinned". However, a quick Google search is not telling me how to "unpin" them so that everything flows across the project.

BTW, does anyone know if there is a mechanism for getting symbols and/or defines into the Processor Expert code? Is there a setting or possibly a hook to pull in a header file somewhere? If I had my way, I would MUCH rather have the MCU defined by a header file than fight with the symbols in the build environment. :smileywink:

Thanks!

0 项奖励
回复
2,238 次查看
BlackNight
NXP Employee
NXP Employee

You can use Processor Expert configuations to define a symbol/define in the generated code: Configurations with Processor Expert | MCU on Eclipse

As for 'inpinning': use 'reset to default' in the resource configuration, see Symbol defined or not, that’s the question | MCU on Eclipse

2,237 次查看
tharonhall
Contributor IV

Brilliant, Erich! My build is cleaned up and I am creating a 64 pin configuration and a 100 pin configuration. (Of course PE immediately generated errors when I toggled over to the 100 pin, but that is par for the course.)

Many thanks!

0 项奖励
回复
2,237 次查看
tharonhall
Contributor IV

Just to follow up for anyone following this topic:

I was able to create two build configurations. I had to make copies of the CPU components and the pin_init:PinSettings for each configuration. It blew up the first time I tried it so I went very cautiously and committed each successful step to SVN and do a couple of reverts when things didn't go right. However, in the end it worked and I now can change configurations and target one of two processors. I do have to regenerate the PE code, obviously, but it is fairly easy to do now that it works.

Again, cheers for Erich! Yahoo. :smileyhappy:

0 项奖励
回复