This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How do I move code from FLASH to RAM?

I'm creating a program for an Atmel AT91SAM7S. Most of my code will run from FLASH during normal operation, but I have a few interrupt service routines and a time sensitive function that need to execute from RAM to get the best possible speed. I'm trying to figure out how to get these routines copied from the FLASH image into the internal RAM.

I have two interrupt service routines that are written in assembly, and it was easy to get them moved. I simply put the code into a READWRITE segment instead of a READONLY segment. This causes the startup code to automatically copy the routines to RAM as the same time that it initializes readwrite data areas.

But I can't find a way to do the same trick with my C code (I'm using the RealView compiler). Although I can put the key routines into a different segment, it always gets the READONLY attribute so the linker places it into the FLASH memory address range.

Does anyone know a solution to this problem (maybe I'm going about it in the wrong way)? I'd hate to have to recode my time sensitive routines into assembly.

Thanks in advance.

0