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

uv2 - ds80c400 - code/ecode/const/hconst cosntant arrays

I am having a bit of a problem with constant arrays on the ds80c400 i.e. char y[] = {1,2,3,4};

Note: the ds80c400 has a 16M contiguous memory map.

example 1:
in the following code the array is placed in segment CONST.

#include <stdio.h>
char foo (int x)
{
  char y[] = { 1,2,3,4};
  return(y[x]);
}

example 2:
in the following code the array is placed in segment CODE.

#include <stdio.h>
char foo (int x)
{
  char y[] = { 1,2,3,4};
  printf("1234%d",1);
  return(y[x]);
}


Question 1:
why do these get placed into CONST/CODE segments and not HCONST/ECODE?

Question 2:
why sometimes CONST and some time CODE?


Question 3:
by default uv2 does not define the CONST segment for the ds80c400.
I know that I can force the data into HCONST with the type "far const" or I can define the CONST segment, but both these have drawbacks in my design. Is there a compiler switch or method to have these default to the HCONST/ECODE segments (or alternativly but less preferable the CODE segment)?


Thanks

0