VSCode for miniHIL

Overview

When developing miniHIL test projects, specialized editors and views for eTrice and CaGe models can be helpful. If you use VSCode, you can install plugins that provide IDE support for MiniHIL projects. This includes:

  • MiniHIL projects

    • build and flash directly from the IDE

  • CaGe test models

    • Syntax highlighting, code completion, validation, navigation

    • Test trace diagrams

    • C targetcode language support (when clangd extension is present)

  • ROOM models

    • Syntax highlighting, code completion, validation, navigation

    • Structure diagrams of actor ports and internal structure

    • Behavior diagrams of actor state machines

Installation

The plugins require an offline installation through .vsix files: * Go to the miniHIL download page (https://dl.protossoftware.de/minihil) and download the etrice-vscode-<version>.vsix and minihil-<version>.vsix files. * Launch VSCode and navigate to the extensions tab on the left side. * At the top of the extensions tab, click the three little dots and select "Install from VSIX…​".

VSIXInstall
  • Navigate to your download location for the .vsix files from earlier and select both the etrice-vscode-<version>.vsix and minihil-<version>.vsix files.

  • After installing the plugins, a VSCode notification should appear in the bottom right, prompting you to install a Java runtime environment for the eTrice language server. Click "download JRE".

DownloadJRE
VSCode notification.

After following these steps, the plugins should be successfully installed and ready for you to program the miniHIL!

Note Depending on project size, it may take a bit before the language server is started and diagrams can be opened.

Editors and views

ROOM

The editor for *.room files provides some typical IDE text editor features:

  • Syntax highlighting

  • ROOM validation

  • Code completion

  • Jump to definition/references

etrice validation completion

From the ROOM editor, there are two ways to open the structure diagram of a ROOM ActorClass from the ROOM editor:

  • Focus on the ActorClass and use the keyboard shortcut Ctrl + Shift + Alt + S

  • Use the Open Structure Diagram above the ActorClass definition

open structure diagram

Similarly, there are two ways to open the behavior (state machine) view of a ROOM ActorClass:

  • Focus on the ActorClass and use the keyboard shortcut Ctrl + Shift + Alt + B

  • Use the Open Behavior Diagram above the ActorClass definition

open behavior diagram

As shown above, you can jump to a code definition of an element in the diagram by selecting it and clicking the Highlight toolbar button. Alternatively, you can use the shortcut Shift + Click.

You can also navigate the behavior and structure diagrams by double clicking on hierarchical elements like ActorRefs and States to open their respective diagrams. They appear in a new tab on the right in VSCode that can freely be moved around.

CaGe

The textual CaGe editor also provides typical IDE features for .cage files:

  • Syntax highlighting

  • CaGe validation

  • Code completion

  • Jump to definition/references

cage validation completion

You can open a trace diagram for the currently focused TestSuite, Step, Sequence, or State Transition Graph by pressing Ctrl + Shift + Alt + C.

cage diagram

Finally, if the VSCode clangd extension is installed, then the C targetcode completion and validation is enabled available in the CaGe editor.

cage targetcode completion validation

Invoking the Build from the IDE

The miniHIL VSCode extension provides a view that integrates the miniHIL gradle build into the IDE.

  • Make sure the miniHIL’s ST-Link debugger and USB-1 port are connected to your PC as described above.

  • In the bottom left corner of VSCode, underneath the file explorer, there is a section labeled MINIHIL PROJECTS that allows you to build and flash projects to the miniHIL

minihil project view

The buttons that appear when mousing over the section have the following functions (from left to right):

  • Open project folder

  • Generate and open HW documentation

  • Open miniHIL dashboard GUI

  • Build miniHIL project

  • Clean miniHIL project

  • Run tests for miniHIL project

  • Debug miniHIL project

  • Flash miniHIL project

For example, click the flash button to build your project and flash it to the miniHIL.

This view can also be dragged around and placed elsewhere. For example it can be placed in the left sidebar to have a miniHIL icon appear that can be clicked to open an independant build menu.