Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion libraries/Portenta_SDRAM/src/SDRAM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ static void MPU_Config() {
}

int SDRAMClass::begin(uint32_t start_address) {
static uint32_t malloc_start_address = 0;

if (FMC_SDRAM_DEVICE->SDCMR == 0x00000000U) {
bool ret = sdram_init();
Expand All @@ -51,7 +52,13 @@ int SDRAMClass::begin(uint32_t start_address) {
}

if (start_address) {
malloc_addblock((void*)start_address, SDRAM_END_ADDRESS - start_address);
if (malloc_start_address && malloc_start_address != start_address) {
return 0;
}
if (!malloc_start_address) {
malloc_addblock((void*)start_address, SDRAM_END_ADDRESS - start_address);
malloc_start_address = start_address;
}
}

return 1;
Expand Down
Loading