RXv3コアのレジスタ一括退避機能を使ってマルチスーパーループ実行ライブラリ(MultiSuperLoopExecLibrary)を作ってみるスレッド

こんにちは。NoMaYです。

今、以下のスレッドに投稿しているのですけれども、派生ネタが思い浮かびましたので、またひとつ立ててみました。

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

派生ネタ

・ スーパーループを複数同時実行する(複数のスーパーループを切り替えながら実行する)、という、ありがちなものです
・ RXv3コアのレジスタ一括退避機能の高速性を鑑みて10μsec程度で切り替えてみたいです
・ お遊びです

Parents
  • 思い浮かんだコードの断片のネタ(ネタの状態ですので動作は試していません)

    CC-RXでWarning Levelを上げるとinline_asm関数の引数で出る未使用引数のInformation Messageを抑止出来た、、、

    /* Unfortunately CC-RX complains about unused parameters though inline_asm function. */
    /* Using intermediate function is a workaround for such CC-RX's information message. */
    #pragma inline_asm _Initialize_RegisterSaveBank
    static void _Initialize_RegisterSaveBank(void)
    {
        /* bank: r1 */
        /* pc:   r2 */
        /* usp:  r3 */

        /* Save PSW, USP to scratch registers and disable interrupt.  */
        mvfc psw, r4
        clrpsw i
        mvfc usp, r5

        /* Initialize the specified register save bank. */
        sub #12, r3     /* Reserve the space for PSW, PC and R1. */
        mvtc r3, usp    /* usp */
        mov.l r4, 8[r3] /* psw */
        mov.l r2, 4[r3] /* pc */
        mov.l r1, 0[r3] /* r1 but the value isn't important.*/
        save r1         /* Only the value of USP and FPSW are important. */

        /* Restore PSW, USP from scratch registers. */
        mvtc r5, usp
        mvtc r4, psw
    }

    /* Unfortunately CC-RX complains about unused parameters though inline_asm function. */
    /* Using intermediate function is a workaround for such CC-RX's information message. */
    #pragma noinline Initialize_RegisterSaveBank
    void Initialize_RegisterSaveBank(uint8_t bank, uint32_t pc, uint32_t usp)
    {
        (void) bank; /* r1 */
        (void) pc;   /* r2 */
        (void) usp;  /* r3 */
        _Initialize_RegisterSaveBank();
    }

     

Reply
  • 思い浮かんだコードの断片のネタ(ネタの状態ですので動作は試していません)

    CC-RXでWarning Levelを上げるとinline_asm関数の引数で出る未使用引数のInformation Messageを抑止出来た、、、

    /* Unfortunately CC-RX complains about unused parameters though inline_asm function. */
    /* Using intermediate function is a workaround for such CC-RX's information message. */
    #pragma inline_asm _Initialize_RegisterSaveBank
    static void _Initialize_RegisterSaveBank(void)
    {
        /* bank: r1 */
        /* pc:   r2 */
        /* usp:  r3 */

        /* Save PSW, USP to scratch registers and disable interrupt.  */
        mvfc psw, r4
        clrpsw i
        mvfc usp, r5

        /* Initialize the specified register save bank. */
        sub #12, r3     /* Reserve the space for PSW, PC and R1. */
        mvtc r3, usp    /* usp */
        mov.l r4, 8[r3] /* psw */
        mov.l r2, 4[r3] /* pc */
        mov.l r1, 0[r3] /* r1 but the value isn't important.*/
        save r1         /* Only the value of USP and FPSW are important. */

        /* Restore PSW, USP from scratch registers. */
        mvtc r5, usp
        mvtc r4, psw
    }

    /* Unfortunately CC-RX complains about unused parameters though inline_asm function. */
    /* Using intermediate function is a workaround for such CC-RX's information message. */
    #pragma noinline Initialize_RegisterSaveBank
    void Initialize_RegisterSaveBank(uint8_t bank, uint32_t pc, uint32_t usp)
    {
        (void) bank; /* r1 */
        (void) pc;   /* r2 */
        (void) usp;  /* r3 */
        _Initialize_RegisterSaveBank();
    }

     

Children
No Data