Skip to content

Commit 6c2455f

Browse files
committed
stmhal: Put an array in ROM.
1 parent fdbc22e commit 6c2455f

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

stmhal/usb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void pyb_usb_dev_init(int usb_dev_type) {
3636
// so the memory is invalid after a soft reset (which resets the GC).
3737
USBD_Init(&hUSBDDevice, &VCP_Desc, 0);
3838
USBD_RegisterClass(&hUSBDDevice, &USBD_CDC);
39-
USBD_CDC_RegisterInterface(&hUSBDDevice, &USBD_CDC_fops);
39+
USBD_CDC_RegisterInterface(&hUSBDDevice, (USBD_CDC_ItfTypeDef*)&USBD_CDC_fops);
4040
USBD_Start(&hUSBDDevice);
4141
//USBD_Init(&USB_OTG_Core, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_PYB_cb, &USR_cb);
4242
break;

stmhal/usbd_cdc_interface.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,11 @@ static void Error_Handler(void);
7676
//static void ComPort_Config(void);
7777
static void TIM_Config(void);
7878

79-
USBD_CDC_ItfTypeDef USBD_CDC_fops =
80-
{
81-
CDC_Itf_Init,
82-
CDC_Itf_DeInit,
83-
CDC_Itf_Control,
84-
CDC_Itf_Receive
79+
const USBD_CDC_ItfTypeDef USBD_CDC_fops = {
80+
CDC_Itf_Init,
81+
CDC_Itf_DeInit,
82+
CDC_Itf_Control,
83+
CDC_Itf_Receive
8584
};
8685

8786
/* Private functions ---------------------------------------------------------*/

stmhal/usbd_cdc_interface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
The period depends on USBD_CDC_POLLING_INTERVAL */
4848
#define USBD_CDC_POLLING_INTERVAL 10 /* in ms. The max is 65 and the min is 1 */
4949

50-
extern USBD_CDC_ItfTypeDef USBD_CDC_fops;
50+
extern const USBD_CDC_ItfTypeDef USBD_CDC_fops;
5151

5252
void USBD_CDC_SetInterrupt(int chr, void *data);
5353
void USBD_CDC_Tx(const char *str, uint32_t len);

0 commit comments

Comments
 (0)