Ok, this is a rant, I know, but...
I once thought I had read that the new xml-based project file format would allow for multiple targets in which source files could have the same name but reside in different physical folders on disk, but I can't remember where I read it. Perhaps it was a dream?
Why do I want this?
Suppose you have two different boards (hardware) and one software project. There is a set of common files, and a set of support files for each of the boards. The board support files reside in different subfolders on disk, but they have the same file name (for instance ./board1/hardware.c and ./board2/hardware.c). With uVision, it is then impossible to define a target for each of the boards, since all project files are obviously shared between all targets, even regardless of groups. I want uVision to *switch* some files when I switch targets. I am stumped why the designers of uVision hasn't allowed for this.
I know I could use #ifdefs and a global define that belongs to the selected target (in a common file), but that's not a solution I like. Another solution is to abandon uVision and just use make, but then debugging is a hassle.
With the new xml format, it should be very easy to actually do this properly. As I see it, the current implementation is fundamentally flawed.
Regards -Oyvind
give the files unique names; eg,
./board1/bd1_hardware.c ./board2/bd2_hardware.c
This does have certain advantages; eg, the object files all end up in the same folder - so, with your current scheme, it's impossible to tell whether a "hardware.obj" came from the "hardware.c" in the "board1" foder, or the "hardware.c" in the "board2" folder...
"I am stumped why the designers of uVision hasn't allowed for this."
Agreed!
"Another solution is to abandon uVision and just use make, but then debugging is a hassle."
How so?
Hi,
you can create a folder structure on the Project Tree, i.e.
- general src - special_board1 - special_board2
Then click on Project -> Manage -> Components, Enviroments, Books
In Project Targets, rename the default target to Board1, and create a new Target named Board2.
You can switch between the targets near the Flash Download button.
Select Board1. Then you can right click on the folder (this also works with single files) and select 'Options for Group'. There you can include / exclude files from Build.
Do the same with Board2.
If you then switch between the targets, either Board1 or Board2 is compiled.
BR, /th.
> I want uVision to *switch* some files when I switch > targets. I am stumped why the designers of uVision > hasn't allowed for this.
So, this is allowed ;-) I just checked it...
When you switch between the targets you can see some red dots on the files / folders, that indicates that there are special options set.
The options for the whole project are also target (Board1, Board2) dependant, so I have a project with three targets called SILUMATOR, ULINK and JLINK, so that I can switch easily between the two debuggers, and a special simulation target with extra defines (i.e. to switch off the GLCD in simulation).
> I know I could use #ifdefs and a global define that > belongs to the selected target (in a common file), > but that's not a solution I like. Another solution is > to abandon uVision and just use make, but then > debugging is a hassle.
Don't use defines if you have a powerfull GUI, this will only end up in cunfusing yourself. I once worked on a project like this, and it was horrible. #if, #ifdef, #ifndef, #else, ... You'll end up in mixing positive with negative logic when doing this.
My suggestion: Think about a good common layer, and implement two sets of low level drivers for the two boards. Then - by switching between the targets you can select which subset of LowLevel drivers you want to compile.
Another problem in uVision is, that (I'd say most of the) users do not know the features of uVision.
So - before doing this post here and you will get an answer. There are soo many features implemented most users do not know about.
Yes, using unique names is a possibility, but I still think it should be possible to have files with the same names but different paths.
Maybe I've misunderstood something, but since the debugger is integrated in uVision, it needs to have a complete project to work. If I were to use make, it would be to avoid all the troubles with multiple targets and the aforementioned file name issues.
Thorsten,
Thanks for your effort to help out, but I did know about the possibility to have special options for files or groups, but I'd still need to make sure that every file has a unique name within the complete project.
It looks a bit messy if you have multiple groups (all with different names) that is switched only by the special options (as indicated by the red dots). I want to be able to reuse names and also to hide the files not part of the current target.
But I guess Keil thinks differently...
the IDE seems to be quite workable for simple projects, but if you have e.g. multiple builds from the same group of files you need to go .bat
Erik
I don't think so - though I could be wrong.
I think sufficient debug information is built for the debugger to not need the full project?
Not sure, though...
I think that's true of most applications.
There is a story that 75% of the suggestions that microsoft received from its "focus groups" were for features that already existed in the products!
> Thanks for your effort to help out, but I did know > about the possibility to have special options for > files or groups, but I'd still need to make sure > that every file has a unique name within the > complete project.
Yep, sorry, that's how it actual is. I'll ask, why, and if there is a posibillity.