Additional fix related to issue #1018. Corrects the usage of TU_ATTR_WEAK for the Keil compiler #2694
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe the PR
Issue #1018 resolved the usage of TU_ATTR_WEAK for the Keil compiler when it comes to function
dcd_edpt0_status_complete()
.Unfortunately, the same problem (the USB device not enumerating properly) occurs again, if the USB device makes use of a BOS descriptor. For example when using a Microsoft OS 2.0 platform capability descriptor to set a specific Device Interface GUID for WinUSB.
In this case the problem is caused by the
tud_descriptor_bos_cb()
andtud_vendor_control_xfer_cb()
callback functions. The compiler does not see and use the user implemented version of these callback functions. Consequently, these callback functions are not called at run-time, causing the enumeration to fail. The attached screenshot shows this:To fix this PR proposes, is exactly the same as for callback function
dcd_edpt0_status_complete()
, just now for the callback functions:tud_descriptor_bos_cb()
tud_vendor_control_xfer_cb()
I verified that this fix resolves the USB enumeration problem with the Keil compiler. Additionally, I performed a quick regression test to make sure things still work when using the GCC or IAR compiler.
Additional context
The PR also adds the same fix for the following four callback functions, because it is just a matter of time before someone else runs into the same problem with those:
tud_mount_cb()
tud_umount_cb()
tud_suspend_cb()
tud_resume_cb()