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

where is DATA/IDATA used

For the '51 compilers/linkers evaluate which data/idata slots can be overlaid. I have to save 3 slots to make room for a new feature. Is there a way to make the linker show the tree in a less cryptic way than by module (i.e. by function) ?

Have fun,

Erik

Parents Reply Children
  • What are the arguments and local variables of this function and what are their data types?

    Jon

  • We are way past the subject: "WHICH of the functions sharing this (I)DATA space is the one that uses the full count". Of course I know what the local variables are, but when 47 functions share the same space it is quite tedious to look at all 47 to find out which one to analyze to see if you can find a workaround to reduce (I)DATA use.
    The abbreviated list in my posting 2 levels up represent a page of functions sharing the same (I)DATA space not just 4

    Erik

  • We are way past the subject: "WHICH of the functions sharing this (I)DATA space is the one that uses the full count". Of course I know what the local variables are, but when 47 functions share the same space it is quite tedious to look at all 47 to find out which one to analyze to see if you can find a workaround to reduce (I)DATA use.
    The abbreviated list in my posting 2 levels up represent a page of functions sharing the same (I)DATA space not just 4


    I you misunderstand the information that is presented in the call tree. The LENGTH is NOT the length of the DATA space used by the functions that are called. It is the size of the function indicated. Perhaps an example will help clarify this:

    #pragma NOREGPARMS  // Don't put arguments in registers
    
    long func_2 (long x)
    {
    long a, b, c, d;  /*** 16 + 4 bytes = 20 bytes ***/
    
    a = 1;
    b = 2;
    c = 3;
    d = 4;
    
    return (x + a + b + c + d);
    }
    
    long func_1 (long x)
    {
    long a, b, c;  /*** 12 + 4 bytes = 16 bytes ***/
    
    a = 11;
    b = 12;
    c = 13;
    
    return (x + a + b + c + func_2 (105));
    }
    
    void main (void)
    {
    long a;  /*** 4 bytes ***/
    
    a = func_1 (100);
    
    while (1);
    }

    Links with the following call tree.

    SEGMENT                          DATA_GROUP 
      +--> CALLED SEGMENT          START    LENGTH
    ----------------------------------------------
    ?C_C51STARTUP                  -----    -----
      +--> ?PR?MAIN?MAIN
    
    ?PR?MAIN?MAIN                  0008H    0004H
      +--> ?PR?FUNC_1?MAIN
    
    ?PR?FUNC_1?MAIN                000CH    0010H
      +--> ?PR?FUNC_2?MAIN
    
    ?PR?FUNC_2?MAIN                001CH    0014H

    In my example program, the main function only has 1 local variable (a long) that takes 4 bytes. The call tree listing is:

    SEGMENT                          DATA_GROUP 
      +--> CALLED SEGMENT          START    LENGTH
    ----------------------------------------------
    ?PR?MAIN?MAIN                  0008H    0004H
      +--> ?PR?FUNC_1?MAIN

    As you can see, the length of the DATA group for the MAIN function is 4 bytes. And, the main function calls func_1.

    func_1 only has 1 argument and 3 local variables (all long). That takes 4*4 or 16 bytes. The call tree listing is:

    SEGMENT                          DATA_GROUP 
      +--> CALLED SEGMENT          START    LENGTH
    ----------------------------------------------
    ?PR?FUNC_1?MAIN                000CH    0010H
      +--> ?PR?FUNC_2?MAIN

    The length of the DATA group for FUNC_1 is 10h bytes which is 16. And, func_1 calls func_2.

    func_2 only has 1 argument and 3 local variables (all long). That takes 5*4 or 20 bytes. The call tree listing is:

    SEGMENT                          DATA_GROUP 
      +--> CALLED SEGMENT          START    LENGTH
    ----------------------------------------------
    ?PR?FUNC_2?MAIN                001CH    0014H

    The length of the DATA group for FUNC_2 is 14h bytes which is 20. And, func_2 doesn't call any other functions.

    <hr>

    If I were looking for places to reduce the DATA space that's used, I'd start looking at which function used the most. I'd look in the call tree.

    SEGMENT                          DATA_GROUP 
      +--> CALLED SEGMENT          START    LENGTH
    ----------------------------------------------
    ?C_C51STARTUP                  -----    -----
    ?PR?MAIN?MAIN                  0008H    0004H
    ?PR?FUNC_1?MAIN                000CH    0010H
    ?PR?FUNC_2?MAIN                001CH    0014H

    And, immediately, I'd notice that FUNC_2 uses 20 bytes of DATA space. So, that's where I'd start.

    Jon


  • If only I could get the list you show. My results (with 6.01) is a long list of functions with ONLY the first having numbers associated with it. My perception is that these are the functions using the same space to store variables. HOWEVER, these functions use a varied number of variables and the length shown is for the one(s) using the most. What I show in the example some postings back is what I get.

  • OK - E-mail me the MAP file (jonw@keil.com).

    I'll take a look at it. However, I don't recall any problems with the 6.01 version of the tools generating this tree incorrectly.

    Jon