Skip to content

Provide multiple RAM region support for the heap when using GCC #9518

@marcuschangarm

Description

@marcuschangarm

Description

Some MCUs, like the STM32L475, have multiple discrete RAM regions. Accessing memory across these boundaries will cause a hard fault. The current sbrk implementation for GCC only allocates heap from one of these regions, leaving unused memory in other regions unavailable.

With a custom sbrk implementation it is possible to allocate heap from multiple regions (see #9441), but the current Mbed OS tests for stack and heap make assumptions that prevent users from mainlining these changes.

It would be useful if Mbed OS defined linker names for multiple regions, e.g., __mbed_sbrk_start_0, __mbed_sbrk_start_1, etc. and provided sbrk functions that took advantage of these. It would then just be a matter of linker script and target configuration for each target instead of each target providing its own sbrk.

Issue request type

[ ] Question
[x] Enhancement
[ ] Bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions