3.9
Absolute address allocation specification
The destination is specified using the __directmap keyword in the CA78K0R, whereas #pragma address is written immediately before the variable declaration in the CC-RL.
The format of the CA78K0R 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
|
- | The CcnvCA78K0R 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 CcnvCA78K0R does not check whether different variables are being assigned to the same address. |
[Examples]
Pattern 1
|
Before conversion
|
__directmap int i = 0xffe00;
|
After conversion
|
#pragma address i=0xffe00
int i;
|
Pattern 2
|
Before conversion
|
__directmap int* i = 0xffe00;
|
After conversion
|
#pragma address i=0xffe00
int* i;
|
Pattern 3
|
Before conversion
|
__directmap int i = 0xffe00, j=0xffe10;
|
After conversion
|
#pragma address i=0xffe00
#pragma address j=0xffe10
int i,j;
|
Pattern 4
|
Before conversion
|
__directmap struct x {
char a ;
char b ;
} xx = { 0xffe30 } ;
|
After conversion
|
#pragma address xx=0xffe30
struct x {
char a ;
char b ;
} xx;
|
Pattern 5
|
Before conversion
|
#define MY_MACRO1 (int i = 0xffe00)
__directmap MY_MACRO1;
|
After conversion
|
#define MY_MACRO1 (int i = 0xffe00)
__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.
|