-Ccx: Cosmic Compatibility Mode for Space Modifiers and Interrupt Handlers

Group

LANGUAGE

Scope

Compilation Unit

Syntax
  -Ccx 
  
Arguments

None

Default

None

Defines

None

Pragmas

None

Description

This option allows you to use Cosmic style @near, @far and @tiny space modifiers as well as @interrupt in your C code. You must switch the -ANSI option off before using this option. It is not necessary to remove the Cosmic space modifiers from your application code. You do not need to place the objects in sections addressable by the Cosmic space modifiers.

When the Compiler parses a Cosmic modifier, the following occurs:

Refer example in the following listing for a PRM file showing section placement for the sections in the following table.

Table 1. Cosmic Modifier Handling
Definition Placement to _CX section
@tiny int my_var _CX_DATA_TINY
@near int my_var _CX_DATA_NEAR
@far int my_var _CX_DATA_FAR
const @tiny int my_cvar _CX_CONST_TINY
const @near int my_cvar _CX_CONST_NEAR
const @far int my_cvar _CX_CONST_FAR
@tiny void my_fun(void) _CX_CODE_TINY
@near void my_fun(void) _CX_CODE_NEAR
@far void my_fun(void) _CX_CODE_FAR
@interrupt void my_fun(void) _CX_CODE_INTERRUPT

For further information about porting applications from Cosmic to CodeWarrior IDE refer to technical note TN234 located at <CodeWarrior for Microcontrollers V6.x Installation>\Help\PDF. The following table gives an overview of HC(S)08 space-modifier mapping.

Table 2. Cosmic Space Modifier Mapping for HC(S)08
Definition Keyword Mapping
@tiny __near
@near __far
@far __far

Refer the following listing for an example of the -Ccx compiler option.

Listing: Cosmic Space Modifiers


volatile @tiny char tiny_ch;
extern @far const int table[100];

static @tiny char * @near ptr_tab[10];

typedef @far int (*@far funptr)(void);

funptr my_fun;  /* banked and __far calling conv. */

char @tiny *tptr = &tiny_ch;

char @far  *fptr = (char @far *)&tiny_ch;

Example for a prm file: 

(16- and 24-bit addressable ROM;

 8-, 16- and 24-bit addressable RAM)

SEGMENTS

  MY_ROM   READ_ONLY     0x2000   TO 0x7FFF;

  MY_BANK  READ_ONLY     0x508000 TO 0x50BFFF;

  MY_ZP    READ_WRITE    0xC0     TO 0xFF;

  MY_RAM   READ_WRITE    0xC000   TO 0xCFFF;

  MY_DBANK READ_WRITE    0x108000 TO 0x10BFFF;

END

PLACEMENT

  DEFAULT_ROM, ROM_VAR, 

  _CX_CODE_NEAR, _CX_CODE_TINY, _CX_CONST_TINY,

  _CX_CONST_NEAR               INTO MY_ROM;

  _CX_CODE_FAR, _CX_CONST_FAR  INTO MY_BANK;

  DEFAULT_RAM, _CX_DATA_NEAR   INTO MY_RAM;

  _CX_DATA_FAR                 INTO MY_DBANK;

  _ZEROPAGE, _CX_DATA_TINY     INTO MY_ZP;

END
See also

Cosmic Manuals, Build Tools Utilities Reference Manual, TN234