View previous topic :: View next topic |
Author |
Message |
FISH6942
Joined: 03 Feb 2006 Posts: 13 Location: Minnesota
|
Source file sharing |
Posted: Tue Feb 28, 2006 9:35 am |
|
|
Hi - I've been using the CCS compiler off and on for the past 5 years but here's my first question on this board.
I have one file that is common between 4 different builds for 4 different boards. Each board has a different PIC micro. Each build
contains only one "main" file that is different for each build. All files for all the builds are kept in a single folder but there are separate MPLAB
build files for each board.
The common file occasionally needs to call a timing function in the (board specific) main file. The actual timer that's used for this
function is different for each board. That's why it needs to reside in the main file.
I'm trying to come up with a way to get these timing function prototypes into a header than can be #included by the common file.
The other option would be to have different folders for each build and keep the common file in it's own location. This would require a specific header file for each build.
Any comments would be appreciated. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
|
Posted: Tue Feb 28, 2006 9:48 am |
|
|
Have a #define, in each of the main source files, in front of the point you include the common file. Something like:
#define SOURCE (1)
Change the number in each of the source files.
Then in the 'common' file, you can use the the #IF statement, to define the required prototypes. So:
#if SOURCE == 1
void timerfunc_fromSource1(int timer);
If the functions have different names in the different main files, use #define to give them all the same name.
So:
#define timer_func(x) timerfunc_fromSource1(x)
If you do that in each 'if' statement section, in the common section of the file, you can call 'timer_func', and it will correctly be redefined to use the function in the main source.
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
|
Posted: Tue Feb 28, 2006 11:59 am |
|
|
Thanks for the advice it looks like it's going to work.
I guess I was getting a little confused on the scope of the #defines in the individual source files and how they would appear in the included common file. |
|
![](templates/subSilver/images/spacer.gif) |
|