Skip to content

Fix linking when building without WebUSB support#1109

Open
dgburr wants to merge 1 commit intoARMmbed:mainfrom
dgburr:link-without-webusb
Open

Fix linking when building without WebUSB support#1109
dgburr wants to merge 1 commit intoARMmbed:mainfrom
dgburr:link-without-webusb

Conversation

@dgburr
Copy link

@dgburr dgburr commented Feb 16, 2026

If records/usb/usb-webusb.yaml is removed from projects.yaml then builds will fail with linking errors like:

/usr/lib/gcc/arm-none-eabi/14.2.1/../../../arm-none-eabi/bin/ld: build/usbd_core_hid.o: in function `USBD_ReqGetDescriptor_HID':
/tmp/DAPLink/projectfiles/make_gcc_arm/stm32f103xb_stm32h743zi_if/../../../source/usb/hid/usbd_core_hid.c:64:(.text.USBD_ReqGetDescriptor_HID+0x78): undefined reference to `usbd_webusb_if_num'
/usr/lib/gcc/arm-none-eabi/14.2.1/../../../arm-none-eabi/bin/ld: build/usbd_core_hid.o: in function `USBD_EndPoint0_Setup_HID_ReqToIF':
/tmp/DAPLink/projectfiles/make_gcc_arm/stm32f103xb_stm32h743zi_if/../../../source/usb/hid/usbd_core_hid.c:148:(.text.USBD_EndPoint0_Setup_HID_ReqToIF+0x9c): undefined reference to `usbd_webusb_if_num'
/usr/lib/gcc/arm-none-eabi/14.2.1/../../../arm-none-eabi/bin/ld: build/usbd_core_hid.o: in function `USBD_EndPoint0_Out_HID_ReqToIF':
/tmp/DAPLink/projectfiles/make_gcc_arm/stm32f103xb_stm32h743zi_if/../../../source/usb/hid/usbd_core_hid.c:166:(.text.USBD_EndPoint0_Out_HID_ReqToIF+0x38): undefined reference to `usbd_webusb_if_num'

The reason for this is because usbd_core_hid.c still checks for usbd_webusb_if_num even when USBD_WEBUSB_ENABLE is not defined. This PR addresses this issue, as well as eliminating an unnecessary definition of usbd_webusb_vendor_code when USBD_WEBUSB_ENABLE is not defined.

…lds will fail with linking errors like:

/usr/lib/gcc/arm-none-eabi/14.2.1/../../../arm-none-eabi/bin/ld: build/usbd_core_hid.o: in function `USBD_ReqGetDescriptor_HID':
/tmp/DAPLink/projectfiles/make_gcc_arm/stm32f103xb_stm32h743zi_if/../../../source/usb/hid/usbd_core_hid.c:64:(.text.USBD_ReqGetDescriptor_HID+0x78): undefined reference to `usbd_webusb_if_num'
/usr/lib/gcc/arm-none-eabi/14.2.1/../../../arm-none-eabi/bin/ld: build/usbd_core_hid.o: in function `USBD_EndPoint0_Setup_HID_ReqToIF':
/tmp/DAPLink/projectfiles/make_gcc_arm/stm32f103xb_stm32h743zi_if/../../../source/usb/hid/usbd_core_hid.c:148:(.text.USBD_EndPoint0_Setup_HID_ReqToIF+0x9c): undefined reference to `usbd_webusb_if_num'
/usr/lib/gcc/arm-none-eabi/14.2.1/../../../arm-none-eabi/bin/ld: build/usbd_core_hid.o: in function `USBD_EndPoint0_Out_HID_ReqToIF':
/tmp/DAPLink/projectfiles/make_gcc_arm/stm32f103xb_stm32h743zi_if/../../../source/usb/hid/usbd_core_hid.c:166:(.text.USBD_EndPoint0_Out_HID_ReqToIF+0x38): undefined reference to `usbd_webusb_if_num'

The reason for this is because usbd_core_hid still checks for usbd_webusb_if_num even when USBD_WEBUSB_ENABLE is not defined.  This PR addresses this issue, as well as eliminating an unnecessary definition of usbd_webusb_vendor_code when USBD_WEBUSB_ENABLE is not defined.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant