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
  • The & in 'C' is the "address-of" operator; the result of the expression

    &a
    

    gives the "address-of" a - so its type is self-evidently "pointer to a"

    So, when you write

    p = &a
    

    the compiler can clearly see that you are assigning a pointer-type expression (&a) to a pointer-type variable (p)

    However, when you write

    p = 7
    

    it is not self-evident that 7 is intended to be a valid address; more particularly, when you write

    p = a
    

    there must be some doubt that you might have meant

    p = &a
    

    hence the compiler gives the warning.

    To avoid the warning, you can make you intention clear by using an explicit cast:

    p = (char*)a
    

    If you're still getting the warning, you must have done it wrong.
    If you want an explanation of what you've done wrong, you will have to show what you have done!

Reply
  • The & in 'C' is the "address-of" operator; the result of the expression

    &a
    

    gives the "address-of" a - so its type is self-evidently "pointer to a"

    So, when you write

    p = &a
    

    the compiler can clearly see that you are assigning a pointer-type expression (&a) to a pointer-type variable (p)

    However, when you write

    p = 7
    

    it is not self-evident that 7 is intended to be a valid address; more particularly, when you write

    p = a
    

    there must be some doubt that you might have meant

    p = &a
    

    hence the compiler gives the warning.

    To avoid the warning, you can make you intention clear by using an explicit cast:

    p = (char*)a
    

    If you're still getting the warning, you must have done it wrong.
    If you want an explanation of what you've done wrong, you will have to show what you have done!

Children