2018-04-15 03:40 PM
Hello Everybody,
I am using DISCO-F429ZI board that has external SDRAM on it with mbed-cli and I have an application that I use very large arrays in it I would like to find out a way that I can use this external SDRAM as my Data Memory(Heap memory).
First step I have found is to uncomment &sharpdefine DATA_IN_ExtSDRAM from system_stm32f4xx.c file, apparently this is not enough and based on my research I have to change startup_stm32f429xx.S and STM32F429xI.ld(linker) I have tried
every
advice in this forum and others to change ld file and also dont know what to change is startup file, but it still doesn't work.Things that I know about my SDRAM :
Start address: 0xD0000000
Length: 0x800000
I would really appreciate if someone can tell me what exactly I have to change in these 2 files to be able to to use
malloc
for larger variable definitions. This is piece of code in main.cpp that I want to store in SDRAM instead of internal
SRAM!
void
*
data;
data
=
(
void
*)
malloc(
190400
);
if
(
data==
NULL){
pc
.
printf(
'Error:
ran
out
of
memory
'
);
}
which current I get 'ran out of memory'
I have seen codes like this to use in main.cpp to define them in SDRAM but I know I need to prepare things before!
/* Create small array and force linker to put it to external RAM at location 0xD0001000
which is external RAM */uint32_t SmallArray
[
10
]
__attribute__
((
at(
0xD0001000
)));
/* Create very big array, compiler will use external RAM because its size is too big
for internal RAM on STM32F429 */uint32_t BigArray
[
0x100000
];
I have also attached 2 files.
Thanks for your helps
##external-sdram #disco-f429zi2018-04-15 03:41 PM