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

Compiling differences between C51 v7.03 and v8.06

Hello!

I have uVision that compiles fine with the C51 v7.03 compiler and the related package, but not complete with the 8.06. I used two different Keil installations. All files are in the same folder.

In the 8.06 I get linker errors like "object does not fit in to pdata page" and "0080H". This looks like the compiler was thinking the PDATA was only 128 bytes, but it is set to 256 bytes in the startup.a51. Any clue what's different in the newer Keil package?

Also there is a warning in 8.06 (which does not show in 7.03) "converting non-pointer to pointer" on this

ptr_xdata = sPtr_obj->Adresse;


while the vars are set like this:

uchar uc_set_obj( uchar pdata *ptr_Set)
{
   uchar i;
   uchar xdata *ptr_xdata;
   struct stOBJADR code *sPtr_obj;

   sPtr_obj=&Obj[*ptr_Set];
   .
   .
   .
   ptr_xdata = sPtr_obj->Adresse;
}


The struct stOBJADR has a member "uint Adresse;"

I can see no wrong use of the pointers. I just want to be sure that the warning does not affect the code to not work correctly.

Parents
  • Unfortunately, this forum doesn't support pictures, so we'll have to make do with "ASCII-Art" - but here goes.

    Consider the following definitions

    typedef unsigned int uint;  // In C51, this occupies 2 bytes (16 bits)
    
    uint   my_uint;             // A variable of type uint
    uint  *my_ptr;              // A  pointer to type uint
    uint **my_ptr_ptr;          // A  pointer to a pointer to type uint
    


    Assuming that pointers are also 16 bits, these could result in a memory layout looking something like this:

    Address:    100    101    102    103    104    105    106
             ...+------+------+------+------+------+------+...
    Memory:     |             |             |             |
             ...+------+------+------+------+------+------+...
    Name:            my_uint      my_ptr       my_ptr_ptr
    


    You can see that:
    The address of my_uint is 100;
    The address of my_ptr is 102;
    The address of my_ptr_ptr is 104.

    Now let's assign some values:

    my_uint    = 986;      // Assign the value 986 to the variable
    
    my_ptr     = &my_uint; // Assign the address of my_uint to my_ptr
    
    my_ptr_ptr = &my_ptr   // Assign the address of the pointer to my_ptr_ptr
    


    This would result in the following values being stored in memory:

    Address:    100    101    102    103    104    105    106
             ...+------+------+------+------+------+------+...
    Memory:     |     986     |     100     |     102     |
             ...+------+------+------+------+------+------+...
    Name:            my_uint      my_ptr       my_ptr_ptr
    


    Now you can see that:
    The address of my_uint is still 100, and the value of (ie, the value stored in) my_uint is 986;
    The address of my_ptr is still 102, and the value of (ie, the value stored in) my_ptr is 100;
    The address of my_ptr_ptr is still 104, and the value of (ie, the value stored in) my_ptr_ptr 102.

    Thus it should now be clear that the address of a pointer has nothing to do with the value of a pointer.

Reply
  • Unfortunately, this forum doesn't support pictures, so we'll have to make do with "ASCII-Art" - but here goes.

    Consider the following definitions

    typedef unsigned int uint;  // In C51, this occupies 2 bytes (16 bits)
    
    uint   my_uint;             // A variable of type uint
    uint  *my_ptr;              // A  pointer to type uint
    uint **my_ptr_ptr;          // A  pointer to a pointer to type uint
    


    Assuming that pointers are also 16 bits, these could result in a memory layout looking something like this:

    Address:    100    101    102    103    104    105    106
             ...+------+------+------+------+------+------+...
    Memory:     |             |             |             |
             ...+------+------+------+------+------+------+...
    Name:            my_uint      my_ptr       my_ptr_ptr
    


    You can see that:
    The address of my_uint is 100;
    The address of my_ptr is 102;
    The address of my_ptr_ptr is 104.

    Now let's assign some values:

    my_uint    = 986;      // Assign the value 986 to the variable
    
    my_ptr     = &my_uint; // Assign the address of my_uint to my_ptr
    
    my_ptr_ptr = &my_ptr   // Assign the address of the pointer to my_ptr_ptr
    


    This would result in the following values being stored in memory:

    Address:    100    101    102    103    104    105    106
             ...+------+------+------+------+------+------+...
    Memory:     |     986     |     100     |     102     |
             ...+------+------+------+------+------+------+...
    Name:            my_uint      my_ptr       my_ptr_ptr
    


    Now you can see that:
    The address of my_uint is still 100, and the value of (ie, the value stored in) my_uint is 986;
    The address of my_ptr is still 102, and the value of (ie, the value stored in) my_ptr is 100;
    The address of my_ptr_ptr is still 104, and the value of (ie, the value stored in) my_ptr_ptr 102.

    Thus it should now be clear that the address of a pointer has nothing to do with the value of a pointer.

Children