Hello, Why does uv3 not allow me to add the file "foo.h" to different targets? or maybe I am missing something? I am actually trying to add the same file twice to different targets. the fact that I get an error is highly annoying as I want to place common data of an application and bootloader in a share include file, and use the same project file but with different targets.
I have the same files in more than one target. One target is a boot loader, and one target is the application. They share a number of source files - for example CRC32 code.
I don't understand why this does not work. I specify the target, double click on the right project folder (source, for example) to add the file, and I always get an error that the file is already a member of another group that belongs to the other target (the other instance is not built). frustrating...
No, you cannot add the same file more than once anywhere in one project.
But why do you want to do this?
In fact, I'm pretty sure that you cannot add a file to an individual Target:
There is only one list of files (and groups?) that applies to the whole project - ie, all Targets.
If a file is not applicable in a particular Target, you can't remove it from the Target - you can only mark it as 'Do Not Build' for that Target.
IMO, the whole uVision "Project Management" scheme is pretty weak...
:-(
I was afraid of this - but when I think of it, it makes sense given the behavior of the components dialog - selecting an alternative path does not change the contents of the file list!
Why does uv3 not allow me to add the file "foo.h" to different targets?
Hmmm... why would you want to add a header file to a target in the first place? You wouldn't compile that anyway!
As to files common to multiple targets, the obvious approach would be to create a source file group name something like "common" and put them in there.
"You wouldn't compile that anyway!"
Conventionally, no - but there's nothing in principle to stop you from compiling a file that happens to have ".h" as its extension...
Early Triscend tools produced a header that you had to compile once and also include in your other source files:
When compiled, it created the initialisation code;
When included, it had to be done like this:
#define PROTOTYPE_ONLY #include <triscend.h> #undef PROTOTYPE_ONLY
and, as the name suggests, that would cause it to just create Prototypes for the functions...
Another reason to add a header to a uVision Project is to make it more easily available for reference - you would then mark it as 'Do Not Build' in its options...