目次

last update: 2024/04

スタートアップガイド
FreeRTOS用BSPパッケージ
評価ボード:Renesas EK-RX671

MCU:RX671(32-bit RXv3) / 120MHz

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

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

EK-RX671

BSP パッケージ内容:

圧縮・解凍emCompress-Embed, emCompress-ToGo
ModbusModbus Master (ASCII/RTU), Modbus Slave (ASCII/RTU)
TCP/IP over USBemNet TCP/IPv4, FTP Server, TELNET, emNet driver over USB
セキュリティemSecure (RSA Sign and Verify)
暗号・サイファーemCrypt PRO (Ciphers, HASH, MAC, Digital Signature, Key Generation, NIST prime curves, random bit generators)
FileSystememFile FAT32, Encryption, Journaling, Disk Driver (MMC/SD Card, USB Disk, RAMDisk)
USB-DeviceemUSB Device, BULK, CDC, HID, MSD, VirtualMSD, DFU, MTP, AUDIO, Printer Class, UVC, IP-over-USB component, USB Driver for RX
USB-HostemUSB Host, BULK, HID, CDC, FT232, CCID, AUDIO, MSD, MIDI, MTP, Printer Class, RX Driver
評価版サンプルのご依頼


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

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

[Workspace]
 ├ EK-RX671   .... サンプルプログラム一式
 └ Windows   .............. テスト用PCツール
EK-RX671
 ├ License.txt   ............. 評価版ライブラリの利用条件
 ├ src
   ├ Application ............. テスト用サンプルアプリケーション
   ├ BSP         ............. ハードウエア依存設定、ドライバ
   ├ Config      ............. コンフィグレーション設定、システム依存設定
   ├ EVAL_Libs   ............. SEGGERソフトウエア評価版ライブラリ
   ├ FreeRTOS    ............. FreeRTOSカーネルソース(e2Studio FITで作成)
   ├ frtos_config    ......... FreeRTOSコンフィグレーション設定
   ├ frtos_skeleton  ......... FreeRTOS関連
   ├ frtos_startup   ......... FreeRTOSスタートアップコード(ボード依存)
   ├ smc_gen     ........ e2StudioのスマートFITコンフィグレータで作成されたBSP
   ├ .project    ............. e2Studio環境用プロジェクト
   └ ek_rx671_freertos.scfg ..... e2Studio FITコンフィグレータ設定

Applicationフォルダ

Application
 ├ Main.c      ...... メインエントリハンドラ
 └ _Exclude    ...... ※このフォルダはビルド対象外に設定しています
     ├ COMPRESS  .... 圧縮・解凍機能のデモサンプル
     ├ CRYPTO    .... 暗号・サイファー機能のデモサンプル
     ├ FS        .... ファイルシステムのテストサンプル
     ├ MB        .... MODBUS SLAVE / MASTER機能のデモサンプル
     ├ IP-Over-USB .... TCP/IPネットワーク通信機能のデモサンプル
     ├ SECURE    .... 不正改造・不正量産を防ぐセキュリティソリューション
     ├ USBD      .... USB Device各種クラス機能のデモサンプル
     └ USBH      .... USB Host各種クラス機能のデモサンプル


開発環境

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

BSP設定

EK-RX671
 └ BSP
    ├ BSP.c    ......... ボード上のLEDインターフェースのドライバ
    ├ BSP_UART.c  ...... ボード上のUARTインターフェース(J27)のドライバ
    ├ BSP_MMC_SD.c  .... SDコントローラのハードウエア依存の初期化設定
    ├ BSP_USB.c   ...... USBコントローラのハードウエア依存の初期化設定・割込みハンドラ
    └ Setup    ......... 各ソフトウエアライブラリのハードウエア依存のドライバ設定

クロック設定

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

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

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

  • Board Support Packages (r_bsp):バージョン 7.41
  • FreeRTOS_Kernel:バージョン 1.0.120
  • FreeRTOS_Object:バージョン 1.0.121
  • Byte-based circular buffer library (r_byteq):バージョン 2.10
  • GPIO Driver (r_gpio_rx):バージョン 5.00
  • SCI Driver (r_sci_rx):バージョン 4.90

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

  1. e2Studio環境で「.project」プロジェクトを開きます。
  2. プロジェクト・エクスプローラーウインドウ下の「ek_rx671_freertos.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,PResetPRG,C_1,C_2,C,C_8,C$*,D*,W*,L,P/0FFE00000,EXCEPTVECT/0FFFFFF80,RESETVECT/0FFFFFFFC
    0x0000_0004SU, SI, B_1, R_1, B_2, R_2, B, R, B_8, R_8
    0xFFE0_0000PResetPRG, C_1, C_2, C, C_8, C$*, D*, W*, L, P
    0xFFFF_FF80EXCEPTVECT
    0xFFFF_FFFCRESETVECT

FreeRTOSコンフィグレーション設定:

#define configUSE_PREEMPTION            1
#define configUSE_IDLE_HOOK             1
#define configUSE_TICK_HOOK             1
#define configCPU_CLOCK_HZ              (BSP_ICLK_HZ)
#define configPERIPHERAL_CLOCK_HZ       (BSP_PCLKB_HZ)
#define configTICK_RATE_HZ              (( TickType_t ) 1000)
#define configMINIMAL_STACK_SIZE        (( unsigned short ) 140)
#define configTOTAL_HEAP_SIZE_N         (30)
#define configTOTAL_HEAP_SIZE           (( size_t ) ( configTOTAL_HEAP_SIZE_N * 1024 ))
#define configMAX_TASK_NAME_LEN         (12)
#define configUSE_TRACE_FACILITY        1
#define configUSE_16_BIT_TICKS          0
#define configIDLE_SHOULD_YIELD         1
#define configUSE_CO_ROUTINES           0
#define configUSE_MUTEXES               1
#define configGENERATE_RUN_TIME_STATS   0
#define configCHECK_FOR_STACK_OVERFLOW  2
#define configUSE_RECURSIVE_MUTEXES     1
#define configQUEUE_REGISTRY_SIZE       0
#define configUSE_MALLOC_FAILED_HOOK    1
#define configUSE_APPLICATION_TASK_TAG  0
#define configUSE_QUEUE_SETS            1
#define configUSE_COUNTING_SEMAPHORES   1
#define configMAX_PRIORITIES            (16)
#define configMAX_CO_ROUTINE_PRIORITIES (2)
#define configUSE_TASK_NOTIFICATIONS     1
#define configUSE_TASK_DPFPU_SUPPORT     0
#define configRECORD_STACK_HIGH_ADDRESS  0
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS  0

/* Dynamic allocation and static allocation. */
#define configSUPPORT_DYNAMIC_ALLOCATION        1
#define configSUPPORT_STATIC_ALLOCATION         0

/* Run time stats gathering definitions. */
unsigned long ulGetRunTimeCounterValue( void );
void vConfigureTimerForRunTimeStats( void );
#define configGENERATE_RUN_TIME_STATS    0
//#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()    vConfigureTimerForRunTimeStats()
//#define portGET_RUN_TIME_COUNTER_VALUE()            ulGetRunTimeCounterValue()

/* Software timer definitions. */
#define configUSE_TIMERS                1
#define configTIMER_TASK_PRIORITY       (6)
#define configTIMER_QUEUE_LENGTH        5
#define configTIMER_TASK_STACK_DEPTH    (configMINIMAL_STACK_SIZE)

/* The interrupt priority used by the kernel itself for the tick interrupt and
the pended interrupt.  This would normally be the lowest priority. */
#define configKERNEL_INTERRUPT_PRIORITY         1

/* The maximum interrupt priority from which FreeRTOS API calls can be made.
Interrupts that use a priority above this will not be effected by anything the
kernel is doing. */
#define configMAX_SYSCALL_INTERRUPT_PRIORITY    14

/* The peripheral used to generate the tick interrupt is configured as part of
the application code.  This constant should be set to the vector number of the
peripheral chosen.  As supplied this is CMT0. */
#define configTICK_VECTOR                       _CMT0_CMI0

/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */

#define INCLUDE_vTaskPrioritySet            1
#define INCLUDE_uxTaskPriorityGet           1
#define INCLUDE_vTaskDelete                 1
#define INCLUDE_vTaskCleanUpResources       0
#define INCLUDE_vTaskSuspend                1
#define INCLUDE_vTaskDelayUntil             1
#define INCLUDE_vTaskDelay                  1
#define INCLUDE_uxTaskGetStackHighWaterMark 1
#define INCLUDE_xTaskGetSchedulerState      1
#define INCLUDE_eTaskGetState               1
#define INCLUDE_xTimerPendFunctionCall      1

void vAssertCalled( void );
#define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled()

/* Override some of the priorities set in the common demo tasks.  This is
required to ensure flase positive timing errors are not reported. */
#define bktPRIMARY_PRIORITY     (( configMAX_PRIORITIES - 3 ))
#define bktSECONDARY_PRIORITY   (( configMAX_PRIORITIES - 4 ))
#define intqHIGHER_PRIORITY     (( configMAX_PRIORITIES - 3 ))


/*-----------------------------------------------------------
 * Ethernet configuration.
 *-----------------------------------------------------------*/

/* MAC address configuration. */
#define configMAC_ADDR0 0x01
#define configMAC_ADDR1 0x12
#define configMAC_ADDR2 0x13
#define configMAC_ADDR3 0x10
#define configMAC_ADDR4 0x15
#define configMAC_ADDR5 0x11

/* IP address configuration. */
#define configIP_ADDR0      192
#define configIP_ADDR1      168
#define configIP_ADDR2      0
#define configIP_ADDR3      200

/* Netmask configuration. */
#define configNET_MASK0     255
#define configNET_MASK1     255
#define configNET_MASK2     255
#define configNET_MASK3     0

/* When the FIT configurator or the Smart Configurator is used, platform.h has to be used. */
#define configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H  1

プロジェクトビルド方法

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

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

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

デバッグ・動作確認方法

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

ハードウエア設定:

アプリケーション要件に合わせて評価ボードの DIPスイッチ、ジャンパーを設定します。

オンボードデバッグモード設定:

  • SW1-1(SW1 DIP Pin1):OFF
  • SW1-2(SW1 DIP Pin2):OFF
  • J7:Jumper on pins 2-3
  • J8:Jumper on pins 2-3
  • J9:Open

J29 USBポートのデバイスモード設定:

usbd setting
  • J30:Jumper on pins 1-2
  • J31:Jumper on pins 2-3
  • J32:Short
  • J33:Jumper on pins 1-2

J29 USBポートのホストモード設定:

usbh setting
  • J30:Jumper on pins 2-3
  • J31:Jumper on pins 1-2
  • J32:Open
  1. デバッグ設定を確認します
    プロジェクト・エクスプローラーウインドウからプロジェクトを選択し、「実行 → デバッグの構成」メニューコマンドでデバッグ構成ダイアログを開きます。デバッガ接続設定は「ek_rx671_freertos HardwareDebug」デバッグ構成を使用します。
    ※ 新規デバッグ構成を作成する場合は以下の手順をご参照ください。
    • 「Renesas GDB Hardware Debugging」構成をマウスダブルクリックして新規デバッグ構成を作成します。
    • メイン → プロジェクトに「ek_rx671_embos」を指定します。
    • Debug hardwareに「E2 Lite(RX)」を選択します。Target Deviceに「R5F5671E」を選択します。
    • Debugger → Connection Settings:
      • メインクロックソース:EXTAL
      • EXTAL 周波数(MHz):24.000
      • 動作周波数(MHz):120.000
      • 接続タイプ:Fine
      • エミュレータから電源を供給する:いいえ
  2. デバッグセッションを開始します
    評価ボードのDEBUG1 (J25) USB micro-Bコネクタをパソコンに接続します。
    デバッグ構成ダイアログから「ek_rx671_embos 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
次の章

圧縮・解凍機能のデモサンプル