-far_rom


This option sets the default near/far attribute of ROM data to far.

[Specification format]

-far_rom

 

-

Interpretation when omitted

The default near/far attribute of ROM data is determined by the -memory_model option setting.

[Detailed description]

-

This option changes the near/far attribute for ROM data, which is specified by the memory model, to far.

-

This option is not applied to the ROM data with the __near or __far keyword specified.

-

When this option is specified and a pointer points to const data, the near/far attribute of this pointer is far. However, when a pointer points to non-const data, its attribute is near. Therefore, though in violation of the C90 and C99 standard, the pointer size depends on whether the pointer points to const data. This option should be used on this understanding.

// -far_rom is specified.
      char* ptr;    // The pointer size is 2 bytes. It points to the char with __near attribute.
const char* c_ptr;  // The pointer size is 4 bytes. It points to the const char with __far attribute.

-

When a standard library functionNote using a pointer to a const variable as a parameter is linked, it is replaced with a standard library function for a far pointer by "#if defined(__FAR_ROM__)" in the standard header.

Note

puts, perror, atof, atoff, strtod, strtof, atoi, atol, strtol, strtoul, bsearch, qsort, memcpy, memmove, memcmp, memchr, memset, strcpy, strncpy, strcat, strncat, strcmp, strncmp, strchr, strcspn, strpbrk, strrchr, strspn, strstr, strlen

[Example of use]

-

To change the near/far attribute for ROM data, which is specified by the memory model, to far, describe as:

>ccrl -far_rom -cpu=S2 -dev=dr5f100pj.dvf main.c