diff --git a/libraries/AP_HAL_ChibiOS/hwdef/common/chibios_board.mk b/libraries/AP_HAL_ChibiOS/hwdef/common/chibios_board.mk index ec91d0a5df..50589311c2 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/common/chibios_board.mk +++ b/libraries/AP_HAL_ChibiOS/hwdef/common/chibios_board.mk @@ -51,6 +51,7 @@ endif ifeq ($(USE_FATFS),) USE_FATFS = yes + FATFS_FLAGS=-DUSE_FATFS endif # @@ -102,9 +103,9 @@ include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk # Other files (optional). #include $(CHIBIOS)/test/rt/test.mk include $(CHIBIOS)/os/hal/lib/streams/streams.mk -include $(CHIBIOS)/os/various/cpp_wrappers/chcpp.mk ifeq ($(USE_FATFS),yes) +include $(CHIBIOS)/os/various/cpp_wrappers/chcpp.mk include $(CHIBIOS)/os/various/fatfs_bindings/fatfs.mk endif @@ -218,7 +219,7 @@ CPPWARN = -Wall -Wextra -Wundef # # List all user C define here, like -D_DEBUG=1 -UDEFS = +UDEFS = $(FATFS_FLAGS) # Define ASM defines here UADEFS = diff --git a/libraries/AP_HAL_ChibiOS/hwdef/common/malloc.c b/libraries/AP_HAL_ChibiOS/hwdef/common/malloc.c index 9433ed86b9..ae692e41e5 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/common/malloc.c +++ b/libraries/AP_HAL_ChibiOS/hwdef/common/malloc.c @@ -52,6 +52,8 @@ void *malloc_ccm(size_t size) if (p != NULL) { memset(p, 0, size); } +#else + (void)size; #endif return p; } diff --git a/libraries/AP_HAL_ChibiOS/hwdef/common/stdio.c b/libraries/AP_HAL_ChibiOS/hwdef/common/stdio.c index 0abc5c1293..55ec54116c 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/common/stdio.c +++ b/libraries/AP_HAL_ChibiOS/hwdef/common/stdio.c @@ -227,6 +227,7 @@ atob(uint32_t *vp, char *p, int base) } +#if HAL_OS_FATFS_IO /* * vsscanf(buf,fmt,ap) */ @@ -343,3 +344,4 @@ static int vfscanf (FILE *stream, const char *fmt, va_list ap) count = vsscanf (buf, fmt, ap); return (count); } +#endif // HAL_OS_FATFS_IO diff --git a/libraries/AP_HAL_ChibiOS/hwdef/common/stdio.h b/libraries/AP_HAL_ChibiOS/hwdef/common/stdio.h index 352fcd8123..5664d03fcd 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/common/stdio.h +++ b/libraries/AP_HAL_ChibiOS/hwdef/common/stdio.h @@ -27,7 +27,9 @@ int vasprintf(char **strp, const char *fmt, va_list ap); int asprintf(char **strp, const char *fmt, ...); int vprintf(const char *fmt, va_list arg); int printf(const char *fmt, ...); +#if defined(USE_FATFS) || (defined(HAL_OS_FATFS_IO) && HAL_OS_FATFS_IO) int fscanf ( FILE * stream, const char * format, ... ); +#endif int scanf (const char *fmt, ...); int sscanf (const char *buf, const char *fmt, ...);