You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order to resolve an issue that has been raised against the Pico version of BBC BASIC, I would like to be able to provide my own memory allocation for LWIP, replacing the routines in either ${PICO_LWIP_PATH}/src/core/mem.c and / or ${PICO_LWIP_PATH}/src/core/memp.c, however I cannot find any way to do this.
While there are CPP macro definitions such as MEMP_MEM_MALLOC and MEM_LIBC_MALLOC which select different memory allocators, there does not seem to be anything that allows providing user routines.
Using #define macros in lwipopts.h (or another include file) to rename the functions does not work since it renames both the function calls and the function definitions.
I have tried using the linker --wrap=... option, but that does not work as the symbols are defined in object files that are explicitly included in the link command, rather than being undefined symbols to be found by a library search.
Since the compilation of the lwip code is controlled by pico-sdk/src/rp2_common/pico_lwip/CMakeLists.txt it should be possible to add this feature to the SDK without requiring any modification to the lwip sub-module.
One possible approach would be to define three extra import libraries:
pico_lwip_nomem - Omits mem.c and memp.c
pico_lwip_mem - Provides mem.c
pico_lwip_memp - Provides memp.c
Another option would be to define CMake variables PICO_LWIP_NO_MEM and PICO_LWIP_NO_MEMP to control the inclusion / exclusion of mem.c and memp.c in the pico_lwip library.
The text was updated successfully, but these errors were encountered:
In order to resolve an issue that has been raised against the Pico version of BBC BASIC, I would like to be able to provide my own memory allocation for LWIP, replacing the routines in either
${PICO_LWIP_PATH}/src/core/mem.c
and / or${PICO_LWIP_PATH}/src/core/memp.c
, however I cannot find any way to do this.While there are CPP macro definitions such as
MEMP_MEM_MALLOC
andMEM_LIBC_MALLOC
which select different memory allocators, there does not seem to be anything that allows providing user routines.Using
#define
macros inlwipopts.h
(or another include file) to rename the functions does not work since it renames both the function calls and the function definitions.I have tried using the linker
--wrap=...
option, but that does not work as the symbols are defined in object files that are explicitly included in the link command, rather than being undefined symbols to be found by a library search.Since the compilation of the lwip code is controlled by
pico-sdk/src/rp2_common/pico_lwip/CMakeLists.txt
it should be possible to add this feature to the SDK without requiring any modification to the lwip sub-module.One possible approach would be to define three extra import libraries:
Another option would be to define CMake variables
PICO_LWIP_NO_MEM
andPICO_LWIP_NO_MEMP
to control the inclusion / exclusion ofmem.c
andmemp.c
in the pico_lwip library.The text was updated successfully, but these errors were encountered: