I'm using AVR Studio 6.2 and I am working on a few projects that are getting a bit more complex than the "hello world" projects, so I want to configure the project to minimize code space (and not just optimize for size). My confusion relates to how "smart" the linker is. As an example, in my current Aquarium Controller project, I have several "libraries" that I need to use with this:
-ds1307_lib (RTC related code)
-ds18b20_lib (temp sensor code)
-i2c_lcd_lib (high level driver for LCD)
-twimaster (low level driver used by i2c_lcd_lib)
-USART_lib (driver for serial comms)
Most of these libraries consist of a single .c and .h file that contains all the functions/data/defines/etc for each library.
How is the best way to organize the project in AVR Studio? I can think of four ways to do this:
1) One solution in the project, but using the "add existing file" function with , with all the .c and .h files in a common directory (or split into src and header directories...).
2) One solution and one project, but using the "add existing file" function with "add as link" so the files remain in a common location for all projects using these libraries.
3) One solution and multiple projects, one executable project and several library projects.
4) One solution and one project, bus using the "Add Library" function under the solution.
Which method generally gives the best code size? The first method is what I started with and it led to code fragmentation when I worked on different projects over time, so I really don't like that. The last method, using the "Add Library" function is one method that I have absolutely no experience with. How does it differ from the other methods?
What are your thoughts? I know that most of the folks on here work on far more complex projects, so hopefully you have already found the answer I need! ;)