Unable to map constant data to __far areas of flash memory

Hello All,

I am working on a RL78 G14 Target whom reference is : R5F104GL

 

Compiler is Renesas CC-RL V1.08

 

The aim of the project I have is to locate huge quantities of data (over 30KBytes) in Flash that should be modified from time to time by my embedded application via the Renesas FSL libraries.

Now, I am just starting in writing this chunk of code to simply place these two Flash variables in Flash : one in __near area Flash on-board memory (MyNearAddressedNonVolatileConstant) and the second in the __far area Flash on-board memory (MyFarAddressedNonVolatileConstant).

 

 

Below is copy of the C source file :

 

void  main(void);


static __near void CPUSavePSW (void);


static __near void CPURestorePSW (void);


void __far MyFarAdressedFunction (void);

 


unsigned char MyGlobaleRAMVariable;

 

 

#pragma section const MyConstant

/* constant in Flash intended to be located in MyConstant_f and to be modified by Renesas FSL libraries later */
const unsigned int __far MyFarAddressedNonVolatileConstant= 5U;

/* constant in Flash intended to be located in MyConstant_n */
const int __near MyNearAddressedNonVolatileConstant= 5;

#pragma section

 

 

 

#pragma inline_asm       CPUSavePSW


static __near void CPUSavePSW (void)


{


MOV A, PSW


MOV !(_MyGlobaleRAMVariable), A


DI


}

#pragma inline_asm       CPURestorePSW


static __near void CPURestorePSW (void)


{
MOV A,!(_MyGlobaleRAMVariable)


MOV PSW, A


}

 


void  main(void)
{
__EI();


while(1)
{

// TODO: add application code here


CPUSavePSW();


CPURestorePSW();

MyFarAdressedFunction();


}


}


void __far MyFarAdressedFunction (void)


{
MyGlobaleRAMVariable = __get_psw();

 


}

 


Link section options are

-Start=.data,.sdata,.RLIB,.SLIB,.dataR,.bss/003000,.sdataR,.sbss/0F3000,.text:.const:MyConstant_n/001FFF,.textf:.constf:MyConstant_f/00FDE8

 

 


Console output gives :

 

W0561520:"on chip debug" in ".option_byte" created by device file


W0561122:Section address in start option is incompatible with alignment: ".const"

 

W0561122:Section address in start option is incompatible with alignment: "MyConstant_n"

 
E0562320: Section address overflowed out of range : ".const"

 

 

Based on the above description of source code and linker start options, 


1) Could you check the above code and help me understanding:

1-a) why the project is not compiling and generated such Error on .const address ?
1-b) confirm if the __far constant MyFarAddressedNonVolatileConstant  is not mapped to demanded address in Flash 
(address is intended to be located in Code Flash and over the first 64K, more precisely at 00FDE8
as you can see the above link section definition)
2) In addition, I would like to know if __far data in program flash that are intended to be modified via FSL library should be declared in section with "text" attribute or with "const" attribute ?

 

 Thank You 

 

Gilbert

  • First problem, 0x001FFF is NOT near address area. This is a far address. In RL78 near ROM is in mirror area at address 0xFFnnnn