AnsweredAssumed Answered

Could I point a function pointer to a RAM area?

Question asked by Peipei Yang on May 23, 2007
Latest reply on May 24, 2007 by Peipei Yang
I am just starting to learn to use CodeWarrior and I encountered a problem. In my program I have to run some subroutines in RAM. The RAM is rare in HCS08 MCUs and I needn't run these subroutines synchronously, so I want to run these different subroutines in the same RAM area one by one.
First I define a buffer area big enough to store the subroutine in RAM as this:
        char buffCode[50];
then I define a function pointer which points to the area buffCode:
        const FunPointer fun=buffCode;
in the definition above, the type FunPointer was defined as this:
        typedef void (*FunPointer)(void);
When I want to run the subroutines, I copy the code from Flash memory to buffCode, and then run it in RAM by
        fun();
But when I compiled this program in CodeWarrior, I got this warning:
C1805: Non standard conversion used
In the description, it says, in ANSI-C it is normally not allowed to cast an object pointer to a function pointer or a function pointer to an object pointer.
Then what can I do if I want to run different subroutines in the same RAM area? Is this warning important? Could the program work properly as I expected if I ignore this warning?
Thanks very much!
Yang

Outcomes