Search code examples
static-librariesavratmegaatmel.a

How to include .a file in Atmel Studio on Windows?


I'm trying to interface BME680 gas sensor module with AVR controller (Atmega644p to be specific) using Atmel Studio in Windows platform. The BME680 does come with example functions multiple .h,.c files for configuration and one .a (static library). .h and .c files are calling some functions from static library as well, so we need to include all available .h, .c and .a files.

.a file was new to me and after basic web search I concluded that .a files are for Unix as .lib files are in Windows.

So can you find me a way to either:

convert my in hand .a file to .lib file? or to add .a file in Atmel studio in Windows platform?

Any help will be highly appreciated.

I did try to include .a file using following steps:

  1. In Project=>Properties
  2. click on the Toolchain tab Under XC8 Linker
  3. click on Libraries In the Libraries (-l) window
  4. click the "+" sign and add "libalgobsec" to the list In the Library search path (-L) window
  5. click on the "+" sign In the "Add Library search path (-L) dialog
  6. click on the "..." button In the file dialog, navigate to the folder that contains libalgobsec.a
  7. Click okay.
  8. Under Project Properties => XC8 Linker => Miscellaneous => Other Objects, add: -u _fstat -u _read -u _write

But it gives this error: Compilation Error.


Solution

  • After 2 months of experiments, coordination with BOSCH and everything, here is the conclusion.

    Pre-compiled library is only compatible with AVR controllers having Boot Memory of 256 Kbytes, and only following 4 controllers make it to list:

    1. ATmega2561
    2. ATmega2564RFR2
    3. ATmega2560
    4. ATmega256RFR2

    So if you try to compile libalgobsec.a available in BSEC software for Atmega controllers with any other controller than mentioned above (in my case Atmega644P), it simply doesn't compile.