Harvard machines such as the Atmel AVR and Dallas Semiconductor MAXQ require special compiler support for addressing data held in code space—and so CrossWorks provides the __code keyword to store data in code space rather than data space. This does, however, lead to some inconvenient programming when dealing with constant string data because each string needs to be named and stored into code space using __code. The CrossWorks compiler offers a solution using the C qualifier to store strings into code space rather than data space. The type of a ‘C’-qualified string is __code const char *.

Example

Without using C-qualified strings you would write:

void sign_on(void)
{
  static const __code char message[] = "Tynadyne wiper widget, v1.0";
  printf_c(message);
}

Using the CrossWorks extension you can write:

void sign_on(void)
{
  printf_c(C"Tynadyne wiper widget, v1.0");
}