Renesas G3-PLC User Manual

G3-PLC Sample Program
User's Manual
Target Device RX Series/RL78/R9A06G037
www.renesas.com
User’s Manual
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 Electronics Corp.
website (http://www.renesas.com).
Rev.1.01 Jun. 19, 2019
Notice
1. 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 or any other use of the circuits, software, and information in the design of your product or system. Renesas Electronics disclaims any and all liability for any losses and damages incurred by you or third parties arising from the use of these circuits, software, or information.
2. Renesas Electronics hereby expressly disclaims any warranties against and liability for infringement or any other claims involving 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 document, including but not limited to, the product data, drawings, charts, programs, algorithms, and application examples.
3. No license, express, implied or otherwise, is granted hereby under any patents, copyrights or other intellectual property rights of Renesas Electronics or others.
4. You shall not alter, modify, copy, or reverse engineer any Renesas Electronics product, whether in whole or in part. Renesas Electronics disclaims any and all liability for any losses or damages incurred by you or third parties arising from such alteration, modification, copying or reverse engineering.
5. Renesas Electronics products are classified according to the following two quality grades: “Standard” and “High Quality”. The intended applications for each Renesas Electronics product depends on the product’s quality grade, as indicated below. "Standard": Computers; office equipment; communications equipment; test and measurement equipment; audio and visual equipment; home
electronic appliances; machine tools; personal electronic equipment; industrial robots; etc.
"High Quality": Transportation equipment (automobiles, trains, ships, etc.); traffic control (traffic lights); large-scale communication equipment; key
financial terminal systems; safety control equipment; etc. Unless expressly designated as a high reliability product or a product for harsh environments in a Renesas Electronics data sheet or other Renesas Electronics document, Renesas Electronics products are not intended or authorized for use in products or systems that may pose a direct threat to human life or bodily injury (artificial life support devices or systems; surgical implantations; etc.), or may cause serious property damage (space system; undersea repeaters; nuclear power control systems; aircraft control systems; key plant systems; military equipment; etc.). Renesas Electronics disclaims any and all liability for any damages or losses incurred by you or any third parties arising from the use of any Renesas Electronics product that is inconsistent with any Renesas Electronics data sheet, user’s manual or other Renesas Electronics document.
6. When using Renesas Electronics products, refer to the latest product information (data sheets, user’s manuals, application notes, “General Notes for Handling and Using Semiconductor Devices” in the reliability handbook, etc.), and ensure that usage conditions are within the ranges specified by Renesas Electronics with respect to maximum ratings, operating power supply voltage range, heat dissipation characteristics, installation, etc. Renesas Electronics disclaims any and all liability for any malfunctions, failure or accident arising out of the use of Renesas Electronics products outside of such specified ranges.
7. Although Renesas Electronics endeavors to improve the quality and reliability of Renesas Electronics products, semiconductor products have specific characteristics, such as the occurrence of failure at a certain rate and malfunctions under certain use conditions. Unless designated as a high reliability product or a product for harsh environments in a Renesas Electronics data sheet or other Renesas Electronics document, Renesas Electronics products are not subject to radiation resistance design. You are responsible for implementing safety measures to guard against the possibility of bodily injury, injury or damage caused by fire, and/or danger to the public in the event of a failure or malfunction of Renesas Electronics products, 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 and impractical, you are responsible for evaluating the safety of the final products or systems manufactured by you.
8. Please contact a Renesas Electronics sales office for details as to environmental matters such as the environmental compatibility of each Renesas Electronics product. You are responsible for carefully and sufficiently investigating applicable laws and regulations that regulate the inclusion or use of controlled substances, including without limitation, the EU RoHS Directive, and using Renesas Electronics products in compliance with all these applicable laws and regulations. Renesas Electronics disclaims any and all liability for damages or losses occurring as a result of your noncompliance with applicable laws and regulations.
9. Renesas Electronics products and technologies shall 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. You shall comply with any applicable export control laws and regulations promulgated and administered by the governments of any countries asserting jurisdiction over the parties or transactions.
10. It is the responsibility of the buyer or distributor of Renesas Electronics products, or any other party who distributes, disposes of, or otherwise sells or transfers the product to a third party, to notify such third party in advance of the contents and conditions set forth in this document.
11. This document shall not be reprinted, reproduced or duplicated in any form, in whole or in part, without prior written consent of Renesas Electronics.
12. Please contact a Renesas Electronics sales office if you have any questions regarding the information contained in this document or Renesas Electronics products.
(Note1) “Renesas Electronics” as used in this document means Renesas Electronics Corporation and also includes its directly or indirectly controlled
subsidiaries.
(Note2) “Renesas Electronics product(s)” means any product developed or manufactured by or for Renesas Electronics.
(Rev.4.0-1 November 2017)
Corporate Headquarters
Contact information
TOYOSU FORESIA, 3-2-24 Toyosu, Koto-ku, Tokyo 135-0061, Japan
www.renesas.com
For further information on a product, technology, the most up-to-date version of a document, or your nearest sales office, please visit:
www.renesas.com/contact/.
Trademarks
Renesas and the Renesas logo are trademarks of Renesas Electronics Corporation. All trademarks and registered trademarks are the property of their respective owners.
© 2019 Renesas Electronics Corporation. All rights reserved
General Precautions in the Handling of Microprocessing Unit and Microcontroller Unit Products
The following usage notes are applicable to all Microprocessing unit and Microcontroller unit products from Renesas. For detailed usage notes on the products covered by this document, refer to the relevant sections of the document as well as any technical updates that have been issued for the products.
1. Precaution against Electrostatic Discharge (ESD) A strong electrical field, when exposed to a CMOS device, can cause destruction of the gate oxide and ultimately degrade the device operation. Steps
must be taken to stop the generation of static electricity as much as possible, and quickly dissipate it when it occurs. Environmental control must be adequate. When it is dry, a humidifier should be used. This is recommended to avoid using insulators that can easily build up static electricity. Semiconductor devices must be stored and transported in an anti-static container, static shielding bag or conductive material. All test and measurement tools including work benches and floors must be grounded. The operator must also be grounded using a wrist strap. Semiconductor devices must not be touched with bare hands. Similar precautions must be taken for printed circuit boards with mounted semiconductor devices.
2. Processing at power-on The state of the product is undefined at the time when power is supplied. The states of internal circuits in the LSI are indeterminate and the states of
register settings and pins are undefined at the time when power is supplied. In a finished product where the reset signal is applied to the external reset pin, the states of pins are not guaranteed from the time when power is supplied until the reset process is completed. In a similar way, the states of pins in a product that is reset by an on-chip power-on reset function are not guaranteed from the time when power is supplied until the power reaches the level at which resetting is specified.
3. Input of signal during power-off state Do not input signals or an I/O pull-up power supply while the device is powered off. The current injection that results from input of such a signal or I/O
pull-up power supply may cause malfunction and the abnormal current that passes in the device at this time may cause degradation of internal elements. Follow the guideline for input signal during power-off state as described in your product documentation.
4. Handling of unused pins Handle unused pins in accordance with the directions given under handling of unused pins in the manual. The input pins of CMOS products are
generally in the high-impedance state. In operation with an unused pin in the open-circuit state, extra electromagnetic noise is induced in the vicinity of the LSI, an associated shoot-through current flows internally, and malfunctions occur due to the false recognition of the pin state as an input signal become possible.
5. Clock signals After applying a reset, only release the reset line after the operating clock signal becomes stable. When switching the clock signal during program
execution, wait until the target clock signal is stabilized. When the clock signal is generated with an external resonator or from an external oscillator during a reset, ensure that the reset line is only released after full stabilization of the clock signal. Additionally, when switching to a clock signal produced with an external resonator or by an external oscillator while program execution is in progress, wait until the target clock signal is stable.
6. Voltage application waveform at input pin Waveform distortion due to input noise or a reflected wave may cause malfunction. If the input of the CMOS device stays in the area between VIL (Max.)
and VIH (Min.) due to noise, for example, the device may malfunction. Take care to prevent chattering noise from entering the device when the input level is fixed, and also in the transition period when the input level passes through the area between VIL (Max.) and VIH (Min.).
7. Prohibition of access to reserved addresses Access to reserved addresses is prohibited. The reserved addresses are provided for possible future expansion of functions. Do not access these
addresses as the correct operation of the LSI is not guaranteed.
8. Differences between products Before changing from one product to another, for example to a product with a different part number, confirm that the change will not lead to problems.
The characteristics of a microprocessing unit or microcontroller unit products in the same group but having a different part number might differ in terms of internal memory capacity, layout pattern, and other factors, which can affect the ranges of electrical characteristics, such as characteristic values, operating margins, immunity to noise, and amount of radiated noise. When changing to a product with a different part number, implement a system­evaluation test for the given product.
Table of Contents
1. Introduction ........................................................................................................................ 1
1.1 List of Abbreviations and Acronyms .......................................................................................................... 1
1.2 Reference .................................................................................................................................................. 1
2. Software Structure ............................................................................................................. 2
2.1 Development Environment......................................................................................................................... 3
2.1.1 Hardware .......................................................................................................................................... 3
2.1.2 Software ........................................................................................................................................... 3
2.2 File structure .............................................................................................................................................. 4
3. Project Settings ............................................................................................................... 11
3.1 Start e2studio ............................................................................................................................................ 11
3.1.1 Workspace settings ........................................................................................................................ 11
3.1.2 Import project ................................................................................................................................. 12
3.1.3 Building project ............................................................................................................................... 13
3.2 Built Environment ..................................................................................................................................... 14
3.3 Macro Definition ....................................................................................................................................... 15
3.3.1 R_DEFINE_APP_MODE ............................................................................................................... 15
3.3.2 R_RL78_PLC ................................................................................................................................. 16
3.3.3 R_DEFINE_APP_BOOT ................................................................................................................ 16
3.4 Memory Map ............................................................................................................................................ 19
3.4.1 RX631 ............................................................................................................................................ 19
3.4.2 RX651 ............................................................................................................................................ 21
3.4.3 RL78G13 ........................................................................................................................................ 23
4. Sample Program .............................................................................................................. 25
4.1 G3-PLC Sample Application .................................................................................................................... 25
4.1.1 Application Control Parameters ..................................................................................................... 28
4.1.2 Command Processing Unit ............................................................................................................ 33
4.1.3 G3 Processing Unit ........................................................................................................................ 37
4.1.4 G3 API Wrapper ............................................................................................................................. 49
4.1.5 Flash control unit ............................................................................................................................ 52
4.1.6 IPv6 unit ......................................................................................................................................... 63
4.2 CPX3 SAP ............................................................................................................................................... 69
4.3 Common Process .................................................................................................................................... 69
4.3.1 CRC control .................................................................................................................................... 69
4.3.2 LED control ..................................................................................................................................... 69
4.3.3 Memory management .................................................................................................................... 69
4.3.4 Queue control ................................................................................................................................. 69
4.3.5 Console control .............................................................................................................................. 69
4.3.6 Soft timer control ............................................................................................................................ 70
4.3.7 Data operation ................................................................................................................................ 70
4.4 BSP .......................................................................................................................................................... 71
4.4.1 FIT .................................................................................................................................................. 71
4.4.2 API Functions ................................................................................................................................. 71
4.4.3 Library ............................................................................................................................................ 73
4.4.4 Startup ............................................................................................................................................ 73
4.5 Framework ............................................................................................................................................... 78
4.5.1 Sequence ....................................................................................................................................... 78
4.5.2 Process Flow .................................................................................................................................. 83
5. Resources Used .............................................................................................................. 86
5.1 Hardware Resources ............................................................................................................................... 86
5.1.1 RX631 ............................................................................................................................................ 86
5.1.2 RX651 ............................................................................................................................................ 87
5.1.3 RL78G13 ........................................................................................................................................ 88
5.2 ROM/RAM Usage Amount ....................................................................................................................... 89
R11UM0114EJ0101 Rev.1.01 Page 1 of 89 Jun. 19, 2019
RENESAS CONFIDENTIAL

1. Introduction

This document is a user’s manual for a sample program to perform power line communication using
R9A06G037.

1.1 List of Abbreviations and Acronyms

Table 1-1 shows an abbreviation used this document .
Table 1-1 List of Abbreviations and Anonyms
Acronym
Description
CPX3
It refers to R9A06G037.
FIT
Abbreviation for "Firmware Integration Technology"
IB
Abbreviation for "Information Base"
NVM
Abbreviation for "Non-Volatile Memory"
SROM
Abbreviation for "Serial flash ROM"

1.2 Reference

Table 1-2 References
No
References
Number
[1]
G3-PLC Sample API Specification for Renesas RX Series
R11UM0041EJ0105
[2]
G3-PLC Sample Application Start Guide for GCPX3 board
R11QS0003EJ0102
[3]
G3-PLC Serial Command Specification
R11UM0042EJ0112
[4]
Serial Boot Operating Manual
R11UM0059EJ0102
[6]
GCPX3 Evaluation Kit J70D1
R30UZ0081EJ0100
[7]
BCPX3 Evaluation Kit J80D1
R30UZ0098EJ0100
[8]
BCPX3 Evaluation Kit J80D2
R30UZ0099EJ0100
G3-PLC Sample Program User's Manual 2. Software Structure
R11UM0114EJ0101 Rev.1.01 Page 2 of 89 Jun. 19, 2019
RENESAS CONFIDENTIAL

2.Software Structure

This sample program consists of the G3-PLC sample application unit, BSP unit, CPX3 SAP unit, and common processing unit. The sample program is implemented on the host controller (microcontroller) and accesses to the system block and the G3 block within R9A06G037 by using serial commands. By using API functions provided by CPX3 SAP, it is possible to access each block within R9A06G037 without considering the serial commands. All source codes for this sample program are open to the public. Figure 2-1 shows the software configuration diagram. For details on specifications in red lines, refer to corresponding documents such as the API specification and the serial command specification.
Figure 2-1 Software structure
Sample program
G3-PLC sample application
R9A06G037
UART I/F
G3 Block
G3
Controller
Open source codes
BSP
Sample API specification
Target of this document
System
Block
G3-PLC serial command specification System block serial command
EAP Layer
ADP Sub Layer
MAC Sub Layer
PHY Layer
CPX3 SAP
Common part
G3-PLC Sample Program User's Manual 2. Software Structure
R11UM0114EJ0101 Rev.1.01 Page 3 of 89 Jun. 19, 2019
RENESAS CONFIDENTIAL

2.1 Development Environment

2.1.1 Hardware

Table 2-1 shows evaluation boards supported in this sample program.
Table 2-1 List of evaluation board
Evaluation board
MCU
Note
J70D1/J70D2
RX631
RX631 represents R5F5631EDD FP. (ROM2Mbytes / RAM128Kbytes / E2 Data Flash32Kbytes)
Refer to the manual "GCPX3 Evaluation Kit J70D1" for board setting.
J80D1
RX651
RX651 represents R5F56519AD FP. (ROM1Mbytes / RAM256Kbytes / Data Flashnone)
Refer to the manual "BCPX3 Evaluation Kit J80D1" for board setting.
J80D2
RL78G13
RL78G13 represents R5F100GLAFB. (ROM512Kbytes / RAM32Kbytes / Data Flash8Kbytes)
Refer to the manual "BCPX3 Evaluation Kit J80D2" for board setting.

2.1.2 Software

The projects on this sample program are operationally tested on the following integrated development environments.
Table 2-2 List of integrated development environments
Integrated development environment
Details
e2studio
e2studio Ver 7.3.0
Compiler (RX631/RX651)
GCC for Renesas 4.8.4.201803-GNURX
Compiler (RL78G13)
CC-RL Ver 1.8.00
G3-PLC Sample Program User's Manual 2. Software Structure
R11UM0114EJ0101 Rev.1.01 Page 4 of 89 Jun. 19, 2019
RENESAS CONFIDENTIAL

2.2 File structure

Table 2-3 shows file configuration of this sample application.
Table 2-3 File structure
Folder Name
File Name
Description
bsp
api
rl inc r_bsp_api.h
Header file for RL78 BSP API function
r_bsp_int.h
Header file for RL78 BSP interrupt function
src
r_bsp_api.c
RL78 BSP API function
rx inc
r_bsp_api.h
RX BSP API function
src
r_bsp_api.c
RX BSP API function
rl_fit
r_bsp
platform.h
RL BSP common definition file
mcu
rl78g13 cpu.c
RL78-dedicated function
cpu.h
Header file for RL78-dedicated function
r_flash_rl
inc
r_flash_rl_if.h
Header file for FLASH API function open to the public
src
r_flash_rl.c
FLASH API function
r_flash_rl.h
Header file for FLASH API function
flash_ty pe_4
r_flash_rl78.h
Header file for FLASH_TYPE_4 FLASH API function
incrl78
pfdl.h
Header file for flash data library(PicoFDL)
pfdl.inc
Flash data library(PicoFSL) include file
pfdl_types.h
Flash data library(PicoFDL) definition file
librl78
pfdl.lib
Flash data library(PicoFDL)
rx_fit
r_bsp
platform.h
RX BSP common definition file
mcu
all r_bsp_common.c
MCU common function
r_bsp_common.h
Header file for MCU common function
rx631
cpu.c
RX631-dedicated function
cpu.h
Header file for RX631-dedicated function
locking.c
Header file for RX631 exclusive control function
locking.h
Header file for RX631 exclusive control function
mcu_clocks.c
RX631 clock control function
mcu_info.h
RX631 configuration
mcu_init.c
RX631 initial function
mcu_init.h
Header file for RX631 initial function
mcu_interrupts.c
RX631 interrupt function
mcu_interrupts.h
Header file for RX631 interrupt function
mcu_locks.c
RX631 exclusive control function by resource
mcu_locks.h
Header file for RX631exclusive control function by resource
r_bsp.h
RX631 BSP header file
r_bsp_config.h
RX631 BSP configuration file
r_mcu_config.h
FLASH configuration when not using FIT
rx651
cpu.c
RX651-dedicated function
cpu.h
Header file for RX651-dedicated function
locking.c
RX651 exclusive control function
locking.h
Header file for RX651 exclusive control function
mcu_clocks.c
RX651 clock control function
mcu_info.h
RX651 configuration
mcu_init.c
RX651 initial function
mcu_init.h
Header file for RX651 initial function
mcu_interrupts.c
RX651 interrupt function
mcu_interrupts.h
Header file for RX651 interrupt function
mcu_locks.c
RX651 exclusive control function by resource
mcu_locks.h
Header file for RX651 exclusive control function by resource
mcu_mapped_interr upts.c
Interrupt function mapped to RX651
mcu_mapped_interr upts.h
Header file for interrupt function mapped to RX651
G3-PLC Sample Program User's Manual 2. Software Structure
R11UM0114EJ0101 Rev.1.01 Page 5 of 89 Jun. 19, 2019
RENESAS CONFIDENTIAL
mcu_mapped_interr upts_private.h
Definition file for mapped interrupt function r_bsp.h
Header file for RX651 BSP header file
r_bsp_config.h
RX651 BSP configuration file
r_bsp_interrupt_con fig.h
Mapped interrupt function configuration r_mcu_config.h
FLASH configuration when not using FIT
r_byteq
r_byteq_config.h
Queue configuration
r_byteq_if.h
Header file for external public queue API function
src r_byteq.c
Queue API function
r_byteq_private.h
Queue API definition file
r_cmt
r_cmt_rx_config.h
CMT configuration
r_cmt_rx_if.h
Header file for external public CMT
src
r_cmt_rx.c
CMT API function
r_eeprom _riic_rx
r_eeprom_riic_rx_co nfig.h
EEPROM configuration
r_eeprom_riic_rx_if. h
Header file for external public EEPROM API function
src
targets
eeprom _riic r_eeprom_riic_rx.c
EEPROM API function
r_eeprom_riic_rx_pr ivate.h
EEPROM API definition file
r_flash_rx
r_flash_rx_config.h
FLASH configuration
r_flash_rx_if.h
Header file for external public FLASH API function
src
r_flash_fcu.c
FLASH_TYPE_3/FLASH_TYPE_4 common function
r_flash_fcu.h
Header file for FLASH_TYPE_3/FLASH_TYPE_4 common function
r_flash_group.c
FLASH_TYPE_1, FLASH_TYPE_3/FLASH_TYPE_4 common function
r_flash_group.h
Header file for FLASH_TYPE_1, FLASH_TYPE_3/FLASH_TYPE_4 common function
r_flash_rx.c
FLASH API function
r_flash_rx.h
Header file for FLASH API function
r_flash_targets.h
FLASH API definition file
flash_type_1
r_codeflash.c
E2 code flash control function
r_codeflash.h
Header file for E2 code flash control function
r_codeflash_extra.c
Access window control function
r_codeflash_extra.h
Header file for access window control function
r_dataflash.c
E2 data flash control function
r_dataflash.h
Header file for E2 data flash control function
r_flash_common.h
Flash common definition file
r_flash_type1.c
FLASH_TYPE_1 API function
r_flash_type1_if.h
Header file for FLASH_TYPE_1 API function
r_flash_utils.c
FLASH API for RX11x series-dedicated section
flash_type_2 r_flash_type2.c
FLASH_TYPE_2 API function
r_flash_type2_if.h
Header file for FLASH_TYPE_2 API function
flash_type_3 r_flash_type3.c
FLASH_TYPE_3 API function
r_flash_type3_if.h
Header file for Header file for FLASH_TYPE_3 API function
flash_type_4 r_flash_type4.c
FLASH_TYPE_4 API function
r_flash_type4_if.h
Header file for FLASH_TYPE_4 API function
targets rx63n
r_flash_rx63n.h
RX631 FLASH definition file
rx65n
r_flash_rx65n.h
RX651 FLASH definition file
r_gpio
r_gpio_rx_config.h
GPIO configuration
r_gpio_rx_if.h
Header file for external public GPIO API function
src
r_gpio_rx.c
GPIO API function
targets
rx631 r_gpio_rx631.c
RX631 data file
r_gpio_rx631.h
RX631 definition file
rx651 r_gpio_rx651.c
RX651 data file
r_gpio_rx651.h
RX651 definition file
r_mpc r_mpc_rx_config.h
MPC configuration
r_mpc_rx_if.h
Header file for external public MPC API function
G3-PLC Sample Program User's Manual 2. Software Structure
R11UM0114EJ0101 Rev.1.01 Page 6 of 89 Jun. 19, 2019
RENESAS CONFIDENTIAL
src
r_mpc_rx.c
MPC API function
r_riic_rx
r_riic_rx_config.h
IIC configuration
r_riic_rx_if.h
Header file for external public IIC API function
r_riic_rx_pin_config. h
PIN configuration for IIC use
src
r_riic_rx.c
IIC API function
r_riic_rx_private.h
IIC API definition file
targets
rx65n r_riic_rx65n.c
RX651 IIC function
r_riic_rx65n_private. h
RX651 definition file
r_sci
r_sci_rx_config.h
SCI configuration
r_sci_rx_if.h
Header file for external public SCI API function
src
r_sci_rx.c
SCI API function
r_sci_rx_platform.h
RX BSP SCI common definition
r_sci_rx_private.h
SCI API definition file
rx631
r_sci_rx631.c
RX631 SCI function
r_sci_rx631_data.c
RX631 data file
r_sci_rx631_private. h
RX631 definition file
rx65n
r_sci_rx65n.c
RX651 SCI function
r_sci_rx65n_data.c
RX651 data file
r_sci_rx65n_private. h
RX651 definition file
setu p
ccrl
rl78g13
bin_include.asm
Binary file for include
cstart.asm
Startup routine
hwsetup.c
Hardware setting file
intprg.c
RL78G13 interrupt function
iodefine.h
RL78G13 register definition
machine.h
Header file for hardware control function
stkinit.asm
Stack area setting
vect.h
RL78G13 vector prototype
ccrx
rx631
inc
iodefine.h
RX631 I/O register definition
sbrk.h
Heap size definition
stacksct.h
Stack area setting
typedefine.h
Type definition
vect.h
RX631 vector prototype
src
dbsct.c
B/R section setting
hwsetup.c
Hardware setting file
intprg.c
RX631 interrupt function
resetprg.c
Startup routine
sbrk.c
Heap memory setting
vecttbl.c
RX631 vector table
rx651
inc
iodefine.h
RX651 ICU register definition
sbrk.h
Heap size definition
stacksct.h
Stack area setting
typedefine.h
Type definition
vect.h
RX651 vector prototype
src
dbsct.c
B/R section setting
hwsetup.c
Hardware setting file
intprg.c
RX651 interrupt function
resetprg.c
Startup routine
sbrk.c
Heap memory setting
vecttbl.c
RX651 vector table
gcc
rx631
inc
interrupt_handlers.h
Header file for RX631 interrupt function
iodefine.h
RX631 I/O register definition
machine.h
Header file for hardware control function
src
hardware_setup.c
Hardware setting file
interrupt_handlers.c
RX631 interrupt function
machine.c
Hardware control function
resetprg.c
Startup routine
G3-PLC Sample Program User's Manual 2. Software Structure
R11UM0114EJ0101 Rev.1.01 Page 7 of 89 Jun. 19, 2019
RENESAS CONFIDENTIAL
vector_table.c
RX631 vector table
rx651
inc
interrupt_handlers.h
Header file for RX651 interrupt function
iodefine.h
RX651 I/O register definition
machine.h
Header file for hardware control function
src
hardware_setup.c
Hardware setting file
interrupt_handlers.c
RX651 interrupt function
machine.c
Hardware control function
resetprg.c
Startup routine
vector_table.c
RX651 vector table
cpx3_api
cpx3_sap
g3
inc
r_adp_binstruct.h
Header file for ADP layer binary command
r_c3sap_g3_buffsiz e.h
Buffer and stack definition file
r_c3sap_g3_depend .h
Environmental dependent part definition file r_c3sap_g3_if.h
Header file for G3 layer API function
r_eap_binstruct.h
Header file for EAP layer binary command
r_g3ctrl_binstruct.h
Header file for G3 layer binary command
r_g3mac_binstruct.h
Header file for MAC layer binary command
r_g3_cmd.h
G3 block command ID definition file
src
r_c3sap_adp.c
ADP layer API function
r_c3sap_adp_conve rt.c
ADP layer convert function r_c3sap_eap.c
EAP layer API function
r_c3sap_eap_conve rt.c
EAP layer convert function r_c3sap_g3.c
G3 layer API function
r_c3sap_g3.h
G3 layer definition file
r_c3sap_g3ctrl_con vert.c
G3 layer convert function r_c3sap_g3mac.c
MAC layer API function
r_c3sap_g3mac_co nvert.c
MAC layer convert function
r_c3sap_g3_convert .h
Header file for G3 block convert function
r_c3sap_g3_depend .c
API function for environment dependent G3 layer
inc
r_adp_sap.h
ADP layer definition file
r_adp_statistics.h
Definition file for ADP layer statistics information
r_c3sap_api.h
CPX3 SAP API definition file
r_c3sap_config.h
CPX3 SAP configuration
r_eap_sap.h
EAP layer definition file
r_eap_statistics.h
Definition file for EAP layer statistics information
r_g3mac_sap.h
MAC layer definition file
r_g3mac_statistics.h
Definition file for MAC layer statistics information
r_g3_api.h
Header file for G3 layer API header file
r_g3_sap.h
G3 layer definition file
r_lml_statistics.h
Definition file for LMAC layer statistics information
r_sys_api.h
Header file for SYSTEM layer API header file
r_sys_sap.h
SYSTEM layer definition file
r_uif_statistics.h
Definition file for UART-IF statistics information
sys
inc r_c3sap_sys_depen
d.h
Definition file for environment dependent system block r_c3sap_sys_if.h
Header file for system block API function
r_constants.h
Definition file(handler) for SAP layer constant
src
r_c3sap_sys.c
System block API function (not depending on environment)
r_c3sap_sys.h
Header file for system block API function(not depending on environment )
r_c3sap_sys_conve rt.c
System block convert function
r_c3sap_sys_conve rt.h
Header file for system block convert function
r_c3sap_sys_depen d.c
System block API function (environment dependent)
r_c3sap_sys_thread .c
CPX3 SAP pseudo thread function
G3-PLC Sample Program User's Manual 2. Software Structure
R11UM0114EJ0101 Rev.1.01 Page 8 of 89 Jun. 19, 2019
RENESAS CONFIDENTIAL
r_c3sap_sys_thread .h
Header file for CPX3 SAP pseudo thread function r_c3sap_sys_ver.h
CPX3 SAP version definition file
r_sys_binstruct.h
Header file for system block binary command
r_sys_cmd.h
System block command ID definition file
uif
inc r_uif_sap_if.h
Header file for external public UIF API function
r_uif_thread_if.h
Header file for UIF API function (IF/core)
src
core
r_uif_base.h
UIF core-based header file
r_uif_base_param.h
UIF core parameter definition file
r_uif_buff_declared. c
UIF core buffer management function
r_uif_buff_declared. h
Header file for UIF core buffer management function
r_uif_data_manage. c
UIF core data management function
r_uif_data_manage. h
Header file for UIF core data management function r_uif_hdlc.h
HDLC packet definition file
r_uif_hdlc_process. c
HDLC packet control function
r_uif_hdlc_process. h
Header file for HDLC packet control r_uif_intc.c
UIF transfer interrupt function
r_uif_intc.h
Header file for UIF transfer interrupt function
r_uif_rx_process.c
UIF reception control function
r_uif_rx_process.h
Header file for UIF reception control function
r_uif_statistics_inter nal.h
UIF statistics information internal definition file
r_uif_tx_process.c
UIF transmission control function
r_uif_tx_process.h
Header file for UIF transmission control function
if
r_c3sap_uif.c
UIF API function
r_c3sap_uif_drv.c
Part function within UIF
r_c3sap_uif_drv.h
Header file for part function within UIF
fw_download inc
r_fw_download.h
Header file for R9A06G037 boot function
src
r_fw_download.c
R9A06G037 boot function
cpx3_fw cpx3_fw_release.bin
Binary file for R9A06G037 firmware
cpx3_fw_release.h
Header file for R9A06G037 firmware
extern
common
inc
r_byte_swap.h
Header file for array/integer data convert function
r_config.h
Sample program setting configuration
r_io_vec.h
Header file for function connecting distributed data to 1 stream
r_mem_tools.h
Header file for memory tool function
r_typedefs.h
Type definition
src
r_byte_swap.c
Array/Integer data convert function
r_io_vec.c
Header file for function connecting distributed data to 1 stream
r_mem_tools.c
Memory tool function
crc inc
r_crc32_api.h
Header file for CRC32 API function
src
r_crc32_api.c
CRC32 API function
led inc
r_led_api.h
Header file for LED control API function
src
r_led_api.c
LED control API function
memory inc
r_memory_api.h
Header file for memory management API function
src
r_memory_api.c
Memory management API function
queue inc
r_queue_api.h
Header file for queue management API function
src
r_queue_api.c
Queue management API function
stdio inc
r_stdio_api.h
Header file for console I/O API function
src
r_stdio_api.c
Console I/O API function
timer inc
r_timer_api.h
Header file for software timer API function
src
r_timer_api.c
Software timer API function
project
e2s
rl78g13
G3PLC .Certificationlinker
Linker file for certification build
.cproject
Tool chain setting file
G3-PLC Sample Program User's Manual 2. Software Structure
R11UM0114EJ0101 Rev.1.01 Page 9 of 89 Jun. 19, 2019
RENESAS CONFIDENTIAL
.Demolinker
Linker file for demo build
.info
Development environment information
.project
Project setting file
.Releaselinker
Linker file for release build
G3PLC Release.launch
Debug setting file makefile.init
Makefile initial setting
rx631
G3PLC
.Certificationlinker
Linker file for certification build
.cproject
Tool chain setting file
.Demolinker
Linker file for demo build
.info
Development environment information
.project
Project setting file
.Releaselinker
Linker file for release build
G3PLC Release.launch
Debug setting file makefile.init
Makefile initial setting
rx651
G3PLC
.Certificationlinker
Linker file for certification build
.cproject
Tool chain setting file
.Demolinker
Linker file for demo build
.info
Development environment information
.project
Project setting file
.Releaselinker
Linker file for release build
G3PLC Release.launch
Debug setting file makefile.init
Makefile initial setting
sample_app
extern
flash
inc
r_demo_nvm_proce ss.h
Header file for NVM management function r_demo_print.h
Header file for string operation function
r_demo_status2text. h
Header file for status information and string convert function
r_flash_lib.h
Header file for FLASH driver wrapper function
r_flash_usage_map. h
Macro definition file for address acquisition in NVM area
src
r_demo_nvm_proce ss.c
NVM management function r_demo_print.c
String operation function
r_demo_status2text. c
Status information and string convert function r_flash_lib.c
FLASH driver wrapper function
ipv6
inc
r_check_sum.h
Header file for checksum calculation function
r_icmp_v6.h
icmp v6 definition file
r_ipv6_headers.h
IPv6 packet definition file
r_udp_headers.h
UDP packet definition file
src
r_check_sum.c
Checksum calculation function
r_icmp_v6.c
ICMP v6 packet control function
r_ipv6_headers.c
IPv6 packet control function
r_udp_headers.c
UDP packet control function
inc
r_cpx3_scramble_m atrix.h
Encryption matrix definition file
r_demo_api.h
Header file for wrapper function of calling CPX3 SAP(MAC,ADP)
r_demo_app.h
Header file for main application
r_demo_app_eap.h
Header file for CPX3 SAP wrapper function (EAP)
r_demo_app_thread .h
Header file for application pseudo thread r_demo_app_ver.h
Version definition file of sample application
r_demo_common.h
Header file for IPv6 packet control API function
r_demo_config.h
Header file for configuration of application
r_demo_ib_access. h
Header file for IB access API function r_demo_main.h
Header file for main function
r_demo_metric_com putation.h
Header file for link cost calculation
r_demo_os_wrapper .h
Header file for OS wrapper function
r_demo_parameters .h
Configuration parameter definition file
G3-PLC Sample Program User's Manual 2. Software Structure
R11UM0114EJ0101 Rev.1.01 Page 10 of 89 Jun. 19, 2019
RENESAS CONFIDENTIAL
r_demo_statistics.h
Header file for statistics information /log acquisition
r_demo_sys.h
Header file for system menu API function
r_demo_tools.h
Header file for string control API function
src
main.c
Main function
r_demo_api.c
CPX3 SAP wrapper function (MAC,ADP)
r_demo_app.c
Main function for sample application
r_demo_app_thread .c
Pseudo thread for applications r_demo_bootstrap.c
Network start function
r_demo_common.c
API function for IPv6 packet control
r_demo_config.c
API function for configuration information management
r_demo_eap.c
CPX3 SAP wrapper function (EAP)
r_demo_g3_cb.c
CPX3 SA callback function
r_demo_ib_access.c
API function for IB access
r_demo_main.c
Sample application start
r_demo_metric_com putation.c
API function for link cost calculation
r_demo_os_wrapper .c
OS wrapper function
r_demo_parameters .c
Configuration parameter r_demo_statistics.c
API function for statistics information / log acquisition
r_demo_sys.c
API function for system menu
r_demo_sys_cb.c
Callback function for system menu
r_demo_tools.c
String control API function
G3-PLC Sample Program User's Manual 3. Project Settings
R11UM0114EJ0101 Rev.1.01 Page 11 of 89 Jun. 19, 2019
RENESAS CONFIDENTIAL

3.Project Settings

3.1 Start e2studio

3.1.1 Workspace settings

Start e2studio and set up the following workspace. For this sample program, a project is prepared for each evaluation board.
Figure 3-1 Select workspace
Evaluation board
Workspace path
J70D1/J70D2
(Installed directory path)\Software\project\e2s\rx631
J80D1
(Installed directory path)\Software\project\e2s\rx651
J80D2
(Installed directory path)\Software\project\e2s\rl78g13
G3-PLC Sample Program User's Manual 3. Project Settings
R11UM0114EJ0101 Rev.1.01 Page 12 of 89 Jun. 19, 2019
RENESAS CONFIDENTIAL

3.1.2 Import project

The project will be imported by the following procedure.
1. File -> Import
2. Existing Project into Workspace
3. Set the following path in the root directory
4. Select G3PLC
Figure 3-2 Import Project
Evaluation board
Root directory path
J70D1/J70D2
(Installed directory path)\Software\project\e2s\rx631
J80D1
(Installed directory path)\Software\project\e2s\rx651
J80D2
(Installed directory path)\Software\project\e2s\rl78g13
G3PLC
[1]
[2]
[3]
[4]
G3-PLC Sample Program User's Manual 3. Project Settings
R11UM0114EJ0101 Rev.1.01 Page 13 of 89 Jun. 19, 2019
RENESAS CONFIDENTIAL

3.1.3 Building project

Select Project -> Build All and do the build.
Figure 3-3 Build project
G3-PLC Sample Program User's Manual 3. Project Settings
R11UM0114EJ0101 Rev.1.01 Page 14 of 89 Jun. 19, 2019
RENESAS CONFIDENTIAL

3.2 Built Environment

There are 3 types of built environments for 1 project, and the parameter to be set can be switched at startup. The Macro definitions to be defined vary depending on the built environment. For some built environments, the setting can be changed by DipSw. The DipSw-bit is assigned as PORT_ID and managed by common control as DipSw allocation varies depending on the evaluation board type. Table 3-1 shows the relationship between DipSw and PORT_ID. Refer to the start guide (G3-PLC Sample Application Start Guide for GCPX3 board) for functions in detail.
Table 3-1 DipSw setting
PORT ID
J70D1/J70D2
J80D1/J80D2
Function
SW
No
SW
No
PORT_ID_AUTO_MODE
SW1
1
SW9
1
Application mode (Refer to 3.3) setting
PORT_ID_CERT_MODE
2
2
Application mode (Refer to 3.3) setting
- 3 3
-
- 4 4
-
PORT_ID_ROUTE_TYPE
5
SW8
1
Route type setting
PORT_ID_BANDPLAN_1
6
2
BandPlan setting PORT_ID_BANDPLAN_0
7
3
PORT_ID_DEVICE_TYPE
8
4
Device type (Coordinator/Peer) setting
This program provides 3 types of built environments. Release build When ”Release” is selected for the build configuration of the development
environment. This manual is based on this built environment if not explicitly stated. The parameters to be set at startup will be reflected by the DipSw setting.
Demo build When “Demo” is selected for the build configuration of the development environment.
The parameters will be reflected based on data recorded in NVM. The memory used for NVM varies depending on the evaluation board, yet NVM is accessed from via the flash control unit(Chapter 4.1.5) in this program. The following macro is defined in the project file. R_DEFINE_APP_MODE=1
Certification mode :When “Certification” is selected for the build configuration of the development
environment. This configuration is used to execute the authentication test by connecting to an authentication device supporting G3. After power supply, the sample application will automatically work and start test communication with the authentication device. This mode is driven by the G3 authentication parameters, and therefore it is not possible to communicate with the evaluation board running on the Release/Demo build. The following macro is defined in the project file. R_DEFINE_APP_MODE=2
Details on macros are explained in Chapter 3.3.
G3-PLC Sample Program User's Manual 3. Project Settings
R11UM0114EJ0101 Rev.1.01 Page 15 of 89 Jun. 19, 2019
RENESAS CONFIDENTIAL

3.3 Macro Definition

This section describes the macro definitions to be set on the project.

3.3.1 R_BOARD_TYPE

This is the definition for determining the evaluation board that will work the sample application.
Table 3-2 R_BORAD_TYPE description
Define name
Value
Description
R_BOARD_NOT_SET
0
Do not use
R_BOARD_G_CPX3
5
J70/D1 and J70/D2 evaluation board.
R_BOARD_J80D1
9
J80/D1 evaluation board.
R_BOARD_J80D2
10
J80/D2 evaluation board.

3.3.2 R_DEFINE_APP_MODE

By defining this macro, it is possible to change the parameter to be set at startup . Table 3-3 shows setting values for this macro.
Table 3-3 R_DEFINE_APP_MODE setting value
Definition
Value
R_DEMO_APP_MODE_NORMAL
0u
R_DEMO_APP_MODE_DEMO
1u
R_DEMO_APP_MODE_CERT
2u
Table 3-4 shows parameters to be set at startup.
Table 3-4 Relationship between R_DEFINE_APP_MODE and parameters
Parameter
R_DEFINE_APP_MODE
R_DEMO_APP_MODE_NORM AL
R_DEMO_APP_MODE_DEMO
R_DEMO_APP_MODE_CERT
bandPlan
Select by DipSw (PORT_ID_BANDPLAN_0, PORT_ID_BANDPLAN_1)
Data value recorded in NVM R_G3_BANDPLAN_ CENELEC_A when no effective data exist
Select by DipSw (PORT_ID_BANDPLAN_0, PORT_ID_BANDPLAN_1)
deviceType
Select by DipSw (PORT_ID_DEVICE_TYPE)
Data value recorded in NVM R_ADP_DEVICE_ TYPE_PEER when no effective data exist
Select by DipSw (PORT_ID_DEVICE_TYPE)
startMode (appMode) *1
Select by DipSw (PORT_ID_AUTO_MODE, PORT_ID_CERT_MODE)
Data value recorded in NVM R_DEMO_MODE_CUI when no effective data exist
Set R_DEMO_MODE_CERT
routeType
Select by DipSw (PORT_ID_ROUTE_TYPE)
Data value recorded in NVM R_G3_ROUTE_TYPE_NORMA L when no effective data exist
R_G3_ROUTE_TYPE_JP_B for ARIB depending on bandPlan
R_G3_ROUTE_TYPE_NORMA L for other than the above
*1 application mode
G3-PLC Sample Program User's Manual 3. Project Settings
R11UM0114EJ0101 Rev.1.01 Page 16 of 89 Jun. 19, 2019
RENESAS CONFIDENTIAL
The sample program defines the following 3 modes as an application mode.
CUI mode(R_DEMO_MODE_CUI) Coordinator or Peer selectable by the user. AUTO mode(R_DEMO_MODE_AUTO) Start operation according to PORT_ID_DEVICE_TYPE. CERT mode(R_DEMO_MODE_CERT) Start test communication with the authentication device by
automatically starting the sample application.

3.3.3 R_RL78_PLC

This macro definition is used to switch the process depending on the microcontroller type (RL78/RX series). Table 3-5 shows parameters to be changed by this macro definition.
Table 3-5 Parameter to be changed by the definition R_RL78_PLC.
Parameter
Defined (RL78G13)
Not defined (RX)
Far modifier
Yes
No
Timer
16-bit timer
8-bit timer and compare match timer
The number of stages in the queue
3 8 Data size to be saved in 1 stage of the queue
1400 bytes
1500 bytes
Refer to 4.5.2 for the queue usage.

3.3.4 R_DEFINE_APP_BOOT

This macro definition is used to switch the CPX3 boot mode. Table 3-6 shows setting values for this macro.
Table 3-6 R_DEFINE_APP_BOOT setting value
Definition
Value
R_DEMO_APP_UART_BOOT
0u
R_DEMO_APP_SROM_BOOT
1u
Table 3-7 shows parameters to be changed by this macro definition.
Table 3-7 Parameter to be changed by definition R_DEFINE_APP_BOOT
Parameter
R_DEMO_APP_UART_BOOT
R_DEMO_APP_SROM_BOOT
R_DEFINE_APP_BOOT
Boot by downloading FW via UART from
the host microcontroller.
Boot by downloading FW saved in the serial flash memory connecting to CPX3.
G3-PLC Sample Program User's Manual 3. Project Settings
R11UM0114EJ0101 Rev.1.01 Page 17 of 89 Jun. 19, 2019
RENESAS CONFIDENTIAL
In the e2studio project, the procedure to change the macro definition is as follows.
1. Project -> Properties
2. C++ Build -> Settings
3. Tool Settings Tab-> Compiler -> Includes
4. Change Macro define value
Figure 3-4 Change macro definition (1/2)
G3-PLC Sample Program User's Manual 3. Project Settings
R11UM0114EJ0101 Rev.1.01 Page 18 of 89 Jun. 19, 2019
RENESAS CONFIDENTIAL
Figure 3-5 Change macro definition (2/2)
G3-PLC Sample Program User's Manual 3. Project Settings
R11UM0114EJ0101 Rev.1.01 Page 19 of 89 Jun. 19, 2019
RENESAS CONFIDENTIAL

3.4 Memory Map

The section layouts for each MCU are shown below.

3.4.1 RX631

Figure 3-6 shows the section layout for the sample program and Table 3-8 describes each section in detail.
Figure 3-6 Section layout (RX631(R5F5631EDxFP))
G3-PLC Sample Program User's Manual 3. Project Settings
R11UM0114EJ0101 Rev.1.01 Page 20 of 89 Jun. 19, 2019
RENESAS CONFIDENTIAL
Table 3-8 Section list (RX631)
Section
Section start address
Description
.ustack
0x00000000
User stack section. Allocation size is 0 as it is not used.
.istack
0x000009F0
Interrupt stack section.
.RPFRAM
0x00000A00
Section for expanding sections of the PFRAM section to RAM.
.data
0x00003000
Section for variables with the initial value.
.gcc_exc
Located after.data
Section for GCC exceptions.
.bss
Located after.gcc_exc
Section for variables without the initial value.
.FW_PRG
0xFFF80000
Section for CPX3 FW
.PFRAM
0xFFFC0000
Section to mapping Flash driver to operate in RAM
.PSTART
0xFFFC1000
Section for startup code.
.text
Located after .PSTART
Section for program codes.
.rvectors
Located after .text
Section for variable (interrupt) vector table.
.init
Located after.rvectors
Section for initial setting codes.
.finit
Located after.init
Section for end codes.
.got
Located after.finit
Section for global offset table.
.rodata
Located after.got
Section for ROM data.
.eh_frame_hdr
Located after.rodata
Section for exceptional handler data.
.eh_frame
Located after.eh_frame_hdr
Section for exceptional handler frame.
.jcr
Located after.eh_frame
Java section.
.tors
Located after.jcr
Section for C++ constructor/ destructor.
.PResetPRG
0xFFFFC000
Section assigned with the function to be executed after reset.
.fvectors
0xFFFFFF80
Section for fixed(exceptional)vector table.
G3-PLC Sample Program User's Manual 3. Project Settings
R11UM0114EJ0101 Rev.1.01 Page 21 of 89 Jun. 19, 2019
RENESAS CONFIDENTIAL

3.4.2 RX651

Figure 3-7 shows the section layout for the sample program, and Table 3-9 describes each section in detail.
Figure 3-7 Section layout (RX651(R5F56519AxFP))
G3-PLC Sample Program User's Manual 3. Project Settings
R11UM0114EJ0101 Rev.1.01 Page 22 of 89 Jun. 19, 2019
RENESAS CONFIDENTIAL
Table 3-9 Section list (RX651)
Section
Section start address
Description
.ustack
0x00000000
User stack section. Allocation size is 0 as it is not used.
.istack
0x000009F0
Interrupt stack section.
.RPFRAM
0x00000A00
Section for expanding sections of the PFRAM section to RAM.
.data
0x00003000
Section for variables with the initial value.
.gcc_exc
Located after.data
Section for GCC exceptions.
.bss
Located after.gcc_exc
Section for variables without the initial value.
.ofs1
0xFE7F5D00
Option setting memory section.
.ofs2
0xFE7F5D10
Option setting memory section.
.ofs3
0xFE7F5D40
Option setting memory section.
.ofs4
0xFE7F5D48
Option setting memory section.
.ofs5
0xFE7F5D50
Option setting memory section.
.ofs6
0xFE7F5D64
Option setting memory section.
.ofs7
0xFE7F5D70
Option setting memory section.
.FW_PRG
0xFFF80000
Section for CPX3 FW
.PFRAM
0xFFFC0000
Section to mapping Flash driver to operate in RAM
.PSTART
0xFFF00000
Section for startup code.
.text
Located after .PSTART
Section for program codes.
.rvectors
Located after .text
Section for variable (interrupt) vector table.
.init
Located after.rvectors
Section for initial setting codes.
.finit
Located after.init
Section for end codes.
.got
Located after.finit
Section for global offset table.
.rodata
Located after.got
Section for ROM data.
.eh_frame_hdr
Located after.rodata
Section for exceptional handler data.
.eh_frame
Located after.eh_frame_hdr
Section for exceptional handler frame.
.jcr
Located after.eh_frame
Java section.
.tors
Located after.jcr
Section for C++ constructor/ destructor
.PResetPRG
0xFFFFC000
Section assigned with the function to be executed after reset.
.exvectors
0xFFFFFF80
Section for exceptional vector table.
.fvectors
0xFFFFFFFC
Section for fixed vector table.
G3-PLC Sample Program User's Manual 3. Project Settings
R11UM0114EJ0101 Rev.1.01 Page 23 of 89 Jun. 19, 2019
RENESAS CONFIDENTIAL

3.4.3 RL78G13

Figure 3-8 shows the section layout for the sample program, and Table 3-10 describes each section in detail.
Figure 3-8 Section layout (RL78G13(R5F100GL))
G3-PLC Sample Program User's Manual 3. Project Settings
R11UM0114EJ0101 Rev.1.01 Page 24 of 89 Jun. 19, 2019
RENESAS CONFIDENTIAL
Table 3-10 Section list (RL78G13)
Section
Section start address
Description
.vect
0x00000000
Section for vector table.
.option_byte
0x000000C0
Section for optional bytes.
.security_id
0x000000C4
Section for security ID.
.const
0x0000300
Section for ROM datanear area allocation).
.text
Located after .const
Section for program codesnear area allocation).
.RLIB
Located after.text
Section for Runtime/Library codes.
.SLIB
Located after.RLIB
Section for standard library codes.
.textf
Located after.SLIB
Section for program codesfar area allocation).
.data
Located after.textf
Section for variables with the near initial value.
.sdata
Located after.data
Section for variables with the initial valuevariables of saddr allocation ).
.PFDL_COD
Located after.sdata
Section for data flash library codes.
.constf
0x00032000
Section for ROM datafar area allocation).
.GPLC_FW
0x00048000
Section for CPX3 FW.
.dataR
0x000F7F90
Section to be mapped from ROM to RAM.
.bss
Located after.dataR
Section for variables without the initial value near area allocation).
.sdataR
0x000FFE20
Section to be mapped from ROM to RAM.
.sbss
Located after.sdataR
Section for variables without the initial valuevariables of saddr allocation ).
G3-PLC Sample Program User's Manual 4. Sample Program
R11UM0114EJ0101 Rev.1.01 Page 25 of 89 Jun. 19, 2019
RENESAS CONFIDENTIAL

4.Sample Program

This sample program consists of the G3-PLC sample application unit, BSP unit ,CPX3 SAP unit, and common processing unit and operates on the framework using timer interrupts after startup sequence initialization. Refer to Chapter 4.5 for the framework in detail.
Figure 4-1 Sample program block diagram

4.1 G3-PLC Sample Application

The G3-PLC sample application consists of process blocks from the command processing unit,G3 processing unit,G3 API wrapper unit,IPV6 unit and flash control unit. The overview of each process block is as below:
(1) Command processing unit provides user interface(CUI) to control sample applications. (2) G3 processing unit provides functions used for G3-PLC communication process. (3) G3 API wrapper provides the wrapper layer to convert CPX3 SAP API from asynchronous to
synchronous. (4) IPV6 unit provides function to generate/analyze IPV6 packets. (5) Flash control unit provides function to manage communication parameters. The sample application performs initialization in the main function and calls the function R_DEMO_Main().
The function R_DEMO_Main() executes command process and G3 process for user interfaces. Figure 4-2 and Figure 4-3 show process flows of the main function and the function R_DEMO_Main() respectively.
Sample program
G3-PLC sample application
Command processing unit
G3 processing unit
CPX3 SAP
G3 API wrapper
BSP
IPV6
Flash control
unit
Common
processing
Loading...
+ 67 hidden pages