From 0ffe2e75bee81f40349ebc188b29be864d376870 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 3 Aug 2019 21:08:40 +1000 Subject: [PATCH] HAL_ChibiOS: fixed warnings --- libraries/AP_HAL_ChibiOS/hwdef/common/flash.c | 3 +- libraries/AP_HAL_ChibiOS/stdio.cpp | 95 ------------------- 2 files changed, 2 insertions(+), 96 deletions(-) diff --git a/libraries/AP_HAL_ChibiOS/hwdef/common/flash.c b/libraries/AP_HAL_ChibiOS/hwdef/common/flash.c index a2bf6572a7..02852873e0 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/common/flash.c +++ b/libraries/AP_HAL_ChibiOS/hwdef/common/flash.c @@ -51,6 +51,7 @@ #include "flash.h" #include "hal.h" #include +#include "stm32_util.h" // #pragma GCC optimize("O0") @@ -379,7 +380,7 @@ bool stm32_flash_erasepage(uint32_t page) stm32_flash_wait_idle(); - stm32_cacheBufferInvalidate(stm32_flash_getpageaddr(page), stm32_flash_getpagesize(page)); + stm32_cacheBufferInvalidate((void*)stm32_flash_getpageaddr(page), stm32_flash_getpagesize(page)); stm32_flash_lock(); #if STM32_FLASH_DISABLE_ISR diff --git a/libraries/AP_HAL_ChibiOS/stdio.cpp b/libraries/AP_HAL_ChibiOS/stdio.cpp index 830c4f8de7..0a4154ff39 100644 --- a/libraries/AP_HAL_ChibiOS/stdio.cpp +++ b/libraries/AP_HAL_ChibiOS/stdio.cpp @@ -119,98 +119,3 @@ __wrap_sscanf (const char *buf, const char *fmt, ...) va_end (ap); return (count); } - -#if defined(HAL_OS_FATFS_IO) && HAL_OS_FATFS_IO -static char * -_getbase(char *p, int *basep) -{ - if (p[0] == '0') { - switch (p[1]) { - case 'x': - *basep = 16; - break; - case 't': case 'n': - *basep = 10; - break; - case 'o': - *basep = 8; - break; - default: - *basep = 10; - return (p); - } - return (p + 2); - } - *basep = 10; - return (p); -} - -static int16_t -_atob (uint32_t *vp, char *p, int base) -{ - uint32_t value, v1, v2; - char *q, tmp[20]; - int digit; - - if (p[0] == '0' && (p[1] == 'x' || p[1] == 'X')) { - base = 16; - p += 2; - } - - if (base == 16 && (q = strchr (p, '.')) != 0) { - if ((unsigned)(q - p) > (unsigned)(sizeof(tmp) - 1)) - return (0); - - strncpy (tmp, p, q - p); - tmp[q - p] = '\0'; - if (!_atob (&v1, tmp, 16)) - return (0); - - q++; - if (strchr (q, '.')) - return (0); - - if (!_atob (&v2, q, 16)) - return (0); - *vp = (v1 << 16) + v2; - return (1); - } - - value = *vp = 0; - for (; *p; p++) { - if (*p >= '0' && *p <= '9') - digit = *p - '0'; - else if (*p >= 'a' && *p <= 'f') - digit = *p - 'a' + 10; - else if (*p >= 'A' && *p <= 'F') - digit = *p - 'A' + 10; - else - return (0); - - if (digit >= base) - return (0); - value *= base; - value += digit; - } - *vp = value; - return (1); -} - -/* - * atob(vp,p,base) - * converts p to binary result in vp, rtn 1 on success - */ -static int16_t atob(uint32_t *vp, char *p, int base) -{ - uint32_t v; - - if (base == 0) - p = _getbase (p, &base); - if (_atob (&v, p, base)) { - *vp = v; - return (1); - } - return (0); -} - -