こんにちは。NoMaYです。ライセンスはMIT Licenseでした。TLSとしてmbed TLSが使用されていました。サポートされているボードの写真を見ていたら、どれにも有線LANコネクタが無いことに気付きました。時代の流れでしょうか、、、Getting Started with Amazon FreeRTOSaws.amazon.com/freertos/getting-started/Amazon FreeRTOSaws.amazon.com/freertos/Amazon FreeRTOS ソースコードgithub.com/aws/amazon-freertos[関連リンク]FreeRTOS - freertos.orgwww.freertos.org/FreeRTOS - sourceforge.netsourceforge.net/projects/freertos/files/FreeRTOS kernel自体はCC-RXにも対応github.com/aws/amazon-freertos/tree/master/lib/FreeRTOS/portable/RenesasAmazon FreeRTOSはTLSにmbed TLSを使用github.com/aws/amazon-freertos/tree/master/lib/third_party/mbedtls[ニュース]組み込み業界に大インパクト「Amazon FreeRTOS」の衝撃 - 大原雄介,MONOistmonoist.atmarkit.co.jp/mn/articles/1712/28/news011.htmlアマゾン「AWS IoT」は何が衝撃的なのか - 大原雄介,MONOistmonoist.atmarkit.co.jp/mn/articles/1510/21/news026.html(2018/01/01 : 記事を選び直しました。)[追記]もしかしたら、オープンソースライセンスのドライバライブラリが用意されていないから、ルネサスさんはアマゾンさんに相手にして貰えないのかも、、、ちなみに、FreeRTOS kernel自体のライセンスがV10からModified GPLからMIT Licenseに変わったようです。
シェルティさん、こんにちは。NoMaYです。シェルティさんがGitHubに登録されたソースで少し確認したいのですが、以下をコメントアウトされたのは、私の変更が少しやり過ぎてしまった、ということになりますか? あるいは、テスト作業優先の一時的なものですか?(そうであれば金曜夕方~土曜/日曜のシェルティさんの作業終了のreadme.txtのコメントがあるまで私のコミットは控えた方が良いですか?)lib\third_party\mbedtls\include\mbedtls\config.h
/* * Allow user to override any previous default. * * Use two macro names for that, as: * - with yotta the prefix YOTTA_CFG_ is forced * - without yotta is looks weird to have a YOTTA prefix. */#if defined(YOTTA_CFG_MBEDTLS_USER_CONFIG_FILE)#include YOTTA_CFG_MBEDTLS_USER_CONFIG_FILE#elif defined(MBEDTLS_USER_CONFIG_FILE)#include MBEDTLS_USER_CONFIG_FILE#elif defined(__RX) || defined(__RX__)//FIXME: Is a command line option better?//#include "mbedtls_user_config.h"#endif
あと、09foxさんの修正で気になっていることがあって、どのタイミングで話を出そうか思っていたことがあるのですが、この機会に話をさせて下さい。以下の修正ですが、r_sci_rx_platform.hはR_SCI_RXモジュールのモジュール内ローカルヘッダファイルですので、モジュール外のソースからインクルードするのは避けた方が良いと思ったのですが、しかしインクルードしないとコンパイルエラーになってしまいますので、ひょっとしてr_sci_rx_if.h内でr_sci_rx_platform.hをインクルードしないといけないものなのではないでしょうか?(又は、実装の詳細を隠蔽しようとしていた訳ですので、キューへのポインタ(というかハンドル)を返す関数を新設するのが一番だと思います。)lib\third_party\mcu_vendor\renesas\amazon_freertos_common\serial_term_uart.c修正前
#include <string.h> // For strlen#include "FreeRTOS.h"#include "serial_term_uart.h" // Serial Transfer Demo interface file.#include "platform.h" // Located in the FIT BSP module#include "r_sci_rx_if.h" // The SCI module API interface file.#include "r_byteq_if.h" // The BYTEQ module API interface file.#include "r_sci_rx_config.h" // User configurable options for the SCI module#include "r_pinset.h"
修正後
#include <string.h> // For strlen#include "FreeRTOS.h"#include "serial_term_uart.h" // Serial Transfer Demo interface file.#include "platform.h" // Located in the FIT BSP module#include "r_sci_rx_platform.h" // The SCI module API interface file.#include "r_byteq_if.h" // The BYTEQ module API interface file.#include "r_bsp_config.h" // User configurable options for the BSP module#include "r_pinset.h"
コンパイルエラーになる記述
189行目 R_BYTEQ_Unused(my_sci_handle->u_tx_data.que, &transmit_length);
コンパイルエラーの内容
serial_term_uart.c(189):E0520393:Pointer to incomplete class type is not allowed
おそらく、r_sci_rx_if.hにあるのは型が構造体へのポインタ型であるという宣言だけで、実際の構造体の定義はr_sci_rx_platform.hからインクルードされているr_sci_rx65n_private.hにしか無いので、R_BYTEQ_Unused()の第一引数の"->"がエラーになっているのだと思います。lib\third_party\mcu_vendor\renesas\FIT\RDP_v1.15_modified\r_sci_rx\r_sci_rx_if.h
/* CHANNEL CONTROL BLOCK HANDLE */typedef struct st_sci_ch_ctrl * sci_hdl_t;
lib\third_party\mcu_vendor\renesas\FIT\RDP_v1.15_modified\r_sci_rx\src\targets\rx65n\r_sci_rx65n_private.h
/* CHANNEL CONTROL BLOCK */typedef struct st_sci_ch_ctrl /* SCI channel control (for handle) */{ sci_ch_rom_t const *rom; /* pointer to rom info */ sci_mode_t mode; /* operational mode */ uint32_t baud_rate; /* baud rate */ void (*callback)(void *p_args); /* function ptr for rcvr errs */ union {#if (SCI_CFG_ASYNC_INCLUDED) byteq_hdl_t que; /* async transmit queue handle */#endif uint8_t *buf; /* sspi/sync tx buffer ptr */ } u_tx_data; union {#if (SCI_CFG_ASYNC_INCLUDED) byteq_hdl_t que; /* async receive queue handle */#endif uint8_t *buf; /* sspi/sync rx buffer ptr */ } u_rx_data; bool tx_idle; /* TDR is empty (async); TSR is empty (sync/sspi) */#if (SCI_CFG_SSPI_INCLUDED || SCI_CFG_SYNC_INCLUDED) bool save_rx_data; /* save the data that is clocked in */ uint16_t tx_cnt; /* number of bytes to transmit */ uint16_t rx_cnt; /* number of bytes to receive */ bool tx_dummy; /* transmit dummy byte, not buffer */#endif uint32_t pclk_speed; /* saved peripheral clock speed for break generation */#if SCI_CFG_FIFO_INCLUDED uint8_t fifo_ctrl; /* fifo ctrl (enable/disable) flag */ uint8_t rx_dflt_thresh; /* RX FIFO threshold(default) */ uint8_t rx_curr_thresh; /* RX FIFO threshold(current) */ uint8_t tx_dflt_thresh; /* TX FIFO threshold(default) */ uint8_t tx_curr_thresh; /* TX FIFO threshold(current) */#endif} sci_ch_ctrl_t;
シェルティさん、こんにちは。NoMaYです。>いえ、どんどんコミットをお願いします。了解しました。それから、このコメントアウトされた部分は後で私の方で元に戻しておきます。>09foxさんに確認してみます。09foxさんは最近ルネサスに来られたのでFITモジュールの>細かいところは触りながら覚えている段階です。今回の09foxさんの件は、09foxさんも「やむを得ず」というところで、根はFITの設計の問題(?)のような気がします。09foxさんに限らず、R_SCI_RXモジュールでR_BYTEQモジュールを使おうとした人は皆さん「あれっ?」っと感じているのではないかという気がします。それから、シェルティさんのコミット内容を見ていて思ったのですが、現状vAssertCalled()内は以下のようになっています。これを、このように修正してはどうでしょうか?そして、test用の.cprojectだけでAFQPTESTを-Dオプションで定義するようにすれば、通常のプロジェクトには影響無いように出来ると思います。そういう修正をコミットしてみようかと思ったのですが、どうでしょうか?lib\third_party\mcu_vendor\renesas\amazon_freertos_common\freertos_start.c現状
void vAssertCalled(void){#if(0) TEST_ABORT(); // XXX unity testing volatile unsigned long ul = 0; taskENTER_CRITICAL(); { /* Use the debugger to set ul to a non-zero value in order to step out of this function to determine why it was called. */ while( 0 == ul ) { portNOP(); } } taskEXIT_CRITICAL();#endif} /* End of function vAssertCalled() */
案
#if defined(AFQPTEST)#include "unity_internals.h"#endif略void vAssertCalled(void){#if (0) // debugging with E1/E2/E2L emulator volatile unsigned long ul = 0; taskENTER_CRITICAL(); { /* Use the debugger to set ul to a non-zero value in order to step out of this function to determine why it was called. */ while( 0 == ul ) { portNOP(); } } taskEXIT_CRITICAL();#elif defined(AFQPTEST) // unity testing TEST_ABORT();#endif} /* End of function vAssertCalled() */
unity_internals.hの中を見るとsetjump()とlongjump()でしたので、vAssertCalled()の中でTEST_ABORT()しても問題なさそうに思います。lib\third_party\unity\src\unity_internals.h
/*------------------------------------------------------- * Test Running Macros *-------------------------------------------------------*/#ifndef UNITY_EXCLUDE_SETJMP_H#define TEST_PROTECT() (setjmp(Unity.AbortFrame) == 0)#define TEST_ABORT() longjmp(Unity.AbortFrame, 1)#else#define TEST_PROTECT() 1#define TEST_ABORT() return#endif
シェルティさん、こんにちは。NoMaYです。>>いえ、どんどんコミットをお願いします。>了解しました。それから、このコメントアウトされた部分は後で私の方で元に戻しておきます。よくよく考えたら、私がtestプロジェクトのことをケアしていないのが不味かったですね。すみませんでした。それで、testプロジェクトを見ていて思ったのですが、出来ることなら以下の2点が望ましいですよね。(AFQPで何も縛りが無ければ。)(1) testプロジェクトと通常プロジェクトでソースファイルの2重持ちは避けたい(2) .projectや.cprojectのtestプロジェクトと通常プロジェクトの差分は少ない方が良いこれをWindowsのシンボリックリンク(MKLINKコマンドで作成)を使って実現出来ないものかと思い始めました。来週、試しに、シンボリックリンクを作成するバッチファイルを作ってみて、必要ならば何か小細工も考えて、ということをしてみようかと思います。ただし、コミットはせず、まずは本スレッドにバッチファイルを投稿するだけにします。(もっとも、思惑通りのものが作れるかは、やってみないと分かりませんが、、、)