Run stack from external Memory

Hello All

I am working on a project using a STR912 ARM9 core microcontroller with 96k internal RAM. I also have a external RAM with 1MB. Since i begin to run low on internal RAM, i want to transfer the whole stack to the external RAM so everything is running from there.

Now i am wondering how to implement this. I am using Keil µVision and the Keil Compiler. In the target options i can specifiy my external RAM but as soon as i declare it as on the only default memory, the code won't execute on the microcontroller anymore.
My guess is that the EMI configuration (it's a c function in my main.c file) needs to be called from the Startup code before the stack gets initialized but i don't really know how to implement this. Has anybody the answer or a example code where this is done ? I searched for this info but haven't found anything.
Oh the startup code i use is the one provided by Keil for the STR912 device.

Thanks for reading

Florian

Parents
  • Yes, you need to configure the EMI BEFORE the external memory is used. This will need to be done before __main is called in the startup.s file.

    You should be able to convert your C function to assembly in the startup file without too much trouble.

    If you are having too much trouble, you could call the C function from the startup file directly before you call __main. Just make sure you have at least a small, valid stack in the 96k of RAM and that you do not do anything that would require the setup that __main does to be called (such as counting on the initial value of a variable)

Reply
  • Yes, you need to configure the EMI BEFORE the external memory is used. This will need to be done before __main is called in the startup.s file.

    You should be able to convert your C function to assembly in the startup file without too much trouble.

    If you are having too much trouble, you could call the C function from the startup file directly before you call __main. Just make sure you have at least a small, valid stack in the 96k of RAM and that you do not do anything that would require the setup that __main does to be called (such as counting on the initial value of a variable)

Children
More questions in this forum