3.9 Absolute Address Allocation Specification

The destination is specified using the __directmap keyword in the CA78K0, whereas #pragma address is written immediately before the variable declaration in the CC-RL.

 

The format of the CA78K0 is as follows.

__directmap [__sreg] [static] type-name variable-name = location-address;

The format of the CC-RL is as follows.

#pragma address variable-name = location-address

variable-declaration

 

-

Since the memory map is different between the 78K0 and RL78, a message is output.

-

The CcnvCA78K0 deletes the __directmap keyword and adds #pragma address just before the variable declaration. The address specification is deleted from the variable declaration and execution moves to the address specification of #pragma address.

-

When a macro or function pointer is used in a description using the __directmap keyword, the function name may be interpreted erroneously. Perform conversion after expanding the macro in advance. The location specification of the function pointer has to be modified manually.

-

If different variables are assigned to the same address with __directmap, a compile error will occur in the CC-RL after conversion. Care is required because the CcnvCA78K0 does not check whether different variables are being assigned to the same address.

 

[Examples]

Pattern 1

Before conversion

__directmap  int  i = 0xfe00;

After conversion

#pragma  address  i=0xfe00
int  i;

Pattern 2

Before conversion

__directmap  int*  i = 0xfe00;

After conversion

#pragma  address  i=0xfe00
int*  i;

Pattern 3

Before conversion

__directmap  int  i = 0xfe00, j=0xfe10;

After conversion

#pragma  address  i=0xfe00
#pragma  address  j=0xfe10
int  i,j;

Pattern 4

Before conversion

__directmap struct x {
  char a;
  char b;
} xx = { 0xfe30 };

After conversion

#pragma address xx=0xfe30
struct x {
  char a;
  char b;
} xx;

Pattern 5

Before conversion

#define MY_MACRO1 (int  i = 0xfe00)
__directmap  MY_MACRO1;

After conversion

#define MY_MACRO1 (int  i = 0xfe00)
__directmap  MY_MACRO1;

Corrective action

Perform conversion after expending the macro.

Pattern 6

Before conversion

__directmap  void (*fp[])(void) = 0x1234;

After conversion

#pragma address void=0x1234
void (*fp[])(void);

Corrective action

Manually write #pragma address for the CC-RL.