This repository was archived by the owner on Mar 26, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,8 +2,8 @@ TARGET = boot-uf2-dfu
22LIBRARIES = fx2 fx2usb fx2dfu fx2usbmassstor fx2uf2 fx2isrs
33MODEL = medium
44
5- CODE_SIZE ?= 0x3c00
6- XRAM_SIZE ?= 0x0400
5+ CODE_SIZE ?= 0x3d00
6+ XRAM_SIZE ?= 0x0300
77
88LIBFX2 = ../../firmware/library
99include $(LIBFX2 ) /fx2rules.mk
Original file line number Diff line number Diff line change @@ -160,6 +160,8 @@ struct usb_descriptor_set {
160160 usb_configuration_set_c * configs ;
161161 uint8_t string_count ;
162162 usb_ascii_string_c * strings ;
163+ uint8_t capability_count ;
164+ usb_desc_generic_c * capabilities ;
163165};
164166
165167typedef __code const struct usb_descriptor_set
Original file line number Diff line number Diff line change @@ -54,6 +54,12 @@ enum usb_descriptor {
5454 USB_DESC_DEVICE_QUALIFIER = 6 ,
5555 USB_DESC_OTHER_SPEED_CONFIGURATION = 7 ,
5656 USB_DESC_INTERFACE_POWER = 8 ,
57+ USB_DESC_BINARY_OBJECT_STORE = 15 ,
58+ USB_DESC_DEVICE_CAPABILITY = 16 ,
59+ };
60+
61+ enum usb_device_capability {
62+ USB_DEV_CAP_PLATFORM = 5 ,
5763};
5864
5965enum usb_feature {
@@ -232,4 +238,14 @@ struct usb_desc_string {
232238typedef __code const struct usb_desc_string
233239 usb_desc_string_c ;
234240
241+ struct usb_desc_binary_object_store {
242+ uint8_t bLength ;
243+ uint8_t bDescriptorType ;
244+ uint16_t wTotalLength ;
245+ uint8_t bNumDeviceCaps ;
246+ };
247+
248+ typedef __code const struct usb_desc_binary_object_store
249+ usb_binary_object_store_c ;
250+
235251#endif
Original file line number Diff line number Diff line change @@ -213,6 +213,22 @@ void usb_serve_descriptor(usb_descriptor_set_c *set,
213213 * buf ++ = 0 ;
214214 scratch [0 ] += 2 ;
215215 }
216+ } else if (type == USB_DESC_BINARY_OBJECT_STORE && index == 0 ) {
217+ __xdata struct usb_desc_binary_object_store * bos_desc =
218+ (__xdata struct usb_desc_binary_object_store * )buf ;
219+ bos_desc -> bLength = sizeof (struct usb_desc_binary_object_store );
220+ bos_desc -> bDescriptorType = USB_DESC_BINARY_OBJECT_STORE ;
221+ // bos_desc->wTotalLength filled in later
222+ bos_desc -> bNumDeviceCaps = set -> capability_count ;
223+ buf += bos_desc -> bLength ;
224+ __code const struct usb_desc_generic * dev_cap_desc =
225+ (__code const struct usb_desc_generic * )& set -> capabilities [1 ];
226+ for (uint8_t i = 0 ; i < set -> capability_count ; i ++ ) {
227+ APPEND (dev_cap_desc ++ );
228+ }
229+ bos_desc -> wTotalLength = buf - scratch ;
230+ SETUP_EP0_IN_DATA (scratch , bos_desc -> wTotalLength );
231+ return ;
216232 } else {
217233 STALL_EP0 ();
218234 return ;
You can’t perform that action at this time.
0 commit comments