Skip to main content
Fibo
Associate II
December 2, 2020
Question

heap allocation on segmented ram

  • December 2, 2020
  • 2 replies
  • 1991 views

The ram on the STM32H7 is segmented into non-contiguous sections. How would one be able to dynamically allocate memory in different sections of RAM? eg: put large objects in AXI-SRAM and small object that need fast access on DTCM.

I'm wondering if this is possible without a custom allocator however, links to open-source custom allocators or ideas for writing simple allocator would be appreciated.

This topic has been closed for replies.

2 replies

Piranha
Principal III
December 2, 2020
Tesla DeLorean
Guru
December 2, 2020

My lazy approach in Keil was to stuff the additional regions into the the allocators linked-list.

Realistically you probably need different pools

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Fibo
FiboAuthor
Associate II
December 3, 2020

Interesting, I also think that different pools are necessary since I would like to explicitly select the pool with which I am working. The "LwMEM" library mentioned by @Piranha​  has the features I'm looking for. Not sure about the reliability since it is under active development. It does have a few unit tests and decent documentation so that is a good start.

Tilen MAJERLE
ST Employee
May 11, 2021

Code on master branch or under releases is usually passing the tests. Of course it doesn't mean it is bug free :)

I welcome you to contribute if you believe you need more features.