Commit 82c7b1b1 authored by Damien George's avatar Damien George
Browse files

stmhal: Put a USB structure in ROM; GC doesn't scan the data segment.

parent b14f2a0b
......@@ -21,10 +21,9 @@ void gc_collect(void) {
// start the GC
// scan everything in RAM before the heap
// this includes the data and bss segments
// TODO possibly don't need to scan data, since all pointers should start out NULL and be in bss
gc_collect_root((void**)&_ram_start, ((uint32_t)&_ebss - (uint32_t)&_ram_start) / sizeof(uint32_t));
// We need to scan everything in RAM that can hold a pointer.
// The data segment is used, but should not contain pointers, so we just scan the bss.
gc_collect_root((void**)&_sbss, ((uint32_t)&_ebss - (uint32_t)&_sbss) / sizeof(uint32_t));
// get the registers and the sp
machine_uint_t regs[10];
......@@ -28,7 +28,7 @@ void pyb_usb_dev_init(usb_device_mode_t mode, usb_storage_medium_t medium) {
} else {
USBD_Init(&hUSBDDevice, &VCP_Desc, 0);
USBD_Init(&hUSBDDevice, (USBD_DescriptorsTypeDef*)&VCP_Desc, 0);
USBD_RegisterClass(&hUSBDDevice, &USBD_CDC_MSC_HID);
USBD_CDC_RegisterInterface(&hUSBDDevice, (USBD_CDC_ItfTypeDef*)&USBD_CDC_fops);
extern USBD_DescriptorsTypeDef VCP_Desc;
extern USBD_DescriptorsTypeDef MSC_Desc;
extern const USBD_DescriptorsTypeDef VCP_Desc;
......@@ -59,7 +59,7 @@ uint8_t *USBD_VCP_USRStringDesc (USBD_SpeedTypeDef speed, uint8_t idx, uint16_t
/* Private variables ---------------------------------------------------------*/
USBD_DescriptorsTypeDef VCP_Desc = {
const USBD_DescriptorsTypeDef VCP_Desc = {
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment