To our customers, Old Company Name in Catalogs and Other Documents On April 1st, 2010, NEC Electronics Corporation merged with Renesas Technology Corporation, and Renesas Electronics Corporation took over all the business of both companies. Therefore, although the old company name remains in this document, it is a valid Renesas Electronics document. We appreciate your understanding. Renesas Electronics website: http://www.renesas.
Notice 1. 2. 3. 4. 5. 6. 7. 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.
Application Note Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) Summary This application note describes how to use the Flash Development Toolkit from Renesas, and explains how to use the SH7086 (SH family) user program mode using the Flash Development Toolkit, as follows: • Boot mode 1 (write to the user boot area) • Boot mode 2 (write to the user area) • User boot mode • User program mode From the explanation given here, please understand the differences between the
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) Table of Contents 1. 1.1 1.2 1.3 SH7086 ............................................................................................................................................. 3 Flash Memory Configuration ............................................................................................................. 3 Operation Modes......................................................................................
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) 1. SH7086 1.1 Flash Memory Configuration The flash memory of the SH7086 (SH family) has two types of memory mats: a user mat (user area) and a user boot mat (user boot area). In addition to these, there is another area in which the flash memory write/erase control program is stored. This area is referred to as the boot mat (boot area).
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) 1.3 On-board Programming Mode There are three on-board programming modes: boot mode, user program mode and user boot mode. The user boot area can be written to and erased in only boot mode. In boot mode, the user area and user boot area are once erased in their entirety. After that, the user area or user boot area can be written to by issuing a command, but their contents cannot be read out up until this state.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) 2. Functionality of the Flash Development Toolkit The Flash Development Toolkit is an on-board flash programming tool for Renesas flash microcomputers, featuring a highly functional, easy to use graphical user interface.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) 3. Method for Using the Flash Development Toolkit in Each Mode For a write to the user boot area in user boot mode or a write to the user area in user program mode to be executed, there must be the load module file for user program mode (shared with user boot mode) written in the area concerned.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) 3.1 Connecting the E8a Emulator The E8a emulator, connected between the host computer and user system, has the facility to write the user application program to or erase the program written in a flash microcomputer’s internal flash memory on the user system (on-board) by using the Flash Development Toolkit.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) An example of a connection between the E8a emulator and the SH7068 is shown below. The pullup and pulldown resistance values are given for reference purposes only. These values need to be evaluated in your system before they are actually used. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) In this application note, we use the CPU board “HSB70865F” made by Hokuto Denshi Co., Ltd. as the SH7086 user system. For details, refer to the URL of Hokuto Denshi Co., which is given below. http://www.hokutodenshi.co.jp/ The relationship between the pin numbers and the pin names of the HSB70865F is shown below. Pin No. REJ06J0071-0100 /Rev.1.00 Pin name Pin No. 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) Since the E8a emulator and the HSB70865F connect to external devices via 14 pins and 20 pins, respectively, the 14 ↔ 20-pin conversion connector “FDM-E8a” made by Hokuto Denshi is used in this document. For details, refer to the URL of Hokuto Denshi Co., which is given below. http://www.hokutodenshi.co.jp/ The pin conversion table of the FDM-E8a is shown below.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) 3.2 Setting Up the Flash Development Toolkit Before writing a program to the flash memory, first set up the Flash Development Toolkit. (1) Start the Flash Development Toolkit. From All Programs, choose “Flash Development Toolkit 4.01.” (2) The Welcome! screen of the Flash Development Toolkit will be displayed. Select the “Create New Project Workspace” radio button and click OK.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (3) Set up a new project workspace. First, specify a workspace name and a project name. Here, use the same name to specify a workspace name and a project name. Choose “Browse,” and from the ensuing list select the location in which you want to save the workspace. When you’ve completed the dialog box, click OK. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (4) Select the target device. Select “SH/7086F (Generic)” and click Next. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (5) Select a communication port. From the pulldown menu, choose “E8aDirect” and click Next. (6) Set up power supply. Simply click OK leaving the Power Supply check box unselected. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (7) Set up the E8a pins for boot mode. Set pin C (FWE) to 1 and pin E (MD1) and pin A (MD0) to 0, respectively and then click OK. When a connection is complete, click OK. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (8) Check the device for confirmation. Select the E8a and click OK. Device confirmation is complete. Click OK. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (9) Set up the device. For Input Clock, enter the clock frequency used in the board in MHz units. Enter 10.00 MHz. Set 8 for Main Clock Multiply Factor and 4 for Peripheral Clock Multiply Factor, and then click Next. The input clock here refers to the clock frequency that is directly fed to the microcomputer. Enter the frequency of the quartz crystal resonator or ceramic resonator connected to the user system.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (10) Set up the type of connection. From the pulldown menu, set the baud rate. Select “625000” and click Next. (11) Select write options. Select “Automatic” for Protection Level and “Advanced” for Output Message Level, and then click Next. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (12) Set the E8a pins as required when the device restarts in reset mode. Since there is no need to set here, simply click Finish. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (13) The SH7086 board will be connected to the Flash Development Toolkit in boot mode. At this time, the user boot area and user area have had their contents erased. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (14) Disconnect the device. Choose “Disconnect from Device” from the Device menu. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) The device will be disconnected. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (15) Save the workspace and quit. Choose “Exit” from the File menu. Click Yes. The Flash Development Toolkit will be closed. The workspace for the Flash Development Toolkit will be saved as 7086.WAS file. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) 3.3 Boot Mode 1 (Write to the User Boot Area) Write the load module file for user program mode to the user boot area in boot mode. The program written to the user boot area is the 7086F.mot file (S type file). Here, use the saved workspace file (7086.AWS) to start. This program already has the bit rate in it corrected according to the clock frequency.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) The 7086 project will be displayed. The Flash Development Toolkit can also be launched directly by opening the project workspace file “7086.AWS” (by double-clicking on it). REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (3) Choose “Connect to Device” from the Device menu. Simply click OK leaving the Power Supply check box unselected. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) Select “E8a” and click OK. The device will be connected. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (4) Select the file to write. Choose “Add File” from the Project menu. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (5) In the Add File dialog box, select the “7086F.mot” file and click Add. The “7086F.mot” file will be added to the project. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (6) To verify that the user boot area and user area have no data written in each, perform a blank check. Choose “Blank Check” from the Device menu. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) The result of a blank check will be displayed. It shows that the user boot area and user area have no data written in each. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (7) Verify a checksum value of the user boot area and user area when these areas have no data written in each. Choose “Flash Checksum” from the Device menu. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) The result of a checksum will be displayed. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (8) Set the user boot area as a preparatory step before writing to that area. Right-click the 7086F.mot file, and from the popup menu choose “User Boot Flash” to set the user boot area for the download destination. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (9) Right-click the 7086F.mot file again, and from the popup menu choose “Download [User Boot Flash]” to download the 7086F.mot file into the user boot area. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) The program has been downloaded into the user boot area. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (10) To verify that the program has been written to the user boot area, perform a blank check and a checksum. Choose “Blank Check” from the Device menu. Choose “Flash Checksum” from the Device menu. The results of a blank check and a checksum will be displayed. The result shows that the program has been written to the user boot area. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (11) Choose “Disconnect from Device” from the Device menu to disconnect the device. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (12) Delete a file. Choose “Delete Files” from the Project menu. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (13) The Delete Project Files dialog box will be displayed. Click the Delete All button. Click OK. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) The files will be deleted. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (14) Delete a folder. Right-click a folder, and from the popup menu choose “Delete Folder.” REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) The folder will be deleted. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) 3.4 Boot Mode 2 (Write to the User Area) Write the load module file for user program mode to the user area in boot mode. The program written to the user area is the same file that was used in Section 3.3, “Boot Mode 1 (Write to the User Boot Area).” (1) Launch Flash Development Toolkit 4.01, open the project workspace file “7086.AWS,” and connect to the device. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (2) Select the file to write. Choose “Add File” from the Project menu. In the Add File dialog box, select the “7086F.mot” file and click Add. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) The “7086F.mot” file will be added to the project. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (3) Before writing the 7086F.mot file to the user area, perform a blank check and a checksum. Choose “Blank Check” from the Device menu. Choose “Flash Checksum” from the Device menu. The results of a blank check and a checksum will be displayed. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (4) Right-click the 7086F.mot file, and from the popup menu choose “Download [User Area]” to download the 7086F.mot file into the user area. The default is “Download [User Area].” REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) The program has been downloaded into the user area. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (5) To verify that the program has been written to the user area, perform a blank check and a checksum. Choose “Blank Check” from the Device menu. Choose “Flash Checksum” from the Device menu. The results of a blank check and a checksum will be displayed. The result shows that the program has been written to the user area. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) 3.5 User Boot Mode In user boot mode, it is possible to write to and erase the user area. This mode does not allow writing to and erasing the user boot area. Therefore, it is necessary that the load module file for user program mode be written in the user boot area beforehand. (1) Launch Flash Development Toolkit 4.01, open the project workspace file “7086.AWS,” and write the 7086F.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (2) Choose “Disconnect from Device” from the Device menu to disconnect the device. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (3) Choose “Project Setting” from the Device menu. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) The project setting window will be displayed. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (4) Set up the user boot mode. Select the Device tab of the project setup window and double-click the “Interface Direct Connection” line. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) Click Next. Click Next. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) In the Select Connection column, select “USER Program Mode” and then click Next. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) Set up the E8a pins for user boot mode. Set pin C (FWE) and pin A (MD0) to 1 and pin E (MD1) to 0, respectively and then click OK. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) Click the Finish button. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) The user boot mode has been set up. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (5) Choose “Connect to Device” from the Device menu to connect the device. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (6) Add the program to write to the user area. Here, write the test_mot file to the user area. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (7) Before writing the test_mot file to the user area, perform a blank check and a checksum. Choose “Blank Check” from the Device menu. Choose “Flash Checksum” from the Device menu. The results of a blank check and a checksum will be displayed. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (8) Write to the user area in user boot mode. Right-click the test_mot file, and from the popup menu choose “Download [User Area]” to download the test_mot file into the user area. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) The program has been downloaded into the user area. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (9) To verify that the program has been written to the user area, perform a blank check and a checksum. Choose “Blank Check” from the Device menu. Choose “Flash Checksum” from the Device menu. The results of a blank check and a checksum will be displayed. The result shows that the program has been written to the user area. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) 3.6 User Program Mode In user program mode, it is possible to write to and erase the user area. Here, write the test.mot file to the user area the same way as in Section 3.5, “User Boot Mode.” This mode does not allow writing to and erasing the user boot area. Therefore, it is necessary that the load module file for user program mode be written in the user area beforehand. (1) Launch Flash Development Toolkit 4.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (2) Set up the user program mode. Select the Device tab of the project setup window and double-click the “Interface Direct Connection” line. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) Click Next. Click Next. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) In the Select Connection column, select “USER Program Mode” and then click Next. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) Set up the E8a pins for user program mode. Here, set for mode 7. Set pin C (FWE), pin E (MD1) and pin A (MD0) to 1, and then click OK. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) Click the Finish button. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) The user program mode has been set up. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (3) Choose “Connect to Device” from the Device menu to connect the device. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (4) Before writing the test_mot file to the user area, perform a blank check and a checksum. Choose “Blank Check” from the Device menu. Choose “Flash Checksum” from the Device menu. The results of a blank check and a checksum will be displayed. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (5) Write to the user area in user program mode. Right-click the test_mot file, and from the popup menu choose “Download [User Area]” to download the test_mot file into the user area. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) The program has been downloaded into the user area. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (6) To verify that the program has been written to the user area, perform a blank check and a checksum. Choose “Blank Check” from the Device menu. Choose “Flash Checksum” from the Device menu. The results of a blank check and a checksum will be displayed. The result shows that the program has been written to the user area. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) 4. Processes of the Flash Development Toolkit The Flash Development Toolkit has three modes in which it connects to the device: Boot mode, user boot mode and user program mode. In each mode, it is possible to specify a continuance of execution from the preceding session. Normally, use a new connection process. The codes expressed in hexadecimal are the command codes of the Flash Development Toolkit.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) 5. Files for User Program Mode This section describes the files for user program mode. 5.1 Source File List The source files are listed below. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) 5.2 Module List The modules are listed below. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) 5.3 Hierarchical Module Structure The hierarchical structure of the modules is shown below. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) 5.4 Program Flow This section describes a program flow referring to the hierarchical module structure. (1) Program processing flow The processing flow of the program is shown below. In user program mode, the bit rate synchronization and user area erase process normally executed in boot mode are not performed. Therefore, the program and data written into the flash memory can be saved. REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (2) Main process (main) The flow of the main process is shown below. 1. Branch from the reset vector to start (startup). 2. Start (startup) sets the stack pointer and calls the main process (main). 3. The main process (main) calls SCI initialization (InitSCI) and branches to ROM main process (RomMain). 4.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (4) RAM main process (RamMain) The flow of the RAM main process (RamMain) is shown below. 1. In command process (ProcessCommand), process the commands. The processed commands are listed below. Since the files for user program mode are run in user programming mode, selecting a write to the user boot area and erasing blocks of the user boot area cannot be performed.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) 6. Sources of the Files for User Program Mode The main sources of the files for user program mode are shown below. 6.1 Header Files The files for user program mode use the header files listed below. (1) Bit rate setting (GenTest.h) Sets a bit rate. /* RATE:9600/bps CLOCK:10MHz Main:x2 Peripheral:x2 */ 0x40 /* Bit rate register channel 1 */ #define MA_BRR_SCI The user program mode is connected at 9,600 bps.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (2) IO register definition (io7086.h) Defines the SCI module and ROM related registers and bits and the PFC register.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) /*----------------------------------------------------------------------*/ /* /*----------------------------------------------------------------------*/ /* /*----------------------------------------------------------------------*/ #define FRQCR (*(volatile unsigned short *)0xFFFFE800) /*----------------------------------------------------------------------*/ /* /*-----------------------------------------------------------
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (3) Macro definitions (FDTUMain.h, KAIg.h) Defines the labels used in the program. • FDTUMain.h /* D E F I N E */ enum { FmatsUserBootMat = 0xaa, FmatsUserMat = 0x00, WriteMode = 0x01, EraseMode = 0x01, FkeyEnable = 0xA5 }; • KAlg.h /* D E F I N E S */ #define LOOP_END #define bufSize #define BLOCK_NO_ERROR #define ERASE_END #define WRITE_END #define ADDRESS_ERROR #define WRITE_ERASE_ENABLE REJ06J0071-0100 /Rev.1.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) 6.2 Main Process and ROM Main Process (1) Hierarchical module structure The hierarchical structure of the main process and ROM main process modules is shown below. Branch from the reset vector to start, set the stack pointer (Strt7086.src) and branch to the main process (GenTest.c, main). In the main process, initialize the SCI (GetTest.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) 6.3 RAM Main Process The RAM main process involves transferring a library, erasing the flash memory, and writing to the flash memory. These processes are executed in the RAM. (1) Library transfer (FDTUMain.c) • LibTrans If commandID is prepareERASE (0x48), set FECS to EraseMode (0x01) and select the erase library. Otherwise (prepareUserAreaWrite, 0x43), set FPCS to WriteMode (0x01) and select the write library.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) • ScoBitSet Set the library transfer destination address in the FTDAR register, set the VBR register to 0x84000000, and set the SCO bit of the FCCS register to 1. There must be 4 or more of NOP instructions after the SCO bit setting.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (2) Area selection (FDTUMain.c) To select the user boot area or the user area, set FmatsuUserBootMat (0xaa) or FmatsUserMat (0x00) in the FMATS register. There must be 2 or more of NOP instructions after the setting.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (3) Flash memory erase (FDTErase.c) • EraseInit Select the user area and after specifying the operating clock frequency, initialize the erase library. For the operating clock frequency, the operating clock frequency specified by FDT is transmitted to the device in new bit rate selection. The library initialization uses this operating clock frequency.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (4) Flash memory write (FDTWrite.c) • WriteInit Select the user area and after specifying the operating clock frequency, initialize the write library.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) • Execution of a write termination process (WriteFLASH) This is part of the flash memory write termination process. For details, refer to the sources of the files for user program mode. In write data reception (GetWriteData), receive the address where the data to write is stored and the address to which to write. If the write destination address is WRITE_END (0xFFFFFFFF), execute a write termination process.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) 7. Programming Guide This section explains how to write a program using the flash microcomputer’s standard boot program. A sample program and the precautions to take are described. For details, see the hardware manual. 7.1 Functional Outline The microcomputer’s standard boot program is comprised of a transfer library, erase library and a write library. The functionality of the boot program is outlined below.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) 7.2 Control Registers and Control Bits The following shows the library transfer and user boot area related control registers and control bits. (1) Selecting the functionality Use the FKEY register to select transfer and write/erase. Set the FKEY register to H’A5 to transfer the write/erase library, or H’5A to execute the write/erase process.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) 7.3 Using the Libraries This section explains how to use the libraries. (1) Transfer Follow the procedure below to perform a transfer. 1. Select the write library or erase library to transfer. For the write library, set the PPVS bit (bit 0) of the FPCS register to 1. For the erase library, set the EPVB bit (bit 1) of the FPCS register to 1. 2. In the FTDAR register, specify the transfer destination address in the RAM.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) 7.4 List of Module Facilities There are three libraries: Transfer library, erase library and write library. The functionality of the respective modules are listed below. – REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) 7.5 Module Specifications Specifications of the library modules are shown below for reference. For details, see the hardware manual. (1) Transfer start Name Type Functionality Parameter Input Return value Output Processing Transfer start None Library is transferred by setting the SCO bit of FCCS register to 1. Program transfer None For the write library, the PPVS bit (bit 0) of the FPCS register is set to 1.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) (3) Block erase (4) Write initialization (5) Write REJ06J0071-0100 /Rev.1.00 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) Home Page and Where to Contact for Support Renesas Technology home page http://www.renesas.com/ Where to contact http://www.renesas.com/inquiry Revision Record Rev. 1.00 Issue date 2009.02.13 REJ06J0071-0100 /Rev.1.00 Page — Contents of revision Points First edition issued 2009.
Flash Development Toolkit Method for Using the User Program Mode (SH7086 Application) © 2009. Renesas Technology Corp., All rights reserved. REJ06J0071-0100 /Rev.1.00 2009.