mirror of https://github.com/ArduPilot/ardupilot
AP_HAL_ChibiOS: removed heap APIs
This commit is contained in:
parent
28dc5deb9a
commit
f8f883baca
|
@ -97,41 +97,6 @@ void Util::free_type(void *ptr, size_t size, AP_HAL::Util::Memory_Type mem_type)
|
||||||
|
|
||||||
|
|
||||||
#if ENABLE_HEAP
|
#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
|
realloc implementation thanks to wolfssl, used by ExpandingString
|
||||||
and ExpandingArray
|
and ExpandingArray
|
||||||
|
|
|
@ -49,11 +49,6 @@ public:
|
||||||
void free_type(void *ptr, size_t size, AP_HAL::Util::Memory_Type mem_type) override;
|
void free_type(void *ptr, size_t size, AP_HAL::Util::Memory_Type mem_type) override;
|
||||||
|
|
||||||
#if ENABLE_HEAP
|
#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;
|
void *std_realloc(void *ptr, uint32_t new_size) override;
|
||||||
#endif // ENABLE_HEAP
|
#endif // ENABLE_HEAP
|
||||||
|
|
||||||
|
@ -144,10 +139,6 @@ private:
|
||||||
FlashBootloader flash_bootloader() override;
|
FlashBootloader flash_bootloader() override;
|
||||||
#endif
|
#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
|
// stm32F4 and F7 have 20 total RTC backup registers. We use the first one for boot type
|
||||||
// flags, so 19 available for persistent data
|
// flags, so 19 available for persistent data
|
||||||
static_assert(sizeof(persistent_data) <= 19*4, "watchdog persistent data too large");
|
static_assert(sizeof(persistent_data) <= 19*4, "watchdog persistent data too large");
|
||||||
|
|
Loading…
Reference in New Issue