Hello to everyone. How can i execute code from RAM? I want to write a Fast interrupt-Routine, it will be called by Timer-Interrupt 200000 times per second. The MCU is a ADUC7126 from ADI. The compiler is the realview-compiler.
int main(void) { POWKEY1 = 0x01; POWCON0 = 0x00; // Set core at maximum speed POWKEY2 = 0xF4; GP4DAT = 0x04000000; // P4.2 is Output for LED and Oszilloscope GP1PAR = 0x11110000; GP1CON = 0x22220000; // Port P1.4 to P1.7 are CLK, MISO, MOSI, CSL SPIDIV = 1; SPICON = BIT6 + BIT1 + BIT0; T1LD = (41779200/200000) - 1; // Counter Value T1CON = 0xC0; // Enabled,Periodic,Binary and CLK/1 FIQEN = BIT3; // Timer1 Fast-Interrupt while (1){} } void FIQ_Handler(void) __irq { static unsigned long int x; T1CLRI = 0x55; // T1CLRI is an 8-bit register. Writing any value to this register clears the Timer1 interrupt. GP4SET = 0x00040000; // P4.2 to "1" to see interupt-start on oszilloscope SPITX = x >> 24; // Byte-1 to DAC SPITX = x >> 16; // Byte-2 to DAC SPITX = x >> 8; // Byte-3 to DAC x++; // Compute next value for DAC (this is only test-example) GP4CLR = 0x00040000; // P4.2 to "0" to see interrupt-ready on oszilloscope }
How can i tell the compiler to put and execute the FIQ-Routine in RAM? The execution speed in Ram will be doubled compared to Flash-Memory. As you can see i am not so experiend with this topic, so i need a little help to lift me on a higher level ;-)
See this:
http://www.keil.com/support/docs/3228.htm
uVision allows you to locate modules to specific memory areas that are entered in the dialog Project - Options - Target. To do so, right click on a source file (or file group) and open the dialog Options - Properties. Then select the memory regions under Memory Assignment.
There is an example in the folder ARM\Examples\RAM_Function.
@John Linq: Thank you very much, at least it was easy. ;-) It took some time, i was very confused about the __ram attribute I guess this __ram attribute is only for the CARM - Compiler but not available for Realview.