We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi, I work on Keil uVison V2.38, and i would to know how can i give an adress to a function ; which instruction can help me to fix the adress of functions or variables. If you have some docs or exemples, please send me : jm.moulinier@synergie-cad.fr Thanks !!
"If you have some docs or exemples" Hey - there's a whole website full at http://www.keil.com/support/ and all the Manuals are installed on your PC with uVision! Look in the 'Books' window.
"which instruction can help me to fix the adress of functions or variables" The _at_ keyword will allow you to fix the address of variables but sadly you cannot use initialisers if you do this. Stefan
For more informations, i would to fix adress of functions in external ram in order to give the hand to it. But i must know his adress and i don t want it change ! Thanks
I usually recommend that people consider making a vector table, rather than locating the actual function at a fixed address. (Fixing the address of the functions also fixes their maximum size, and makes it harder for the linker to do its job.) It's similar to the way the interrupt vector table in the hardware works. Just declare a table of function pointers; locate that table at a well-known, fixed address (using the linker, since you'll probably want to use an initializer to specify the function addresses). The clients look up the address of function N in the table and call it. It would look something like:
typedef void (*Vector)(void); typedef enum { VecA, VecB, VecC, NumVectors } VectorApi; const Vector code myTable[NumVectors] = { // initializer means you can't use _at_ Func1, Func2, Func3 } ... // client code myTable[VecA]();