Hi,
I have two RAM on my board.
I am using external ram which starts with address : 0x6000000 External RAM size : 1Mb
Internal ram which starts with address : 0x2000000 Internal RAM size : 128 kb
As I am running out internal ram. I starts using external ram for global variables. which is not idea.
I specify use external ram per cpp file properties in Keil IDE. these files have global variables. This works but not pretty to maintain.
All heap and stack use internal ram.
How I can use external ram with heap. Can I use Keil Memory pool functions with external ram access? Do I need to overload new and delete operators?
I am do want to use heap allocation for some pointer on internal ram.
External RAM is slow access.
Thanks, Naeem
Reply from ARM technical support.
Normally you can use the external ram as the internal ram if you can make sure the external ram is initialized before you use it. Make sure the initialization code use just internal ram and locate at early stage of your program.
My reply:
I am initializing external ram at driver level. I can use external ram only for my global and static variables by specifying per cpp file properties. select external ram option.
I am using internal ram for stack and heap. I believe I can only use either internal or external ram for heap and stack not both at the same time. My question is how and where I can specify per C++ class with new and delete operator overload and using memory pool to use external ram with its address.
My suggestion is a simple solution for your case. Just define your heap address to the external ram, and initialize the external memory at the beginning of your program. Then you can use new and delete freely. You could also define all the global and static variables in the external ram(RW ZI to the scatter file), if you are not using them before complete the initialization of the external ram.
My reply: I known that just define your heap address to the external ram, and initialize the external memory at the beginning of your program. However I want to use both internal and external ram for heap. Is there alternative method?
any suggestions?
As we are running out of heap on internal ram.
We should consider using heap on external ram using scatter file.
http://www.keil.com/forum/23045/setup-heap-on-external-ram/
stack can remain on internal ram for fast access.
Any alternative method?