Unable to load my code in R5F21258SNFP through Renesas E8a deubgger -"Memory area error. It is outside the effective address range" warning is shown by emulator.


  • Controller: R5F21258SNFP 
  • Debugger: Renesas E8a 
  • ToolChain : M16C
  • IDE         : HEW Version
  • Evaluation Version


  •  When i try to load my code into controller. My  debugger is getting connected but when trying to load into the device, the emulator throws the following warning. "Memory area error. It is outside the effective address range".


  • For your kind reference the Memory details are below
    • DATA 0002757(00AC5H) Byte(s)
    • ROMDATA 0003776(00EC0H) Byte(s)
    • CODE 0053064(0CF48H) Byte(s)


      Please find the attachments in the URL(Google Drive)

  • Files
    • Build Output Log file
    • Map File (File name Rest.map)
  • Images
    • Memory Area error warning message
    • Build Log
  • Related Files
    • ncrt0.a30
    • nc_define.inc 
    • sect30.inc



  • The debugger has information about the available memory range in the processor. It "knows" that program flash uses the address range 0x004000 - 0x13FFF. Your code goes far beyond this area. Please split your code to near code and far code areas.
  • Noted and Thanks. It was very helpful.

    Now i face a problem wherein my library files are creating a issue. sprintf,strncpy,strlen etc are not able to link properly. This causes my device to hang completely. I use nc30lib and have set CPU settings to R8C/2X series

    How to overcome this issue.
  • Sorry, a description "it does not work, why" does not give any hints as to what could be the problem.
    What gives you the idea that it is a library problem?
    I have never heard of a library problem crashing an application.
    To which addresses are your libraries linked?
    Have you checked the library calls in your application? Do they go to the correct addresses?
    Which CPU type do you select?
  • Hi Raja,

    Is this issue okay now? Please confirm so that we can close this thread. Thank you.

    RenesasRulz Forum Moderator


  • I resolved the issue using #pragma. I have another question. Is it possible to write/erase half of 1kb page (internal flash).
  • You can write a single byte, but you can only erase complete blocks. So 1KB in data flash is minimum.
  • Noted and thanks. While writing Flash i must check whether Vcc falls below 2.7 V

    Found this document: reu05b0104_r8cap.pdf where API_MonitorVccAndResetIfLow seems useful.

    But i couldn't find the iec_tests.c iec_tests.h.
  • This application note is for implementing self test for IEC 60730.
    Did you also download the sample source code?

    I would guess this is much more than what you are looking for. The monitor software initializes the voltage detection circuit and resets the processor if the voltage detection is triggered.
  • Thank you for the quick response. Minutes ago i found the same document. I was lost initially!!
    My aim is to stop writing into internal flash if my Vcc goes beyond the 2.7V being said in Datasheet

    how to enable the interrupt of voltage monitoring?
    how to get the voltage value from registers?

    if(Voltval( )>2.7V) //Voltvalfunction shall return value
    Result=FlashWrite((FLASH_PTR_TYPE)0x2400,(BUF_PTR_TYPE) local_buff,902);//BlockA
    //try 3 times
    then break;
    display error on screen

    unsigned char Voltval(void)

    /* Protection off for VCA2 and VW1C */
    prc3 = 1;

    vw1c1 = 0x01;//bit 1 dig filter disabled
    vca26 = 0x01;//bit 6 set , Voltage detection 1 circuit enabled

    //wait for 100 μs

    vw1c7 = 0x00;
    vw1c1 = 0x01//dig filter disabled
    vw1c1 = 0x00;//volt monitor1 interrupt mode

    vw1c2 = 0x00;

    prc0 = 1;//prcr = 1; /* Protection off */
    cm14 = 0x00;
    prc0 = 0;//prcr = 1; /* Protection on */

    //wait time req only if dig filer is enabled

    vw1c0 = 0x01;//volt monitor enabled

    /* Protection on for VCA2 and VW1C */
    prc3 = 0;


    In the sample code being provided (API_MonitorVccAndResetIfLow) Why is it shifted and divided. In my case wherein i have to just know the Vcc . how can i implement it.

    And my OFS register is something like this in sect30.c
    ; fixed vector section
    .section fvector,ROMDATA ; fixed vector table
    ; .org 0ffdcH
    ; option function select register
    .ofsreg 0FFH //THIS ONE

    .endif ; __R8C

  • How should i enable the Voltage Monitor 2 Interrupt? While doing so my code id was corrupted and i couldn't reprogram my MCU.
  • Hi, Please provide me some solution, i'm stuck up in creating the voltage monitor 2 interrupt
  • Raja,

    Have you had any luck testing your voltage?

    Mike Clements
    RenesasRulz Moderator
Reply Children