diff --git a/libraries/AP_HAL_ChibiOS/hwdef/common/board.c b/libraries/AP_HAL_ChibiOS/hwdef/common/board.c index b78cb68e9f..e1fffde4c9 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/common/board.c +++ b/libraries/AP_HAL_ChibiOS/hwdef/common/board.c @@ -16,6 +16,7 @@ */ #include "hal.h" +#include "usbcfg.h" #if HAL_USE_PAL || defined(__DOXYGEN__) /** diff --git a/libraries/AP_HAL_ChibiOS/hwdef/common/stdio.c b/libraries/AP_HAL_ChibiOS/hwdef/common/stdio.c index 55ec54116c..e823b5522d 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/common/stdio.c +++ b/libraries/AP_HAL_ChibiOS/hwdef/common/stdio.c @@ -28,6 +28,7 @@ #include #include #include +#include "stdio.h" int vsnprintf(char *str, size_t size, const char *fmt, va_list ap) { @@ -116,6 +117,7 @@ int printf(const char *fmt, ...) int scanf (const char *fmt, ...) { + (void)fmt; return 0; } /* @@ -170,7 +172,7 @@ _atob (uint32_t *vp, char *p, int base) } if (base == 16 && (q = strchr (p, '.')) != 0) { - if (q - p > sizeof(tmp) - 1) + if ((unsigned)(q - p) > (unsigned)(sizeof(tmp) - 1)) return (0); strncpy (tmp, p, q - p); @@ -227,7 +229,7 @@ atob(uint32_t *vp, char *p, int base) } -#if HAL_OS_FATFS_IO +#if defined(HAL_OS_FATFS_IO) && HAL_OS_FATFS_IO /* * vsscanf(buf,fmt,ap) */ diff --git a/libraries/AP_HAL_ChibiOS/hwdef/common/usbcfg.c b/libraries/AP_HAL_ChibiOS/hwdef/common/usbcfg.c index 989cb2ea36..27cb503c23 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/common/usbcfg.c +++ b/libraries/AP_HAL_ChibiOS/hwdef/common/usbcfg.c @@ -167,39 +167,6 @@ static const uint8_t vcom_string0[] = { USB_DESC_WORD(0x0409) /* wLANGID (U.S. English). */ }; -/* - * Vendor string. - */ -static const uint8_t vcom_string1[] = { - USB_DESC_BYTE(20), /* bLength. */ - USB_DESC_BYTE(USB_DESCRIPTOR_STRING), /* bDescriptorType. */ - 'A', 0, 'r', 0, 'd', 0, 'u', 0, 'P', 0, 'i', 0, 'l', 0, 'o', 0, - 't', 0 -}; - -/* - * Device Description string. - */ -static const uint8_t vcom_string2[] = { - USB_DESC_BYTE(56), /* bLength. */ - USB_DESC_BYTE(USB_DESCRIPTOR_STRING), /* bDescriptorType. */ - 'C', 0, 'h', 0, 'i', 0, 'b', 0, 'i', 0, 'O', 0, 'S', 0, '/', 0, - 'R', 0, 'T', 0, ' ', 0, 'V', 0, 'i', 0, 'r', 0, 't', 0, 'u', 0, - 'a', 0, 'l', 0, ' ', 0, 'C', 0, 'O', 0, 'M', 0, ' ', 0, 'P', 0, - 'o', 0, 'r', 0, 't', 0 -}; - -/* - * Serial Number string. - */ -static const uint8_t vcom_string3[] = { - USB_DESC_BYTE(8), /* bLength. */ - USB_DESC_BYTE(USB_DESCRIPTOR_STRING), /* bDescriptorType. */ - '0' + CH_KERNEL_MAJOR, 0, - '0' + CH_KERNEL_MINOR, 0, - '0' + CH_KERNEL_PATCH, 0 -}; - /* * Strings wrappers array. The strings are created dynamically to * allow them to be setup with apj_tool diff --git a/libraries/AP_HAL_ChibiOS/hwdef/common/usbcfg.h b/libraries/AP_HAL_ChibiOS/hwdef/common/usbcfg.h index 35ff134d9b..3deb5d599e 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/common/usbcfg.h +++ b/libraries/AP_HAL_ChibiOS/hwdef/common/usbcfg.h @@ -33,4 +33,7 @@ extern const USBConfig usbcfg; extern SerialUSBConfig serusbcfg; extern SerialUSBDriver SDU1; #endif -/** @} */ \ No newline at end of file + +void setup_usb_strings(void); + +/** @} */ diff --git a/libraries/AP_HAL_ChibiOS/system.cpp b/libraries/AP_HAL_ChibiOS/system.cpp index da381374ce..23f5605f1c 100644 --- a/libraries/AP_HAL_ChibiOS/system.cpp +++ b/libraries/AP_HAL_ChibiOS/system.cpp @@ -38,10 +38,13 @@ typedef enum { void *__dso_handle; +void __cxa_pure_virtual(void); void __cxa_pure_virtual() { while (1); } //TODO: Handle properly, maybe generate a traceback +void NMI_Handler(void); void NMI_Handler(void) { while (1); } +void HardFault_Handler(void); void HardFault_Handler(void) { //Copy to local variables (not pointers) to allow GDB "i loc" to directly show the info //Get thread context. Contains main registers including PC and LR @@ -72,6 +75,7 @@ void HardFault_Handler(void) { void BusFault_Handler(void) __attribute__((alias("HardFault_Handler"))); +void UsageFault_Handler(void); void UsageFault_Handler(void) { //Copy to local variables (not pointers) to allow GDB "i loc" to directly show the info //Get thread context. Contains main registers including PC and LR @@ -99,6 +103,7 @@ void UsageFault_Handler(void) { while(1) {} } +void MemManage_Handler(void); void MemManage_Handler(void) { //Copy to local variables (not pointers) to allow GDB "i loc" to directly show the info //Get thread context. Contains main registers including PC and LR