Merge pull request #500 from btashton/update_libopencm3

Target latest libopencm3 version
This commit is contained in:
UweBonnes 2019-08-15 10:16:13 +02:00 committed by GitHub
commit e52e2f56c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 33 additions and 36 deletions

@ -1 +1 @@
Subproject commit db7a8d71ca30dd9ce7947aa036897b910bdc4ad2
Subproject commit 3eff201a4bb3759a9c967a6f5e3fd0aad46dc5af

View File

@ -419,7 +419,7 @@ static void dfu_detach_complete(usbd_device *dev, struct usb_setup_data *req)
scb_reset_core();
}
static int cdcacm_control_request(usbd_device *dev,
static enum usbd_request_return_codes cdcacm_control_request(usbd_device *dev,
struct usb_setup_data *req, uint8_t **buf, uint16_t *len,
void (**complete)(usbd_device *dev, struct usb_setup_data *req))
{
@ -433,23 +433,23 @@ static int cdcacm_control_request(usbd_device *dev,
cdcacm_set_modem_state(dev, req->wIndex, true, true);
/* Ignore if not for GDB interface */
if(req->wIndex != 0)
return 1;
return USBD_REQ_HANDLED;
cdcacm_gdb_dtr = req->wValue & 1;
return 1;
return USBD_REQ_HANDLED;
case USB_CDC_REQ_SET_LINE_CODING:
if(*len < sizeof(struct usb_cdc_line_coding))
return 0;
return USBD_REQ_NOTSUPP;
switch(req->wIndex) {
case 2:
usbuart_set_line_coding((struct usb_cdc_line_coding*)*buf);
return 1;
return USBD_REQ_HANDLED;
case 0:
return 1; /* Ignore on GDB Port */
return USBD_REQ_HANDLED; /* Ignore on GDB Port */
default:
return 0;
return USBD_REQ_NOTSUPP;
}
case DFU_GETSTATUS:
if(req->wIndex == DFU_IF_NO) {
@ -461,17 +461,17 @@ static int cdcacm_control_request(usbd_device *dev,
(*buf)[5] = 0; /* iString not used here */
*len = 6;
return 1;
return USBD_REQ_HANDLED;
}
return 0;
return USBD_REQ_NOTSUPP;
case DFU_DETACH:
if(req->wIndex == DFU_IF_NO) {
*complete = dfu_detach_complete;
return 1;
return USBD_REQ_HANDLED;
}
return 0;
return USBD_REQ_NOTSUPP;
}
return 0;
return USBD_REQ_NOTSUPP;
}
int cdcacm_get_config(void)

View File

@ -62,7 +62,7 @@ void platform_init(void)
scb_reset_core();
}
rcc_clock_setup_hse_3v3(&rcc_hse_8mhz_3v3[RCC_CLOCK_3V3_48MHZ]);
rcc_clock_setup_pll(&rcc_hse_8mhz_3v3[RCC_CLOCK_3V3_168MHZ]);
/* Enable peripherals */
rcc_periph_clock_enable(RCC_OTGFS);

View File

@ -46,7 +46,7 @@ void platform_init(void)
scb_reset_core();
}
rcc_clock_setup_hse_3v3(&rcc_hse_8mhz_3v3[RCC_CLOCK_3V3_48MHZ]);
rcc_clock_setup_pll(&rcc_hse_8mhz_3v3[RCC_CLOCK_3V3_168MHZ]);
/* Enable peripherals */
rcc_peripheral_enable_clock(&RCC_AHB2ENR, RCC_AHB2ENR_OTGFSEN);

View File

@ -68,7 +68,7 @@ extern uint8_t running_status;
gpio_set_output_config(SWDIO_PORT, GPIO_OTYPE_PP, GPIO_DRIVE_2MA, SWDIO_PIN); \
}
extern usbd_driver lm4f_usb_driver;
extern const usbd_driver lm4f_usb_driver;
#define USB_DRIVER lm4f_usb_driver
#define USB_IRQ NVIC_USB0_IRQ
#define USB_ISR usb0_isr

View File

@ -25,5 +25,5 @@ MEMORY
}
/* Include the common ld script from libopenstm32. */
INCLUDE libopencm3_stm32f1.ld
INCLUDE cortex-m-generic.ld

View File

@ -198,20 +198,20 @@ usbdfu_getstatus_complete(usbd_device *dev, struct usb_setup_data *req)
}
}
static int usbdfu_control_request(usbd_device *dev,
static enum usbd_request_return_codes usbdfu_control_request(usbd_device *dev,
struct usb_setup_data *req, uint8_t **buf, uint16_t *len,
void (**complete)(usbd_device *dev, struct usb_setup_data *req))
{
(void)dev;
if((req->bmRequestType & 0x7F) != 0x21)
return 0; /* Only accept class request */
return USBD_REQ_NOTSUPP; /* Only accept class request */
switch(req->bRequest) {
case DFU_DNLOAD:
if((len == NULL) || (*len == 0)) {
usbdfu_state = STATE_DFU_MANIFEST_SYNC;
return 1;
return USBD_REQ_HANDLED;
} else {
/* Copy download data for use on GET_STATUS */
prog.blocknum = req->wValue;
@ -222,22 +222,22 @@ static int usbdfu_control_request(usbd_device *dev,
if ((addr < app_address) || (addr >= max_address)) {
current_error = DFU_STATUS_ERR_TARGET;
usbdfu_state = STATE_DFU_ERROR;
return 1;
return USBD_REQ_HANDLED;
} else
prog.addr = addr;
}
usbdfu_state = STATE_DFU_DNLOAD_SYNC;
return 1;
return USBD_REQ_HANDLED;
}
case DFU_CLRSTATUS:
/* Clear error and return to dfuIDLE */
if(usbdfu_state == STATE_DFU_ERROR)
usbdfu_state = STATE_DFU_IDLE;
return 1;
return USBD_REQ_HANDLED;
case DFU_ABORT:
/* Abort returns to dfuIDLE state */
usbdfu_state = STATE_DFU_IDLE;
return 1;
return USBD_REQ_HANDLED;
case DFU_UPLOAD:
if ((usbdfu_state == STATE_DFU_IDLE) ||
(usbdfu_state == STATE_DFU_DNLOAD_IDLE) ||
@ -250,10 +250,10 @@ static int usbdfu_control_request(usbd_device *dev,
dfu_function.wTransferSize);
memcpy(*buf, (void*)baseaddr, *len);
}
return 1;
return USBD_REQ_HANDLED;
} else {
usbd_ep_stall_set(dev, 0, 1);
return 0;
return USBD_REQ_NOTSUPP;
}
case DFU_GETSTATUS: {
uint32_t bwPollTimeout = 0; /* 24-bit integer in DFU class spec */
@ -268,16 +268,16 @@ static int usbdfu_control_request(usbd_device *dev,
*complete = usbdfu_getstatus_complete;
return 1;
return USBD_REQ_HANDLED;
}
case DFU_GETSTATE:
/* Return state with no state transision */
*buf[0] = usbdfu_state;
*len = 1;
return 1;
return USBD_REQ_HANDLED;
}
return 0;
return USBD_REQ_NOTSUPP;
}
void dfu_init(const usbd_driver *driver, dfu_mode_t mode)

View File

@ -25,5 +25,5 @@ MEMORY
}
/* Include the common ld script from libopenstm32. */
INCLUDE libopencm3_stm32f4.ld
INCLUDE cortex-m-generic.ld

View File

@ -25,4 +25,4 @@ MEMORY
}
/* Include the common ld script from libopenstm32. */
INCLUDE libopencm3_stm32f1.ld
INCLUDE cortex-m-generic.ld

View File

@ -25,4 +25,4 @@ MEMORY
}
/* Include the common ld script from libopenstm32. */
INCLUDE libopencm3_stm32f1.ld
INCLUDE cortex-m-generic.ld

View File

@ -42,8 +42,6 @@ void traceswo_init(void)
{
TRACE_TIM_CLK_EN();
timer_reset(TRACE_TIM);
/* Refer to ST doc RM0008 - STM32F10xx Reference Manual.
* Section 14.3.4 - 14.3.6 (General Purpose Timer - Input Capture)
*

View File

@ -68,7 +68,6 @@ void usbuart_init(void)
/* Setup timer for running deferred FIFO processing */
USBUSART_TIM_CLK_EN();
timer_reset(USBUSART_TIM);
timer_set_mode(USBUSART_TIM, TIM_CR1_CKD_CK_INT,
TIM_CR1_CMS_EDGE, TIM_CR1_DIR_UP);
timer_set_prescaler(USBUSART_TIM,

View File

@ -25,5 +25,5 @@ MEMORY
}
/* Include the common ld script from libopenstm32. */
INCLUDE libopencm3_lm4f.ld
INCLUDE cortex-m-generic.ld