Create a VEE Port

This section describes the steps to create a new VEE Port with the SDK, and options to connect it to an external Board Support Package (BSP) as well as a third-party C toolchain.

Note

If you own a legacy VEE Port, you can either create your VEE Port again from scratch, or follow the Former Platform Migration chapter.

VEE Port Project Creation

The first step is to create a VEE Port configuration project:

  • Click File > New > Project from Version Control….

  • Select Repository URL.

  • Select Git as Version control.

  • Fill the URL of the VEE Port Project Template Github Repository.

  • Fill the Directory in which the Project Template must be cloned.

  • Click on Clone button.

Version Control Window in Android Studio

Version Control Window in Android Studio

  • When the Gradle project is loaded, select View > Tool Windows > Terminal.

  • In the integrated terminal, run the following command at the root of the project to remove the Git Repository:

    rm -r -Force .git*
    
  • Rename the project and change its group and version in the build.gradle.kts build script.

Architecture Selection

The next step is to select an Architecture compatible with your device instructions set and C compiler. A VEE Port requires exactly one Architecture. MicroEJ Corp. provides MicroEJ Evaluation Architectures for most common instructions sets and compilers at https://repository.microej.com/modules/com/microej/architecture. Please refer to the chapter Architectures MCU / Compiler for the details of ABI and compiler options.

If the requested MicroEJ Architecture is not available for evaluation or to get a MicroEJ Production Architecture, please contact your MicroEJ sales representative or our support team.

Once you know which Architecture to use, add it as a dependency of the VEE Port project in the vee-port/build.gradle.kts file:

dependencies {

    microejArchitecture("com.microej.architecture.[ISA].[TOOLCHAIN]:[UID]:[VERSION]")

}

The [UID] of the dependency needed for your VEE Port can be found in the chapter Architectures MCU / Compiler. Check the table of your corresponding Architecture and follow the link in the Module column.

For example, to declare the MicroEJ Evaluation Architecture version 8.1.1 for Arm® Cortex®-M4 microcontrollers compiled with GNU CC toolchain:

dependencies {

    microejArchitecture("com.microej.architecture.CM4.CM4hardfp_GCC48:flopi4G25:8.1.1")

}

Runtime Capability

Depending on the selected Architecture, several Runtime Capabilities are available: mono, multi or tiny. The Capability used for the VEE Port can be defined thanks to the com.microej.runtime.capability property in the vee-port/configuration.properties file of the VEE Port Configuration project:

com.microej.runtime.capability=multi

Pack Import

MicroEJ Pack provides additional features on top of the MicroEJ Architecture such as Graphical User Interface or Networking. This is the primary mechanism for augmenting the capabilities of a VEE Port.

A MicroEJ Pack is a group of related files (Foundation Libraries, scripts, link files, C libraries, Simulator Mock, tools, etc.) that together provide all or part of a VEE Port capability.

A Pack can extend an Architecture with additional capabilities such as:

Note

MicroEJ Packs are optional. You can skip this section if you intend to integrate MicroEJ runtime only with custom libraries.

To add a MicroEJ Pack, add it as a dependency of the VEE Port configuration project in the build.gradle.kts file:

dependencies {

    // MicroEJ Architecture Specific Pack
    microejPack("com.microej.architecture.[ISA].[TOOLCHAIN]:[UID]-[NAME]-pack:[VERSION]")

    // MicroEJ Generic Pack
    microejPack("com.microej.pack.[NAME]:[NAME]-pack:[VERSION]")

    // Legacy MicroEJ Generic Pack
    microejPack("com.microej.pack:[NAME]:[VERSION]")

}

For example, to declare the MicroEJ Architecture Specific Pack UI version 14.0.1 for MicroEJ Architecture flopi4G25 on Arm® Cortex®-M4 microcontrollers compiled with GNU CC toolchain:

dependencies {

    // MicroEJ Architecture Specific Pack
    microejPack("com.microej.architecture.CM4.CM4hardfp_GCC48:flopi4G25-ui-pack:14.0.1")

}

To declare the MicroEJ Generic Pack Bluetooth version 2.1.0:

dependencies {

    // MicroEJ Generic Pack
    microejPack("com.microej.pack.bluetooth:bluetooth-pack:2.1.0")

}

And to declare the Legacy MicroEJ Generic Pack Net version 9.2.3:

dependencies {

    // Legacy MicroEJ Generic Pack
    microejPack("com.microej.pack:net:9.2.3")

}

Enabling/Disabling modules of Legacy and Architecture Specific Packs

Architecture Specific Packs and Legacy Packs may contain multiple modules. They are all automatically installed during the VEE Port build, but can de disabled individually by configuration. This is not the case for the Generic Packs, which always contain only one module. Therefore, if you want to disable the module of a Generic Pack, simply remove the Pack dependency.

The modules of the Architecture Specific Packs and Legacy Packs can be enabled/disabled in the vee-port/configuration.properties file of the VEE Port Configuration project by adding the property com.microej.runtime.<module>.<feature>.enabled=true|false for each module that must be enabled/disabled. The <feature> is optional. When no feature is defined, the whole module is enabled/disabled. Here are some examples:

# Disable the "display_decoder_bmpm" feature of the "ui" module of the Pack UI
com.microej.runtime.ui.display_decoder_bmpm.enabled=false

# Disable the whole "ssl" module of the Pack Net
com.microej.runtime.ssl.enabled=false

For a complete list of the properties allowing to enable/disable modules, refer to the VEE Port Project Template.

Packs Configuration

Packs can be configured in the vee-port/configuration.properties file of the VEE Port Configuration project. Each Pack provides a set of option which follows the pattern name com.microej.pack.<module>.<option>=<value>. Here are some examples:

# Defines the number of bits per pixels the display device is using to render a pixel
com.microej.pack.display.bpp=argb8888

# Defines the native file system user directory
com.microej.pack.fs.user.dir=/home/microej

# Defines the native stack you want to use
com.microej.pack.net.stack=bsd

VEE Port Usage

Depending on your use case, there are different ways to use the VEE Port from an Application or a Library. All of them are described in the Select a VEE Port page.

In a nutshell,

VEE Port Customization

The VEE Port Configuration project can contain an optional vee-port/dropins folder. The full content of this folder will be copied in the VEE Port during the build. Files in the dropins folder have the highest priority. If one file has the same path and name as a file already installed in the VEE Port, the file from the dropins folder will be used in the built VEE Port. This feature allows to add or overwrite libraries, tools, etc. into the VEE Port.

The dropins folder organization should respect the VEE Port files and folders organization. For instance, the tools are located in the sub-folder tools. In order to see how the VEE Port files and folders are organized, launch a VEE Port build without the dropins folder by executing the Gradle task buildVeePort. The built VEE Port is located in the folder vee-port/build/vee. Then fill the dropins folder with additional features and build again the VEE Port to get a customized VEE Port.

VEE Port Publication

Publishing a VEE Port in a repository allows to make it easily available to any project.

To be able to publish a VEE Port, you have to make sure that the group and version property are defined in the vee-port/build.gradle.kts file:

group = "com.mycompany"
version = "1.0.0"

The name of the artifact can be defined in the settings.gradle.kts file with the rootProject.name property. It is set by default to the folder name of the project.

Once these properties are defined, the publication of a VEE Port is done, as any other Gradle project, by executing the publish task.

An important point to notice is that publishing a VEE Port does not publish the built VEE Port, it publishes all the configuration and dropins of the project, as well as the BSP when it is configured in Full Connection mode. The VEE Port is then built on the fly when it is required (when building the Executable of an Application for example).

BSP Publication Filtering

If the VEE Port is configured in Full BSP Connection, the BSP is included in the VEE Port when it is published. Since the BSP can be big and all the files are not necessary to build an Executable, the SDK provides configuration properties to filter the BSP files in publish:

  • bsp.publication.includes.pattern: comma-separated list of Ant-style files and folders patterns to include in the published VEE Port. By default all the files and folders are included.

  • bsp.publication.excludes.pattern: comma-separated list of Ant-style files and folders patterns to exclude from the published VEE Port. By default no files or folders are excluded.

Here is an example which excludes 3 folders:

bsp.publication.includes.pattern=**/*
bsp.publication.excludes.pattern=**/VEE_PORT_EVAL/,**/WIN32/,**/Utilities/Media/

Refer to the Javadoc of the Gradle PatternFilterable class to have more details on the Ant-style patterns.

BSP Connection

In order to build the Executable of an Application, the BSP Connection must be configured. Refer to the BSP Connection section for more details.