2016-02-08 04:53 AM
Hello,
Iwant to
locate heap in SDRAM. I found some Keil samples, but ... SDRAM adress is 0xD0000000, size 8M. Thanks a lot #sdram #openstm32 #heap2016-02-08 06:21 AM
Add SDRAM region
and edit /* User_heap_stack section, used to check that there is enough RAM left */ ._user_heap_stack : { . = ALIGN(8); PROVIDE ( end = . ); PROVIDE ( _end = . ); . = . + _Min_Heap_Size; . = . + _Min_Stack_Size; . = ALIGN(8); } >RAM this. If only heap you want into SDRAM split this section.2016-02-08 09:50 AM
Be conscious that SDRAM is the slowest memory available to you, and you might only want to use it for large allocations that won't fit in the internal memories.
Look at the allocator in the newlib/stub file(s)2016-02-09 11:32 AM
First - thank you very much!
Yes I want only heap into SDRAM (the heap can use the whole SDRAM), but how can I split this? Sorry but I am not very familiar with linker scripts2016-02-09 12:41 PM
Why you don't read GCC docimentation?
._user_heap_stack : { . = ALIGN(8); PROVIDE ( end = . ); PROVIDE ( _end = . ); . = . + _Min_Heap_Size; /// stack . = . + _Min_Stack_Size; /// heap . = ALIGN(8); } >RAM ''.'' dot means address, be notice that end and other symbol must be corect for syscalls. AC6 linker script is ugly.2016-02-16 06:23 AM
Attached the final code with all modifications
________________ Attachments : code.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0vt&d=%2Fa%2F0X0000000biL%2FV7ne155SGoLFg3Gh2XEMIGuD4WSFfhHHw3QSLSgjC1c&asPdf=false2016-02-16 07:39 AM
Also be aware that some stm32 had FMC errata items which could cause corruption of data read from it. For example stm32f437 revision ''A''.
2.9.4 Corruption of data read from the FMC
Description
When the FMC is used as stack, heap or variable data, an interrupt occurring during a CPU read access to the FMC may results in read data corruption or hard fault exception. This problem does not occur when read accesses are performed by another master or when FMC accesses are done when the interrupts are disabled.
Workaround
Two workarounds can be applied:
Do not use the FMC as stack or heap, and make sure CPU read accesses to the FMC are performed while interrupts are disabled
Use only DMAs to perform read accesses to the FMC.
This limitation is present only in revision “A� devices. It is fixed in revision “Y�, “1� and “3�.