Closed cyrozap closed 3 years ago
This certainly looks like a bug, thank you. However, I still need to find out why it builds on my machine as well with GitHub CI.
OK, I confirm the issue, but I don't believe you fixed it in the right way. The only thing that is really needed is to add missing "extern" modifiers into usb_descriptors.h. There is no need to remove those declarations and move them to usb_core.c. There is no need to touch usb_core.c at all.
Here is what I suggest:
extern const usb_string_descriptor_t *usb_string_descriptors[usb_string_index_last];
Actually, I believe the simplest way is to roll back everything and then add missing extern modifiers to usb_descriptors.h
Thoughts?
I can confirm that your suggested fix also fixes the issue for me. I've updated this PR accordingly.
Looks great! Thank you for identifying the issue and for your contribution to the project. It this point I am ready to accept the PR.
The USB descriptor variables were effectively being declared twice--once in
usb_descriptors.c
and once inusb_core.c
--because both files includedusb_descriptors.h
, where those variables were originally declared without the "extern" keyword. Because of this, GCC refused to link the object files. After declaring the variables as "extern", the build finishes without issue.Here's an example of the issue this PR fixes: