From a7a4c085894f6edf8a5a5ac2e947925109eb9b79 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 20 Jan 2020 14:20:30 +1100 Subject: [PATCH] HAL_ChibiOS: fixes for build with master ChibiOS --- libraries/AP_HAL_ChibiOS/RCOutput.cpp | 2 +- .../AP_HAL_ChibiOS/hwdef/common/chconf.h | 35 ++++++++++++++++++- .../hwdef/common/chibios_board.mk | 2 +- .../AP_HAL_ChibiOS/hwdef/common/common.ld | 18 +++++----- .../AP_HAL_ChibiOS/hwdef/common/halconf.h | 10 +++++- 5 files changed, 54 insertions(+), 13 deletions(-) diff --git a/libraries/AP_HAL_ChibiOS/RCOutput.cpp b/libraries/AP_HAL_ChibiOS/RCOutput.cpp index 49c7924656..c3873acac2 100644 --- a/libraries/AP_HAL_ChibiOS/RCOutput.cpp +++ b/libraries/AP_HAL_ChibiOS/RCOutput.cpp @@ -1336,7 +1336,7 @@ bool RCOutput::serial_write_bytes(const uint8_t *bytes, uint16_t len) */ void RCOutput::serial_bit_irq(void) { - systime_t now = chVTGetSystemTimeX(); + systime_t now = AP_HAL::micros(); uint8_t bit = palReadLine(irq.line); bool send_signal = false; diff --git a/libraries/AP_HAL_ChibiOS/hwdef/common/chconf.h b/libraries/AP_HAL_ChibiOS/hwdef/common/chconf.h index c7497d1239..ca7b588a5e 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/common/chconf.h +++ b/libraries/AP_HAL_ChibiOS/hwdef/common/chconf.h @@ -31,7 +31,7 @@ #include "hwdef.h" #define _CHIBIOS_RT_CONF_ -#define _CHIBIOS_RT_CONF_VER_6_0_ +#define _CHIBIOS_RT_CONF_VER_6_1_ /*===========================================================================*/ /** * @name System timers settings @@ -410,6 +410,39 @@ #define CH_CFG_USE_PIPES FALSE #endif +/** + * @brief Objects Caches APIs. + * @details If enabled then the objects caches APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#if !defined(CH_CFG_USE_OBJ_CACHES) +#define CH_CFG_USE_OBJ_CACHES TRUE +#endif + +/** + * @brief Delegate threads APIs. + * @details If enabled then the delegate threads APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#if !defined(CH_CFG_USE_DELEGATES) +#define CH_CFG_USE_DELEGATES TRUE +#endif + +/** + * @brief Jobs Queues APIs. + * @details If enabled then the jobs queues APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#if !defined(CH_CFG_USE_JOBS) +#define CH_CFG_USE_JOBS TRUE +#endif + /** * @brief Dynamic Threads APIs. * @details If enabled then the dynamic threads creation APIs are included diff --git a/libraries/AP_HAL_ChibiOS/hwdef/common/chibios_board.mk b/libraries/AP_HAL_ChibiOS/hwdef/common/chibios_board.mk index ea788a0c0c..ac2f2485ac 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/common/chibios_board.mk +++ b/libraries/AP_HAL_ChibiOS/hwdef/common/chibios_board.mk @@ -96,7 +96,7 @@ include $(CHIBIOS)/$(CHIBIOS_STARTUP_MK) # HAL-OSAL files (optional). include $(CHIBIOS)/os/hal/hal.mk include $(CHIBIOS)/$(CHIBIOS_PLATFORM_MK) -include $(CHIBIOS)/os/hal/osal/rt/osal.mk +include $(CHIBIOS)/os/hal/osal/rt-nil/osal.mk # RTOS files (optional). include $(CHIBIOS)/os/rt/rt.mk include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk diff --git a/libraries/AP_HAL_ChibiOS/hwdef/common/common.ld b/libraries/AP_HAL_ChibiOS/hwdef/common/common.ld index bdabc12869..a95325523c 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/common/common.ld +++ b/libraries/AP_HAL_ChibiOS/hwdef/common/common.ld @@ -54,18 +54,18 @@ SECTIONS constructors : ALIGN(4) SUBALIGN(4) { - __init_array_start = .; + __init_array_base__ = .; KEEP(*(SORT(.init_array.*))) KEEP(*(.init_array)) - __init_array_end = .; + __init_array_end__ = .; } > flash destructors : ALIGN(4) SUBALIGN(4) { - __fini_array_start = .; + __fini_array_base__ = .; KEEP(*(.fini_array)) KEEP(*(SORT(.fini_array.*))) - __fini_array_end = .; + __fini_array_end__ = .; } > flash .text : ALIGN(4) SUBALIGN(4) @@ -138,25 +138,25 @@ SECTIONS . = ALIGN(4); PROVIDE(_textdata = LOADADDR(.data)); PROVIDE(_data = .); - _textdata_start = LOADADDR(.data); - _data_start = .; + __textdata_base__ = LOADADDR(.data); + __data_base__ = .; *(.data) *(.data.*) *(.ramtext) . = ALIGN(4); PROVIDE(_edata = .); - _data_end = .; + __data_end__ = .; } > DATA_RAM AT > flash .bss (NOLOAD) : ALIGN(4) { . = ALIGN(4); - _bss_start = .; + __bss_base__ = .; *(.bss) *(.bss.*) *(COMMON) . = ALIGN(4); - _bss_end = .; + __bss_end__ = .; PROVIDE(end = .); } > BSS_RAM diff --git a/libraries/AP_HAL_ChibiOS/hwdef/common/halconf.h b/libraries/AP_HAL_ChibiOS/hwdef/common/halconf.h index 538f2100a7..85656700ed 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/common/halconf.h +++ b/libraries/AP_HAL_ChibiOS/hwdef/common/halconf.h @@ -43,7 +43,8 @@ #pragma once #define _CHIBIOS_HAL_CONF_ -#define _CHIBIOS_HAL_CONF_VER_7_0_ +#define _CHIBIOS_HAL_CONF_VER_7_1_ + #include "mcuconf.h" /** @@ -81,6 +82,13 @@ #define HAL_USE_DAC FALSE #endif +/** + * @brief Enables the EFlash subsystem. + */ +#if !defined(HAL_USE_EFL) || defined(__DOXYGEN__) +#define HAL_USE_EFL FALSE +#endif + /** * @brief Enables the GPT subsystem. We don't need it on most boards * in ArduPilot, so it is disabled by default