RX65N/RX72N emWin+AppWizardでJapanese Language Displayが出来るか調べてみることにしました(Is it available?)

こんにちは。NoMaYです。

最近、以下のスレッドに関わったのですが、日本語が表示出来ないなんて?と、気になったので調べてみることにしました。もっとも、何から手を付けて良いのかさっぱり分からない状態からのスタートですので、ぼちぼちと、、、

AppWizardでの日本語テキスト表示について
japan.renesasrulz.com/cafe_rene/f/002-2095199602/8313/appwizard

まず、ソッコーで思い浮かんでアクセスしてみる情報から。

SEGGER emWinグラフィックスライブラリ (RX MCUs)
www.renesas.com/jp/ja/products/microcontrollers-microprocessors/rx-32-bit-performance-efficiency-mcus/rx-partners/segger-emwin-graphics-library-rx-mcus

RX Ecosystem Partner Solution
emWin - PROFESSIONAL EMBEDDED GRAPHICS LIBRARY
SEGGER( 日本国内販売代理店:株式会社エンビテック)
www.renesas.com/jp/ja/document/prb/segger-emwin-graphics-library-solution-brief-rx-mcus

emWin
Graphic Library with Graphical User Interface
User Guide & Reference Manual
Document: UM03001
Software version: V5.50 ⇒ ドキュメントのバージョンが古過ぎますね(下記のFITモジュールのとおり既にV6.22ですね)
Document revision: 0
Date: June 11, 2019
www.renesas.com/jp/ja/document/mat/emwin-graphic-library-gui-user-guide-reference-manual

RXファミリ emWin v6.22モジュール Firmware Integration Technology
www.renesas.com/jp/ja/document/apn/rx-family-emwin-v622-module-using-firmware-integration-technology
 

Parents
  • こんにちは。NoMaYです。

    最近またソースコードを見ていたのですけれども、以下のようなコードは、タスク切り替えや(多重割り込み含めて)割り込みに対して危険ですね。(以下のコード自体は、起動時の初期化で呼ばれるだけだろうと思いますので、危険度は高くは無いだろうと思いますけれども。) 以下は、FIT emWin v6.22モジュールのソースです。

    人類の知性には、プログラムを最初からちゃんと考えて書く、という課題は早過ぎるのではないでしょうかね。宇宙銀河連邦(そういうものがあるとして)に人類が加盟出来るようになるのと、どっちが先になるでしょうかね。

    src/smc_gen/r_drw2d_rx/src/rx/dave_irq_rx.c

    /***********************************************************************
     * Function Name: d1_ien_set
     * Description  : Write the IER register.
     * Arguments    : enable
     *                    Enable or disable the register bit.
     *                vector
     *                    Interrupt vector number.
     * Return Value : none
     **********************************************************************/
    static void d1_ien_set(bool enable, int vector)
    {
        unsigned char *p_ien_addr;
        unsigned char tmp_ier;
        unsigned char tmp_ien;

        tmp_ier = vector / 8;
        tmp_ien = vector % 8;

        /* The address offset from the address of the base register is cast
    to match the size of the register. */
        p_ien_addr = ((unsigned char *)IEN_0_BASE) + tmp_ier;

        if (true == enable)
        {
            *p_ien_addr = ((*p_ien_addr) | (1 << tmp_ien));
        }
        else
        {
            *p_ien_addr = ((*p_ien_addr) & (~(1 << tmp_ien)));
        }
    } /* End of function d1_ien_set() */

     

    /***********************************************************************
     * Function Name: d1_genal1_set
     * Description  : Write the GENAL1 register.
     * Arguments    : enable
     *                    Enable or disable the register bit.
     *                grp_num
     *                    The register bit position.
     * Return Value : none
     **********************************************************************/
    static void d1_genal1_set(bool enable, int grp_num)
    {
        unsigned long *p_genal1_addr;

        /* The address of the base register is cast to match the size of the register. */
        p_genal1_addr = ((unsigned long *)GENAL1_0_BASE);

        if (true == enable)
        {
            *p_genal1_addr = ((*p_genal1_addr) | (1 << grp_num));
        }
        else
        {
            *p_genal1_addr = ((*p_genal1_addr) & (~(1 << grp_num)));
        }
    } /* End of function d1_genal1_set() */

     
    src/smc_gen/r_drw2d_rx/src/rx/dave_base_rx.c.c

    /***********************************************************************
     * Function Name: d1_mstp_set
     * Description  : Write the MSTP register.
     * Arguments    : enable
     *                    Enable or disable the register bit.
     *                mstp_char
     *                    MSTP register offset position.
     *                mstp_num
     *                    The register bit position.
     * Return Value : none
     **********************************************************************/
    static void d1_mstp_set(bool enable, int mstp_char, int mstp_num)
    {
        volatile unsigned long R_BSP_EVENACCESS_SFR *p_mstp_addr;

        /* The address offset from the address of the base register is cast
    to match the size of the register. */
        p_mstp_addr = ((volatile unsigned long R_BSP_EVENACCESS_SFR *)MSTP_0_BASE)
    + mstp_char;

        if (true == enable)
        {
            *p_mstp_addr = ((*p_mstp_addr) & (~(1 << mstp_num)));
        }
        else
        {
            *p_mstp_addr = ((*p_mstp_addr) | (1 << mstp_num));
        }
    } /* End of function d1_mstp_set() */

    /***********************************************************************
     * Function Name: d1_registerprotectenable
     * Description  : Enable protect bit 1 of PRCR register.
     * Arguments    : none
     * Return Value : none
     **********************************************************************/
    static void d1_registerprotectenable()
    {
        volatile unsigned short R_BSP_EVENACCESS_SFR *p_prcr_addr;

        /* The address of the base register is cast to match the size of the register. */
        p_prcr_addr = (volatile unsigned short R_BSP_EVENACCESS_SFR *)PRCR_0_BASE;
        *p_prcr_addr = (((*p_prcr_addr) | PRCR_KEY) & (~PRCR_PRC1));
    } /* End of function d1_registerprotectenable() */

    /***********************************************************************
     * Function Name: d1_registerprotectdisable
     * Description  : Disable protect bit 1 of PRCR register.
     * Arguments    : none
     * Return Value : none
     **********************************************************************/
    static void d1_registerprotectdisable()
    {
        volatile unsigned short R_BSP_EVENACCESS_SFR *p_prcr_addr;

        /* The address of the base register is cast to match the size of the register. */
        p_prcr_addr = (volatile unsigned short R_BSP_EVENACCESS_SFR *)PRCR_0_BASE;
        *p_prcr_addr = (((*p_prcr_addr) | PRCR_KEY) | PRCR_PRC1);
    } /* End of function d1_registerprotectdisable() */

     
    [追記]

    修正案は、以下ではないかなぁ、と思います。

    (1) ビット操作はビット操作命令を使うコードに書き換える。(ビット操作命令を使う組み込みライブラリ関数でも可。)
    (2) レジスタライトプロテクトの解除操作/再開操作はgetpsw(),clrpsw_i(),setpsw_i()で大域的に割り込み不可にする。
    (2') それだけでは不十分かも?、、、一連の動作全体を何かで保護しないといけない?、、、
    (2'-1) タスク切り替えが起きないようにする。
    (2'-2) 割り込み処理中で2重に解除操作/再開操作をしてしまわないようにするカラクリも用意する。(BSPのAPIとする。)
    (2'-3) 一連の動作全体を大域的に割り込み不可にしてしまうという手も無くは無いけれども。

    [追記]

    RXマイコンではIRレジスタに1を書き込むことは出来ないです。(レベル割り込みでは0を書き込むことも出来ないです。)

    src/smc_gen/r_drw2d_rx/src/rx/dave_irq_rx.c

    /***********************************************************************
     * Function Name: d1_ir_set
     * Description  : Write the IR register.
     * Arguments    : enable
     *                    Enable or disable the register bit.
     *                vector
     *                    Interrupt vector number.
     * Return Value : none
     **********************************************************************/
    static void d1_ir_set(bool enable, int vector)
    {
        unsigned char *p_ir_addr;

        /* The address offset from the address of the base register is cast
    to match the size of the register. */
        p_ir_addr = ((unsigned char *)IR_0_BASE) + vector;

        if (true == enable)
        {
            *p_ir_addr = 1;
        }
        else
        {
            *p_ir_addr = 0;
        }
    } /* End of function d1_ir_set() */

     

Reply
  • こんにちは。NoMaYです。

    最近またソースコードを見ていたのですけれども、以下のようなコードは、タスク切り替えや(多重割り込み含めて)割り込みに対して危険ですね。(以下のコード自体は、起動時の初期化で呼ばれるだけだろうと思いますので、危険度は高くは無いだろうと思いますけれども。) 以下は、FIT emWin v6.22モジュールのソースです。

    人類の知性には、プログラムを最初からちゃんと考えて書く、という課題は早過ぎるのではないでしょうかね。宇宙銀河連邦(そういうものがあるとして)に人類が加盟出来るようになるのと、どっちが先になるでしょうかね。

    src/smc_gen/r_drw2d_rx/src/rx/dave_irq_rx.c

    /***********************************************************************
     * Function Name: d1_ien_set
     * Description  : Write the IER register.
     * Arguments    : enable
     *                    Enable or disable the register bit.
     *                vector
     *                    Interrupt vector number.
     * Return Value : none
     **********************************************************************/
    static void d1_ien_set(bool enable, int vector)
    {
        unsigned char *p_ien_addr;
        unsigned char tmp_ier;
        unsigned char tmp_ien;

        tmp_ier = vector / 8;
        tmp_ien = vector % 8;

        /* The address offset from the address of the base register is cast
    to match the size of the register. */
        p_ien_addr = ((unsigned char *)IEN_0_BASE) + tmp_ier;

        if (true == enable)
        {
            *p_ien_addr = ((*p_ien_addr) | (1 << tmp_ien));
        }
        else
        {
            *p_ien_addr = ((*p_ien_addr) & (~(1 << tmp_ien)));
        }
    } /* End of function d1_ien_set() */

     

    /***********************************************************************
     * Function Name: d1_genal1_set
     * Description  : Write the GENAL1 register.
     * Arguments    : enable
     *                    Enable or disable the register bit.
     *                grp_num
     *                    The register bit position.
     * Return Value : none
     **********************************************************************/
    static void d1_genal1_set(bool enable, int grp_num)
    {
        unsigned long *p_genal1_addr;

        /* The address of the base register is cast to match the size of the register. */
        p_genal1_addr = ((unsigned long *)GENAL1_0_BASE);

        if (true == enable)
        {
            *p_genal1_addr = ((*p_genal1_addr) | (1 << grp_num));
        }
        else
        {
            *p_genal1_addr = ((*p_genal1_addr) & (~(1 << grp_num)));
        }
    } /* End of function d1_genal1_set() */

     
    src/smc_gen/r_drw2d_rx/src/rx/dave_base_rx.c.c

    /***********************************************************************
     * Function Name: d1_mstp_set
     * Description  : Write the MSTP register.
     * Arguments    : enable
     *                    Enable or disable the register bit.
     *                mstp_char
     *                    MSTP register offset position.
     *                mstp_num
     *                    The register bit position.
     * Return Value : none
     **********************************************************************/
    static void d1_mstp_set(bool enable, int mstp_char, int mstp_num)
    {
        volatile unsigned long R_BSP_EVENACCESS_SFR *p_mstp_addr;

        /* The address offset from the address of the base register is cast
    to match the size of the register. */
        p_mstp_addr = ((volatile unsigned long R_BSP_EVENACCESS_SFR *)MSTP_0_BASE)
    + mstp_char;

        if (true == enable)
        {
            *p_mstp_addr = ((*p_mstp_addr) & (~(1 << mstp_num)));
        }
        else
        {
            *p_mstp_addr = ((*p_mstp_addr) | (1 << mstp_num));
        }
    } /* End of function d1_mstp_set() */

    /***********************************************************************
     * Function Name: d1_registerprotectenable
     * Description  : Enable protect bit 1 of PRCR register.
     * Arguments    : none
     * Return Value : none
     **********************************************************************/
    static void d1_registerprotectenable()
    {
        volatile unsigned short R_BSP_EVENACCESS_SFR *p_prcr_addr;

        /* The address of the base register is cast to match the size of the register. */
        p_prcr_addr = (volatile unsigned short R_BSP_EVENACCESS_SFR *)PRCR_0_BASE;
        *p_prcr_addr = (((*p_prcr_addr) | PRCR_KEY) & (~PRCR_PRC1));
    } /* End of function d1_registerprotectenable() */

    /***********************************************************************
     * Function Name: d1_registerprotectdisable
     * Description  : Disable protect bit 1 of PRCR register.
     * Arguments    : none
     * Return Value : none
     **********************************************************************/
    static void d1_registerprotectdisable()
    {
        volatile unsigned short R_BSP_EVENACCESS_SFR *p_prcr_addr;

        /* The address of the base register is cast to match the size of the register. */
        p_prcr_addr = (volatile unsigned short R_BSP_EVENACCESS_SFR *)PRCR_0_BASE;
        *p_prcr_addr = (((*p_prcr_addr) | PRCR_KEY) | PRCR_PRC1);
    } /* End of function d1_registerprotectdisable() */

     
    [追記]

    修正案は、以下ではないかなぁ、と思います。

    (1) ビット操作はビット操作命令を使うコードに書き換える。(ビット操作命令を使う組み込みライブラリ関数でも可。)
    (2) レジスタライトプロテクトの解除操作/再開操作はgetpsw(),clrpsw_i(),setpsw_i()で大域的に割り込み不可にする。
    (2') それだけでは不十分かも?、、、一連の動作全体を何かで保護しないといけない?、、、
    (2'-1) タスク切り替えが起きないようにする。
    (2'-2) 割り込み処理中で2重に解除操作/再開操作をしてしまわないようにするカラクリも用意する。(BSPのAPIとする。)
    (2'-3) 一連の動作全体を大域的に割り込み不可にしてしまうという手も無くは無いけれども。

    [追記]

    RXマイコンではIRレジスタに1を書き込むことは出来ないです。(レベル割り込みでは0を書き込むことも出来ないです。)

    src/smc_gen/r_drw2d_rx/src/rx/dave_irq_rx.c

    /***********************************************************************
     * Function Name: d1_ir_set
     * Description  : Write the IR register.
     * Arguments    : enable
     *                    Enable or disable the register bit.
     *                vector
     *                    Interrupt vector number.
     * Return Value : none
     **********************************************************************/
    static void d1_ir_set(bool enable, int vector)
    {
        unsigned char *p_ir_addr;

        /* The address offset from the address of the base register is cast
    to match the size of the register. */
        p_ir_addr = ((unsigned char *)IR_0_BASE) + vector;

        if (true == enable)
        {
            *p_ir_addr = 1;
        }
        else
        {
            *p_ir_addr = 0;
        }
    } /* End of function d1_ir_set() */

     

Children
No Data