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

locating arguments

Hello,


I would like to know how the keil compiler locate the arguments of a function.

1) it pass it via the stack?
2) it declares a places in the memory space, and in this case how he choose the memory space that it will use?


Thank You
Kaoru

Parents
  • i have to locate those arguments. Can you tell me if it is possible?

    If I understand you, you want to locate the arguments to several functions to the same address. For example:

    int func_a (int arg_a, int arg_b, int arg_c);
    int func_b (int arg_a, int arg_b, int arg_c);
    int func_c (int arg_a, int arg_b, int arg_c);
    

    func_a, func_b, and func_c should all have their arguments stored at the same address x.

    If that's the case, there is no way to automatically do that with the compiler.

    You can, however, do it manually with little or no overhead. Simply declare global variables that represent the function arguments. For example:

    int arg_a, arg_b, arg_c;
    
    int func_a (void);
    int func_b (void);
    int func_c (void);
    

    Then, you can "load" the arguments externally and you can access the arguments inside func_a, func_b, and func_c.

    Jon

Reply
  • i have to locate those arguments. Can you tell me if it is possible?

    If I understand you, you want to locate the arguments to several functions to the same address. For example:

    int func_a (int arg_a, int arg_b, int arg_c);
    int func_b (int arg_a, int arg_b, int arg_c);
    int func_c (int arg_a, int arg_b, int arg_c);
    

    func_a, func_b, and func_c should all have their arguments stored at the same address x.

    If that's the case, there is no way to automatically do that with the compiler.

    You can, however, do it manually with little or no overhead. Simply declare global variables that represent the function arguments. For example:

    int arg_a, arg_b, arg_c;
    
    int func_a (void);
    int func_b (void);
    int func_c (void);
    

    Then, you can "load" the arguments externally and you can access the arguments inside func_a, func_b, and func_c.

    Jon

Children
No data