Move malloc()
, free()
, etc. from esp-wifi
to esp-alloc
#2865
Labels
status:needs-attention
This should be prioritized
Motivations
esp-wifi
,esp-alloc
andesp-mbedtls
are tightly coupled by their memory allocator implementation.esp-wifi
needs an implementation ofmalloc()
andfree()
, and since #2099, it uses Rust's Global allocator.esp-alloc
is a provider of a global allocator for ESP SoCs but users are free to provide their own allocator if they want.esp-mbedtls
andesp-mbedtls-sys
depend onesp-wifi
, strictly for providingmalloc()
andfree()
.Solution
These should be moved to
esp-alloc
, to only depend on an allocation crate, if one only needsmalloc()
,free()
, etc. They should be defined with conditional compilation and / or weak linkage to avoid conflict issues if another crate provides these symbols.Alternatives
Provide a
c-lib
/c-compat
/esp-c-compat
crate to define and implement C symbols, with conditional compilation. It would not only provide memory allocation symbols, but any symbols such asvsnprintf()
.Additional context
The text was updated successfully, but these errors were encountered: