rp2/cyw43_configport: Use m_tracked_calloc and m_tracked_free.
When using malloc and free there were out-of-memory situations depending on the arm-none-eabi package version. This commit changes malloc/free to use the MicroPython GC heap instead. Signed-off-by: robert-hh <robert@hammelrath.com> Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
parent
4074f828dd
commit
f84b4617cb
|
@ -2,9 +2,6 @@
|
|||
|
||||
set(PICO_BOARD "pico_w")
|
||||
|
||||
# The C malloc is needed by cyw43-driver Bluetooth
|
||||
set(MICROPY_C_HEAP_SIZE 4096)
|
||||
|
||||
set(MICROPY_PY_LWIP ON)
|
||||
set(MICROPY_PY_NETWORK_CYW43 ON)
|
||||
|
||||
|
|
|
@ -90,13 +90,14 @@
|
|||
|
||||
#define cyw43_schedule_internal_poll_dispatch(func) pendsv_schedule_dispatch(PENDSV_DISPATCH_CYW43, func)
|
||||
|
||||
// Bluetooth uses the C heap to load its firmware (provided by pico-sdk).
|
||||
// Space is reserved for this, see MICROPY_C_HEAP_SIZE.
|
||||
// Bluetooth requires dynamic memory allocation to load its firmware (the allocation
|
||||
// call is made from pico-sdk). This allocation is always done at thread-level, not
|
||||
// from an IRQ, so is safe to delegate to the MicroPython GC heap.
|
||||
#ifndef cyw43_malloc
|
||||
#define cyw43_malloc malloc
|
||||
#define cyw43_malloc(nmemb) m_tracked_calloc(nmemb, 1)
|
||||
#endif
|
||||
#ifndef cyw43_free
|
||||
#define cyw43_free free
|
||||
#define cyw43_free m_tracked_free
|
||||
#endif
|
||||
|
||||
void cyw43_post_poll_hook(void);
|
||||
|
|
Loading…
Reference in New Issue