Azure RTOSでRXマイコンが使えるようになったのですね

こんにちは。NoMaYです。

Azure RTOSでRXマイコンが使えるようになったのですね。コンパイラはGNURXが使われていました。

Getting started with the Renesas Starter Kit+ for RX65N-2MB (英文です。)
02/05/2021 Ryan Winter
docs.microsoft.com/ja-jp/samples/azure-rtos/getting-started/getting-started-with-the-renesas-starter-kit-for-rx65n-2mb/
 

  • NoMaYさん

    シェルティです、こんにちは。

    情報提供ありがとうございます。じつは本家GitHubにもサンプルアップ完了しました!

    NoMaYさんに作っていただいたマルチコンパイラ対応コードを正式にBSPを組み込んでそれをAzure RTOSに取り込んでもらっておりまして、CC-RX、GCC、IAR全部対応になりました。

    組み立て済サンプル:

    https://github.com/azure-rtos/samples

    ソースコード:

    https://github.com/azure-rtos/getting-started

    以上です

  • こんにちは。NoMaYです。

    んっ?これは何でしょうかね?FreeRTOSを使ってAzure IoT servicesも使うことが出来るのかな?(ちなみに、RXマイコンは未対応、でした。)

    Azure IoT middleware for FreeRTOS in general availability
    azure.microsoft.com/ja-jp/updates/azure-iot-middleware-for-freertos-in-general-availability/

    Currently, customers who are leveraging FreeRTOS-based devices and wish to connect to Azure need to resort to home-grown solutions or venture to adapt existing SDKs to get a working solution. With this middleware they'll get a proper SDK that exposes the APIs these developers expect to see when getting their devices connected to Azure. In contrast with home-grown solutions, the Azure IoT middleware for FreeRTOS is maintained and supported by Microsoft, and it is an open-source project that allows you to adapt it to a number of different hardware combinations to support your business and technical requirements.


    samples for Azure IoT middleware for FreeRTOS on GitHub.
    github.com/Azure-Samples/iot-middleware-freertos-samples

    The Azure IoT middleware for FreeRTOS simplifies the connection of devices running FreeRTOS to the Azure IoT services. It implements a modular approach that brings flexibility to IoT developers by allowing them to bring their own network stack (MQTT, TLS and Socket).

    The Azure IoT middleware for FreeRTOS repo has the core functionalities of the middleware and no external dependencies, however to implement the working samples, we need to bring a network stack which is the objective of the samples in this repo.

  • こんにちは。NoMaYです。

    別スレッドへの投稿を書き終えてから1日経って気になったのですけれども、Azure RTOSにも以下の機能はあるのでしょうかね?

    RXv3コアのレジスタ一括退避機能の使い方(Register Bank Save Function Usage)を調べてみるスレッド
    community-ja.renesas.com/cafe_rene/forums-groups/mcu-mpu/rx/f/forum5/9572/rxv3-register-bank-save-function-usage/46739#46739

    > (3) FreeRTOS(やNORTi)では、OS管理外の高優先度割り込みが使える …以後省略…
    ⇒ カーネル内部のクリティカルセクションでの割り込み禁止時にも割り込みを受け付ける(割り込みルーチンへ飛ぶ)機能
    ※ (ただし、その割り込みでは(割り込みルーチン内では)、RTOS APIを呼んではいけないという制限が付く)

    > (4) というか、ラウンドロビンのコンテキスト切り替え処理は1msecとか10msecとかのオーダーの頻度で …以後省略…
    ⇒ 同一優先度のタスクで実行可能状態にあるものをタイムスライス方式で順番に実行する機能

  • こんにちは。NoMaYです。

    Azure RTOSのCritical SectionはFree RTOSのものとは何か挙動が異なるみたいですね。理解するのに時間が掛かりそう。Critical Section内でも高優先度スレッドに切り替わるらしいです。(まあ、逆に、Azure RTOSユーザからすれば、えっ、Free RTOSのCritical Sectionでは切り替わらないの?!なのでしょうけど、、、)

    Azure RTOS_Preemption-Threshold Scheduling
    azure.microsoft.com/ja-jp/resources/azure-rtos-preemption-threshold-scheduling/

    Preemption-Threshold Scheduling Enables Real-Time Systems to Achieve Higher Performance
    Innovative real-time scheduling mode permits responsiveness, while protecting critical sections and reducing overhead
    January 2020
    azure.microsoft.com/mediahandler/files/resourcefiles/azure-rtos-preemption-threshold-scheduling/Azure%20RTOS_PTS%20Improves%20Performance_Whitepaper.pdf
    Page 7 of 11 (色付けは私によるもの)

    Benefits

    Preemption-Threshold Scheduling offers several benefits. It is a tool that may be used by system designers in many ways, even beyond those mentioned here, to suit various system use cases. Here are a few examples of the benefits of Preemption-Threshold Scheduling:



    2. Critical Section Protection. A critical section is a part of a multithreaded program that may not be concurrently executed by more than one of the threads. Typically, the critical section accesses a shared resource, such as a data structure, a peripheral device, or a network connection, that does not allow multiple concurrent accesses. Typically, preemption is disabled during critical section access, protecting the section but delaying response to unrelated events. Preemption-Threshold Scheduling can be used to prevent preemption among a set of threads, all of which interact with the same critical section. Threads dealing with the critical section cannot “step on” each other, but they still can be preempted by higher-priority threads that do not use the critical section, thus achieving better system responsiveness.




    [メモ]

    当面の気になること

    ・ Azure RTOSカーネルでは割り込み禁止時間はどうなっているのか?
    ・ それは、CortexコアとRXコアでは、扱いが異なっているのか?それとも同じなのか?

    関連すること

    ・ Free RTOSカーネルでは、OS管理外の高優先度割り込みが使える
    ⇒ カーネル内部のCritical Sectionでの割り込み禁止時にも割り込みを受け付ける(割り込みルーチンへ飛ぶ)機能
    ※ (ただし、その割り込みでは(割り込みルーチン内では)、RTOS APIを呼んではいけないという制限が付く)

  • こんにちは。NoMaYです。

    Azure RTOSカーネルのドキュメントの入り口は、ここですかね。

    Azure RTOS ThreadX documentation
    Azure RTOS ThreadX is an advanced real-time operating system (RTOS) designed specifically for deeply embedded applications.
    learn.microsoft.com/en-us/azure/rtos/threadx/

    そこから以下へと続きますね。

    Overview of Azure RTOS ThreadX
    learn.microsoft.com/en-us/azure/rtos/threadx/overview-threadx

    About the Azure RTOS ThreadX Guide
    learn.microsoft.com/en-us/azure/rtos/threadx/about-this-guide
     

  • こんにちは。NoMaYです。

    割り込みに関して、ここに、こういう記述がありました。

    Chapter 3 - Functional Components of Azure RTOS ThreadX
    learn.microsoft.com/en-us/azure/rtos/threadx/chapter3


    High-frequency Interrupts

    Some interrupts occur at such a high frequency that saving and restoring full context upon each interrupt would consume excessive processing bandwidth. In such cases, it is common for the application to have a small assembly language ISR that does a limited amount of processing for a majority of these high-frequency interrupts.

    After a certain point in time, the small ISR may need to interact with ThreadX. This is accomplished by calling the entry and exit functions described in the above template.

    なお、`High-frequency`であって、`High-priority`では無い、ですけれども。


    Interrupt Latency

    ThreadX locks out interrupts over brief periods of time. The maximum amount of time interrupts are disabled is on the order of the time required to save or restore a thread's context.

    微妙なのは、まさにコンテキストの退避/復帰を行っている期間だけなのか、それともタスク切り替え処理の全体に渡っているのか、というところですかね。それから、タスク切り替えが起きなければ割り込み禁止になることは無いのか、というところですかね。

  • こんにちは。NoMaYです。

    Azure RTOSプロジェクトを作ろうとしたけれども、以下の画面コピーのところで止まって?しまうなぁ、、、(既に3回ぐらいキャンセルしてやり直しているけれど、また既に30分ぐらい経過したかなぁ、、、)


     

  • こんにちは。NoMaYです。

    前の投稿の続きですが、朝になったらウェブサイトからのAzure RTOSのダウンロードは終わっていました。ただ、ダウンロードダイアログでは -rc3 という文字が付いていたのですが、プロジェクト作成ダイアログでは取れてしまっていて、-rc1、-rc2、-rc3、といった区別が出来なくなって、ちょっと困惑しています。


     

  • こんにちは。NoMaYです。

    前の投稿の続きですが、ダウンロードしたモジュールフォルダを覗くと、今回はRX Driver Packageのダウンロードに2時間ほど掛かっていたようです。他方、以前にもAzure RTOSをダウンロードしたことがあったのですが、その頃は30分ほどで済んでいたようです。

    以下、Windowsエクスプローラの画面コピーです。

    今回: RX Driver Packageのダウンロードに2時間ほど掛かっていたらしい


    以前: RX Driver Packageのダウンロードは30分ほどで済んでいたらしい

     

  • こんにちは。NoMaYです。

    Azure RTOSカーネル(Azure RTOS v6.1.12_rel-rx-1.0.0-rc3)内の割り込み禁止処理についてちょっと追ってみました。

    カーネル内の割り込みの禁止/許可は以下のマクロで行われるようです。素朴にPSWのIビットを操作しているもので、PSWのIPLフィールド(4ビット)を操作しているのでは無いものでした。

    続く。

    libs/threadx/ports/rxv3/ccrx/inc/tx_port.h (改行の数とか空白文字の長さとか少し加工しています)

    /* Define ThreadX interrupt lockout and restore macros for protection on 
       access of critical kernel information.  The restore interrupt macro must
       restore the interrupt posture of the running thread prior to the value
       present prior to the disable macro.  In most cases, the save area macro
       is used to define a local function save area for the disable and restore
       macros.  */

    /* UINT   _tx_thread_interrupt_control(UINT new_posture); */

    #pragma inline_asm _tx_thread_interrupt_disable
    static UINT _tx_thread_interrupt_disable(void){
        MVFC PSW,R1  ;
        CLRPSW I     ;
    }

    #pragma inline_asm _tx_thread_interrupt_restore
    static void _tx_thread_interrupt_restore(UINT old_posture){
        MVFC PSW, R2  ;
        BTST #16,r1   ;
        BMC  #16,r2   ;
        MVTC r2,PSW   ;
    }

    #define TX_INTERRUPT_SAVE_AREA  unsigned int interrupt_save;

    #define TX_DISABLE              interrupt_save =  _tx_thread_interrupt_disable();

    #define TX_RESTORE              _tx_thread_interrupt_restore(interrupt_save);