ルネサスさんのRenesas Extensions for Visual Studio Codeを使ってみるスレッド

こんにちは。NoMaYです。

ルネサスさんからRenesas Extensions for Visual Studio Code(テクニカルプレビューバージョン)が出ていましたので触ってみることにしました。

Renesas Extensions for Visual Studio Code(テクニカルプレビューバージョン) 製品ページ
www.renesas.com/jp/ja/software-tool/renesas_extension_of_vscode

Renesas VS Code Extension Help
tool-support.renesas.com/e2studio/vscode/docs/debug/index.html

[関連スレッド]

最近Atom IDEとかVisual Studio Codeとか新しい開発環境が出て来てますね(Renesas CSplusと連携させる方法を探したいですね)
community-ja.renesas.com/cafe_rene/forums-groups/tools/f/forum21/4553/atom-ide-visual-studio-code-renesas-csplus

Visual Studio 2022 Community EditionでRX MCUやRL78 MCUのSoftware Developmentが出来るか試してみようと思います
community-ja.renesas.com/cafe_rene/forums-groups/tools/f/forum21/7703/visual-studio-2022-community-edition-rx-mcu-rl78-mcu-software-development

e2 studioでCMakeでビルドする、というアプリケーションノートがあるのですがスマートコンフィグレータは使えるのでしょうか?
community-ja.renesas.com/cafe_rene/forums-groups/tools/f/forum21/7713/e2-studio-cmake
 

  • 以下、まずは片側がビルド出来ただけですけれども、先程ビルド出来たプロジェクトファイル一式を添付しておきます。なお、VSCodeの問題ウィンドウを開くと(カラクリは予想が付くにせよ)ゲンナリするメッセージが表示されていました。

    ・ RXスマートコンフィグレータを使用しない設定でe2 studioでプロジェクト生成したもの
      tb_rx130_ccrx_minimal
    ・ RXスマートコンフィグレータを使用したTB-RX130のオフィシャルLED点滅サンプルプログラム
      tb_rx130_r20an0468jj0100_blinky

    issue_RenesasVSCodeExtension_20230308.zip ← まだtb_rx130_ccrx_minimalしかビルド出来ません

    ちなみに、以下の行を追加してビルドしただけです。(先程投稿した環境変数のPathの設定の件もありますけれども。)

    tb_rx130_ccrx_minimal/cross.cmake

    # Set the environment root directory
    # It can be used to specify the target environment location
    # e.g compiler's location. This variable is most useful when crosscompiling.
    #(Should avoid spaces in the path or have to escape them)

    # Unfortunately, in certain cases, Libgen causes the following error even if CMAKE_FIND_ROOT_PATH is set.
    # F0563400:Cannot execute "prelnk"
    # You msut set the Path environment variable to contain the CC-RX's bin folder path in the Windows' control panel.
    SET(CMAKE_FIND_ROOT_PATH C:/Renesas/CS+/CC/CC-RX/V3.05.00/bin)

    if (NOT CMAKE_FIND_ROOT_PATH)
    message("Toolchain path not defined. Please use CMAKE_FIND_ROOT_PATH variable to set the toolchain's bin folder")
    endif()

    以下省略

     
    以下、VSCodeの問題ウィンドウの画面コピーです。


     

  • 危惧はしていましたけれども、CC-RXでワーニングメッセージが出力されていても、問題ウィンドウに反映されません。

    以下、VSCodeの画面コピーです。



     


  • 危惧はしていましたけれども、__evenaccessキーワードがエディタウィンドウや問題ウィンドウでエラー表示されます。

    以下、VSCodeの画面コピーです。



     

  • > 危惧はしていましたけれども、CC-RXでワーニングメッセージが出力されていても、問題ウィンドウに反映されません。

    冒頭の関連スレッドではCC-RX/RL/RHのエラー/ワーニングの文字列フォーマットを、VSCodeやVisual Studioが認識する文字列フォーマットへと、Power Shellスクリプト言語やCMakeスクリプト言語で文字列変換する、というやり方にて対処していました。

  • > 危惧はしていましたけれども、__evenaccessキーワードがエディタウィンドウや問題ウィンドウでエラー表示されます。

    冒頭の関連スレッドではCC-RX/RL/RHに特有な仕様を、そのような仕様をマクロ置換(#define)で無効化するインクルードファイルを、Microsoft C++エクステンションのIntelliSense機能に認識させることでエラー表示されないようにする、というやり方などにて対処していました。[訂正] すみません、CC-RHに関しては、これから始めるところでした。

    ルネサスさんのRenesas Extensions for Visual Studio Codeの場合、Microsoft C++エクステンションの代わりにclangdエクステンションを使用していますけれども、同様なやり方が可能ではないかと思います。

    ただ、clangdエクステンションに関連したウェブサイトを追ってみたところ、clangd環境設定ファイルというものがあるらしいことが書かれていましたけれども、それに設定を記述していくことでも対処出来るのかも知れないと思いました。


    clangd.llvm.org/config

    clangd.llvm.org


    marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.vscode-clangd


    clang.llvm.org/extra/clang-tidy/checks/list.html


    clang.llvm.org/extra/clang-tidy/


    clang.llvm.org/docs/DiagnosticsReference.html

    clang.llvm.org/docs/ClangCommandLineReference.html
     

  • 以下、次に、まずは片側だけですけれども、Renesas VS Code Extension Helpのデバッグ開始手順に従って、シミュレータデバッグが出来るようにしてみました。プロジェクトファイル一式を添付しておきます。

    ・ RXスマートコンフィグレータを使用しない設定でe2 studioでプロジェクト生成したもの
      tb_rx130_ccrx_minimal
    ・ RXスマートコンフィグレータを使用したTB-RX130のオフィシャルLED点滅サンプルプログラム
      tb_rx130_r20an0468jj0100_blinky

    issue_RenesasVSCodeExtension_20230309.zip ← まだtb_rx130_ccrx_minimalしかビルド/デバッグ出来ません

    なお、VSCodeのデバッグ用環境設定ファイルにはユーザ環境依存のパスが以下の通り含まれていますので、適宜変更する必要があります。

    tb_rx130_ccrx_minimal/.vscode/launch.json

    {
        // IntelliSense を使用して利用可能な属性を学べます。
        // 既存の属性の説明をホバーして表示します。
        // 詳細情報は次を確認してください: go.microsoft.com/.../
        "version": "0.2.0",
        "configurations": [
            {
                "type": "renesas",
                "request": "launch",
                "name": "Renesas Simulator Debugging",
                "program": "${workspaceFolder}/build/name.x",
                "gdb": "C:/Renesas/e2studio64/SupportFiles/.eclipse/com.renesas.platform_733684649/DebugComp/RX/rx-elf-gdb",
                "target": {
                    "deviceFamily": "RX",
                    "device": "R5F51308",
                    "debuggerType": "SIMULATOR",
                    "server": "C:/Renesas/e2studio64/SupportFiles/.eclipse/com.renesas.platform_733684649/DebugComp/RX/e2-server-gdb",
                    "port": "61234",
                    "serverParameters": ["-p", "61234", "-g", "SIMULATOR", 。。。途中省略。。。, "--english", "--gdbVersion=", "7.2"]
                }
            }
        ]
    }

     
    以下、Renesas VS Code Extension HelpのウェブページとVSCodeの画面コピーおよびVSCodeのデバッガ起動時のコンソールログです。





    vscode_debug.log

    vscode_debug.log.20230309.txt
    GDB Server for Renesas targets.
    	Version 9.0.0.v20221226-025508 [2de64c59] (Jan  6 2023 16:58:54)
    
    
    Starting server with the following options: 
            Raw options                : C:/Renesas/e2studio64/SupportFiles/.eclipse/com.renesas.platform_733684649/DebugComp/RX/e2-server-gdb -g SIMULATOR -t R5F51308 -p 61234 -g SIMULATOR -t R5F51308 -uConnectionTimeout= 30 -uPeripheralClkRatio= 1 -uCpuClkFreq= 32 -uRegisterSetting= 0 -uModePin= 0 -uCacheDecode= 1 -uIOModule= IodllForCMT_1u.dll -uIOModule= IodllForICU.dll -n 0 -uWorkRamAddress= 0 -uEmStopInt= 0 -uEmStopInterrupt= 0 -uEmStopFPexp= 0 -l -uCore= SINGLE_CORE|enabled|1|main -uSyncMode= async -uFirstGDB= main --english --gdbVersion= 7.2
    GNU gdb (GDB) 7.8.2-20210419-Build_1
    Copyright (C) 2014 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "--host=i686-pc-mingw32 --target=rx-elf".
    Type "show configuration" for configuration details.
    For bug reporting instructions, please see:
    <http://www.gnu.org/software/gdb/bugs/>.
    Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.
    For help, type "help".
    Type "apropos word" to search for commands related to "word".
    GNU gdb (GDB) 7.8.2-20210419-Build_1
    Copyright (C) 2014 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "--host=i686-pc-mingw32 --target=rx-elf".
    Type "show configuration" for configuration details.
    For bug reporting instructions, please see:
    <http://www.gnu.org/software/gdb/bugs/>.
    Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.
    For help, type "help".
    Type "apropos word" to search for commands related to "word".
    set step-mode off
    set breakpoint always-inserted on
    GDB unhandled notify: cmd-param-changed: {"param":"breakpoint always-inserted","value":"on"}
    inferior 1
    [Switching to inferior 1 [<null>] (<noexec>)]
    set remotetimeout 10
    GDB unhandled notify: cmd-param-changed: {"param":"remotetimeout","value":"10"}
    set tcp connect-timeout 30
    set confirm off
    GDB unhandled notify: cmd-param-changed: {"param":"confirm","value":"off"}
    
    Connecting to SIMULATOR, RX Target
            GDBServer endian           : little
            Target power from emulator : Off
    Starting target connection
    Finished target connection
    GDB: 61234
    connected to remote target localhost:61234
    monitor do_nothing
    info line *224
    No line number information available for address 0xe0
    set backtrace limit 11
    monitor is_target_connected
    Target connection status - OK
    Connection status=connected.
    monitor set_target,R5F51308
    monitor is_target_connected
    Target connection status - OK
    Connection status=connected.
    monitor prg_download_start_on_connect
    Starting download
    exec-file "C:\\Renesas\\GitHubDesktop\\workspaces\\work_vscode\\tb_rx130_ccrx_minimal/build/name.x"
    load "C:\\Renesas\\GitHubDesktop\\workspaces\\work_vscode\\tb_rx130_ccrx_minimal/build/name.x"
    Loading section PResetPRG, size 0x29 lma 0xffff8000
    Loading section .rodata, size 0x34 lma 0xffff802c
    Loading section C$DSEC, size 0x24 lma 0xffff8060
    Loading section C$BSEC, size 0x18 lma 0xffff8084
    Loading section C$VECT, size 0x400 lma 0xffff809c
    Loading section .data, size 0x4 lma 0xffff849c
    Loading section PIntPRG, size 0xf2 lma 0xffff84a0
    Loading section .text, size 0x71 lma 0xffff8592
    Loading section FIXEDVECT, size 0x80 lma 0xffffff80
    Start address 0xffff8000, load size 1664
    Transfer rate: 85 KB/sec, 184 bytes/write.
    load "C:\\Renesas\\GitHubDesktop\\workspaces\\work_vscode\\tb_rx130_ccrx_minimal/build/name.x"
    Loading section PResetPRG, size 0x29 lma 0xffff8000
    Loading section .rodata, size 0x34 lma 0xffff802c
    Loading section C$DSEC, size 0x24 lma 0xffff8060
    Loading section C$BSEC, size 0x18 lma 0xffff8084
    Loading section C$VECT, size 0x400 lma 0xffff809c
    Loading section .data, size 0x4 lma 0xffff849c
    Loading section PIntPRG, size 0xf2 lma 0xffff84a0
    Loading section .text, size 0x71 lma 0xffff8592
    Loading section FIXEDVECT, size 0x80 lma 0xffffff80
    Start address 0xffff8000, load size 1664
    Transfer rate: 232 KB/sec, 184 bytes/write.
    monitor prg_download_end
    Finished download
    monitor reset
    monitor enable_stopped_notify_on_connect
    
    Program received signal SIGINT, Interrupt.
    PowerON_Reset_PC () at C:\Renesas\GitHubDesktop\workspaces\work_vscode\tb_rx130_ccrx_minimal\generate\/resetprg.c:80
    80	void PowerON_Reset_PC(void)
    monitor enable_execute_on_connect
    monitor do_nothing
    set backtrace limit 11
    Hardware breakpoint set at address 0xffff85b4
    
    Temporary breakpoint 1, main () at C:\Renesas\GitHubDesktop\workspaces\work_vscode\tb_rx130_ccrx_minimal\src\/tb_rx130_ccrx_minimal.c:29
    29	        __nop();
    

     

  • > (しかし、たぶん、MSYSはe2 studioインストール時に一緒にインストールされている筈のmakeで事足りるだろうと思います。同様に、たぶん、Python 2.7もe2 studioインストール時に一緒にインストールされている筈のPython 2.7で事足りるだろうと思います。)

    この件、試してみました。確かにそれで事足りました。(ですので、e2 studioインストール済みなら、MSYSもPython 2.7もインストールする必要は無いです。)

    以下、Windowsのコントロールパネルの環境変数の設定画面です。(インストールパスは実際にインストールしたパスに読み替えて下さい。ちなみに、私は数年前にe2 studioのフォルダ設定をカスタマイズした時にSupportFilesというフォルダ名に変更してずっと引き継ぎながら使っていたのですけれども、このフォルダは普通にはSupportFoldersとした方が通りが良いですね。そのうち変えようかと思います。)



     

  • 上から目線になってしまうのも何ですけれども、今回のテクニカルプレビュー版で、どうなるのかな/どういうつもりなのかな、と思うところはあります。

    ・ ほぼ最終版のつもりで公開するタイプのプレビューなのかな?まだまだマイルストーンを重ねていくタイプのプレビューなのかな?

    ・ どちらにせよ、プレビューは意見を募る目的があるのが一般的ですけれども果たしてそのつもりがあるのかな?(どこにレポートすれば良いのかな?) 一応、ワールドワイド向けのRulzにも投稿してみたのですけれども、そのフォーラムでは的外れなのでは?という感はしています、、、

    Issues of the Renesas Extensions for Visual Studio Code
    www.google.com/search?q=community.renesas.com/tools/misc_tools/f/misc-tools-forum/30076/issues-of-renesas-extensions-for-visual-studio-code


    ちなみに、CC-RLのC++14のテクニカルプレビュー版も同じ印象がありますけれども、、、

  • > ワールドワイド向けのRulzにも投稿してみたのですけれども
    > (1) CMake doesn't support CC-RX/RL/RH and the Renesas' workaround is NOT good.
    これについてはどこがなぜアカンと思ったのかを指摘してしまった方が話が早くなるかと思います。

  • ほや さん、こんにちは。NoMaYです。

    リプライありがとうございます。以下の件、おいおいやっていきますけれども、先日書いたMakefileでの例え話と同様に、業務をお願いしている協力会社の担当の人に、ちゃんとMakefileを用意して下さいね、と言って、出来ました!、ということで送られてきたものを見たところ、依存関係記述が全く無かった、みたいな話でもあるわけですので、「どこがなぜアカン」ということを分かって貰うのは、そもそも、Makeとは何か、何の為にあるのか、同じくMakefileとは、といったことにまで遡っていくような話にも似た話にもなりかねないので、なかなか大変そうです、、、

    > これについてはどこがなぜアカンと思ったのかを指摘してしまった方が話が早くなるかと思います。


    別の例え話として、昔、e2 studioで、何もソースを変更していないのにビルドすると大量のコンパイルが行われる、といった案件があったと記憶していますけれども、もし万一「それのどこが悪いのかサッパリ分からない(ディベート的な返答では無くて本気でそう思っている)」人に理解して貰うのが大変なのと似たようなものかなぁ、とも思います、、、

    それから、e2 studioで、というので思い浮かんだ、クリーンビルド時にコード再生成されること、とかもかなぁ、、、