# Multiple AVR Projects Sharing Code - Managing Large Projects

I'm working on a group project that is based around designing an automotive CAN bus system. Essentially there are multiple different nodes on the bus, acting as sensors, displays, controllers or transmitters. My question is how to share/include common code?

Each node is based around an Atmel AVR µC, usually an Atmega or Attiny. All the nodes are making use of Microchip MCP2515 CAN Controllers and MCP2561 CAN Transceivers. Our team consists of multiple members each working on their own nodes. We are using Github & SourceTree for source control.

Some code is common to each node, mainly the SPI/CAN functions for TX and RX. We have this working at proof of concept level at the moment. I'm used to working on individual projects however I'm lost as how to share code among projects effectively.

Really what I would like to do is have each node's code in its own directory and then have the common 'library' code in a directory that is referenced in each nodes source code. This way changes to the 'library' code only need to happen in one place and not in multiple copies.

Something like this:
 Code>> Display Node>> Display_main.c Sensor Node>> Sensor_main.c TX Node>> TX_main.c Shared lib>> SPI.c SPI.h MCP2515_func.c MCP2515_func.h 

I am using Eclipse + AVR plugin for my dev, other members are using Atmel Studio.

I'm not too sure if I should: a) Lump all the shared code in a folder and #include "../Shared lib/xxxx.h"

b) Lump all the shared code in a folder and set Eclipse compiler to include this folder? then #include "xxxx.h" will work ? (what about ATStudio friends? )

c) Create an Eclipse project without a main.c, that contains all the code and include this project with my other projects?

d) Compile the code into a 'static library' ?

I've done a fair bit of research and haven't found any good idea of direction. I guess it comes down to how to manage multiple code projects (nodes) by multiple members on multiple platforms ? I seem to be pretty good at basic stuff but this is the next level in code organization for me.

EDIT:

To add to this question, how could I create a Github project with all my own custom librarys and macros that I can keep updated and then just include in any project I work on?