Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rp2/CYW43: Use m_tracked_calloc and m_tracked_free for CYW43 malloc. #12647

Merged
merged 1 commit into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions ports/rp2/boards/RPI_PICO_W/mpconfigboard.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
9 changes: 5 additions & 4 deletions ports/rp2/cyw43_configport.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading