From f8f883baca629904ddadeb8cf3080116a8bc30ae Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 18 Nov 2024 09:50:55 +1100 Subject: [PATCH] AP_HAL_ChibiOS: removed heap APIs --- libraries/AP_HAL_ChibiOS/Util.cpp | 35 ------------------------------- libraries/AP_HAL_ChibiOS/Util.h | 9 -------- 2 files changed, 44 deletions(-) diff --git a/libraries/AP_HAL_ChibiOS/Util.cpp b/libraries/AP_HAL_ChibiOS/Util.cpp index aeec5aed47..1012216b02 100644 --- a/libraries/AP_HAL_ChibiOS/Util.cpp +++ b/libraries/AP_HAL_ChibiOS/Util.cpp @@ -97,41 +97,6 @@ void Util::free_type(void *ptr, size_t size, AP_HAL::Util::Memory_Type mem_type) #if ENABLE_HEAP -/* - heap functions used by lua scripting - */ -void *Util::heap_create(uint32_t size) -{ - memory_heap_t *heap = (memory_heap_t *)malloc(size + sizeof(memory_heap_t)); - if (heap == nullptr) { - return nullptr; - } - chHeapObjectInit(heap, heap + 1U, size); - return heap; -} - -void Util::heap_destroy(void *ptr) -{ - free(ptr); -} - -void *Util::heap_allocate(void *heap, uint32_t size) -{ - if (heap == nullptr) { - return nullptr; - } - if (size == 0) { - return nullptr; - } - return chHeapAlloc((memory_heap_t *)heap, size); -} - -void Util::heap_free(void *ptr) -{ - return chHeapFree(ptr); -} - - /* realloc implementation thanks to wolfssl, used by ExpandingString and ExpandingArray diff --git a/libraries/AP_HAL_ChibiOS/Util.h b/libraries/AP_HAL_ChibiOS/Util.h index 9fae8f9490..5ff46016e7 100644 --- a/libraries/AP_HAL_ChibiOS/Util.h +++ b/libraries/AP_HAL_ChibiOS/Util.h @@ -49,11 +49,6 @@ public: void free_type(void *ptr, size_t size, AP_HAL::Util::Memory_Type mem_type) override; #if ENABLE_HEAP - // heap functions for scripting support - void *heap_create(uint32_t size) override; - void heap_destroy(void *p) override; - void *heap_allocate(void *heap, uint32_t size) override; - void heap_free(void *ptr) override; void *std_realloc(void *ptr, uint32_t new_size) override; #endif // ENABLE_HEAP @@ -144,10 +139,6 @@ private: FlashBootloader flash_bootloader() override; #endif -#if ENABLE_HEAP - static memory_heap_t scripting_heap; -#endif // ENABLE_HEAP - // stm32F4 and F7 have 20 total RTC backup registers. We use the first one for boot type // flags, so 19 available for persistent data static_assert(sizeof(persistent_data) <= 19*4, "watchdog persistent data too large");