diff --git a/libraries/AP_HAL_ChibiOS/Device.cpp b/libraries/AP_HAL_ChibiOS/Device.cpp index 7e8f5f8d43..4c51a5efe9 100644 --- a/libraries/AP_HAL_ChibiOS/Device.cpp +++ b/libraries/AP_HAL_ChibiOS/Device.cpp @@ -89,6 +89,7 @@ void DeviceBus::bus_thread(void *arg) return; } +#if CH_CFG_USE_HEAP == TRUE AP_HAL::Device::PeriodicHandle DeviceBus::register_periodic_callback(uint32_t period_usec, AP_HAL::Device::PeriodicCb cb, AP_HAL::Device *_hal_device) { if (!thread_started) { @@ -133,6 +134,7 @@ AP_HAL::Device::PeriodicHandle DeviceBus::register_periodic_callback(uint32_t pe return callback; } +#endif // CH_CFG_USE_HEAP /* * Adjust the timer for the next call: it needs to be called from the bus diff --git a/libraries/AP_HAL_ChibiOS/hwdef/common/malloc.c b/libraries/AP_HAL_ChibiOS/hwdef/common/malloc.c index cb11620198..626c510ef1 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/common/malloc.c +++ b/libraries/AP_HAL_ChibiOS/hwdef/common/malloc.c @@ -31,6 +31,8 @@ #include #include "stm32_util.h" +#if CH_CFG_USE_HEAP == TRUE + #define MIN_ALIGNMENT 8 #if defined(CCM_RAM_SIZE_KB) @@ -161,3 +163,5 @@ size_t mem_available(void) return totalp; } + +#endif // CH_CFG_USE_HEAP diff --git a/libraries/AP_HAL_ChibiOS/shared_dma.cpp b/libraries/AP_HAL_ChibiOS/shared_dma.cpp index 59669a0755..e51a9a2676 100644 --- a/libraries/AP_HAL_ChibiOS/shared_dma.cpp +++ b/libraries/AP_HAL_ChibiOS/shared_dma.cpp @@ -20,6 +20,8 @@ code to handle sharing of DMA channels between peripherals */ +#if CH_CFG_USE_SEMAPHORES == TRUE + using namespace ChibiOS; Shared_DMA::dma_lock Shared_DMA::locks[SHARED_DMA_MAX_STREAM_ID]; @@ -183,3 +185,5 @@ void Shared_DMA::lock_all(void) chBSemWait(&locks[i].semaphore); } } + +#endif // CH_CFG_USE_SEMAPHORES diff --git a/libraries/AP_HAL_ChibiOS/shared_dma.h b/libraries/AP_HAL_ChibiOS/shared_dma.h index 59f42ea8d7..6f1b72171e 100644 --- a/libraries/AP_HAL_ChibiOS/shared_dma.h +++ b/libraries/AP_HAL_ChibiOS/shared_dma.h @@ -81,7 +81,9 @@ private: static struct dma_lock { // semaphore to ensure only one peripheral uses a DMA channel at a time +#if CH_CFG_USE_SEMAPHORES == TRUE binary_semaphore_t semaphore; +#endif // CH_CFG_USE_SEMAPHORES // a de-allocation function that is called to release an existing user dma_deallocate_fn_t deallocate; @@ -90,3 +92,4 @@ private: Shared_DMA *obj; } locks[SHARED_DMA_MAX_STREAM_ID]; }; +