Home

Data Flash Access Library - Type T01

image

Contents

1. 4 R FDL OK operation R FDL Handler gt EN Check Busy i 4 R FDL BUSY Write third word R FDL Handler Check Ready 4 R FDL OK dle Figure 11 Stand By processing on a Data Flash Write operation R01US0079ED0103 User Manual RENESAS EN Data Flash Access Library Type T01 European Release User Interface API Chapter 4 User Interface API This chapter provides the formal description of the application programming interface of the Flash Data Library Type TO1 FDL Itis strongly advised to read and understand the previous chapters presenting the concepts and structures of the library before continuing with the API details 4 1 Pre compile configuration The pre compile configuration has a direct impact on the object file generated by the compiler Hence it is used for conditional compilation e g solve device dependencies of the code The configuration is done in the module fd1 cfg h The user has to configure all parameters and attributes by adapting the related constant definitions in that header file The following configuration options are available 1 Critical section One configuration element is the critical section handling of the library The function R FDL Init needs to activate the device internal special memory for a short time in order to have access to certain data This results in disabling the Code Flash During
2. C R FDL CMD READ End ee Figure 14 Handling of ECC error registers during read command The user shall take into consideration that the following registers are modified 1 DFERSTC register is written to clear any errors in DFFSTERSTR 2 DFERRINT register is backed up and cleared 3 DFERRINT register is restored R01US0079ED0103 User Manual 2ENESAS User Interface API 54 Data Flash Access Library Type T01 European Release Library Setup and Usage Chapter 5 Library Setup and Usage This chapter contains important information about how to put the FDL into operation and how to integrate it into your application Please read this chapter carefully and also especially Chapter 6 Cautions in order to avoid problems and misbehaviour of the library Before integrating the library into your project however please make sure that you have read and understood how the FDL works and which basic concepts are used see Chapter 2 Architecture and Chapter 3 Functional Specifications 5 1 Obtaining the library The FDL is provided by means of an installer via the Renesas homepage at http www renesas eu update Please follow the instructions of the installer carefully Please ensure to always work on the latest version of the library 5 2 File structure The library is delivered as a complete compilable sample project which contains the FDL and in addition an application sample to show the library implementat
3. R01US0079ED0103 User Manual RENESAS Data Flash Access Library Type T01 European Release User Interface API Arguments Parameters None Return value e H FDL OK Operation finished successfully r fdl status t e HR FDL ERR REJECTED Wrong library handling flow FDL is not in stand by state Pre The library must be in stand by mode condmions The hardware conditions CPU frequency voltage etc must be restored to the state before issuing the stand by request Post None conditions Description The main purpose of this function is to wake up the library from the stand by mode and resume Flash hardware For more information see chapter 3 6 Stand by and Wake up functionality Example See R FDL StandBy 4 4 4 Administration 4 4 4 1 R_FDL_GetVersionString Outline This function returns the pointer to the null terminated library version string Interface C Interface const uint8 t R FDL GetVersionString void Arguments Parameters None R01US0079ED0103 User Manual RENESAS 8 Data Flash Access Library Type TO1 European Release User Interface API Return value Type Description The library version is a string value in the following const uint8_t format DH850T01xxxxxYZabcD Please check function description below for details Pre None conditions Post None conditions Description D H850 TO1 xxxxx Y Z abc D Opti
4. Therefore it is important to read this user manual in advance The best way after initial reading of the user manual will be testing the FDL application sample After a first compile run it will be worth playing around with the library in the debugger By that you will get a feeling for the source code files and the working mechanism of the library After this exercise it might be easier to understand and follow the recommendations and considerations of this document R01US0079ED0103 User Manual RENESAS ot Data Flash Access Library Type T01 European Release Library Setup and Usage Note Before the first compile run the compiler path must be configured in the Makefile of the sample application set the variable COMPILER INSTALL DIR to the correct compiler directory 5 6 Library configuration Before using the Data Flash Access library the library has to be configured and adapted to a certain degree in order to fit the requirements of the user application For information about configuration settings and handling please refer to chapter 4 2 Run time configuration 5 7 Basic Reprogramming Flow The following flow chart shows the basic reprogramming flow for a certain Data Flash range RO1US0079ED0103 59 User Manual ENESAS Data Flash Access Library Type T01 European Release Library Setup and Usage C Reprogramming start b Y FDL Init y A Configure request structure req R_FD
5. Value Description R_FDL_OK FDL operation successfully finished R_FDL_BUSY FDL operation is still ongoing R FDL SUSPENDED Data Flash operation is suspended R FDL ERR CONFIGURATION The FDL configuration descriptor was wrong R FDL ERR PARAMETER An error was found in the given parameter s R FDL ERR PROTECTION FDL operation stopped due to hardware error wrong access rights or wrong conditions R FDL ERR REJECTED A flow error occurred e g library not initialized other operation on going R FDL ERR WRITE Data Flash write error R FDL ERR ERASE Data Flash erase error R FDL ERR BLANKCHECK The blank check command was stopped because the specified area is not blank R FDL ERR COMMAND Unknown command R FDL ERR ECC SED Single bit error detected by ECC R FDL ERR ECC DED Double bit error detected by ECC R FDL ERR INTERNAL The current FDL command stopped due to an library internal error e g hardware errors that should never occur or library errors which were not expected and might result from library data manipulation by the application 4 4 Functions The API functions grouped by their role in the interface Initialization e R FDL Init Flash Operations e R FDL Execute e R FDL Handler Operation control e R FDL SuspendRequest e R FDL ResumeRequest e R FDL StandBy e R FDL WakeUp R01US0079ED0103 User Manual RENESAS 91 Data Flash Access Library
6. Command operation Description R FDL CMD ERASE Flash erase Erase one or more Flash blocks R FDL CMD WRITE Flash write Write one or more Flash words Blank Check one or more Flash words Return the fail R FDL CMD BLANKCHECK Flash blank check address in case some Flash word is not blank Read one or more Flash words to a buffer Return a R FDL CMD READ Flash data read possible ECC Error correction code error to the application together with the address of the error The following picture shows the basic flow of Flash operations at the example of erasing 2 Flash blocks While the Flash hardware can only Erase or Write one unit Erase 1 block Write 1 word the FDL will manage handling multiple units Blank Check is executed on word basis but internally it is split in multiple units at each multiple of 0x4000 bytes boundary R01US0079ED01 03 14 User Manual 2ENESAS Data Flash Access Library Type T01 European Release Functional Specifications Data Flash User application FDL programming hardware R_FDL_Execute Erase 2 blocks Start erase blk 1 4 R FDL BUSY R FDL Handler K Check Busy 34 4 R FDL BUSY R FDL Handler Erase 1 block tat Check Busy 34 4 R FDL BUSY R FDL Handler jo lat Check Ready Start erase blk 2 4 R FDL BUSY
7. EEL will be able to operate This is an output member It contains the status of the operation during and after the execution Possible values are described in the next table status enu The following table describes all possible status returns Table 10 Read operation returned status Status Background and Handling meaning Operation finished successfully R FDL OK reason No problems during execution remedy Nothing R FDL ERR PARAMETER meaning Current command is rejected RO1US0079ED0103 Ed User Manual 24 NE S AS Data Flash Access Library Type TO1 European Release User Interface API Status Background and Handling Wrong command parameters e access is made outside of physically available Data Flash e command shall operate in User pool but reason accessType enuis notR FDL ACCESS USER e command shall operate in EEL pool but accessType enuisnotR FDL ACCESS EEL e cnt ul6isOorit is too big e flash read address is not aligned with granularity 4 bytes remedy Refrain from further Flash operations and investigate in the root cause meaning Current command is rejected e To gain robustness the parameter check is repeated right before Flash modification and returns the protection error in case of a violation e g due to an R FDL ERR PROTECTION reason unwanted variable modification e Other device specific protec
8. R FDL BUSY e put device in power save stand by mode e device wake up e call R FDL WakeUp e continue with initial FDL command Note Please consider not entering a power save mode e g Deep Stop mode which resets the Flash hardware alter stack or library variables because a resume of the previous operation is not possible afterwards The library is not able to detect this failure fdl status t fdlRet enu r rdl request t myReq str str RO1US0079ED0103 User Manual RENESAS qe Data Flash Access Library Type TO1 European Release User Interface API Start Erase operation myReq str str command enu R FDL CMD ERASE myReg str Str idx u32 gs myReg str strcat ulb 4 myReq str str accessType enu R FDL ACCESS USER R FDL Execute amp myReq str str do f fOlBet R FDL StandBy 14 while R FDL BUSY fdlRet if R FDL OK fdlRet error handler devic nters power save mode device recovers from power save mode fdlRet R FDL WakeUp if R FDL OK fdlRet error handler Finish erase command while myReq str str status enu R FDL BUSY R FDL Handler if R FDL OK myReg str str status enu Error handler while 1 4 4 3 4 R FDL WakeUp Outline This function wakes up the library from Stand by Interface C Interface r fdl status t R FDL WakeUp void
9. R FDL Handler 4 Check Busy 34 4 R FDL BUSY R FDL Handler 4 R FDL BUSY Check Busy Erase next block R FDL Handler a lt a Check Ready 9 REDLOK Figure 3 Flash erase sequence 3 2 Request response oriented dialog The FDL utilizes request response architecture in order to initiate the commands This means any requester any tasks in the user application has to fill a request structure and pass it by reference to the Data Flash Access Library using R FDL Execute function The FDL interprets the content of the request variable checks its plausibility and initiates the execution The feedback is reflected immediately to the requester via the status member status enu of the same request structure The completion of an accepted request command is done by calling R_FDL Handler periodically as long as the request remains busy R01US0079ED0103 User Manual RENESAS Data Flash Access Library Type T01 European Release Functional Specifications Application myRequest command_enu bufAddr_u32 Figure 4 Usage of the request structure Details on the request variable structure and its members are given later in section 4 3 3 r fdl request t Please also note that not all structure members are required for all commands The individual command descriptions in section 4 5 Commands provide the corresponding detailed information 3 3
10. Type T01 European Release User Interface API Administration e R FDL GetVersionString The following sub chapters describe the Flash operations that can be initiated and controlled by the library The operations are initiated by a library function R FDL Execute and later on controlled by the library function R_FDL Handler All FDL interface functions are prototyped in the header file rx fdl h 4 4 1 Initialization 4 4 1 1 R FDL Init Outline Initialization of the Data Flash Access Library Interface C Interface fol status t R FDL Init const r fdl descriptor t descriptor pstr Arguments Parameters Argument Type Access Description FDL configuration descriptor see descriptor pstr r fdl descriptor t R section 4 3 2 r fdl request t Return value Type Description e R FDL OK Operation finished successfully e R FDL ERR CONFIGURATION Wrong parameters have been passed to the FDL e Descriptor address is NULL r fdl status t e FDL pool is zero e EEL pool ends beyond FDL pool edge e Specified CPU clock is outside limits for this device e HR FDL ERR INTERNAL Initialization failed due to various factors insufficient stack space unknown hardware or software issues Pre Interrupt execution shall be disabled for a brief time during execution of this function This conditions must either be done in advance by the user or the user must properly configur
11. User Manual RENESAS pa Data Flash Access Library ENESAS RO1USOO79EDO108 Renesas Electronics Corporation
12. checking the area e perform an erase if needed or e consider the checked area as defect if R FDL CMD BLANKCHECK command fails when executed immediately after an erase operation on the same area R FDL ERR INTERNAL meaning A library internal error occurred which could not happen in case of normal application execution reason e Application bug e g program run away destroyed program counter or hardware problem e Only on older F1x devices failed ID code authentication supplied in the device descriptor See section 4 2 Run time configuration for details about ID code remedy Refrain from further Flash operations and investigate in the root cause a R01US0079ED0103 User Manual R_FDL Execute Will never set this status code 2ENESAS User Interface API Data Flash Access Library Type T01 European Release User Interface API R FDL Handler will never set this status code 4 5 4 R_FDL_CMD_READ The read operation will read a certain address range in the Data Flash and copy the data to the specified target buffer A higher level EEPROM Emulation library may want to read Data Flash addresses which are possibly not completely written or erased Reading those addresses would most probably result in an ECC error interrupt request which must be handled by the user application This behaviour is usually not intended as an emulation library would have to deal with the errors Bas
13. of the RH850 microcontroller family are equipped with a separate flash area the Data Flash This flash area is meant to be used exclusively for data It cannot be used for instruction execution code fetching Flash Granularity The Data Flash of RH850 device is separated into blocks of 64 byte While erase operations can only be performed on complete blocks data writing can be done on a granularity of one word 4 bytes Reading from an erased flash word will return random data The number of available Data Flash blocks varies between the different RH850 devices Please refer to the corresponding user s manual for the hardware for detailed information Data Flash is divided into Flash macro R01US0079ED0103 User Manual RENESAS is Data Flash Access Library Type TO1 European Release Architecture Chapter 2 Architecture This chapter introduces the basic software architecture of the FDL and provides the necessary background for application designers to understand and effectively use the library Please read this chapter carefully before moving on to the details of the API description 2 1 Layered Architecture This chapter describes the function of all blocks belonging to the EEPROM Emulation System EES Even though this manual describes the functional block FDL a short description of all concerned functional blocks and their relationship can be beneficial for the general understanding Code Flash Data
14. to the R FDL Init function please check Figure 6 Flash Access Rights After each operation the access right is reset to R FDL ACCESS NONE to prevent accidental access Member Value Member Value Description R FDL ACCESS NONE FDL internal value Not used by the application Application wants to execute an FDL operation in the PPU ACORDS USER User pool Data Flash area Application wants to execute an FDL operation in the AL FDLACCESS EEL EEL pool Data Flash area RO1US0079ED0103 29 User Manual 2ENESAS Data Flash Access Library Type TO1 European Release User Interface API 4 3 6 r_fdl_status_t Type definition typedef enum R_FDL STATUS T R FDL OK R FDL BUSY R FDL SUSPENDED R FDL ERR CONFIGURATION R FDL ERR PARAMETER R FDL ERR PROTECTION R FDL ERR REJECTED R FDL ERR WRITE R FDL ERR ERASE R FDL ERR BLANKCHECK R FDL ERR COMMAND R FDL ERR ECC SED R FDL ERR ECC DED R FDL ERR INTERNAL r fdl status t Description This enumeration type defines all possible status and error codes that can be generated by the FDL Some error codes are command specific and are described in detail in section 4 5 Commands RO1US0079ED0103 User Manual RENESAS Data Flash Access Library Type TO1 European Release User Interface API Member Value Member
15. u32 Not used Input The virtual start address for performing blank check in data flash Must be word 4 bytes aligned Ene uinga nurse Output Fail address in case of blank check error unchanged if the operation finishes with R FDL OK cnt u16 uint16 t number Number of words 4 bytes to check TT ETT R FDL ACCESS USER Selects the Flash pool in which the command ype R FDL ACCESS EEL will be able to operate This is an output member It contains the status of the operation during and after the execution Possible values are described in the next table status enu The following table describes all possible status returns Table 8 Blank check operation returned status Status Background and Handling meaning Operation started successfully R FDL BUSY reason No problems during execution remedy CallR FDL Handler until the Flash operation is finished reported by the request structure status return value meaning Operation finished successfully R FDL OK reason No problems during execution remedy Nothing meaning An on going Flash operation was successfully suspended R FDL SUSPENDED reason Suspend processing successfully finished ECL remedy e operation or resume the suspended R FDL ERR PARAMETER meaning Current command is rejected R01US0079ED0103 User Manual RENESAS ii Data Flash Access Library Type TO1 European Release Sta
16. 1 2 2 Pool Definitions cnica is 12 2 3 Architecture related NOt8S ooommmmcccccnnccnccccnnnnnanancccccnenennnnnnnnnnccncrrnnnnnnnnnaanannns 12 Chapter 3 Functional Specifications 14 3 1 Supported functions commands and Flash operations 14 3 2 Request response oriented dialog eese 15 3 3 Background Opera MO Mina ai 16 3 4 Flash Access Protection csa AA 17 3 5 Suspend Resume mechanism eeeeeeeeeeeeeeeeeeeeene enn 18 3 6 Stand by and Wake up functionality eeeeeeeeeeeseeeee 22 Chapter 4 User Interface API eese 24 4 1 Pre compile configuration eeeeeeeeeeeeee eene eene nnn nnne nnn 24 4 2 Run time cODIQUEAETIOD auis oe ixdxibsue a 24 LESER E 26 4 3 1 Library specific simple type definitions 26 LECHE No o E 26 A 10 e A AX 27 4 3 4 r fdl command 28 4 3 5 r fdl access Type di 29 q3 Or CL ARA AA AA APP APA 30 AA AA 31 4 44 Initialization ice 32 4 4 2 Flash OPGlayiOnS M 33 4 4 3 Operation CONTO bilan aasa 37 4 4 4 Administrati n M 42 4 5 COMIMANOS iia 44 AS LEH FDE CMD ERASE Sinarcas 45 452H FDL CMD WHITE ciar 46 45 3H
17. 24 NE S AS Data Flash Access Library Type T01 European Release RENESAS 32 Bit MCU RH Family RH850 Series Installer RENESAS FDL RH850 T01E V1 xx All information contained in these materials including products and product specifications represents information on the product at the time of publication and is subject to change by Renesas Electronics Corp without notice Please review the latest information published by Renesas Electronics Corp through various means including the Renesas Technology Corp website http www renesas com Renesas Electronics R01USO0079ED0103 WWW renesas com 19 02 2014 Data Flash Access Library Type TO1 European Release Notice Notice 1 All information included in this document is current as of the date this document is issued Such information however is subject to change without any prior notice Before purchasing or using any Renesas Electronics products listed herein please confirm the latest product information with a Renesas Electronics sales office Also please pay regular and careful attention to additional and different information to be disclosed by Renesas Electronics such as that disclosed through our website 2 Renesas Electronics does not assume any liability for infringement of patents copyrights or other intellectual property rights of third parties by or arising from the use of Renesas Electronics products or technical information described in this docu
18. 850 Data Flash Access Library Type 01 from here on referred to as FDL is provided for the Green Hills IAR and Renesas compiler environments The library and application programs are distributed using an installer tool allowing selecting the appropriate environment The libraries are delivered together with device dependent application programs showing the implementation of the libraries and the usage of the library functions The Data Flash Access library the latest version of this user manual and other device dependent information can be downloaded from the following URL http www renesas eu update Please ensure to always use the latest release of the library in order to take advantage of improvements and bug fixes This manual is based on the assumption that the device will operate in supervisor mode For information on other modes refer to the user s manual for the hardware Note Please read all chapters of this user manual carefully Much attention has been put to proper description of usage conditions and limitations Anyhow it can never be completely ensured that all incorrect ways of integrating the library into the user application are explicitly forbidden So please follow the given sequences and recommendations in this document exactly in order to make full use of the library functionality and features and in order to avoid malfunctions caused by library misuse Flash Infrastructure Besides the Code Flash many devices
19. B suspend is not possible e Write or Erase gt suspend B Erase operation is not possible e Any operation B suspend B other operation B suspend is not possible e Write operation gt suspend B other Write operation is not possible It is recommended to avoid nesting as much as possible 16 Stand by Do not continue FDL functions execution or start execution of any other function than R FDL GetVersionString R FDL WakeUpOrR FDL Init when the library is in stand by mode 17 Data alignment Data Flash blocks are aligned to 64 bytes and Data Flash words are aligned to 4 bytes RO1US0079ED0103 63 User Manual ENESAS Data Flash Access Library Type T01 European Release Cautions RH850 devices also add alignment restrictions for types larger than 8 bits Please consult device hardware manual for details 18 Precompile options The user must not use any pre compile configuration options that are not documented in present manual 19 Supported devices The RH850 FDL library is supported on 3 device families at the moment of writing of this manual These families are E1x F1x Pix and R1x where x can be any letter depending on power consumption peripherals etc Further device families may be added in the future R01US0079ED0103 User Manual RENESAS kag Data Flash Access Library Type T01 European Release Revision History Revision History Rev 1 03 Initial released document version R01US0079ED0103
20. Background Operation The flash technology provided by Renesas enables the application to write erase the Data Flash in parallel to the CPU execution In order to satisfy the operation in concurrent or distributed systems the command execution is divided into two steps 1 Initiation of the command execution using R FDL Execute 2 Processing of the requested command state by using R FDL Handler This approach comes with one important advantage Command processing can be done centrally at one place in the target system normally the idle loop or the scheduler loop while the status of the requests can be polled locally within the requesting tasks Please note that R FDL Execute only initiates the command execution and returns immediately with the request status busy after execution of the first internal state or an error in case the request cannot be accepted The device flash hardware is responsible for executing the operation in the background The device hardware operation might be divided into multiple operations each performed on a separate occasion depending on the number of blocks and data items The first operation is conducted by calling the R FDL Execute function The second and subsequent operations are triggered by calling the R FDL Handler function Thus there is a need to call the R FDL Handler function multiple times Processing is suspended from the time each separate operation is completed until the next one is trigge
21. EL may be configured to use virtual blocks A virtual block size is an integer multiple of physical block size and it is aligned to physical blocks Please consult EEL documentation for details Example of descriptor when EEL is used with virtual block size 32 times the size of physical block size R01US0079ED0103 User Manual RENESAS Es Data Flash Access Library Type T01 European Release User Interface API default access code define AUTHENTICATION ID OxFFFFFFFF N OxFFFFFFFF OxFFFFFFFF OxFFFFFFFF define CPU FREQUENCY MHZ 80 define FDL POOL SIZE 512 FDL pool will use 32KB from wich EEL pool occupies area START 1 32 64 2048 till END 6 32 64 2048 14335 define EEL VIRTUALBLOCKSIZE 32u define EEL POOL START lu EEL VIRTUALBLOCKSIZE define EEL POOL SIZE 6u EEL VIRTUALBLOCKSIZE 4 3 Data types This section describes all data definitions used and offered by the FDL In order to reduce the probability of type mismatches in the user application please make strict usage of the provided types 4 3 1 Library specific simple type definitions Type definition typedef signed char inte t7 typedef unsigned char uinte ES typedef signed short antic t typedef unsigned short uineig t typedef signed long int3s t typedef unsigned long uint32 Es typedef
22. Electronics endeavours to improve the quality and reliability of its products semiconductor products have specific characteristics such as the occurrence of failure at a certain rate and malfunctions under certain use conditions Further Renesas Electronics products are not subject to radiation resistance design Please be sure to implement safety measures to guard them against the possibility of physical injury and injury or damage caused by fire in the event of the failure of a Renesas Electronics product such as safety design for hardware and software including but not limited to redundancy fire control and malfunction prevention appropriate treatment for aging degradation or any other appropriate measures Because the evaluation of microcomputer software alone is very difficult please evaluate the safety of the final products or system manufactured by you Please contact a Renesas Electronics sales office for details as to environmental matters such as the environmental compatibility of each Renesas Electronics product Please use Renesas Electronics products in compliance with all applicable laws and regulations that regulate the inclusion or use of controlled substances including without limitation the EU RoHS Directive Renesas Electronics assumes no liability for damages or losses occurring as a result of your noncompliance with applicable laws and regulations This document may not be reproduced or duplicated in any form in whole or i
23. FDL CMD BLANKCOHECRK mamana 48 4 5 4 R FDL CMD READ iii 51 Chapter 5 Library Setup and Usage 55 5 1 Obtaining the librafy iii 55 unu Renesas Data Flash Access Library Type TO1 European Release 5 2 File structure Mae 55 52 d DVBEVIQW s 22 2 83238222282 3 9 d a a E a a aa aaa aa aaa aa aaa aaa aaa 55 5 2 2 Delivery package directory structure and files 56 5 3 Library TESQUECES iscicnicicinn annsa in aannaaien inanasan innad a naira niaaa 58 5 3 1 Linker p cd 58 5 3 2 Stack and Data BURNS nissan 58 5 4 MISRA CompllanCe inma 58 5 5 Sample Application cian dd cae ooi d oc wan e e f OR 58 5 6 Library configurallOn iiitesecscccsenccasesensndsavensncsasenseidasancescensadeatetandncsavensutdasencaans 59 5 7 Basic Reprogramming Flow 59 58 R FDL Handler calls 61 Chapter 6 Cautions eec 62 uS RENESAS Data Flash Access Library Type TO1 European Release Introduction Chapter 1 Introduction This user manual describes the internal structure the functionality and the application programming interface API of the Renesas RH850 Data Flash Access Library FDL Type 01 designed for RH850 flash devices based on a common flash technology The libraries are delivered in source code However it has to be considered carefully to do any changes as not intended behaviour and programming faults might be the result The Renesas RH
24. Flash Hardware Figure 1 Symbolic relationship between the EES functional blocks As depicted in the figure above the software architecture of the EEPROM Emulation System is built up of several blocks e User Application This functional block will use functions offered by the FDL and EEL The user shall take care that FDL functions are not used at the same time while EEL is operating Please refer to EEL documentation for how to stop EEL execution in order to safely access FDL functions e EEPROM Emulation Library EEL This functional block offers all functions and commands that the User Application block can use in order to handle its EEPROM data e Data Flash Access Library FDL The Data Flash Access Library is the subject of this manual It should offer an access interface to any user defined flash area the so called FDL poo described in next chapter Beside the initialization function the FDL allows the execution of access commands like write blank check as well as suspend able erase command RO1US0079ED0103 11 User Manual ENESAS Data Flash Access Library Type T01 European Release Architecture e Data Flash Hardware This functional block represents the Flash Programming Hardware controlled by the FDL 2 2 Pool Definitions The FDL pool defines the Flash blocks the user application and a potential EEPROM Emulation EEL may use for FDL Flash access The limits of the FDL pool are taken into considera
25. L_CMD_ERASE y R_FDL_Execute amp req al User code execution Flash Erase lt R_FDL_Handler flow R_FDL_BUSY req status_enu R_FDL_OK req status_enu gt Y Y Configure request structure req R_FDL_CMD_WRITE Y R_FDL_Execute amp req Reprogramming end Error handler Y User code execution Flash R FDL Handl Write lt mee flow R FDL BUSY req status enu R FDL OK req status enu Reprogramming end Error handler Reprogramming end Success Figure 16 Basic reprogramming flow R01US0079ED0103 User Manual RENESAS AR Data Flash Access Library Type T01 European Release Library Setup and Usage Error treatment of the FDL functions themselves is not detailed described in the flow charts for simplification reasons For details on enabling or disabling access to the Data Flash refer to the user s manual for the hardware An example is given by the sample application file sample app main c functions FDL Open and FDL Close 5 8 R FDL Handler calls Once initiated FDL operations need to be driven forward by successive handler calls The frequency of these handler calls does have an impact on the FDL operation performance and needs to be adapted to the target application In the following different approach
26. MD myRequest command enu R ERASE myRequest myRequest idx u32 cnt ul6 myRequest accessType nu ACCESS USE R FDL Execute amp myRequest while myRequest status enu R FDL BUSY R FDL Handler myRequest status enu R FDL OK Error handler Example Write 8 bytes starting from addresses 0x10 r fdl request t myRequest uint32 t data 0x11223344 0x55667788 myRequest command enu R FDL CMD WRITE myRequest idx u32 0x10 myRequest cnt ul6 2 myRequest bufAddr u32 uint32 t amp data O myRequest accessType enu R FDL ACCESS USER R FDL Execute amp myRequest while myRequest status enu R FDL BUSY R01US0079ED0103 User Manual RENESAS 2 Data Flash Access Library Type TO1 European Release User Interface API R_FDL Handler if myRequest status enu R FDL OK Error handler Example Blank Check addresses from 0x10 to 0x17 r fdl request t myRequest myRequest command enu R FDL CMD BLANKCHECK myRequest idx u32 0x10 myRequest cnt_ul6 2 myRequest accessType enu R_FDL ACCESS USER R FDL Execute amp myRequest while myRequest status enu R FDL BUSY R FDL Handler if myRequest status enu R FDL OK Error handler Example Read two words starting from addr
27. R FDL ResumeRequest BP 4 HR FDL OK R FDL Handler 4 H FDL OK ERR BLANKCHECK Start Blankcheck R FDL Handler amp 4 R FDL BUSY Check Busy Blank Check 4 4FFF R FDL SuspendRequest al leet lt ______R FDL OK R FDL Handler gt Check Busy 4 R FDL BUSY R FDL Handler 4 H FDL SUSPENDED KL Check Ready e end R_FDL_ResumeRequest gt susp 4 R FDL OK R FDL Handler 4 R FDL OK ERR BLANKCHECK dle Figure 9 Suspend Resume a Blankcheck operation Notes When Erase processing is suspended and resumed this is not considered as an additional erase with respect to the specified Flash erase endurance The suspend resume mechanism cannot be nested Therefore the following sequence is not allowed Erase Flash Suspend B Start another erase flash gt Suspend R01US0079ED0103 User Manual RENESAS al Data Flash Access Library Type T01 European Release Functional Specifications 3 6 Stand by and Wake up functionality Entering a device power save stand by mode is not allowed when a Data Flash operation is on going Due to that especially Data Flash Erase operation can delay entering a power save mode significantly In order to allow fast entering of such mode the functions R FDL StandBy and R FDL Wak
28. Status Error codes returned by the library see 4 3 6 r fdl status t status enu 4 3 4 r fdl command t Type definition typedef enum R FDL COMMAND T R FDL CMD ERASE R FDL CMD WRITE R FDL CMD BLANKCHECK R FDL CMD READ r fdl command t Description User command to execute This type is used within the structure r fdl request t see section 4 3 3 r fdl request t in order to specify which command shall be executed via the function R FDL Execute A detailed description of each command can be found in section 4 5 Commands R01US0079ED0103 User Manual RENESAS en Data Flash Access Library Type TO1 European Release User Interface API Member Value Member Value Description R_FDL_CMD_ERASE Erase Data Flash block s R FDL CMD WRITE Write Data Flash word s R FDL CMD BLANKCHECK Blank check certain Data Flash area R FDL CMD READ Read from Data Flash and return data and possible ECC errors 4 3 5 r fd accessType t Type definition typedef enum R FDL ACCESS TYPE T R FDL ACCESS NONE R FDL ACCESS USER R FDL ACCESS EF r fdl accessType t Description In order to initiate a Data Flash operation the access type to the Data Flash must be set depending on the configured pool that will be accessed The pool ranges are defined in the FDL descriptor passed
29. a specified amount of memory starting from a specified address is written This command will stop at the first memory location that is not erased with status R FDL ERR BLANKCHECK Notes 1 On blank check fail the cells are surely not blank This might result from successfully written cells but also from interrupted erase or write operations 2 On blank check pass the cells are surely not written This might result from successfully erased cells but also from interrupted erase or write operations 3 Depending on the Flash operations use case e g EEPROM emulation it may be necessary to log the Flash operations results in order to be sure that Flash cells are correctly written or erased The way of logging depends on the use case e g as part of a EEPROM Emulation concept R01US0079ED0103 User Manual 2ENESAS User Interface API Data Flash Access Library Type TO1 European Release User Interface API 4 Internally blankcheck operation is split into smaller operations every time the operation crosses a 0x4000 bytes boundary This means that time to suspend is not going to exceed the time to fully perform a blankcheck on 0x4000 bytes The members of the request structure given to R FDL Execute are described in the following table Table 7 Request structure usage for blank check command Structure member Value Description command enu R FDL CMD BLANKCHECK Request a blank check operation bufAddr
30. ary is not initialized e Library is already in stand by mode r fdl status t R FDL Init must have been executed successfully FDL is not in stand by mode Repeat the execution of the R FDL StandBy function until the state indicated by the function changes from R_FDL BUSY Do not execute functions R FDL Execute R FDL SuspendRequest R FDL ResumeRequest OrR FDL StandBy when FDL is in stand by state This function suspends an ongoing flash operation and brings FDL into stand by state The system can then change to special states e g change power mode Function does not necessarily immediately suspend any Flash operation as suspend might be delayed by the device internal hardware or might not be supported at all only Erase and Write are suspendable So the function R FDL StandBy tries to suspend the Flash operation and returns R FDL BUSY as long as a Flash operation is on going If suspend was not possible e g blank check operation R FDL BUSY is returned until the operation is finished normally So in order to be sure to have no Flash operation on going the function must be called continuously until the function does no longer return R FDL BUSY or until a timeout occurred After stand by it is mandatory to call R FDL WakeUp to resume normal FDL operation again The prescribed sequence in case of using R FDL StandBy R FDL WakeUp is e any FDL command is in operation e cal R FDL StandBy until it does no longer return
31. ction contains library internal constant data It can be located anywhere in the code flash e R FDL TEXT FDL code section containing the library code It can be located anywhere in the code flash 5 3 2 Stack and Data Buffer The FDL utilizes the same stack as specified in the user application It is the developer s duty to reserve enough stack for the operation of both user application and FDL With source code library it is not possible to give an exact value for stack consumption However an estimate value for the FDL library is 268 bytes for GHS compiler and 316 bytes for Renesas compiler The data buffer used by the FDL refers to the RAM area in which data is located that is to be written into the data flash This buffer needs to be allocated and managed by the user Note In order to allocate the stack and data buffer to a user specified address please utilize the link directives of your framework 5 4 MISRA Compliance The FDL code has been tested regarding MISRA compliance The used tool is the QA C Source Code Analyzer which tests against the MISRA 2004 standard rules Note MISRA is a registered trademark of MIRA Ltd held on behalf of the MISRA Consortium QA C is a registered trademark of Programming Research Ltd 5 5 Sample Application It is very important to have theoretic background about the Data Flash and the FDL in order to successfully implement the library into the user application
32. ctly bypassing FDL will produce undefined data with a tendency to the previously written data and it will most probably cause ECC error exceptions To avoid this exceptions use R FDL CMD READ command DMA transfers from Data Flash are permitted but need to be synchronized with the FDL During command execution Data Flash is not available Any direct read during command execution will result in invalid data therefore it must be avoided 12 Dual operation It is not possible to modify the Code Flash in parallel to a modification of the Data Flash or vice versa due to shared hardware resources 13 Reusing the request command Do not change the content of the request structure while an FDL command is operating because the library may crash or data loss can occur Multiple requests each using different request structures do not have these adverse effects 14 Workload and supervision It is recommended to supervise the FDL operations and functions execution by timeout supervision e g timer counter watchdog etc In addition the user of the library should evaluate the time necessary to perform a certain operation and divide long lasting operations to meet real time system specifications 15 Suspend and Stand by nesting It is not always possible to nest suspend and or stand by E g e Any operation suspend B suspend is not possible e Any operation gt stand by B stand by is not possible e Any operation B stand by
33. d during suspended state Description This function requests suspending a Flash operation in order to be able to do other Flash operations Example r fdl status t srRes enu r fdl request t myReq str str int32 i Start Erase operation myReq str str command enu R FDL CMD ERASE myReg str str idx U32 07 myRed str str ont ulo 47 myReq str str accessType enu R FDL ACCESS USER R FDL Execute amp myReq str str R01US0079ED01 03 37 User Manual Data Flash Access Library Type TO1 European Release User Interface API f R FDL Handler Now the FDL is suspended and we Flash mg Erase resume srRes enu R POL ResumeRequest 7 R_FDL OK srRes enu Error handler Finish the erase while myReq str str status nu R FDL Handler 4 4 3 2 R FDL ResumeRequest Now call the handler some times i 0 while myReq str str status enu R FDL BUSY amp amp i lt 10 R_FDL Handler itty Suspend request and wait until suspended srRes enu R FDL SuspendRequest if IR FDL OK t goles enu error handler while 1 while R_FDL SUSPENDED myReq str_str status_enu can handle other operations or read the Data R_FDL_SUSPENDED while myReq str str status enu R FDL BUSY R FDL Handler if R FDL OK l myReg str str s
34. e given Please also consider that mixtures of the above mentioned approaches can be meaningful depending on the target scenario Note When evaluating concepts for calling the R FDL Handler please be aware that all FDL functions are not re entrant That means it is not allowed to call an FDL function from interrupt service routines while another FDL function is already running R01US0079ED01 03 61 User Manual 2ENESAS Data Flash Access Library Type TO1 European Release Cautions Chapter 6 Cautions Before starting the development of an application using the FDL please carefully read and understand the following cautions 1 CPU operating frequency configuration Correct frequency configuration is essential for Flash programming quality and stability Wrong configuration could lead to loss of data retention or Flash operation fail The limits for CPU frequency are device dependent Please consult Device Manual for correct range If the CPU frequency is a fractional value round up the value to the nearest integer Do not change power mode voltage or CPU clock while FDL is performing a Data Flash operation If power mode must change the user can e put current operation into stand by mode and wait until hardware conditions are restored e wait until operations are no longer busy or e reinitialize the library with proper CPU frequency value 2 CPU mode The initialization function R FDL Init must be executed in CPU super
35. e names zcompilers Sample dr7f701035_startup 850 for GHS compiler 3 Device and compiler specific start up code cstart asm for REC compiler gt dr71701035 1g for GHS compiler m mE 2 Compiler specific linker directives dr7f701035 dir for REC compiler gt dr7f701035 0 h dr7f701 035 irq h for GHS compiler gt Definitions of IO registers interrupt and exceptions i he AA vector table for RH850 device iodefine h vecttbl asm 2 lt for REC compiler gt RO1US0079ED0103 User Manual ENESAS 56 Data Flash Access Library Type T01 European Rel File ease Description eel cfg h EEL pre compile definitions eel descriptor c eel descriptor h EEL descriptor used in the sample application sampleapp h sampleapp control c Sample application code sampleapp main c fdl cfg h FDL pre compile definitions fdl descriptor c fdl descriptor h FDL descriptor used in the sample application fdl user c User defined code for handling interrupts and library fdl user h pre initialization target h Initialization code for target microcontroller r typedefs h C types used by FDL library lt installation_folder gt lt device_name gt lt compiler gt Sample EEL r eel h EEL API definitions r eel mem map h Section mapping definitions r eel types h User interface type definitions
36. e number of blocks to be accessed by the FDL for user access and EEL access Usually it is set to the total number of blocks physically available on the device For example if the device is equipped with 32 KB of Data Flash and the block size is 64 bytes then FDL POOL SIZE can be any value up to 512 EEL POOL START It defines the starting block of the EEL Pool If FDL is used without EEL on top the value should be set to 0 EEL POOL SIZE It defines the number of blocks used for the EEL Pool If FDL is used without EEL on top the value should be set to 0 FDL block size is always equal to the physical block size of Data Flash Example of descriptor when FDL is used alone default access code define AUTHENTICATION ID OxFFFFFFFF N OxFFFFFFFF N OxFFFFFFFF OxFFFFFFFF define CPU FREQUENCY MHZ 80 FDL pool will use 512 blocks 64 bytes 32KB no EEL pool define FDL POOL SIZE 512 define EEL POOL START 0 define EEL POOL SIZE 0 Example of descriptor when EEL is used default access code define AUTHENTICATION ID OxFFFFFFFF N OxFFFFFFFF OxFFFFFFFF OxFFFFFFFF j define CPU FREQUENCY MHZ 80 FDL pool will use 32KB EEL pool occupies fist 16 KB define FDL POOL SIZE 512 define EEL POOL START 0 define EEL POOL SIZE 256 E
37. e provided callback macro functions in a1 cfg h see description and example below Post None conditions R01US0079ED0103 32 User Manual 2ENESAS Data Flash Access Library Type T01 European Release User Interface API Description This function is executed before any execution of FDL Flash operation Function checks the input parameters and initializes the hardware and software Note This function will temporarily disable Code Flash Please refer to Chapter 6 Cautions for limitations that must be considered Example const r fdl descriptor t sampleApp fdlConfiq enu AUTHENTICATION ID CPU_FREQUENCY MHZ FDL POOL SIZE POOL START POOL SIZE y r fdl status t ret ret R FDL Init amp sampleApp fdlConfig enu if ret 1 R FDL OK Error handler Example for setting the protected section with callbacks provided in the sample application define FDL CRITICAL SECTION BEGIN L User CriticalSetionBegin define FDL CRITICAL SECTION END L User CriticalSetionEnd 4 4 2 Flash Operations 4 4 2 1 R FDL Execute Outline Initiate a Data Flash operation Interface C Interface void E FDL Execute r fdl request t request pstrl Arguments Parameters Argument Type Access Description This argument points to a request structure defining the command command parameters re
38. eUp have been introduced The main functionality of the functions is to suspend a possibly on going Data Flash Erase or Write operation R FDL StandBy and resume it after waking up from power save mode R FDL WakeUp Once started stand by processing must always end in stand by status Calling the R FDL StandBy does not necessarily immediately suspend any Data Flash operation as suspend might be delayed by the device internal hardware or might not be supported at all only Erase and Write are suspend able In this case the R FDL StandBy function must be called repeatedly until the stand by status is reached Blank Check and Read Data Flash operations are suspendable from software point of view but the library will wait for the operation to be finished by hardware while suspend is processed and the result will be presented after resuming This wait however is not that important because blank check and read operations are much faster than erase or write In case the FDL is in an idle state no on going Data Flash operations by calling the R FDL StandBy the FDL will immediately enter the Stand By state By calling the R_FDL WakeUp the FDL will return to previous state in this case the idle state The following pictures describe the library behaviour in case a stand by request is issued during FDL operation Data Flash up FDL programming a
39. ed on these considerations the read operation of the FDL temporarily disables the interrupt generation for ECC errors The status of ECC interrupt generation is restored when the operation is finished Errors detected during read operation are signalled to the user application by the request structure status enu variable and idx u32 variable In case of single bit error the data read will be continued and the 1st occurrence of the ECC error will be returned In case of double bit error the read operation is stopped and the fail address is returned In case of a previous single bit error detected the fail address of the single bit error is overwritten Read command execution is synchronous to execution of R FDL Execute function Therefore this command cannot be suspended and does not need to be processed by R FDL Handler function The members of the request structure given to R FDL Execute are described in the following table Table 9 Request structure usage for read command Structure member Value Description command enu R FDL CMD READ Request a read operation Data destination buffer address in RAM bufAddr u32 uint32 t number T KG Note The buffer must be 32 bit aligned Data Flash virtual address from where to ME TUS Uae read Must be word 4 bytes aligned cnt u16 uint16 t number Numbers of words 4 bytes to read R FDL ACCESS USER Selects the Flash pool in which the command accessType enu R FDL ACCESS
40. enesas Electronics product is Standard unless otherwise expressly specified in a Renesas Electronics data sheets or data books etc Standard Computers office equipment communications equipment test and measurement equipment R01US0079ED01 03 2ENESAS audio and visual equipment home electronic appliances machine tools personal electronic equipment and industrial robots High Transportation equipment automobiles trains ships etc traffic control systems anti disaster Quality systems anti crime systems safety equipment and medical equipment not specifically designed for life support Specific Aircraft aerospace equipment submersible repeaters nuclear reactor control systems medical equipment or systems for life support e g artificial life support devices or systems surgical implantations or healthcare intervention e g excision etc and any other applications or purposes that pose a direct threat to human life You should use the Renesas Electronics products described in this document within the range specified by Renesas Electronics especially with respect to the maximum rating operating supply voltage range movement power voltage range heat radiation characteristics installation and other product characteristics Renesas Electronics shall have no liability for malfunctions or damages arising out of the use of Renesas Electronics products beyond such specified ranges Although Renesas
41. error and status codes installation folder2 device names zcompilers Sample EEL lib r eel basic fct c r eel user if c EEL main source code r eel global h Global variables and settings lt installation_folder gt lt device_name gt lt compiler gt Sample FDL r_fdl h FDL API definitions r fdl mem map h Section mapping definitions r fdl types h User interface type definitions error and status codes lt installation_folder gt lt device_name gt lt compiler gt Sample FDL lib r_fdl_env h Internal FDL definitions r fdl global h Global variables and settings r fdl hw access c FDL main source code r fdl user if c 7 These files are not available if the EEL layer is not part of the delivered package File names are dependent on the chosen device Shown filenames are valid for F1L devices R01US0079ED0103 User Manual 2ENESAS Library Setup and Usage 57 Data Flash Access Library Type TO1 European Release Library Setup and Usage 5 3 Library resources 5 3 1 Linker sections The following sections are related to the Data Flash Access Library and need to be defined in the linker file please see sample linker directive file for an example Data sections e R FDL DATA This section contains all FDL internal variables It can be located either in internal or external RAM Code sections e R FDL CONST This se
42. es for calling the R FDL Handler are compared with respect to their advantages and disadvantages e Calling R FDL Handler repeatedly after starting an operation execution This approach is also utilized in most of the code examples you can find in this manual Typically realized in a loop waiting for the operation status not to be busy anymore this approach results in the best FDL operation performance However the CPU is fully loaded and blocked for other tasks as long as the FDL operation is being executed e Calling R FDL Handler in a timed task By calling the R FDL Handler periodically FDL commands can be driven forward while other tasks are processed by the CPU The period between the status check calls can have significant impact on the FDL operation performance Shorter calling intervals result in better FDL performance but also increase the CPU load by the FDL Due to this trade off a general advice for the calling interval cannot be given It needs to be analysed and tailored individually for each target application e Calling R FDL Handler in the idle task If it is ensured that the idle task is called often enough this method might result in a good FDL performance as the handler can be called continuously However this approach is not deterministic in case of a high CPU load by the application itself Due to the individual requirements of each application a general advice for selecting a strategy to call the R FDL Handler cannot b
43. ess 0x10 r fdl request t myRequest uint32 t data 2 myRequest command enu R FDL CMD READ myRequest idx u32 0x10 myRequest cnt ul6 2 myRequest bufAddr u32 uint32 t amp data 0 myRequest accessType enu R FDL ACCESS USER R FDL Execute amp myRequest if myRequest status enu R FDL OK Error handler RO1US0079ED0103 35 User Manual ENESAS Data Flash Access Library Type T01 European Release 4 4 2 2 R FDL Handler Outline This function needs to be called repeatedly in order to drive pending commands and observe their progress Interface C Interface User Interface API void R FDL Handler void Arguments Parameters Argument Type Access Description None Return value Type Description None Pre R FDL Init andR FDL 1 Execute must have been executed successfully conditions Post The status of a pending FDL command may be updated i e the status enu member of conditions the corresponding request structure is written Description The function needs to be called regularly in order to drive pending commands and observe their progress Thereby the command execution is performed state by state When a command execution is finished the request status variable structural element status enuofr fdl request t is updated with the status error code of the correspo
44. ich is declared in x fdl types h but defined in the user application and passed to the library by the function R FDL Init The file fdl descriptor c shall show an example of the descriptor structure definition and filling while the fdl descriptor h shall show an example of the definitions required to fill in the structure In fact the file fdal descriptor h might be modified according to the user applications needs and might be added to the user application project together with the fd1 descriptor c The descriptor files c and h are part of the library installation package R01US0079ED0103 User Manual RENESAS sd Data Flash Access Library Type TO1 European Release User Interface API The following settings should be configured by user 1 AUTHENTICATION_ID A 16 byte access ID code The ID code is used to secure access to 1 On Chip Debug unit 2 Serial programming 3 Self programming only on older F1x devices Newer devices will simply ignore a wrong ID code so self programming feature is always available On older devices where ID code is still checked a wrong code will not result in a failed initialization but FDL commands will fail to operate with a R FDL ERR PROTECTION error status CPU FREQUENCY MHZ This defines the internal CPU frequency in MHz unit rounded up to the nearest integer e g for 24 3 MHz set CPU FREQUENCY MHZ to 25 Please check the Device Manual for limit values FDL POOL SIZE It defines th
45. in case of a violation e g due to an R FDL ERR PROTECTION reason unwanted variable modification ma B e Other device specific protection mechanisms e g security unit like ICU or FHVE protection mechanisms prevent Flash operations Refrain from further Flash operations and investigate in the remedy root cause meaning Current command is rejected R FDL ERR REJECTEDO reason Another operation is ongoing uS Request again the command when the preceding remedy E command has finished meaning At least one bit within the specified blocks is not erased SEO Hardware defect one or more Flash bits could not be R FDL ERR ERASE erased completely A Flash block respectively the complete Data Flash should remedy be considered as defect A library internal error occurred which could not happen in meaning baba case of normal application execution e Application bug e g program run away destroyed program counter or hardware problem R FDL ERR INTERNAL reason e Only on older F1x devices failed ID code EE a authentication supplied in the device descriptor See section 4 2 Run time configuration for details about ID code Refrain from further Flash operations and investigate in the remedy root cause 7 2 4 5 2 R_FDL_CMD_WRITE R FDL Execute will never set this status code R_FDL Handler will never set this status code The write command can be used to write a number of data words located in the RAM into the Data Flash a
46. initions for more information An access as user application will be allowed to all configured Flash blocks outside the EEL Pool while an access from EEL will be allowed to the EEL Pool only Generally on any Data Flash operation initiation the access type must be defined in the operation request structure variable Setting this variable enables the access either to the EEL Pool or to the Data Flash blocks outside the EEL Pool User Pool If the variable is not initialized appropriately or if the wrong pool shall be accessed a protection error is returned R01US0079ED0103 User Manual RENESAS lil Data Flash Access Library Type T01 European Release Functional Specifications Data Flash FDL Pool User Application Figure 6 Flash Access Rights 3 5 Suspend Resume mechanism Some Data Flash operations can last a long time especially multiple erase and write The user application cannot always wait for the operation end because other operations have higher priority So from user point of view current operation is suspend able and can be resumed after finishing the other Flash accesses From software point of view an on going operation always ends in suspended state unless the resume is requested beforehand In case the Flash hardware has already finished an operation but its end result has not already been processed by the library the library returns the suspended status The final operation result is returned after successfu
47. ion and usage in the target application The delivery package contains dedicated directories for the library containing the source and the header files 5 2 1 Overview The following picture contains the library and the application related files API declaration Descriptors User Passed to the library Libray m r_fdl h m Source Code Application r_fdl_ a lib Precompiled Library ttdi 0 Source Code Library Library Configuration Library Files Fix may not be touched by the user DE Library pre compile configuration Only on souce code delivery File name fix File content user configurable m Application User Code Completely in the hand of the user Figure 15 File structure of library and sample application R01US0079ED01 03 55 User Manual 2ENESAS Data Flash Access Library Type T01 European Release Library Setup and Usage The library must be configured for compilation The file a1 cfg h contains defines for that As it is included by the library source files the file contents may be modified by the user but the file name may not These files reflect an example how the library descriptor variable can be built up and passed to the function R FDL Init for run time configuration The structure of the descriptor is defined in r fdl types h which needs to be included in the user applica
48. ions Data Flash programming hardware R FDL Handler dt FDL BUSY R FDL SuspendRequest 4 R FDL OK R FDL ResumeR 4 R FDL OK R FDL Handler 4 H FDL BUSY R FDL Handler 1 Check Ready 4 R FDL OK Figure 8 Erase Write Suspend Immediate Resume tat Check Busy 34 a Check Busy 34 Erase 1 block Or Write 1 word idle Blankcheck operation will not be interrupted by a suspend request unless the operation reaches a Flash Macro boundary any multiple of 0x4000 bytes or it will be finished R01US0079ED0103 User Manual 2ENESAS 20 Data Flash Access Library Type T01 European Release Functional Specifications Data Flash User application FDL programming R_FDL_Execute hardware Blank Check 0x3000 to 0x4FFF Start Blankcheck 4 R FDL BUSY R FDL Handler gt lt _______R_FDL_BUSY Check Busy R_FDL_SuspendRequest Blank Check 4 R FDL OK 0x3000 to Ox3FFF R FDL Handler 4 R FDL BUSY Check Busy R FDL Handler lt R FDL SUSPENDED 4 Check Ready suspende
49. ives and distributors R01US0079ED01 03 User Manual 124 NE S AS Data Flash Access Library Type TO1 European Release Preface Readers Preface This manual is intended for users who want to understand the functions of the concerned libraries Purpose This manual presents the software manual for the concerned libraries Note Additional remark or tip Caution ltem deserving extra attention Numeric Binary Xxxx or xxxB notation Decimal XXXX Hexadecimal XXXXH or Ox xxxx Numeric Representing powers of 2 address space memory capacity prefix K kilo 210 1024 M mega 220 1024 1 048 576 G giga 230 1024 1 073 741 824 Register X x don t care Diagrams Block diagrams do not necessarily show the exact software flow but the functional structure Timing diagrams are for functional explanation purposes only without any relevance to the real hardware implementation RO1US0079ED0103 5 User Manual 2ENESAS Data Flash Access Library Type TO1 European Release How to Use This Document How to Use This Document 1 Purpose and Target Readers This manual is designed to provide the user with an understanding of the functions and characteristics of the Self Programming Library lt is intended for users designing application systems incorporating the library A basic knowledge of embedded systems is necessary in order to use this manual The manual comprises an overview of the library API description usage notes a
50. l possible status returns Table 4 Erase operation returned status Status Background and Handling meaning Operation started successfully reason No problems during execution R FDL BUSY rained CallR FDL Handler until the Flash operation is finished reported by the request structure status return value meaning Operation finished successfully R FDL OK reason No problems during execution remedy Nothing meaning An on going Flash operation was successfully suspended R FDL SUSPENDED reason Suspend processing successfully finished Start another operation or resume the suspended remedy operation meaning Current command is rejected Wrong command parameters e access is made outside of physically available Data Flash R FDL ERR PARAMETER e command shall operate in User pool but reason accessType enuis notR FDL ACCESS USER e command shall operate in EEL pool but accessType enuis notR FDL ACCESS EEL e cnt ul6isOorit is too big RO1US0079ED0103 45 User Manual ENESAS Data Flash Access Library Type TO1 European Release Status Background and Handling Refrain from further Flash operations and investigate in the remedy root cause meaning Current command is rejected e To gain robustness the parameter check is repeated right before Flash modification and returns the protection error
51. l resume request The FDL contains special functions to suspend and resume an ongoing operation Please refer to chapter 4 4 3 1 R_FDL_SuspendRequest Examples of Erase or Write Suspend Resume flow R01US0079ED0103 User Manual RENESAS 18 Data Flash Access Library Type TO1 European Release Functional Specifications Data Flash User application FDL programming hardware R_FDL_Execute Erase Write Start unit 1 4 R FDL BUSY R FDL Handler tat Check Busy 4 R FDL BUSY Erase 1 block Or RF TA N Write 1 word 4 R FDL OK R FDL Handler a Suspend gt 4 R FDL BUSY R FDL Handler a lq Check Suspended 4 R FDL SUSPENDED suspende ee CENE 4 _FDL_ OK R FDL Handler a lt q __R_FDL_BUSY Resume R_FDL_Handler a 44 R FDL BUSY lq Check Busy Erase or Write next unit resumed R FDL Handler 4_ A_FDL_OK Check Ready idle Figure 7 Erase Write Suspend Resume Flow R01US0079ED0103 User Manual RENESAS 8 Data Flash Access Library Type TO1 European Release User application 4 R FDL BUSY FDL R FDL Execute Erase or Write I Start unit 1 Functional Specificat
52. lash access layer Software protection of flash memory against FHVE programming and erasure Not present in all devices Firmware is a piece of software that is located in a Firmware hidden area of the device handling the interfacing to the flash Electrically erasable and programmable non volatile Flash memory The difference to ROM is that this type of memory can be re programmed several times A flash block is the smallest erasable unit of the flash Flash Block memory RO1US0079ED0103 6 Data Flash Access Library Type TO1 European Release How to Use This Document Abbreviation Full form Flash Macro A certain number of Flash blocks are grouped together in a Flash macro ICU Intelligent Cryptographic Unit Power Save Mode Device modes to consume less power than during normal operation In the device documentation also called stand by modes Random access memory volatile memory with RAM random access REE Renesas Electronics Europe GmbH REL Renesas Electronics Japan ROM Read only memory non volatile memory The content of that memory cannot be changed All trademarks and registered trademarks are the property of their respective owners R01US0079ED0103 User Manual 2ENESAS Data Flash Access Library Type TO1 European Release Table of Contents Chapter 1 Introduction siones 10 Chapter 2 Architecture na 11 2 1 Layered Architecture nnmnnn nnna 1
53. letely written or erased Flash The reaction depends remedy 0n the data handling concept In case of expected completely written Flash a multiple bit error would mean loss of data Refrain from further Flash operations and investigate in the root cause meaning A library internal error occurred which could not happen in case of normal application execution e Application bug e g program run away destroyed program counter or hardware problem R FDL ERR INTERNAL reason e Only on older F1x devices failed ID code 2 E authentication supplied in the device descriptor See section 4 2 Run time configuration for details about ID code remedy Refrain from further Flash operations and investigate in the root cause The following figure shows the handling of ECC error registers during read command execution R01US0079ED0103 User Manual RENESAS s Data Flash Access Library Type TO1 European Release C R FDL CMD READ Start Clear ECC errors Backup ECC interrupt status Disable ECC interrupt status Y Read data from Data Flash into destination buffer Y Read ECC errors Double bit error o Y provoked the ECC error Save address that Save add ress that provoked the ECC error Single bit error Last read address Y Clear ECC errors Restore ECC interrupt status
54. ment No license express implied or otherwise is granted hereby under any patents copyrights or other intellectual property rights of Renesas Electronics or others 3 You should not alter modify copy or otherwise misappropriate any Renesas Electronics product whether in whole or in part 4 Descriptions of circuits software and other related information in this document are provided only to illustrate the operation of semiconductor products and application examples You are fully responsible for the incorporation of these circuits software and information in the design of your equipment Renesas Electronics assumes no responsibility for any losses incurred by you or third parties arising from the use of these circuits software or information 5 When exporting the products or technology described in this document you should comply with the applicable export control laws and regulations and follow the procedures required by such laws and regulations You should not use Renesas Electronics products or the technology described in this document for any purpose relating to military applications or use by the military including but not limited to the development of weapons of mass destruction Renesas Electronics products and technology may not be used for or incorporated into any products or systems whose manufacture use or sale is prohibited under any applicable domestic or foreign laws or regulations 6 Renesas Electronics has used reas
55. n This structure is the central type for the request response oriented dialog for the command execution see section 3 2 Request response oriented dialog Not every element of this structure is required for each command However all members of the request variable must be initialized once before usage Please refer to section 4 5 Commands for a more detailed description of the structure elements command specific usage For simplification idx u32 structure member is a virtual address that starts at 0x0 and not at the address at which Data Flash is mentioned in the hardware user manual R01US0079ED0103 User Manual RENESAS er Data Flash Access Library Type TO1 European Release User Interface API Member Value Member Value Description User command to execute e H FDL CMD ERASE command enu e H FDL CMD WRITE e H FDL CMD BLANKCHECK e RH FDL CMD READ Source Destination buffer address for Write Read operations bufAddr u32 Bidirectional e Start block number when starting block based commands erase or idx u32 e Start word address when starting address based commands write blank check read or e failure address in case of blank check or ECC read commands Number of blocks 64 bytes to operate in case of erase cnt u16 command Number of words 4 bytes to operate for all the other commands Data Flash access originator accessType enu e H FDL ACCESS USER or e RH FDL ACCESS EEL
56. n part without prior written consent of Renesas Electronics Please contact a Renesas Electronics sales office if you have any questions regarding the information contained in this document or Renesas Electronics products or if you have any other inquiries Note 1 Renesas Electronics as used in this document means Renesas Electronics Corporation and also includes its majority owned subsidiaries Note 2 Renesas Electronics product s means any product developed or manufactured by or for Renesas Electronics User Manual Data Flash Access Library Type TO1 European Release Regional information Regional information Some information contained in this document may vary from country to country Before using any Renesas Electronics product in your application please contact the Renesas Electronics office in your country to obtain a list of authorized representatives and distributors They will verify e Device availability e Ordering information e Product release schedule e Availability of related technical literature e Development environment specifications for example specifications for third party tools and components host computers power plugs AC supply voltages and so forth e Network requirements In addition trademarks registered trademarks export restrictions and other legal issues may also vary from country to country Visit http Awww renesas com to get in contact with your regional representat
57. nd cautions Particular attention should be paid to the precautionary notes when using the manual These notes occur within the body of the text at the end of each section and in the Cautions section The revision history summarizes the locations of revisions and additions It does not list all revisions Refer to the text of the manual for details 2 List of Abbreviations and Acronyms Abbreviation Full form Bootloader A piece of software located in the Boot Cluster handling the reprogramming of the device Embedded Flash where the application code or Seda Flash constant data is stored Data Flash Embedded Flash where mainly the data of the EEPROM emulation are stored Dual operation is the capability to access flash memory during reprogramming of another flash memory range Dual operation is available between Code Flash and Data Flash Between different Code Flash macros dual operation depends on the device implementation Dual Operation ECC Error Correction Code EEL EEPROM Emulation Library EEPROM Electrically erasable programmable read only memory EEPROM emulation In distinction to a real EEPROM the EEPROM emulation uses some portion of the flash memory to emulate the EEPROM behavior To gain a similar behavior some side parameters have to be taken in account User Manual 2ENESAS FCL Code Flash Library Code Flash access layer FDL Data Flash Library Data F
58. nding command execution Note When no command is being processed R FDL Handler consumes few CPU cycles Example while true R FDL Handler User Task A User Task B User Task C j User Task D R01US0079ED0103 User Manual RENESAS us Data Flash Access Library Type T01 European Release User Interface API 4 4 3 Operation control 4 4 3 1 R_FDL_SuspendRequest Outline This function requests suspending a Flash operation in order to be able to do other Flash operations Interface C Interface r fdl status t R FDL SuspendRequest void Arguments Parameters Argument Type Access Description None Return value Type Description e R FDL OK Operation finished successfully e H FDL ERR REJECTED r fd status t Wrong library handling flow e No operation is ongoing e FDLis already in suspended state Pre A Flash operation must have been started and not yet finished request structure status conditions value is R FDL BUSY The FDL must not be processing another suspend request Post CallR FDL Handler until the library is suspended status R FDL SUSPENDED conditions If the function returned successfully no further error check of the suspend procedure is necessary as a potential error is saved and restored on R FDL ResumeRequest The request structure used before suspend shall not be modified by the command s issue
59. o problems during execution R FDL BUSY roinsdy Call R FDL Handler until the Flash operation is finished reported by the request structure status return value meaning Operation finished successfully R FDL OK reason No problems during execution remedy Nothing meaning An on going Flash operation was successfully suspended reason Suspend processing successfully finished R FDL SUSPENDED Start another operation or resume the suspended remedy operation meaning Current command is rejected Wrong command parameters e access is made outside of physically available Data Flash e command shall operate in User pool but accessType enuis notR FDL ACCESS USER reason R FDL ERR PARAMETER e command shall operate in EEL pool but accessType enuis notR FDL ACCESS EEL e cnt ul6isOorit is too big e flash writing address is not aligned with granularity 4 bytes remed Refrain from further Flash operations and investigate in the y root cause R FDL ERR PROTECTION meaning Current command is rejected RO1US0079ED0103 47 User Manual RENESAS Data Flash Access Library Type TO1 European Release Status Background and Handling reason e To gain robustness the parameter check is repeated right before Flash modification and returns the protection error in case of a violation e g due to an unwanted variable modification e Other device specific pro
60. ode from internal RAM allocated space on stack Please ensure that e Code execution is done from other locations e g internal RAM e No access to Code Flash is allowed e g by jump to interrupt exception functions direct Code Flash Read Execution from the CPU DMA accesses to Code Flash The user can configure the provided callback macro functions in d1 cfg h in order to handle e g R01US0079ED0103 User Manual RENESAS eS Data Flash Access Library Type TO1 European Release Cautions interrupt amp exception disable DMA The sample application provides examples on how to disable and restore interrupts and exceptions using the callback routines 9 Interrupted flash operations In case of Flash modification operation Erase Write interruption the electrical conditions of the affected Flash range Flash block on erase Flash write unit on Write get undefined It is impossible to give a statement on the read value after the interruption Furthermore the resulting read value is not reliable the electrical margin for the specified data retention may not be given In such case erase and re write the affected Flash block s to ensure data integrity and retention 10 Write operation Before executing a write operation please make sure the given address range is erased 11 Reading Data Flash Data Flash on RH850 devices is made with differential cells for storage This means that reading erased Data Flash areas dire
61. onable care in preparing the information included in this document but Renesas Electronics does not warrant that such information is error free Renesas Electronics assumes no liability whatsoever for any damages incurred by you resulting from errors in or omissions from the information included herein 7 Renesas Electronics products are classified according to the following three quality grades Standard High Quality and Specific The recommended applications for each Renesas Electronics product depends on the product s quality grade as indicated below You must check the quality grade of each Renesas Electronics product before using it in a particular application You may not use any Renesas Electronics product for any application categorized as Specific without the prior written consent of Renesas Electronics Further you may not use any Renesas Electronics product for any application for which it is not intended without the prior written consent of Renesas Electronics Renesas Electronics shall not be in any way liable for any damages or losses incurred by you or third parties arising from the use of any Renesas Electronics product for an application categorized as Specific or for which the product is not intended where you have failed to obtain the prior written consent of Renesas Electronics R01US0079EDO0103 User Manual 12 NE SAS 8 Data Flash Access Library Type TO1 European Release Notice The quality grade of each R
62. onal character identifying different engineering versions Library version number a bc E for engineering version V for normal version Coded information about the used memory register model If no information is coded the library is a generic library valid for all memory register models Coded information about the supported compiler If no information is coded the library is a source code library valid for different compilers Library type TO1 Type01 MCU series name H850 RH850 Flash Code Data library S Code D Data Figure 12 Version string Example uints t vetr Winte t R FOL GetVersionString 1 R01US0079ED0103 User Manual RENESAS i Data Flash Access Library Type T01 European Release User Interface API 4 5 Commands The following sub chapters describe the Flash operations that can be initiated and controlled by the library In general all FDL commands can be handled in the same way as illustrated in Figure 13 1 The requester fills up the private request variable my request command definition 2 The requester tries to initiate the command execution by R FDL Execute amp my request 3 The requester has to call R FDL Handler to proceed the FDL command execution as long the request is being processed i e my request status enu R FDL BUSY 4 After finishing the command i e my request s
63. pplication pp hardware R_FDL_Execute Erase 2 blocks Start erase block 4 R FDL BUSY R FDL Handl FDL Handler Check Busy 4 Erase 4 R FDL BUSY First block R FDL Handler a Start erase block 4 R FDL BUSY R FDL Handler gt 1 Check Busy Erase 4 R_FDL_BUSY Second block R PI StandBy pp 4 R FDL OK Erase second block interrupted cxan de R FDL WakeU i sate too NEN R FDL OK interrupted block R FDL Handler a tat Check Busy 4 4 R FDL BUSY Erase Block 2 R FDL Handler Check Ready 4 R FDL OK idie Figure 10 Stand By processing on a Data Flash Erase operation R01US0079ED0103 User Manual RENESAS Data Flash Access Library Type TO1 European Release Functional Specifications User Data Flash application FDL programming ii hardware R FDL Execute Write 3 words 4 R FDL BUSY Start Write byte R FDL Handler 4 R FDL BUSY Write Check Busy first word R FDL Handler 4 H FDL BUSY o uen susp suspen ux 4 R FDL BUSY ee EE second word Start Write byte R FDL StandBy 4 R FDL OK cxan doy A A AA AA KAG c a
64. quest pstr r fdl request t RW and also the execution results A more detailed description of request structure can be found in section 4 3 3 r fdl request t RO1US0079ED0103 33 User Manual 2ENESAS Data Flash Access Library Type T01 European Release User Interface API Return value Type Description none Pre R FDL Init must have been executed successfully conditions Post CallR FDL Handler until the Flash operation is finished This is reported by the request conditions structure status return value value changes from R FDL BUSY to a different value The user application must not modify members of the request structure while the command is in operation Description The execute function initiates all Flash modification operations The operation type and operation parameters are passed to the FDL by a request structure the status and the result of the operation are returned to the user application also by the same structure The required parameters as well as the possible return values depend on the operation to be started This function only starts a hardware operation according to the command to be executed The command processing must be controlled and stepped forward by the handler function R FDL Handler Possible commands parameters and return values are described into chapter 4 5 Commands Example Erase blocks 0 to 3 r fdl request t myRequest C
65. red Therefore as the time interval between R FDL Handler functions call increases so does the overall processing time An exception to this background operation is R FDL CMD READ command that is executed synchronously during R FDL Execute function R01US0079ED01 03 16 User Manual 2ENESAS Data Flash Access Library Type T01 European Release Functional Specifications La Data Flash m programming User application FDL hardware i Library is busy with a R FDL Execute Command Flash operation Start Flash operation gt R_FDL_BUSY R_FDL_Handler Status check atus chec gt R FDL BUSY lag Operation is ongoing 4 R_FDL_Handler EM Status check atus chec Operation is finished a peration is finishe Start Flash ati art Flash operation Operation started B R_FDL_BUSY a Other operations may follow Ss A ma nes R FDL Handler gt i Status check atus chec gt Operation is finished R FDL OK rai Possible asynchronous commands R FDL CMD ERASE R FDL CMD WRITE R FDL CMD BLANKCHECK Figure 5 Background operation 3 4 Flash Access Protection The FDL Flash Access Protection shall protect Flash accesses to unintended addresses The protection distinguishes EEL Pool Flash blocks from User Pool blocks refer to chapter 2 2 Pool Def
66. t the location specified by the virtual target address Note It is not allowed to Overwrite data which means writing data to already partly or completely written Flash User Interface API area Please always erase the targeted area before writing into it The members of the request structure given to R FDL Execute are described in the following table Table 5 Request structure usage for write command Structure member Value Description command enu R FDL CMD WRITE Request a write operation R01US0079ED0103 46 User Manual RENESAS Data Flash Access Library Type TO1 European Release User Interface API Structure member Value Description Address of the buffer containing the source bufAddr_u32 uint32 t number data to be writte The virtual start address for writing in Data lox uaa imga ENON Flash aligned to word size 4 Bytes cnt u16 uint16 t number Number of words to write R FDL ACCESS USER Selects the Flash pool in which the command accessType enu R FDL ACCESS EEL will be able to operate This is an output member It contains the status of the operation during and after the execution Possible values are described in the next table status enu The following table describes all possible status returns Table 6 Write operation returned status Status Background and Handling meaning Operation started successfully reason N
67. tatus enu Error handler Outline This function requests to resume the FDL operation after suspending Interface C Interface r fdl status t R FDL ResumeRequest void RO1US0079ED0103 ag User Manual 2ENESAS Data Flash Access Library Type T01 European Release User Interface API Arguments Parameters None Return value e R FDL OK Operation finished successfully r fdl status t e HR FDL ERR REJECTED Wrong library handling flow FDL is not in suspended or suspend pending state Pre The library must be in suspended state conditions Post Call R FDL Handler until the library operation is resumed conditions Description This function requests to resume the FDL operation after suspending The resume is just requested by this function Resume handling is done by the R FDL Handler function Example See R FDL SuspendRequest 4 4 3 3 R FDL StandBy Outline This function suspends an ongoing flash operation Interface C Interface r fdl status t R FDL StandBy void Arguments Parameters None RO1US0079ED0103 39 User Manual RENESAS Data Flash Access Library Type T01 European Release User Interface API Pre conditions Post conditions Description Example Return value Type Description e H FDL OK FDL operation finished successfully e R FDL BUSY The started Flash operation is still on going e H FDL ERR REJECTED Flow error e Libr
68. tatus enu R FDL BUSY the requester has to analyse the status to detect potential errors start command execution fill request variable my request O R_FDL_Execute 8my_request 2 R FDL Handler other R_FDL_OK lt other gt error handling mod of command oca Figure 13 Generic command execution flow RO1US0079ED0103 44 User Manual 2ENESAS Data Flash Access Library Type TO1 European Release User Interface API 4 5 1 R FDL CMD ERASE The erase command can be used to erase a number of Flash blocks defined by a start block and the number of blocks The members of the request structure given to R FDL Execute are described in the following table Table 3 Request structure usage for erase command Structure member Value Description command enu RH FDL CMD ERASE Request a block erase operation bufAddr u32 Not used Number of the first block to be erased Flash blocks are defined by the erase granularity that is 64 Bytes e g idx u32 uint32 t number block 0 0x00 Ox3F block 1 0x40 Ox7F cnt u16 uint16 t number Numbers of blocks to erase ESE STUD SH R FDL ACCESS USER Selects the Flash pool in which the command ype R FDL ACCESS EEL will be able to operate This is an output member It contains the status of the operation during and after the execution Possible values are described in the next table status enu The following table describes al
69. tection mechanisms e g security unit like ICU or FHVE protection mechanisms prevent Flash operations remedy Refrain from further Flash operations and investigate in the root cause meaning Current command is rejected R FDL ERR REJECTED aa Another operation is ongoing remedy Request again the command when the preceding command has finished meaning At least one data could not be written correctly reason R FDL ERR WRITE e User flow defect tried to overwrite data write into non erased cells e Hardware defect one or more Flash bits could not be written remedy Erase write area before writing A Flash block respectively the complete Data Flash should be considered as defect meaning A library internal error occurred which could not happen in case of normal application execution R FDL ERR INTERNAL reason e Application bug e g program run away destroyed program counter or hardware problem e Only on older F1x devices failed ID code authentication supplied in the device descriptor See section 4 2 Run time configuration for details about ID code remedy Refrain from further Flash operations and investigate in the root cause Mg FDL Execute will never set this status code 2 4 5 3 R_FDL_CMD_BLANKCHECK R FDL Handler will never set this status code The blank check command can be used by the requester to check whether
70. that time code from Code Flash cannot be executed as well as data cannot be read The library provides the possibility to execute call back routines in order for the user to handle the implications of disabling the Code flash for the impact on the application please refer to Chapter 6 Cautions The call back routines are executed at the begin and end of the critical section The defines to set the call back routines are described in the following FDL CRITICAL SECTION BEGIN Possibility to execute a call back routine at critical section start e g disable interrupts and exceptions FDL CRITICAL SECTION END Possibility to execute a call back routine at critical section end e g enable interrupts and exceptions Implementation in the sample application define FDI SECTION BEGIN FDL User CriticalSetionBegin define FDI SECTION END FDL User CriticalSetionEnd 2 Device family The macro FDL CFG E1X P1X PLATFORM must be defined for E1x and P1x and must be left undefined for F1x and R1x devices 4 2 Run time configuration The FDL configuration can be changed dynamically at runtime It contains important FDL related information e g CPU frequency number of blocks used by library authentication code and EEL information e g EEL pool size and EEL starting block number The run time configuration is stored in a descriptor structure see x fdl descriptor t wh
71. tion The value definition should be done in the file 1 descriptor h The constant variable definition and value assignment should be done in the file d1_descriptor c If adding the files r a1 descriptor c hto the application only the file fd1 descriptor h needs to be adapted by the user while d1_descriptor c may remain unchanged For usage please refer to chapter 4 2 Run time configuration 5 2 2 Delivery package directory structure and files The following table contains all files installed by the library installer e Files in red belong to the build environment controlling the compile link and target build process e Files in blue belong to the sample application e Files in green are description files only e Files in black belong to the FDL Table 11 File structure of the FDL package File Description installation folders Release txt Library package release notes installation folders Make GNUPublicLicense txt GNU Make utility license file Readme txt Extra information for source code of GNU Make make exe libiconv2 dll Minimal installation of GNU Make utility libintl3 dll setup exe GNU Make installer package installation folder2 device names zcompilers Build bat Batch file to build the FDL sample application Clean bat Batch file to clean the FDL sample application Makefile Make file that controls the build and clean process installation folder devic
72. tion by any of the FDL Flash access commands The user can define the size of the FDL pool freely at project run time during library initialization The FDL pool provides the space for the EEL Pool which is allocated by the EEL inside the FDL pool The EEL Pool provides the Flash space for the EEL to store the emulation data and management information All FDL pool space not allocated by the EEL Pool is freely usable by the user application so is called the User Pool Data Flash FDL Pool FDL Pool lt NL Figure 2 Pools overview 2 3 Architecture related notes e All Data Flash related operations are executed by the FDL Thus the application cannot access Erase Write the Data Flash directly An exception is Reading the Flash contents As the Flash is mapped to the CPU address space it can be directly read by the CPU The FDL provides an additional read operation that will take care of possible ECCs error correction code errors to allow error polling e The FDL allows accessing the Data Flash only R01US0079EDO0103 User Manual RENESAS NE Data Flash Access Library Type TO1 European Release Architecture e Parallel Flash operations Except Read by the CPU on Data Flash and Code Flash are not possible due to shared resources between the Flash macros R01US0079ED0103 User Manual RENESAS 13 Data Flash Access Library Type T01 European Release Functional Specifications Chapter 3 Functional Specifica
73. tion mechanisms e g security unit like ICU or FHVE protection mechanisms prevent Flash operations Refrain from further Flash operations and investigate in the remedy root cause meaning Current command is rejected R FDL ERR REJECTED reason Another operation is ongoing Request again the command when the preceding command has finished remedy A data word contains a single bit ECC error Single bit meaning errors are automatically corrected by the ECC logic Note The first occurrence of the fail address is returned e Not completely written or erase Flash R FDL ERR ECC SED reason e Cell level degradation by time e Hardware defect A single bit error is acceptable if resulting from degradation by time Depending on the data handling concept on top the affected data should be refreshed Erased and rewritten in order to remove the error remedy A data word contains a multiple bit ECC error This error cannot be corrected by the ECC logic Note The read operation will stop at the failing address R FDL ERR ECC DED and the fail address is returned meaning e Not completely written or erase Flash reason e Cell level degradation by time e Hardware defect R01US0079ED0103 User Manual RENESAS Be Data Flash Access Library Type TO1 European Release User Interface API Status Background and Handling A multiple bit error can appear when caused by not comp
74. tions 3 1 Supported functions commands and Flash operations For a better understanding of the flows and mechanisms required for an FDL usage the basic functions of the FDL are introduced in the following The API of the FDL is thereby on the one hand based on functions used to manage the operation of the library itself on the other hand it offers so called commands to access and control the content of the FDL pool The following table lists up all functions the library will support Please refer to the chapter 4 4 Functions for detailed descriptions Table 1 FDL Function Function Description R FDL Init Initialize the library and Flash hardware R FDL Execute Initiate a Flash operation R FDL Handler Control an initiated Flash operation and forward the status R FDL SuspendRequest Request suspending an on going Flash operation R FDL ResumeRequest Resume a suspended Flash operation Suspend an on going Flash operation from an R FDL StandBy asynchronous context R FDL WakeUp Wake up the FDL from Stand by state R FDL GetVersionString Return a pointer to the library version string Commands are used to manage the FDL pool Commands are initiated via R FDL Execute and the further progress is controlled by regular execution of R FDL Handler The following commands can be used to execute the following Flash operations Table 2 FDL commands and operations Initiated Flash
75. tus Background and Handling reason Wrong command parameters e access is made outside of physically available Data Flash e command shall operate in User pool but accessType enuis notR FDL ACCESS USER e command shall operate in EEL pool but accessType enuisnotR FDL ACCESS EEL e cnt ul6isOorit is too big e flash blank check address is not aligned with granularity 4 bytes remedy Refrain from further Flash operations and investigate in the root cause R FDL ERR PROTECTION meaning Current command is rejected reason e To gain robustness the parameter check is repeated right before Flash modification and returns the protection error in case of a violation e g due to an unwanted variable modification e Other device specific protection mechanisms e g security unit like ICU or FHVE protection mechanisms prevent Flash operations remedy Refrain from further Flash operations and investigate in the root cause R FDL ERR REJECTED meaning Current command is rejected reason Another operation is ongoing remedy Request again the command when the preceding command has finished R FDL ERR BLANKCHECK meaning At least one bit within the specified blocks is not blank reason For any bit in the specified range the voltage level is below specification for a blank cell remedy Remedy depends on the usage e nothing to do if only
76. unsigned char rBools Description These simple types are used throughout the complete library API All library specific simple type definitions can be found in file x typedefs h which is part of the library installation package 4 3 2 r fdl descriptor t Type definition typedef struct R FDL DESCRIPTOR T uint3z t id au32 4 uineig t cpuFrequencyMHz ul6 uinti6 t fdlPoolSize ulb UINTIG t eelPoolStart ul6 uineig t eelPoolSize amp uloz k fdl descriptor tj R01US0079ED0103 26 User Manual 2ENESAS Data Flash Access Library Type T01 European Release User Interface API Description This type is the run time configuration see chapter 4 2 Run time configuration A variable of this type is read during initialization phase then hardware and internal variables are set according to the configuration Member Value Member Value Description id_au32 4 Authentication ID array code cpuFrequencyMHz u16 CPU frequency in MHz fdiPoolSize u16 FDL pool size in number of blocks eelPoolStart u16 Number of first block of the EEL pool eelPoolSize u16 Last block of the EEL pool 4 3 3 r fdl request t Type definition typedef volatile struct R FDL REQUEST T r fdl command t command enu int32 t bufAddr u32 uint3z t idx u32 uintl6 t cnt ul6 r fdl accessType t accessType enu r fdl status t Status enu Y fal request t Descriptio
77. visor mode register bit PSW UM 0 3 Function re entrancy All functions are not re entrant So re entrant calls of any FDL function must be avoided 4 Task switch context change synchronization between functions Each function depends on global available information and is able to modify this information In order to avoid synchronization problems it is necessary that at any time only one FDL function is executed So it is not allowed to start an FDL function then switch to another task context and execute another FDL function while the last one has not finished 5 Entering power save stand by mode Entering power save mode is not allowed at all during on going Data Flash operations Use R FDL StandBy or wait until operations are no longer busy 6 Different power save stand by modes Other power save modes than HALT will result in Flash hardware internal data loss So don t enter power save modes except HALT when further FDL operations are intended after wake up If entering other modes the FDL need to be re initialized by R FDL Init 7 Initialization The FDL library initialization by means of calling R FDL Init must be performed before calling most of the library functions Exception is R FDL GetVersionString function that can be called anytime 8 Critical Section handling TheR FDL Init function temporarily disables Code Flash During this time since the Code Flash is not available the library is executing c

Download Pdf Manuals

image

Related Search

Related Contents

PROTECCIÓN DE PLAN DE PROTECCIÓN GEEK SQUAD  Ver - Ministerio de Defensa  Liebert XDWP™ - Emerson Network Power  vrc bb Taille 507,28 KB  USER MANUAL BEDIENUNGSANLEITUNG  608406-613419 120V LS flr machine (EN  Sony KV-13VM42 User's Manual  

Copyright © All rights reserved.
Failed to retrieve file