Skip to content

Add SPIRAM allocation support to CoAP (IEC-562) #784

Description

@devunwired

Is your feature request related to a problem?

The libcoap implementation currently ported by this component relies on HAVE_MALLOC in the port configuration and routes all memory allocations through the default malloc(). This force all memory allocations in this library to be routed to internal memory on ESP32 devices unless CONFIG_SPIRAM_USE_MALLOC is globally enabled for the entire project.

Describe the solution you'd like.

Introduce a KConfig option to enable SPIRAM allocations for the library that disables HAVE_MALLOC in the POSIX configuration and provides proper heap_caps_malloc() overrides for coap_malloc_type(), coap_realloc_type(), and coap_free_type().

Describe alternatives you've considered.

Simply enabling CONFIG_SPIRAM_USE_MALLOC for all projects that use SPIRAM is not a best practice and applications should have the ability to tune the memory allocation strategy for the library components they include.

Additional context.

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions