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.

Using __data16_write_addr() gives warning in large memory model

Other Parts Discussed in Thread: MSP430F5418A

I am using an MSP430F5418A in large memory model.  I have 'mspx' silicon version selected.

It seems that no matter what I do, I cannot use the  __data16_write_addr() function to compile without throwing the following warning:

"#770-D conversion from pointer to smaller integer"

I've tried various alternatives of casting, but no success.

Here's a code snippet:

----------------------

uint8_t* dsp_spi_data_ptr;
...

__data16_write_addr( (uint16_t) &DMA2SA, (uint32_t)(dsp_spi_data_ptr) );

...

----------------------

When I compile in small memory model, this function creates no warnings.  Am I misunderstanding the use of this function?

  • In small data memory model, a data address like &DMA2SA is 16-bits wide.  So converting that address to a uint16_t does not lose any information.  In large data memory mode, that address is 32-bits wide.  Converting it to a uint16_t does lose information, thus the diagnostic you see.  If you know that no information is being lost, you can disable the diagnostic.  Please see the section of the MSP430 compiler manual titled Understanding Diagnostic Messages.

    Thanks and regards,

    -George

  • You're not supposed to use that intrinsic at all in large model.  Just write to the pointer directly:

    *dsp_spi_data_ptr = (uint16_t) &DMA2SA;