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.

TMS28015 16-bit const issues

Hi Champs,

using TMS28015 I'd like to have a 16-bit constant pointer vector, but the linker always takes 2 wordfor every element, so I waste 16bit for every pointer. If I definte 16-bit variable pointer vector instead, the linker runs correctly, allocating 16-bit per element. Is it possible to have a "full" use of the32bit word?

Exmaples:

const long pippo = (long)(void *)&stringa; //this works correctly
 
int pippo = (long)(void *)&stringa; // also this works correctly
 
const int pippo = (long)(void *)&stringa; // not good, I ahve a trunc error.
 
Thanks in advance!
Alberto
 
  • If you are compling with large memory model (-ml) then all pointers are 22-bits in order to reach the entire data space memory map.  A 22-bit pointer of course takes up a 32-bit word. 

    Both the conversions from 'long' to 'int' will cause truncation.

    (Note: we suggest always using large model for 28x since all auxillary registers are 32-bits). 

    If you are not compling with large memory model then pointers are 16-bits and far pointers are 22-bits. Far is only valid in C. 

    -Lori

  •  Ok Lory,

    thanks for you help!

    Alberto