Can You "malloc()" DMAMEM?

Status
Not open for further replies.

gfvalvo

Well-known member
So, the DMAMEM directive is available to specify at compile-time time that a variable is to be stored in the lower RAM block. I'm wondering if there's a way to do the same thing with a dynamic allocation. I think the heap usually grows "up" (while the stack grows "down"). So, member it happens just due to that. Depends where it starts growing from.

BTW, I'm just talking about T3.2, 3.5, 3.6 here.

Thanks in advance.
 
With malloc you have no way to be sure where in the address space you'll get the memory allocated.

It does grow upward, starting right after all the allocated variables. So if you static memory use is less than the size of the lower bank, then you can expect early calls to malloc to return memory from the lower bank. But if static usage has already claimed all of the lower bank, you'll never get malloc to return memory there. Likewise if other calls to malloc have used up the lower memory.
 
Status
Not open for further replies.
Back
Top