abcminiuser / lufa

LUFA - the Lightweight USB Framework for AVRs.
http://www.lufa-lib.org
1.04k stars 325 forks source link

Issues with static libraries #52

Closed franky47 closed 8 years ago

franky47 commented 9 years ago

Hello,

I'm trying to add LUFA to a firmware that is built using several modules, each built in a separate static library, and linked together to produce the final elf file, but I encounter a link error with CALLBACK_USB_GetDescriptor. In order to keep it simple, I tried to replicate the project's structure using the ClassDriver MIDI Device demo in your repository, using my build system (based on CMake).

The whole project looks like this:

LUFA and lufa-demo-core each compile to liblufa.a and liblufa-demo-core.a, C static libraries.

lufa-demo-firmware links against these static libs to produce the final elf, but fails to find the CALLBACK_USB_GetDescriptor symbol, implemented in Descriptors.c, from its usage in USB_Device_ProcessControlRequest in the file DeviceStandardReq.c.

All LUFA components use the same LUFAConfig.h file (the one from the demo), and the signature for CALLBACK_USB_GetDescriptor matches in both the implementation and the call (so it's not a signature issue).

Please note that when building the demo files as-is in a single executable target, the link step succeeds.

I can't attach archives on GitHub, so here's a link to the modified demo files: https://drive.google.com/file/d/0B7AbgN8zxRh0SmE0UDBoV0dWQTA/view?usp=sharing

More details if it helps:

Any insight would be most welcome !

Best regards, Francois.

franky47 commented 9 years ago

I just found that if I merge Descriptors and MIDI files together (in the MIDI file), it links alright. That's odd..

abcminiuser commented 8 years ago

Oops. I'm guessing this is now solved (or you've long since given up and decided I was a fool) - please re-open if not and I'll help out ASAP.

franky47 commented 8 years ago

Yep my "fix" in the second comment is fine enough for my use. Thanks for a very cool library !