From ccdecf255dbd34b42f4b45a384bfdb9049881e29 Mon Sep 17 00:00:00 2001 From: Matthias Blankertz Date: Tue, 12 Aug 2025 18:34:33 +0200 Subject: [PATCH] rp2: Allow using btree module with rp2 port Integrate btree extmod in rp2 CMakeLists so it can be enabeled with MICROPY_PY_BTREE=On. Default values for DEFPSIZE and MINCACHE copied from esp8266 board. Note: To be able to use the btree module, you must set the MICROPY_C_HEAP_SIZE CMake option to at least 8192. --- ports/rp2/CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ports/rp2/CMakeLists.txt b/ports/rp2/CMakeLists.txt index 7405f9753..ad5fb6026 100644 --- a/ports/rp2/CMakeLists.txt +++ b/ports/rp2/CMakeLists.txt @@ -474,6 +474,15 @@ if (MICROPY_PY_NETWORK_WIZNET5K) ) endif() +if (MICROPY_PY_BTREE) + target_link_libraries(${MICROPY_TARGET} micropy_extmod_btree) + target_compile_definitions(${MICROPY_TARGET} PRIVATE + MICROPY_STREAMS_POSIX_API=1 + MICROPY_BERKELEY_DB_DEFPSIZE=1024 + MICROPY_BERKELEY_DB_MINCACHE=3 + ) +endif() + # Add qstr sources for extmod and usermod, in case they are modified by components above. list(APPEND MICROPY_SOURCE_QSTR ${MICROPY_SOURCE_EXTMOD} @@ -554,6 +563,7 @@ set_source_files_properties( ) target_compile_definitions(${MICROPY_TARGET} PRIVATE + ${MICROPY_DEF_CORE} ${MICROPY_DEF_BOARD} FFCONF_H=\"${MICROPY_OOFATFS_DIR}/ffconf.h\" LFS1_NO_MALLOC LFS1_NO_DEBUG LFS1_NO_WARN LFS1_NO_ERROR LFS1_NO_ASSERT