|
using eclipse to produce multiple targets or derivative projects
I've been using Eclipse for java in my day job for a couple of years. Finally got tired of the minimal functionality of MPLAB as an IDE and looked for some help getting going with Eclipse for FRC code. Also, we've started using CVS on the team to share and backup code, so of course Eclipse is quite nice for this with its integrated CVS support. So I was very happy to find this thread with lots of good info.
I got a basic setup working. However, in recent years we've had the practice on Team 1011 of using multiple MPLAB mcp files to produce hex files for different purposes. Basically the two motivations for this are:
(1) to produce a version that works with either the FRC or EDURC. We use the cheaper EDURC on some of our prototype bots and want to have the same code base for an EDURC and a FRC version.
(2) to produce derivative loadable codes that share most .c and .h files, for example, to make a diagnostic code distinct from a functional code.
For the first case, using different build configurations works out pretty well. As with the mcp files under MPLAB, I can use the different build configurations to define a preprocessor variable EDURC that can be used where needed in the code (not many places) when the behavior or I/O usages needs to be different between the EDURC and FRC versions. I also have different include and search paths to get the .h and .lib files appropriate for either the EDURC or the FRC.
I haven't quite figured out how to accomplish the second case. The closest I got was to make a main project and then have other derivative projects that refer to the main one for most files. I can get as far as sharing .h files and .lib files, by making search paths in the derivative project that refer to the main project. But I don't see how to get it to find .o files needed by the derivative project that are located in the main project. And you won't want all the .o files - just the ones that are required to resolve link time references. E.g. you don't want the .o file that contains "main" from the main project if you have a definition for "main" in the derivative project.
One way to fix this would be to have the main project create a .lib of it's .o files, then have the derivative project refer to that .lib. I guess this is pretty straight forward enhancement to the makefile generator. I'm going to look at doing that - unless somebody out there has better advice.
Thanks
Bill Bennett
CRUSH 1011
|