Skip to main content
Renesas Electronics Europe - Knowledgebase

How to read out the whole ROM area?

Latest Updated:05/18/2015


I am using the CC-RL compiler for RL78 devices. How can I read out the whole ROM area?


You need access with the far attribute, since mirror areas and non-mirror areas are present in ROM from the MCU’s point of view. Declare the addresses to be accessed as unsigned long type; and access a far pointer after casting, since the CC-RL C compiler has a specification for only changing the 2 lower-order bytes as a result of addition to and subtraction from far pointers.

int data;
#define TOPADDR 0x00000
#define ENDADDR 0x20000
unsigned char sumdata;
void chksum(void)
	unsigned long addr = TOPADDR;
	unsigned char sum = 0x00;
	sum += *(__far const unsigned char *)addr;
	}while(addr !=ENDADDR);
	sumdata = sum;
Suitable Products
e² studio
CS+ (formerly CubeSuite+)
C Compiler Package for RL78 Family