Hello,
target: stm32f429I-DISC1
How can I use the SDRAM as heap?
First I initialized the SDRAM stting GPIOs, fmc, clock… -> SDRAM accessable, fine.
Next I modified the linker script and enabled a SDRAM memory section and moved the heap into SDRAM
SDRAM (rwx) : ORIGIN = 0xD0000000, LENGTH = 8M
.heap (NOLOAD):
{
__uvisor_heap_start = .;
__end__ = .;
end = __end__;
. += HEAP_SIZE;
__HeapLimit = .;
__uvisor_heap_end = .;
} > SDRAM
On project build I get the ASSERT-error "Region RAM overflowed with stack and heap".
I commented that out. No need for testing.
If I now allocate memory by using “new” I get until _sbrk in mbed_retarget.cpp which fetches a valid pointer from SDRAM:
static unsigned char* heap = (unsigned char*)&__end__;
unsigned char* prev_heap = heap;
unsigned char* new_heap = heap + incr;
but compares it to the MSP
if (new_heap >= (unsigned char*)__get_MSP()) {
and then gives ENOMEM
errno = ENOMEM;
return (caddr_t)-1;
}
because new_heap (0xD0nnnnnn) is greater than MSP (0x200mmmmm).
Do I really have to implement my own _sbrk syscall in order to put the HEAP onto the SDRAM?
Thanks
best regards
dirk
-
This topic was modified 7 years, 5 months ago by krid.