Using the latest AS 7.0.634, I've successfully created a small static library; it's components show up as the requisite .d and .o output files, and the library as a .a file. Moreover, they all are about the right size, so I have good confidence that they really are what I expect.
I created another project (a C-language executable) in a new solution; from within that solution, I imported/inserted my (existing) static library project. So, the solution now contains the static lib project and the C executable project. I checked the executable project's properties: Toolchain->AVR/GNU Linker->Libraries: this lists my static library, along with libm. So far, so good.
I've keep getting an "undefined reference to" error regarding (the first test) function with which I'm trying to link from within the main executable to the static library. Looking at the output window, I began to notice that while my C source files from the executable project were compiled without error and their .o output files included in the link step, the link list did *NOT* list the static library file from my static library project.
I used to work exclusively (many years ago in some pretty complicated builds) with makefiles, so I decided to take a look at it. I found that its LIB_DEP symbol *DOES* list my static library, but in the link command
@echo Building target: $@
@echo Invoking: AVR8/GNU Linker : 4.9.2
$(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-g++.exe$(QUOTE) -o$(OUTPUT_FILE_PATH_AS_ARGS) $(OBJS_AS_ARGS) $(USER_OBJS) $(LIBS) -Wl,-Map="Startup.map" [remainder elided...]
the $(LIBS) symbol's contents are completely missing from the output in the output window. Examining the makefile more closely, I see where $(LIBS) is cleared:
but, it is never touched afterward. So, the linker is doing exactly what the makefile told it: namely, to exclude my static lib. Also, the $(LIB_DEPS) symbol is a dependency in the linker rule.
The output windows shows:
Invoking: AVR8/GNU Linker : 4.9.2
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-g++.exe" -o Startup.elf Journ1.o main.o -Wl,-Map="Startup.map" -Wl,--start-group -Wl,-lm -Wl,-lMega2561 -Wl,--end-group -Wl,-L"C:\Users\David\Documents\Atmel Studio\7.0\Production0\SH\Mega2561\Debug" -Wl,--gc-sections -mrelax -mmcu=atmega2561 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.0.90\gcc\dev\atmega2561"
main.o: In function `main':
Notice the missing library ref (before -Wl in the highlited section).
I know, of course, that you're not supposed to edit the makefile, so I'm not even considering that. However, I haven't found anywhere in the properties for either project that would appear to have any bearing this - other than the Toolchain->AVR/GNU Linker->Libraries I mentioned above (which appears correct).
is this a bug in the new version, or have I missed something really simple?
Also, I tried the two methods of adding a static library to my project that I know about:
1. Add a Project Library from the Add Library command.
2. Add a Browse Library from the Add Library command.
Neither work; both report the same "undefined reference" error.