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 to run the function from RAM in keil.

Hi,

i am using keil ide and controller LPC1837. i want to execute the function which is using IAP commands from RAM.

I found options are available to make that executable code in RAM in following link.

http://www.keil.com/support/docs/3228.htm

I followed the steps given in above link, but i don't find the code gets stored in RAM memory area i have given.

In alternate method, i tried to copy a functions to RAM area using memcpy(). After doing, i was able to see that my code (function) was copied in the RAM area i passed in memcpy. Now i need to execute that functions in RAM.

How to do that. Can anyone help me on this.

Parents
  • Thanks Pier,

    As you suggested i tried. But i have doubt, how the function definition of Func() can be assigned to RAM address.

    typedef void (*pFunction)(void);

    pFunction pF1 = Func;

    /* definition of Func() */

    void Func(void)
    {

    }
    here the address of Func can be assigned to function pointer pFunction. But adding this line "Func = (pFunction)&Buffer[1];" is giving error saying redefinition of function Func.

    How can i assign the RAM address (referred by Buffer) to the function defined Func()

Reply
  • Thanks Pier,

    As you suggested i tried. But i have doubt, how the function definition of Func() can be assigned to RAM address.

    typedef void (*pFunction)(void);

    pFunction pF1 = Func;

    /* definition of Func() */

    void Func(void)
    {

    }
    here the address of Func can be assigned to function pointer pFunction. But adding this line "Func = (pFunction)&Buffer[1];" is giving error saying redefinition of function Func.

    How can i assign the RAM address (referred by Buffer) to the function defined Func()

Children