目次

last update: 2025/05

スタートアップガイド
M3S-T4-Tiny TCP/IP(OSレス)環境で動作可能な各種ミドルウェアサンプル
評価ボード:RX72N Envision Kit

MCU:RX72N(32-bit RXv3) / 240MHz

評価ボードの詳細はこちら

開発環境/IDE:Renesas CCRX (e2Studio)

RX72N Envision Kit

BSP パッケージ内容:

ModbusModbus Master (TCP), Modbus Slave (TCP)
セキュリティSSH Secure Shell, SSL / TLS Secure Sockets Layer
IoT ToolkitHTTP Client
評価版サンプルのご依頼


インストール・フォルダ構成

リリースプログラムの「RX72N_EnvisionKit」及び「Windows」フォルダを、開発環境インストール済みのユーザーパソコンのローカルドライブにコピーします。

[Workspace]
 ├ RX72N_EnvisionKit   .... サンプルプログラム一式
 └ Windows   .............. テスト用PCツール
RX72N_EnvisionKit
 ├ Application ................... テスト用サンプルアプリケーション
 ├ BSP         ................... ハードウエア依存設定、ドライバ
 ├ Config      ................... コンフィグレーション設定、システム依存設定
 ├ EVAL_Libs   ................... SEGGERソフトウエア評価版ライブラリ
 ├ License.txt ................... 評価版ライブラリの利用条件
 ├ .project    ................... e2Studio環境用プロジェクト
 └ rx72n_envisionkit_m3s_t4.scfg ...... e2Studio FITコンフィグレータ設定

Applicationフォルダ

Application
 ├ Main.c      ...... メインエントリハンドラ
 └ _Exclude    ...... ※このフォルダはビルド対象外に設定しています
     ├ IOT       .... HTTPクライアントデモサンプル
     ├ MB        .... MODBUS/TCP MASTER・SLAVE機能のデモサンプル
     ├ SSL       .... SSL 通信機能のデモサンプル
     ├ SSH       .... SSH 通信機能のデモサンプル
     └ M3S_T4_Startup.c  .... M3S-T4-Tiny TCP/IPスタックの基本デモサンプル


開発環境

  • ビルド・デバッグIDE環境: Renesas e2Studio Version: 2025-04 (25.4.0)
  • コンパイラ: CC-RX V3.05.00
  • デバッグツール: RX E2 Lite(オンボード ECN1 USB micro-Bコネクタ)
  • FITコンフィグレーター: Renesas e2studio FIT Version: 10.2.0

BSP設定

RX72N_EnvisionKit
 └ BSP
    ├ BSP.c    ......... ボード上のLEDインターフェースのドライバ
    ├ BSP_M3S_T4.c  .... M3S-T4-Tinyモジュールのスタートアップコード
    ├ Setup    ......... 各ソフトウエアライブラリのハードウエア依存のドライバ設定
    └ smc_gen  ......... e2StudioのスマートFITコンフィグレータで作成されたBSP

クロック設定

ボードのクロック・PLL設定はFITコンフィグレータで行います。

メインクロック:16MHz
FlashIFクロック(FCLK):60MHz
システムクロック(ICLK):240MHz
周辺モジュールクロック(PCLKA):120MHz
周辺モジュールクロック(PCLKB):60MHz
周辺モジュールクロック(PCLKC):60MHz
周辺モジュールクロック(PCLKD):60MHz
外部バスクロック(BCLK):80MHz
USBクロック:48MHz
CLKOUT25Mクロック:25MHz

スマートFITコンフィグレータで作成するコンポーネント

  • Board Support Packages (r_bsp):バージョン 7.53
  • TCP/IP protocol stack [M3S-T4-Tiny] for Renesas MCUs:バージョン 2.10
  • TCP/IP protocol stack [M3S-T4-Tiny] - RX Ethernet Driver Interface:バージョン 1.09
  • Ethernet Driver (r_ether_rx):バージョン 1.24
  • CMT driver (r_cmt_rx):バージョン 5.71
  • Generic system timer for RX MCUs using CMT module (r_sys_time_rx):バージョン 1.02
  • GPIO Driver (r_gpio_rx):バージョン 5.11
  • ポート:バージョン 2.4.1

※スマートFITコンフィグレータ設定内容の確認及び変更する場合は、以下の手順をご参照ください。

  1. e2Studio環境で「.project」プロジェクトを開きます。
  2. プロジェクト・エクスプローラーウインドウ下の「rx72n_envisionkit_m3s_t4.scfg」ファイルを選択してマウスダブルクリックでスマート・コンフィグレータパネルを開きます。
  3. 概要、ボード、クロックなど各タブ項目の設定内容を確認します。

プロジェクトビルド設定:

  • コンパイラ設定のプリプロセッサマクロ定義: DEBUG=1, SEGGER_BUILD_MAXSPEED
  • コンパイラビルドの最適化設定: 最適化レベル2、実行性能重視の最適化(-speed)
  • リンカーセクション設定:
    SU,SI,B_1,R_1,B_2,R_2,B,R,B_8,R_8/04,B_ETHERNET_BUFFERS*,B_RX_DESC*,B_TX_DESC*/0800000,BEXRAM_1,REXRAM_1,BEXRAM_2,REXRAM_2,BEXRAM,REXRAM,BEXRAM_8,REXRAM_8/0810000,PResetPRG,C_1,C_2,C,C_8,C$*,D*,W*,L,P/0FFC00000,EXCEPTVECT/0FFFFFF80,RESETVECT/0FFFFFFFC
    0x0000_0004SU, SI, B_1, R_1, B_2, R_2, B, R, B_8, R_8
    0x0080_0000B_ETHERNET_BUFFERS*, B_RX_DESC*, B_TX_DESC*
    0x0081_0000BEXRAM_1, REXRAM_1, BEXRAM_2, REXRAM_2, BEXRAM, REXRAM, BEXRAM_8, REXRAM_8
    0xFFC0_0000PResetPRG, C_1, C_2, C, C_8, C$*, D*, W*, L, P
    0xFFFF_FF80EXCEPTVECT
    0xFFFF_FFFCRESETVECT

M3S-T4-TINYモジュールのコンフィグレーション設定

ルネサス社製 M3S-T4-TINY TCP/IPプログラムはスマートFITコンフィグレータから作成します。
追加するソフトウエアコンポーネント:

  1. TCP/IP protocol stack [M3S-T4-Tiny] for Renesas MCUs(r_t4_rx)
  2. TCP/IP protocol stack [M3S-T4-Tiny] - RX Ethernet Driver Interface(r_t4_driver_rx)
  3. Ethernet Driver(r_ether_rx)
M3S-T4-TINY TCP/IPコンポーネント

(r_ether_rx)ドライバのコンフィグレーション設定:

  • Ethernet interface: MII
  • PHY-LSI address setting for ETHER0: 1
  • The number of Rx descriptors: 16
  • The number of Tx descriptors: 2
  • Transmit and Receive buffer size: 1536
  • Group AL1 interrupt priority level: Level 10
  • The register bus of PHY0 for ETHER0: Use ETHER0
  • The access timing of MII/RMII register: 8
  • The waiting time for reset completion of PHY-LSI: 0x00020000L
  • The link status is detected: Unused
  • Use KSZ8041NL of the Micrel Inc.: Used
  • use non blocking: Unused

(r_t4_rx)TCP/IPコンフィグレーション設定:

  • Channel number your system has: 1
  • Enable/Disable DHCP function: 1
  • Ether ch0 MAC address: default value
  • SYSTEM callback function use: 1
  • SYSTEM callback function name: system_callback
  • TCP REPID1 port number: 22
  • TCP REPID2 port number: 502

※ その他デフォルト設定値のまま

システムコールバックハンドラ(system_callback):

システムコールバックハンドラ(system_callback関数)はルネサス様提供標準サンプルのコードのまま使用しています。
File: BSP_M3S_T4.c

/******************************************************************************
* Function Name     : system_callback
* Description       : Ethernet callback.
* Argument          : UB        channel ;    RJ45 interface
*                   : UW        eventid ;    Event code
*                   : VP        param   ;    Parameter block
* Return Value      : ER                ;    always 0 (not in use)
******************************************************************************/
ER system_callback(UB channel, UW eventid, VP param)
{
  uint8_t*    ev_tbl[] = {
    "ETHER_EV_LINK_OFF",
    "ETHER_EV_LINK_ON",
    "ETHER_EV_COLLISION_IP",
    "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
    "DHCP_EV_LEASE_IP",
    "DHCP_EV_LEASE_OVER",
    "DHCP_EV_INIT",
    "DHCP_EV_INIT_REBOOT",
    "DHCP_EV_APIPA",
    "DHCP_EV_NAK",
    "DHCP_EV_FATAL_ERROR",
    "DHCP_EV_PLEASE_RESET"
  };
#if defined(DEBUG_PRINT)
  printf("callback ch:%d, eventID = %s\n", channel, ev_tbl[eventid]);
#endif /*#if defined(DEBUG_PRINT)*/
  switch(eventid) {
    case ETHER_EV_LINK_OFF: {
      /* Do Nothing. */
    }
    break;

    case ETHER_EV_LINK_ON: {
      /* Do Nothing. */
    }
    break;

    case ETHER_EV_COLLISION_IP: {
      /* Do Nothing. */
    }
    break;

    case DHCP_EV_LEASE_IP: {
      /* cast from VP to DHCP* */
      gpt_dhcp[channel] = (DHCP*)param;
#if defined(DEBUG_PRINT)
      printf("DHCP.ipaddr[4]   %d.%d.%d.%d\n",
             gpt_dhcp[channel]->ipaddr[0], gpt_dhcp[channel]->ipaddr[1],
             gpt_dhcp[channel]->ipaddr[2], gpt_dhcp[channel]->ipaddr[3]);
      printf("DHCP.maskaddr[4] %d.%d.%d.%d\n",
             gpt_dhcp[channel]->maskaddr[0], gpt_dhcp[channel]->maskaddr[1],
             gpt_dhcp[channel]->maskaddr[2], gpt_dhcp[channel]->maskaddr[3]);
      printf("DHCP.gwaddr[4]   %d.%d.%d.%d\n",
             gpt_dhcp[channel]->gwaddr[0], gpt_dhcp[channel]->gwaddr[1],
             gpt_dhcp[channel]->gwaddr[2], gpt_dhcp[channel]->gwaddr[3]);
      printf("DHCP.dnsaddr[4]  %d.%d.%d.%d\n",
             gpt_dhcp[channel]->dnsaddr[0], gpt_dhcp[channel]->dnsaddr[1],
             gpt_dhcp[channel]->dnsaddr[2], gpt_dhcp[channel]->dnsaddr[3]);
      printf("DHCP.dnsaddr2[4] %d.%d.%d.%d\n",
             gpt_dhcp[channel]->dnsaddr2[0], gpt_dhcp[channel]->dnsaddr2[1],
             gpt_dhcp[channel]->dnsaddr2[2], gpt_dhcp[channel]->dnsaddr2[3]);
      printf("DHCP.macaddr[6]  %02X:%02X:%02X:%02X:%02X:%02X\n",
             gpt_dhcp[channel]->macaddr[0], gpt_dhcp[channel]->macaddr[1],
             gpt_dhcp[channel]->macaddr[2], gpt_dhcp[channel]->macaddr[3],
             gpt_dhcp[channel]->macaddr[4], gpt_dhcp[channel]->macaddr[5]);
      printf("DHCP.domain[%d] %s\n", strlen(gpt_dhcp[channel]->domain),
             gpt_dhcp[channel]->domain);
      printf("\n");
#endif /*#if defined(DEBUG_PRINT)*/
    }
    break;

    case DHCP_EV_LEASE_OVER: {
      /* Do Nothing. */
    }
    break;

    case DHCP_EV_INIT: {
      /* Do Nothing. */
    }
    break;

    case DHCP_EV_INIT_REBOOT: {
      /* Do Nothing. */
    }
    break;

    case DHCP_EV_APIPA: {
      /* cast from VP to DHCP* */
      gpt_dhcp[channel] = (DHCP*)param;
#if defined(DEBUG_PRINT)
      printf("DHCP.ipaddr[4]   %d.%d.%d.%d\n",
             gpt_dhcp[channel]->ipaddr[0], gpt_dhcp[channel]->ipaddr[1],
             gpt_dhcp[channel]->ipaddr[2], gpt_dhcp[channel]->ipaddr[3]);
      printf("DHCP.maskaddr[4] %d.%d.%d.%d\n",
             gpt_dhcp[channel]->maskaddr[0], gpt_dhcp[channel]->maskaddr[1],
             gpt_dhcp[channel]->maskaddr[2], gpt_dhcp[channel]->maskaddr[3]);
      printf("DHCP.gwaddr[4]   %d.%d.%d.%d\n",
             gpt_dhcp[channel]->gwaddr[0], gpt_dhcp[channel]->gwaddr[1],
             gpt_dhcp[channel]->gwaddr[2], gpt_dhcp[channel]->gwaddr[3]);
      printf("DHCP.dnsaddr[4]  %d.%d.%d.%d\n",
             gpt_dhcp[channel]->dnsaddr[0], gpt_dhcp[channel]->dnsaddr[1],
             gpt_dhcp[channel]->dnsaddr[2], gpt_dhcp[channel]->dnsaddr[3]);
      printf("DHCP.dnsaddr2[4] %d.%d.%d.%d\n",
             gpt_dhcp[channel]->dnsaddr2[0], gpt_dhcp[channel]->dnsaddr2[1],
             gpt_dhcp[channel]->dnsaddr2[2], gpt_dhcp[channel]->dnsaddr2[3]);
      printf("DHCP.macaddr[6]  %02X:%02X:%02X:%02X:%02X:%02X\n",
             gpt_dhcp[channel]->macaddr[0], gpt_dhcp[channel]->macaddr[1],
             gpt_dhcp[channel]->macaddr[2], gpt_dhcp[channel]->macaddr[3],
             gpt_dhcp[channel]->macaddr[4], gpt_dhcp[channel]->macaddr[5]);
      printf("DHCP.domain[%d] %s\n", strlen(gpt_dhcp[channel]->domain), 
             gpt_dhcp[channel]->domain);
      printf("\n");
#endif /*#if defined(DEBUG_PRINT)*/
    }
    break;

    case DHCP_EV_NAK: {
      /* Do Nothing. */
    }
    break;

    case DHCP_EV_FATAL_ERROR: {
      /* Do Nothing. */
    }
    break;

    case DHCP_EV_PLEASE_RESET: {
      /* Do Nothing. */
    }
    break;

    default: {
      /* Do Nothing. */
    }
    break;
  }

  return 0;
}

M3S-T4-Tinyモジュールのスタートアップ用BSP API:

File: BSP_M3S_T4.c

  • int M3S_T4_Init(void)
    M3S-T4-Tiny TCP/IPモジュール及びLANドライバの初期化を行います。
  • void M3S_T4_Exit(void)
    TCP/IPインターフェースをクロースしてLANドライバを終了します。
  • int M3S_T4_LinkReady(int ch)
    本APIでアプリケーションからLANポートのリンクステータスを確認します。

プロジェクトビルド方法

評価版パッケージのサンプルプロジェクトはe2Studio環境でビルド・デバッグ可能です。

e2Studioプロジェクトのビルド構成:HardwareDebug

e2Studio IDE環境でのビルド手順

RX72N_EnvisionKit
 ├ HardwareDebug   ............... 出力フォルダ(e2Studio環境プロジェクト)
 ├ .cproject   ................... e2Studio環境用プロジェクト
 ├ .project    ................... e2Studio環境用プロジェクト
  1. プロジェクトをインポートします
    e2Studioツールを起動して、「ファイル → インポート」コマンドでインポートダイアログを開きます。「既存のプロジェクトをワークスペースへ」を選択して「次(N)」をクリックします。インポートダイアログから「RX72N_EnvisionKit」フォルダを選択して、「rx72n_envisionkit_m3s_t4」プロジェクトを選びます。「完了」ボタンを押してプロジェクトを開きます。
    ビルド構成は「HardwareDebug」を設定します。
  2. アプリケーションを選択します
    プロジェクト設定では「\Application\_Exclude\」フォルダ下のすべてのアプリケーションファイルはビルド対象外に設定しています。動作確認を行うテストサンプルファイルをビルド対象設定の「\Application」フォルダ下にコピーします。
    copy application
  3. プロジェクトをビルドします
    「プロジェクト → プロジェクトのビルド」メニューコマンドでプロジェクトを再ビルドします。正常にビルドできましたら「HardwareDebug」フォルダ下にデバッグ用の実行イメージ及びリンカーMAPファイルなどが作成されます。

デバッグ・動作確認方法

デバッグツールはオンボード RX E2 Lite を使用します。評価ボードのECN1 USB micro-Bコネクタをパソコンに接続してe2Studio環境からプログラムのダウンロード及びステップ・実行デバッグ操作が可能です。

ハードウエア設定:

評価ボードの SW1 DIPスイッチを以下のように設定します。

  • SW1-1:Off(Ethernet PHY reset)
  • SW1-2:Off(Emulator reset)

e2Studio IDE環境でのデバッグ操作

  1. デバッグ設定を確認します
    プロジェクト・エクスプローラーウインドウからプロジェクトを選択し、「実行 → デバッグの構成」メニューコマンドでデバッグ構成ダイアログを開きます。デバッガ接続設定は「rx72n_envisionkit_m3s_t4 HardwareDebug」デバッグ構成を使用します。
    ※ 新規デバッグ構成を作成する場合は以下の手順をご参照ください。
    • 「Renesas GDB Hardware Debugging」構成をマウスダブルクリックして新規デバッグ構成を作成します。
    • メイン → プロジェクトに「rx72n_envisionkit_m3s_t4」を指定します。
    • Debug hardwareに「E2 Lite(RX)」を選択します。
    • Target Deviceに「R5F572NN」を選択します。
    • Debugger → Connection Settings:
      • メインクロックソース:EXTAL
      • EXTAL 周波数(MHz):16.000
      • 動作周波数(MHz):240.000
      • 接続タイプ:Fine
      • エミュレータから電源を供給する:いいえ
  2. デバッグセッションを開始します
    評価ボードのECN1 USB micro-Bコネクタをパソコンに接続します。
    デバッグ構成ダイアログから「rx72n_envisionkit_m3s_t4 HardwareDebug」構成を選択して「デバッグ」ボタンをクリックします。又は、「実行 → デバッグ」メニューコマンドでデバッグセッションを開始します。
  3. プログラムを実行します
    「Renesas Views → デバッグ → Renesas Debug Virtual Console」メニューコマンドでデバッグメッセージを出力するIOコンソールを開きます。プログラムを実行してデバッグコンソールのログ情報から結果を確認します。

制限事項


  • 評価版パッケージの各ソフトウエアコンポーネントライブラリは「リトル・エンディアン」モードで作成されています。「ビッグ・エンディアン」モード環境での評価を希望されているお客様はご相談ください。
  • 倍精度浮動小数点処理命令を有効にする「-dpfpu」オプションは使用できません。
  • 使用時間制限:ハードウエアリセット後約4時間

License(利用条件)

SEGGER's Friendly License (SFL), January 16th 2020

For non-commercial use or for evaluation purposes, you - regardless whether you
are an individual person or a legal entity - are welcome to use the software
free of charge under this license.
Any other use of the software is considered commercial use, for which a 
commercial-use license must be obtained from SEGGER.


DEFINITIONS

"Non-commercial use" means using the software for teaching, learning, studying, 
or projects that do not have a commercial background. If the software is used 
for products or services intended to be sold, the use is considered to be 
commercial.
"Evaluation" means you are trying out the software for possible future use. 
While the length of this time period is up to you, once it becomes a standard 
part of your workflow we no longer consider it evaluation. 


DISCLAIMER OF WARRANTY

When using the software under this license, you accept that it is provided on 
an "as is" basis, without warranty of any kind. 


LIMITATION OF LIABILITY

When using the software under this license, you accept that SEGGER is not liable 
for any damages arising out of the use of or inability to use the software.


3RD-PARTY SOFTWARE AND LICENSES

More information about 3rd-party components, if any, included in the software 
and the licenses that these components are under can be found in the file 
doc/license/3rd-party.txt after installation of the software.


RESTRICTIONS

You may not:
(a) decompile, disassemble, reverse engineer, or otherwise attempt to derive the 
    source code of the software,
(b) redistribute, encumber, sell, rent, lease, sublicense, or otherwise transfer 
    rights in the software,
(c) remove or alter any trademark, logo, copyright or other proprietary notices, 
    legends, symbols or labels of the software.

    
REVOCATION

SEGGER reserves the right to revoke the right to use the software granted by 
this license on a case-by-case basis. In this unlikely event, SEGGER will 
provide the revocation notice in writing, allowing an adequate notice period.


APPLICABLE LAW, VENUE

German Law (with the exception of its rules for Conflicts of Law) applies. 
Sole venue is Monheim/Rhein.

(c) 2020 - 2021 SEGGER Microcontroller GmbH www.segger.com info@segger.com
次の章

HTTPクライアント