AP_HAL_ChibiOS: removed heap APIs

This commit is contained in:
Andrew Tridgell 2024-11-18 09:50:55 +11:00
parent 5413e73c8b
commit 919c0817f4
2 changed files with 0 additions and 44 deletions

View File

@ -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

View File

@ -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");