Project structure in Atmel studio 7 - Page 1
Forum section: electronics / general

author: Dan Moos
author_rank: Frequent Contributor
timestamp: October 16, 2016, 05:23:36 pm
content: Ok, I'm working on a simple project (I2C LCD driver) that currently consists of two libraries, and a simple "test frame" program that's just a place to try out my library functions as I create them.Ok, so I'm pretty sure I'm not using the most effective way of managing the various elements of the project. Here is what I have, and the problems it creates.I have three solutions. My I2C functions are in one solution, and that compiles to a library. My LCD functions are in another solution, and it also compiles as a library. Finally, my test frame program is its own solution, and compiles as an executable. Everything is C code.So the test frame program calls stuff in the LCD library, and the LCD library calls stuff in the I2C library. That is where the trouble is. Say I make a change in the I2C library. It forces me to recompile that library, then load the LCD library, recompile that, and finally load the test frame program and recompile that. Seems really inefficient.Is there a way to structure the project so that everything recompiles in one step? I feel that I am misusing the whole "solution" concept. I am pretty dead set on having separate LCD and I2C libraries.I just want one step recompile no matter what part of the project I change.

author: ataradov
author_rank: Super Contributor
timestamp: October 16, 2016, 06:23:01 pm
content: Quote from: Dan Moos on October 16, 2016, 05:23:36 pmIf they are real libraries, then only changed library needs to be recompiled (I2C and test program in this case).I think what you want to have is one solution and multiple projects. The project is what carries all the information, so you still get library isolation, so you can get I2C project and attach to multiple solutions.I don't know if there is automated way of rebuilding them with dependencies, but at least there is a very fast and easy way to switch between the projects within the solution.And since AS is just a Visual Studio, you may get results if you look for project management with VS instead.

author: Dan Moos
author_rank: Frequent Contributor
timestamp: October 16, 2016, 07:00:17 pm
content: Ok, first of, good ideas searching VS rather than just Atmel Studio. I'll definately do that.I thought that under my current scheme, any thing that calls on a library needs to be recompiled. So if I change I2C, who's functions are called by LCD, I need to also recompile LCD. Since Test calls LCD's functions, and LCD has been recompiled, I would need to recompile it too. Am I missing something?I never quite got the difference between projects and solutions in VS or Atmel Studio. Perhaps my searching needs to start there. Thanks!

author: ataradov
author_rank: Super Contributor
timestamp: October 16, 2016, 07:04:33 pm
content: Quote from: Dan Moos on October 16, 2016, 07:00:17 pmLibrary is just a bunch of functions. As long as there is no inline functions that are part of the library API (and there should not be, if it is a real library), then there is no need to recompile any libraries that are using this one, since any dependent libraries only have references to the functions in the first library. And the final resolution happens at a link time.Quote from: Dan Moos on October 16, 2016, 07:00:17 pmThe easiest way to instantly get it is to look inside *.atsln and *.cproj files. They are just XML files, so you can open them with any text editor.

author: Dan Moos
author_rank: Frequent Contributor
timestamp: October 16, 2016, 08:01:32 pm
content: Hmmm. Sounds like I'm misunderstanding how linking goes when one library calls another. If LCD calls a recently altered I2C, I thought I2C gets linked into LCD when LCD is compiled. Thus, I thought a non recompiled LCD would have the old I2C still linked in. Do I have the process of linking wrong?

author: ataradov
author_rank: Super Contributor
timestamp: October 16, 2016, 08:03:05 pm
content: Quote from: Dan Moos on October 16, 2016, 08:01:32 pmNope. All you need to compile LCD is a header file from I2C, you don't even need the code or the library itself at this point.