Setting Global Symbols

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Setting Global Symbols

Jump to solution
1,050 Views
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."

Labels (1)
Tags (2)
1 Solution
824 Views
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

View solution in original post

7 Replies
824 Views
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 Kudos
824 Views
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 Kudos
824 Views
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

824 Views
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 Kudos
825 Views
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

824 Views
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 Kudos
824 Views
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 Kudos