RL78/F13 Datasheet

Hii,

       I am using RL78/F13 series R5F10BMG microcontroller for my project. I want to know more about registers behavior of this micro. could anyone share resources to get know about register used for EEPROM in RL78/F13 micro ?

Thanks.

  • The EEL sits on top of the FDL, it does not directly use the MCU registers, it only manages the data stored in the data-flash memory.

    The FDL interacts with the flash registers, which are not disclosed by Renesas for this device family.  Your only option for using the data-flash is use the FDL and optionally use EEL (e.g. for wear-leveling and reset resistance).

    There are two types of EEL available for RL78 - Std / T01 type which maintains backward compatibility with 78K0R/Fx3 EEL and the Tiny / T02 type which is less demanding of CPU resources.  There is no EEL support for the Pico / T04 FDL type.

    For the F13 devices with only 4KB of data-flash it is usually recommended to use the T02 EEL.  In some cases the T01 EEL can also work, but it must be evaluated on a case by case basis.

  • Hii JB,

    Under chapter 30.8 of the hardware user's manual,  There is only one register description available. what about others? is it possible to get know about all flash registers?

    Thanks.

  • Thanks for your clarification.  currently , I am using T02 EEL library .  I don't know how to plug it with my project. There is no .c files in EEL library.   could you help me to link it?

  • Here are some sample files for you (had to change file extensions to get them post here).

    Sample C-file exercising the EEL functions:

    Test-EEL_c.txt
    /************************************************************************************/
    /*                                                                                  */
    /* File:        testcase_01.c                                                       */
    /* Project:     FDL/EEL T02 demo project                                            */
    /* Device:      RL78/F12 (R5F109GE)                                                 */
    /*                                                                                  */
    /* Description: Demonstration of EEL operation.                                     */
    /*                                                                                  */
    /************************************************************************************/
    
    /* include files list */
    /* ------------------ */
    #include "compiler.h"                             /* compiler dependancies  */
    #include "fdl.h"                                  /* library API            */
    #include "fdl_types.h"                            /* library type defs      */
    #include "fdl_descriptor.h"                       /* descriptor type def    */
    #include "eel_types.h"                            /* library type defs      */
    #include "eel.h"                                  /* library API            */
    #include "user_types.h"                           /* eeprom user type defs  */
    
    
    volatile eel_u08 DebugBrk=0;
    
    
    static eel_u08 __far*      eel_version_string_pu08;              /* pointer to EEL version string    */
    
    /* my EEL demo related variables */
    static eel_request_t   my_eel_request_str;                   /* EEL-Pool request variable        */
    static eel_request_t   my_refr_eel_request_str;
    static fdl_status_t    FDL_Status;
    
    static eel_u08             eel_X_pattern_u08;                        /* EEL-pool variable pattern        */
    static eel_u08             eel_Y_pattern_u08;                        /* EEL-pool variable pattern        */
    static eel_u08             eel_Z_pattern_u08;                        /* EEL-pool variable pattern        */
    static type_X              eel_X;                                    /* EEL-Pool RAM mirror variable     */
    static type_Y              eel_Y;                                    /* EEL-Pool RAM mirror variable     */
    static type_Z              eel_Z;                                    /* EEL-Pool RAM mirror variable     */
    
    extern  void fill_buffer    (u08* destination_pu08, u08 pattern_u08,  u16 length_u16);    /* from functions.c */
    void fdl_error_handler(fdl_status_t ErrorCode);
    
    /* --------------------------------- */
    /* EEL fatal error handler            */
    /* --------------------------------- */
    void eel_error_handler(eel_status_t ErrorCode)
    {
    	while (1) {
    		COMPILER_NOP;
    	}
    }
    /* --------------------------------- */
    
    /*******************************************************************/
    static void eel_Refresh(void)
    {
    	my_refr_eel_request_str.command_enu     = EEL_CMD_REFRESH;
    
    	/* issue refresh cmd */
    	do {
    		EEL_Handler();
    		EEL_Execute(&my_refr_eel_request_str);
    	} while (EEL_ERR_REJECTED == my_refr_eel_request_str.status_enu);
    
    	if (EEL_BUSY != my_refr_eel_request_str.status_enu) {
    		/* fatal error, or should retry */
    		eel_error_handler(my_refr_eel_request_str.status_enu); 
    	}
    	else {
    		/* refresh cmd accepted, process it with the EEL handler */
    		while (EEL_BUSY == my_refr_eel_request_str.status_enu) {
    			EEL_Handler(); 
    		}
    	}
    
    	if (EEL_OK != my_refr_eel_request_str.status_enu) {
    		eel_error_handler(my_refr_eel_request_str.status_enu); 
    	}
    	else {
    
    	}
    }
    /*******************************************************************/
    
    /*******************************************************************/
    /***** BEGIN:  EEL example                                     *****/
    /*******************************************************************/
    void EEL_Test(void)
    {
      /* read out the version string of the used library */
      eel_version_string_pu08 = EEL_GetVersionString();
    
      /* initialize the library, assign the active descriptor */
    
    //  fdl_status_t FDL_Status = FDL_Init(&fdl_descriptor_str);
      FDL_Status = gFDL_Init();
      if (FDL_OK != FDL_Status) {
        fdl_error_handler(FDL_Status);
        return;
      }
      FDL_Open();
    
      /* initialize and open the access to EEL-Pool   */
    { eel_status_t my_eel_status_enu = EEL_Init();
      if (EEL_OK != my_eel_status_enu) {
        eel_error_handler(my_eel_status_enu);
        return;
      }
    } EEL_Open();
    
      /* ------------------------------------------------------------------------------------------------------------ */
      /* STARTUP the EEL pool --------------------------------------------------------------------------------------- */
      /* ------------------------------------------------------------------------------------------------------------ */
      my_eel_request_str.command_enu = EEL_CMD_STARTUP;
      EEL_Execute(&my_eel_request_str);
      while (EEL_BUSY == my_eel_request_str.status_enu) {
        EEL_Handler();
      }
    
      /* ---------------------------------------------------------------------------------------------------------- */
      /* ------ if EEL pool is inconsistent -> execute FORMAT command  and re-start STARTUP (all data lost) ------- */
      /* ---------------------------------------------------------------------------------------------------------- */
      if (EEL_ERR_POOL_INCONSISTENT == my_eel_request_str.status_enu)
      {
        my_eel_request_str.command_enu = EEL_CMD_FORMAT;
        EEL_Execute(&my_eel_request_str);
        while (EEL_BUSY == my_eel_request_str.status_enu) {
          EEL_Handler();
        }
    
        if (EEL_OK != my_eel_request_str.status_enu) {
          eel_error_handler(my_eel_request_str.status_enu);
        }
        else {
          my_eel_request_str.command_enu = EEL_CMD_STARTUP;
          EEL_Execute(&my_eel_request_str);
          while (EEL_BUSY == my_eel_request_str.status_enu) {
            EEL_Handler();
          }
          if (EEL_OK != my_eel_request_str.status_enu) {
            eel_error_handler(my_eel_request_str.status_enu);
          }
        }
      }
      /* ------------------------------------------------------------------------------------------------------------ */
    
    
    
      /* ------------------------------------------------------------------------------------------------------------ */
      /* READ all EEL variables  ------------------------------------------------------------------------------------ */
      /* ------------------------------------------------------------------------------------------------------------ */
      my_eel_request_str.command_enu     = EEL_CMD_READ;
      my_eel_request_str.address_pu08    = &eel_X[0];
      my_eel_request_str.identifier_u08  = 0x01;
      my_eel_request_str.status_enu      = EEL_OK;
    
      do {
        EEL_Handler();
        EEL_Execute(&my_eel_request_str);
      } while (EEL_ERR_REJECTED == my_eel_request_str.status_enu);
      while (EEL_BUSY == my_eel_request_str.status_enu) {
        EEL_Handler();
      }
    
      if (EEL_ERR_NO_INSTANCE == my_eel_request_str.status_enu)
      {
        eel_X_pattern_u08  = X_INIT_PATTERN;
        fill_buffer(&eel_X[0], eel_X_pattern_u08, sizeof(type_X));
      }
      else if (EEL_OK != my_eel_request_str.status_enu) {
        eel_error_handler(my_eel_request_str.status_enu);
      }
      else {
        eel_X_pattern_u08  = eel_X[0];
        eel_X_pattern_u08 += 0x33;
        fill_buffer(&eel_X[0], eel_X_pattern_u08, sizeof(type_X));
      }
      /* ------------------------------------------------------------------------------------------------------------ */
      my_eel_request_str.address_pu08    = &eel_Y[0];
      my_eel_request_str.identifier_u08  = 0x02;
      my_eel_request_str.status_enu      = EEL_OK;
    
      do {
        EEL_Handler();
        EEL_Execute(&my_eel_request_str);
      } while (EEL_ERR_REJECTED == my_eel_request_str.status_enu);
      while (EEL_BUSY == my_eel_request_str.status_enu) {
        EEL_Handler();
      }
    
      if (EEL_ERR_NO_INSTANCE == my_eel_request_str.status_enu)
      {
        eel_Y_pattern_u08  = Y_INIT_PATTERN;
        fill_buffer(&eel_Y[0], eel_Y_pattern_u08, sizeof(type_Y));
      }
      else if (EEL_OK != my_eel_request_str.status_enu) {
        eel_error_handler(my_eel_request_str.status_enu);
      }
      else {
        eel_Y_pattern_u08  = eel_Y[0];
        eel_Y_pattern_u08 += 0x33;
        fill_buffer(&eel_Y[0], eel_Y_pattern_u08, sizeof(type_Y));
      }
      /* ------------------------------------------------------------------------------------------------------------ */
      my_eel_request_str.address_pu08    = &eel_Z[0];
      my_eel_request_str.identifier_u08  = 0x03;
      my_eel_request_str.status_enu      = EEL_OK;
    
      do {
        EEL_Handler();
        EEL_Execute(&my_eel_request_str);
      } while (EEL_ERR_REJECTED == my_eel_request_str.status_enu);
      while (EEL_BUSY == my_eel_request_str.status_enu) {
        EEL_Handler();
      }
    
      if (EEL_ERR_NO_INSTANCE == my_eel_request_str.status_enu)
      {
        eel_Z_pattern_u08  = Z_INIT_PATTERN;
        fill_buffer(&eel_Z[0], eel_Z_pattern_u08, sizeof(type_Z));
      }
      else if (EEL_OK != my_eel_request_str.status_enu) {
        eel_error_handler(my_eel_request_str.status_enu);
      }
      else {
        eel_Z_pattern_u08  = eel_Z[0];
        eel_Z_pattern_u08 += 0x33;
        fill_buffer(&eel_Z[0], eel_Z_pattern_u08, sizeof(type_Z));
      }
      /* ------------------------------------------------------------------------------------------------------------ */
    
    	while (1) {
    		/* wait for debugger to proceed */
    		if (DebugBrk) {
    			break;
    		}
    	}
    
      /* ------------------------------------------------------------------------------------------------------------ */
      /* WRITE all EEL variables  ----------------------------------------------------------------------------------- */
      my_eel_request_str.command_enu     = EEL_CMD_WRITE;
      /* ------------------------------------------------------------------------------------------------------------ */
      my_eel_request_str.address_pu08    = &eel_X[0];
      my_eel_request_str.identifier_u08  = 0x01;
    
      do {
        EEL_Handler();
        EEL_Execute(&my_eel_request_str);
        if (EEL_ERR_POOL_FULL == my_eel_request_str.status_enu) {
          eel_Refresh();
        }
      } while (EEL_ERR_REJECTED == my_eel_request_str.status_enu);
      while (EEL_BUSY == my_eel_request_str.status_enu) {
        /* proceed execution */
        EEL_Handler();
      }
      if (EEL_OK != my_eel_request_str.status_enu) {
        eel_error_handler(my_eel_request_str.status_enu);
      }
    
      /* ------------------------------------------------------------------------------------------------------------ */
      my_eel_request_str.address_pu08    = &eel_Y[0];
      my_eel_request_str.identifier_u08  = 0x02;
    
      do {
        EEL_Handler();
        EEL_Execute(&my_eel_request_str);
        if (EEL_ERR_POOL_FULL == my_eel_request_str.status_enu) {
          eel_Refresh();
        }
      } while (EEL_ERR_REJECTED == my_eel_request_str.status_enu);
      while (EEL_BUSY == my_eel_request_str.status_enu) {
        EEL_Handler();
      }
      if (EEL_OK != my_eel_request_str.status_enu) {
        eel_error_handler(my_eel_request_str.status_enu);
      }
    
      /* ------------------------------------------------------------------------------------------------------------ */
      my_eel_request_str.address_pu08    = &eel_Z[0];
      my_eel_request_str.identifier_u08  = 0x03;
    
      do {
        EEL_Handler();
        EEL_Execute(&my_eel_request_str);
        if (EEL_ERR_POOL_FULL == my_eel_request_str.status_enu) {
          eel_Refresh();
        }
      } while (EEL_ERR_REJECTED == my_eel_request_str.status_enu);
      while (EEL_BUSY == my_eel_request_str.status_enu) {
        EEL_Handler();
      }
      if (EEL_OK != my_eel_request_str.status_enu) {
        eel_error_handler(my_eel_request_str.status_enu);
      }
      /* ------------------------------------------------------------------------------------------------------------ */
    
      /* calculate next write pattern */
      eel_X_pattern_u08 += 0x33;
      eel_Y_pattern_u08 += 0x33;
      eel_Z_pattern_u08 += 0x33;
      fill_buffer(&eel_X[0], eel_X_pattern_u08, sizeof(type_X));
      fill_buffer(&eel_Y[0], eel_Y_pattern_u08, sizeof(type_Y));
      fill_buffer(&eel_Z[0], eel_Z_pattern_u08, sizeof(type_Z));
    
    	while (1) {
    		/* wait for debugger to proceed */
    		if (DebugBrk) {
    			break;
    		}
    	}
    
      /* ------------------------------------------------------------------------------------------------------------ */
      /* SHUTDOWN the EEL pool   ------------------------------------------------------------------------------------ */
      /* ------------------------------------------------------------------------------------------------------------ */
      my_eel_request_str.command_enu     = EEL_CMD_SHUTDOWN;
      my_eel_request_str.status_enu      = EEL_OK;
    
      EEL_Execute(&my_eel_request_str);
      while (EEL_BUSY == my_eel_request_str.status_enu) {
        EEL_Handler();
      }
      if (EEL_OK != my_eel_request_str.status_enu) {
        eel_error_handler(my_eel_request_str.status_enu);
      }
      /* ------------------------------------------------------------------------------------------------------------ */
    
    
    
      /* close the access to EEL-Pool   */
      EEL_Close();
    
    
      /* deactivate data flash "physically" */
      FDL_Close();
    
    
      /* just a short delay */
      COMPILER_NOP;
      COMPILER_NOP;
      COMPILER_NOP;
      COMPILER_NOP;
      COMPILER_NOP;
      COMPILER_NOP;
      COMPILER_NOP;
      COMPILER_NOP;
    }
    /*******************************************************************/
    void AppHandlerCback(void)
    {
    	/* no WDT to service, no peripherals, to poll, etc. */
    }
    /*******************************************************************/
    

    Sample linker definition for CC-RL:

    RL78-EEL-CCRL_dir.txt
    ;*******************************************************************************
    ; Library       : Flash Data Library T02 (Tiny FDL)
    ;
    ; File Name     : $Source: eel_sample_linker_file.sub $
    ; Lib. Version  : $RL78_EEL_LIB_VERSION_T02_CCRL: V1.00 $
    ; Mod. Revision : $Revision: 1.4 $
    ; Mod. Date     : $Date: 2015/03/11 16:09:40MEZ $
    ; Device(s)     : RL78/G13 (R5F100LE)
    ; Description   : Linker sample file, please modify according to your device
    ;******************************************************************************
    ; DISCLAIMER
    ; This software is supplied by Renesas Electronics Corporation and is only
    ; intended for use with Renesas products. No other uses are authorized. This
    ; software is owned by Renesas Electronics Corporation and is protected under
    ; all applicable laws, including copyright laws.
    ; THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
    ; THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
    ; LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
    ; AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
    ; TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
    ; ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
    ; FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
    ; ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
    ; BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
    ; Renesas reserves the right, without notice, to make changes to this software
    ; and to discontinue the availability of this software. By using this software,
    ; you agree to the additional terms and conditions found by accessing the
    ; following link:
    ; http://www.renesas.com/disclaimer
    ;
    ; Copyright (C) 2015 Renesas Electronics Corporation. All rights reserved.
    ;*******************************************************************************
    
    ;***********************************************************************************************************************
    ; ATTENTION: 
    ;   Below settings for the linker only consider the sections required by EEL.
    ;   Before using this linker command file it is imperative to add sections according to your application needs.
    ;
    ; CAUTIONS:
    ;   1.  Do not locate any function arguments, data buffers or stack to the short address area from 0xFFE20 to 0xFFEDF.
    ;   2.  It is not allowed to locate any arguments and stack memory to the self-RAM area.
    ;       For the RAM areas used by the flash library for the given microcontroller, please consult 
    ;       "Self RAM list of Flash Self-Programming Library for RL78 Family" (R20UT2943(JPN), R20UT2944(ENG))
    ;   3.  Please also consider further restrictions regarding memory sections for your target microcontroller (e.g. for 
    ;       on-chip debugging and the mirror area). For details, please consult the "User's Manual: Hardware" of your target
    ;       microcontroller.
    ;
    ; SECTIONS:
    ;   1.  FDL_CODE: contain the actual library code of the Tiny FDL
    ;       - for CC-RL compiler, the library takes care in the code to define this section with TEXTF_UNIT64KP relocation
    ;         attribute
    ;   2.  EEL_CODE: contain the actual library code of the Tiny EEL
    ;       - for CC-RL compiler, the library takes care in the code to define this section with TEXTF_UNIT64KP relocation
    ;         attribute
    ;   3.  FDL_CNST: contain the constants used by the Tiny FDL
    ;       - for CC-RL compiler, the library takes care in the code to define this section with TEXTF_UNIT64KP relocation
    ;         attribute
    ;   4.  EEL_CNST: contain the constants used by the Tiny EEL
    ;       - for CC-RL compiler, the library takes care in the code to define this section with TEXTF_UNIT64KP relocation
    ;         attribute
    ;   5.  FDL_SDAT: contain all FDL-internal variables used by the Tiny FDL
    ;       - for CC-RL compiler, the library takes care in the code to define this section with SBSS relocation
    ;         attribute
    ;   6.  EEL_SDAT: contain all EEL-internal variables used by the Tiny EEL
    ;       - for CC-RL compiler, the library takes care in the code to define this section with SBSS relocation
    ;         attribute
    ;***********************************************************************************************************************
    
    ; please note that below mapping is only a sample for RL78/G13 (R5F100LE) and might need to be adapted to your 
    ; microcontroller
    
    -STARt=FDL_CODE*,EEL_CODE*/D8,FDL_CNST*,EEL_CNST*/8000,FDL_SDAT*,EEL_SDAT*/FFE20 
    
    
    

    Sample linker definition for IARv2:

    lnkr5f10bmg-EEL-IARv2_icf.txt
    //-------------------------------------------------------------------------
    //      ILINK command file template for RL78 microcontroller R5F10BMG.
    //
    //      This file can be used to link object files from the RL78
    //      Assembler, IASMRL78, and the C/C++ compiler ICCRL78.
    //
    //          This file is generated from the device file:
    //          DR5F10BMG.DVF
    //          Copyright(C) 2015 Renesas
    //
    //          Core type: s3
    //
    //          Format version 3.00, File version 1.11 
    //-------------------------------------------------------------------------
    
    define exported symbol __link_file_version_2 = 1;
    
    initialize by copy with packing = auto { rw };
    initialize manually { ro section .const, ro section .switch };
    do not initialize  { section *.noinit };
    
    define memory mem with size = 1M;
    
    // R5F10BMG RAM:  8 Kbytes (FDF00H to FFEFFH)
    define region ROM_near = mem:[from 0x000D8 to 0x0FFFF];
    define region ROM_far  = mem:[from 0x000D8 to 0x1FFFF];
    define region ROM_huge = mem:[from 0x000D8 to 0x1FFFF];
    define region SADDR    = mem:[from 0xFFE20 to 0xFFEDF];
    define region RAM_Self = mem:[from 0xFDF00 to 0xFE2FF];
    define region RAM_near = mem:[from 0xFE300 to 0xFFE1F];
    define region RAM_far  = mem:[from 0xFE300 to 0xFFE1F];
    define region RAM_huge = mem:[from 0xFE300 to 0xFFE1F];
    define region VECTOR   = mem:[from 0x00000 to 0x0007F];
    define region CALLT    = mem:[from 0x00080 to 0x000BF];
    define region EEPROM   = mem:[from 0xF1000 to 0xF1FFF];
    
    define block NEAR_HEAP with alignment = 2, size = _NEAR_HEAP_SIZE {  };
    define block FAR_HEAP  with alignment = 2, size = _FAR_HEAP_SIZE {  };
    define block HUGE_HEAP with alignment = 2, size = _HUGE_HEAP_SIZE {  };
    define block CSTACK    with alignment = 2, size = _STACK_SIZE { rw section CSTACK };
    define block INIT_ARRAY with alignment = 2, fixed order { ro section .preinit_array,
                                                              ro section .init_array };
    define block MIRROR_ROM with maximum size = _NEAR_CONST_LOCATION_SIZE { ro section .const_init,
                                                                            ro section .switch_init };
    define block MIRROR_RAM with maximum size = _NEAR_CONST_LOCATION_SIZE { rw section .const,
                                                                            rw section .switch };
    define block OPT_BYTE with size = 4  { ro section .option_byte,
                                           ro section OPTBYTE };
    define block SECUR_ID with size = 10 { ro section .security_id,
                                           ro section SECUID };
    define block OCD_ROM_AREA with alignment = 2, size = 0x0200 {  };
    define block OCD_TRACE_AREA with alignment = 2, size = 0x0200 {  };
    define block HOTPLUGIN_AREA with alignment = 2, size = 0x0030 {  };
    
    
    place at address mem:0x00000       { ro section .reset };
    place at address mem:0x00004       { ro section .intvec };
    place at address mem:0x000C0       { block OPT_BYTE };
    place at address mem:0x000C4       { block SECUR_ID };
    place at address mem:0x1FE00       { block OCD_ROM_AREA };
    place at address mem:0xFE300       { block OCD_TRACE_AREA };
    place at address mem:0xFE500       { block HOTPLUGIN_AREA };
    place at address mem:_NEAR_CONST_LOCATION_START             { block MIRROR_ROM };
    place at address mem:(_NEAR_CONST_LOCATION_START | 0xF0000) { block MIRROR_RAM };
    
    "CALLT":place in CALLT             { ro section .callt0 };
    
    "ROMNEAR":place in ROM_near        { ro section .text};
    
    "ROMFAR":place in ROM_far          { block INIT_ARRAY,
                                         rw section .text_unit64kp,
                                         ro section FDL_CODE,
                                         ro section EEL_CODE,
                                         ro section FDL_CNST,
                                         ro section EEL_CNST,
                                         ro section .constf,
                                         ro section .switchf,
                                         ro };
    
    "ROMHUGE":place in ROM_huge        { ro section .consth,
                                         ro section .textf };
    
    "RAMNEAR":place in RAM_near        { block NEAR_HEAP,
                                         block CSTACK,
                                         zi section .iar.dynexit,
                                         rw section .data,
                                         rw section .bss*,
                                         rw };
    
    "RAMFAR":place in RAM_far          { block FAR_HEAP,
                                         rw section .dataf,
                                         rw section .data_unit64kp,
                                         rw section .bss_unit64kp,
                                         rw section .bssf* };
    
    "RAMHUGE":place in RAM_huge        { block HUGE_HEAP,
                                         rw section .hdata,
                                         rw section .hbss* };
    
    "SADDRMEM":place in SADDR          { rw section .sdata,
                                         rw section .sbss,
                                         rw section FDL_SDAT,
                                         rw section EEL_SDAT,
                                         rw section .wrkseg };
    
    // Set the symbol __RESERVE_OCD_ROM to 1 to reserve the OCD area for debugging.
    // IDE: Symbol can be defined within the project settings here:
    //      "Project"-->"Options..."->"Linker"-->"Config"-->"Configuration file symbol definitions"
    //      Symbol definition: __RESERVE_OCD_ROM=1
    // Command line: --config_def __RESERVE_OCD_ROM=1
    
    if (isdefinedsymbol(__RESERVE_OCD_ROM))
    {
      if (__RESERVE_OCD_ROM == 1)
      {
        keep { block OCD_ROM_AREA };
      }
    }
    
    // Set the symbol __RESERVE_OCD_TRACE_RAM to 1 to reserve the OCD trace ram area for debugging.
    // IDE: Symbol can be defined within the project settings here:
    //      "Project"-->"Options..."->"Linker"-->"Config"-->"Configuration file symbol definitions"
    //      Symbol definition: __RESERVE_OCD_TRACE_RAM=1
    // Command line: --config_def __RESERVE_OCD_TRACE_RAM=1
    
    if (isdefinedsymbol(__RESERVE_OCD_TRACE_RAM))
    {
      if (__RESERVE_OCD_TRACE_RAM == 1)
      {
        keep { block OCD_TRACE_AREA };
      }
    }
    
    // Set the symbol __RESERVE_HOTPLUGIN_RAM to 1 to reserve the hot plugin area for debugging.
    // IDE: Symbol can be defined within the project settings here:
    //      "Project"-->"Options..."->"Linker"-->"Config"-->"Configuration file symbol definitions"
    //      Symbol definition: __RESERVE_HOTPLUGIN_RAM=1
    // Command line: --config_def __RESERVE_HOTPLUGIN_RAM=1
    
    if (isdefinedsymbol(__RESERVE_HOTPLUGIN_RAM))
    {
      if (__RESERVE_HOTPLUGIN_RAM == 1)
      {
        keep { block HOTPLUGIN_AREA };
      }
    }
    
    

    Sample linker definition for GCC-RL78:

    RL78-F1x-EEL-GCC_ld.txt
    /*******************************************************************************
    * Library       : EEPROM Emulation Library (T02)
    *
    * File Name     : $Source: eel_sample_linker_file.ld $
    * Lib. Version  : $RL78_EEL_LIB_VERSION_T02_GNU: V1.00 $
    * Mod. Revision : $$
    * Mod. Date     : $$
    * Device(s)     : RL78/F13,F14,F15 (R5F10Axx,R5F10Bxx,R5F10Pxx,R5F113xx)
    * Description   : Linker sample file, layed out to work with ANY RL78/F1x device with 32KB or more flash
    *******************************************************************************
    * DISCLAIMER
    * This software is supplied by Renesas Electronics Corporation and is only
    * intended for use with Renesas products. No other uses are authorized. This
    * software is owned by Renesas Electronics Corporation and is protected under
    * all applicable laws, including copyright laws.
    * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
    * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
    * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
    * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
    * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
    * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
    * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
    * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
    * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
    * Renesas reserves the right, without notice, to make changes to this software
    * and to discontinue the availability of this software. By using this software,
    * you agree to the additional terms and conditions found by accessing the
    * following link:
    * http://www.renesas.com/disclaimer
    *
    * Copyright (C) 2012-2014 Renesas Electronics Corporation. All rights reserved.
    ************************************************************************************
    *               R5F10xxC    R5F10AxE    R5F10BxE    R5F10BMG    R5F10PPJ    R5F113TL
    *               F13/LIN     F13/LIN     F13/CAN     F13/CAN     F14/256KB   F15/512KB
    * RAM-End        FEFF0H      FEFF0H      FEFF0H      FFEFFH      FEFFFH      FFEFFH
    * RAM-Size         2KB         4KB         4KB         8KB        20KB        32KB
    * RAM-Start      FF700H*     FEF00H      FEF00H      FDF00H      FAF00H      F7F00H
    * Mirror-End     F7FFFH      FEEFFH      FBFFFH      FDEFFH      FAEFFH      F7EFFH*
    * Mirror-Size     24KB       51.75KB      40KB       47.75KB     31.75KB     11.75KB*
    * Mirror-Start   F2000H      F2000H      F2000H      F2000H      F3000H      F5000H*
    * DF-End         F1FFFH      F1FFFH      F1FFFH      F1FFFH      F2FFFH      F4FFFH
    * DF-Size          4KB         4KB         4KB         4KB         8KB        16KB
    * DF-Start       F1000H*     F1000H*     F1000H*     F1000H      F1000H      F1000H
    *
    * CF-End         08000H*     08000H      08000H      20000H      40000H      80000H
    * CF-Size          32KB        64KB        64KB       128KB       256KB       512KB
    * 
    ************************************************************************************/
    
    OUTPUT_ARCH(rl78)
    ENTRY(_start)
    
    MEMORY
    {
        VEC : ORIGIN = 0x0, LENGTH = 4
        IVEC : ORIGIN = 0x4, LENGTH = 188
        OPT : ORIGIN = 0xC0, LENGTH = 4
        SEC_ID : ORIGIN = 0xC4, LENGTH = 10
        OCDSTAD : ORIGIN = 0xCE, LENGTH = 10
        OCDROM : ORIGIN = 0xFE00, LENGTH = 512
        ROM : ORIGIN = 0xD8, LENGTH = 20264
        MIRROR : ORIGIN = 0x05000, LENGTH = 12032
    
        DATAFLASH : ORIGIN = 0xF1000, LENGTH = 4096
        RAM : ORIGIN = 0xFF700, LENGTH = 1792
        SADDR (w) : ORIGIN = 0xffe20, LENGTH = 160
    }
    
    
    SECTIONS
    {
        .vec 0x0 : AT (0x0)
        {
            KEEP(*(.vec))
        } > VEC
        .vects 0x4 : AT (0x4)
        {
            KEEP(*(.vects))
        } > IVEC
        .option_bytes 0xC0 : AT (0xC0)
        {
            KEEP(*(.option_bytes))
        } > OPT
        .security_id 0xC4 : AT (0xC4)
        {
            KEEP(*(.security_id))
        } > SEC_ID
    
        FDL_CODE 0xD8 : AT (0xD8)
        {
            *(FDL_CODE)
        } > ROM
    
        EEL_CODE :
        {
            *(EEL_CODE)
        } > ROM
    
        FDL_CNST : 
        {
            *(FDL_CNST)
        } > ROM
    
        EEL_CNST : 
        {
            *(EEL_CNST)
        } > ROM
    
        .frodata : 
        {
            . = ALIGN(2);
            *(.frodata)
            *(.frodata.*)
            _efrodata = .;
        } > ROM
    
    PROVIDE (__rl78_abs__ = 0);
    
    /*******************************************************************************
    * .text section is intentionally placed after the constants sections in order
    * to ensure correct mapping of constants into the mirror area.
    * This approach may leave an unused gap in the ROM area before the mirror area.
    * If application requires more ROM, then an additional ROM section might be
    * defined before the mirror area, but care should be taken that the constants
    * sections .rodata, FDL_CNST and EEL_CNST are mapped inside the mirror area.
    *******************************************************************************/
        .text :
        {
            *(.text)
            *(.text.*)
            etext = .;
            . = ALIGN(2);
        } > ROM
        .init : 
        {
            *(.init)
        } > ROM
        .fini : 
        {
            *(.fini)
        } > ROM
        .got : 
        {
            *(.got)
            *(.got.plt)
        } > ROM
        .eh_frame_hdr : 
        {
            *(.eh_frame_hdr)
        } > ROM
        .eh_frame : 
        {
            *(.eh_frame)
        } > ROM
        .jcr : 
        {
            *(.jcr)
        } > ROM
        .tors : 
        {
            . = ALIGN(2);
            __CTOR_LIST__ = .;
            ___ctors = .;
            *(.ctors)
            ___ctors_end = .;
            __CTOR_END__ = .;
            __DTOR_LIST__ = .;
            ___dtors = .;
            *(.dtors)
            ___dtors_end = .;
            __DTOR_END__ = .;
            . = ALIGN(2);
        } > ROM
    
        .rodata : 
        {
            . = ALIGN(2);
            *(.rodata)
            *(.rodata.*)
            _mdata = .;
        } > MIRROR
    
        .data : AT (_mdata)
        {
            . = ALIGN(2);
            _data = .;
            *(.data)
            *(.data.*)
            . = ALIGN(2);
            _edata = .;
        } > RAM
        .bss : 
        {
            . = ALIGN(2);
            _bss = .;
            *(.bss)
            *(.bss.**)
            . = ALIGN(2);
            *(COMMON)
            . = ALIGN(2);
            _ebss = .;
            _end = .;
        } > RAM
        .stack 0xFFE00 (NOLOAD)  : AT (0xFFE00)
        {
            _stack = .;
        } > RAM
    
        FDL_SDAT (NOLOAD) :
        {
            _FDL_SDAT = .;
        } > SADDR  
    
        EEL_SDAT (NOLOAD) :
        {
           _EEL_SDAT = .;
        } > SADDR  
    
        .saddr : 
         {
         . = ALIGN(2);
         PROVIDE (__saddrstart = .);
         *(.saddr)
         . = ALIGN(2);
         } >SADDR AT>ROM
    }
    

  • Hello pk,

    How is your issue? Has JB answered your questions? Please let us know if we can mark this post as solved.

    Kind regards,

    Sergey Sokol

    RenesasRulz Forum Moderator

    https://renesasrulz.com/
    https://academy.renesas.com/
    https://en-support.renesas.com/knowledgeBase/

  • Hi JB 

    May I ask you something?
    I also use the RL78F13 (R5F10BLF), and the clock is set to 32MHz.
    When the status of the pool is full after executing the write command, it needs to be refreshed. How long does it take to "refresh"?

    In my case, the refresh time is about 60msec. (see below )

    NOP(); /* start */
    eel_request.command_enu = EEL_CMD_REFRESH;
    EEL_Execute( &eel_request );
    while( eel_request.status_enu == EEL_BUSY ) EEL_Handler();
    NOP(); /* end */


    Could it be that the while routine calls EEL_Handler consecutively, taking more time?
    Is there any way to do it faster?

    thank you.

  • I would guess that calling the handler in a loop would be the fastest way to execute a refresh.

    60ms is not an unreasonable time for  refresh operation, from the T02 EEL U/M:

    Dependencies on the number of data sets being stored and the size of the data sets will drive the time for a refresh, there probably isn't a whole you can do outside of monitoring the free space with the EEL_GetSpace() function and maybe triggering a refresh earlier than waiting until the block is full and unable to accept another write operation.

  • Dear JimB.

    Thanks for your advice.
    In normal operation, taking 60msec time is not a problem.
    But, if B+ (Power) is off suddenly while the motor is running, the last position should be saved, but 60msec is not enough time to save.
    In terms of H/W, the capacitor only maintains VDD for about 30msec.

    When I applied FDL before applying EEL, Block Erase time was less than 10msec.
    When using EEL, I don't understand why the refresh time takes more than 60msec.

    Anyway, as you advised, I'll use the EEL_GetSpace() function and apply the space check beforehand.

    thank you.

  • I don't know why the time is so long to perform the refresh, there must be a lot of manual housekeeping in programming the new block with the most recently written data, etc.

    Good luck with your application.