This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Warning #770-D conversion from pointer to small integer

Other Parts Discussed in Thread: MSP430F5419

I am using MSP430F5419  which uses the BIG memory model. I upgraded from very old Code Composer 3.0 to 6.0 and CC6  produces the #770-D warning for the line of code below.

__data16_write_addr((unsigned short) &DMA1SA, (unsigned long) &.buffer[1] );

'buffer' is in RAM so it is in low memory and both CC3.0 and CC6.0 produced code that works.

How do I get rid of the warning?

  • If you build with --verbose_diagnostics, the compiler echoes the problem source line with a ^ character indicating where the problem begins.  Look in the Console view, not the Problems view, to see it.  You would see that the problem isn't with buffer, but with converting &DMA1SA to an unsigned short.  The problem is that, in large data model, pointers are 20-bits, and an unsigned short is 16-bits.  This conversion loses bits.  It doesn't matter because DMA1SA is always located in the first 16-bits of the address space.  But at the time the compiler processes this line, that fact is not known.  Thus the diagnostic.

    It is a bug in the older compiler that no diagnostic is issued.  You can disable the diagnostic with the option --diag_suppress=770.  Or, you might prefer

    #pragma diag_suppress=770
    

    Thanks and regards,

    -George

  • Thanks for your response.  Yes, I also discovered it is the 20-bit DMAxSA not the buffer address.  I also found two solutions; that produce the correct working code and don't give any warnings.

    _data20_write_long((unsigned long) &DMA0DA, (unsigned long) &buf[0]);

    and

    DMA0DA = (__SFR_FARPTR) (unsigned long) &buf[0];

  • Thanks for this Tom, been meaning to find a way to correctly suppress the warning.