Remote projects on RT-Druid

From ERIKA WIKI
Jump to: navigation, search

The content of this page is deprecated as we suggest to always use cross-compilation running RT-Druid on a local project.


Introduction

There are some scenarios in which the board has the processing capabilities for running a full compiler for native building.
This is the case, for example, of powerful multi-core ARM SoCs running a Linux distribution, where we may use a hypervisor like Jailhouse for running ERIKA alongside Linux.
In such circumstances, having a native compilation of ERIKA on the target could be easier than cross-compiling using a host machine.
Unfortunately, the Eclipse IDE requires an x86 platform with a fair amount of resources (in terms of both processing and memory).

This guide, therefore, explains how to set-up Eclipse on a host x86 machine, leaving the compilation process on the target.
Handling a remote project can be done manually, of course, by transferring the built files through ftp/scp/rsync or by mounting locally the target filesystem using nfs/sshfs.
However, this guide explains how to use the remote project feature of Eclipse, which internally relies on the sftp protocol.

Important: the code of ERIKA must be available on the target because it is needed by the build process. Similarly, all the tools and the environment variables needed by the building process must be available/set on the target.


Plugins installation on Eclipse

This Section illustrates how to add the support for remote projects to Eclipse.
The procedure, which must be done only once, will install the following plugins into Eclipse:

  • Remote System Explorer User Actions
  • TM Terminal

These plugins can be easily installed through the typical steps for installing a plugin:

  1. MenuHelpInstall new Software
  2. Select the neon update site of Eclipse and wait until the list is properly refreshed
  3. Search General Purpose Tools
    Figure 1: Plugins installation (1).
  4. Select the following plugins:
    • Remote System Explorer User Actions
      which adds support for remote projects
    • TM Terminal
      which allows opening an SSH shell within Eclipse
      Figure 2: Plugins installation (2).
  5. Click in Next to finish the installation, and then restart Eclipse


Establishing a connection with the target

Once Eclipse has been restarted, follow the next steps to establish an SSH connection with the target.

  1. Open the Remote System Explorer perspective (press the button on the right top)
    Figure 3: Open perspective.
  2. From the Remote System view, press the right mouse button on local and create a new connection
    Figure 4: New connection.
  3. Select SSH Only
    Figure 5: New SSH connection.
  4. Specify the connection parameters
    Figure 6: SSH connection parameters.

    This way, a new connection will be created.

  5. Clicking the Sftp branch, Eclipse will ask the credentials to access the file
    Figure 7: SFTP parameters.


Remote project creation

Before creating the remote project in Eclipse, it is important to put a copy of the ERIKA3 RTOS on the target.
This can be easily done by e.g. cloning the Erika3 git repository:

   git clone https://github.com/evidence/erika3.git

In addition, all the needed application files (i.e., oil, .h and .c files) must be transferred to the target as well.

Then, on Eclipse:

  1. On the remote filesystem, select the directory that will host the project on the target.
    Note1: We suggest to specify a directory in pkg/arch/.../examples/.
    Note2: The specified directory must include the oil file and the source files.
    Note3: During the next steps, RT-Druid will create the out/ subdirectory containing the configuration.
    Then, click the right mouse button and select Create Remote Project
    Figure 8: New remote project.
  2. Going back to the C/C++ perspective, it will be possible to see the remote project and, in case, generate the code for ERIKA
    Figure 8: The remote project.
    If the directory selected for the remote project does not yet contain an "RT-Druid" project, the generation of the configuration files for ERIKA won't be supported.

    Follow the next steps to enable such functionality:

    1. Click the right mouse button on the project in the Project Explorer window
    2. Select the Configure item
    3. Click the Add RT-Druid Builder sub-item
      Figure 9: Add RT-Druid builder.

Once this operation is finished, the project will be able of generating the configuration of ERIKA, but still needs to be configured.
In particular, we need to provide the following information:

  • which OIL file contains the system configuration;
  • the path of ERIKA;
  • the path of the generator files.

This information can be provided through the following steps:

  1. Open the project properties (i.e., by clocking with the right button on the project, or selecting ProjectProperties once the project has been selected).
    Figure 10: Project properties.
  2. Select the Oil item and specify the oil file on the target through the Browse button
    Figure 11: Selecting the OIL file.
  3. Select the Erika Files Location item and:
    • In the Manual box, specify the path of ERIKA on the target.
      This path must be specified manually (don't use the File system... button as it has no visibility of the target filesystem).
    • Specify the path on the local filesystem where the RT-Druid packet is located.
      You can select Plugins for using the pack shipped within the current Eclipse tool.
      Figure 12: Specifying ERIKA files path.
  4. Click Ok to complete the configuration

Generation of project configuration files

Once RT-Druid has been configured as illustrated in the previous steps, it is capable of generating the configuration of the specific project starting from the configuration specified in the OIL file. Thus, if the Eclipse automatic build flag is checked (in the Project menu), RT-Druid re-generates the ERIKA configuration files whenever the OIL file specified in the project properties is saved.

Figure 13: Automatic build settings.

It is possible to delete the ERIKA folders by clicking with the right mouse button on the project and selecting the Clean Erika item.

Figure 14: Clean ERIKA files.

The deleted folders can be regenerated through the following steps:

  • Change and modify the OIL file
  • Clean and then rebuild the project
Figure 15: Rebuild the deleted files (1).
Figure 16: Rebuild the deleted files (2).

Note that when the automatic build is not enabled, the system automatically asks if to start a project build.

Project build

Now that the project has been properly configured, and the configuration files have been generated, it is possible to connect to the target and start the native building of the ERIKA3 binary file.

If the TM Terminal plugin has been installed (as illustrated above), it is possible to open a view containing an SSH console from within Eclipse.
Note that this step (as well as the plugin installation) is not mandatory, as it is possible to connect to the target through different tools.
Nevertheless, the next steps show how to use this console for building the binary on the target through the make command.

  1. Open a new view (MenuWindowShow ViewOther...) and search Terminal
    Figure 17: View for SSH connection.
  2. Press the button on the right of the Terminal view to create a new connection:
    Figure 18: New SSH connection.
  3. Select SSH and specify the connection parameters:
    Figure 19: SSH configuration.
  4. Once the console has been created, it is possible to use the typical remote commands (e.g., cd and ls):
    Figure 20: Remote commands.
  5. Enter the out directory within the project directory and run the make command to build the ERIKA binary.
    In case you build a binary for Jailhouse, remember to properly export the JAILHOUSE_DIR variable before starting the build process.
    Figure 21: Make command.

Notes

  • Currently, Acceleo is not capable of generating files on top of the Eclipse virtualization. The generation is therefore done in two steps:
    1. Acceleo generates files in a directory within the local workspace: .metadata/.plugins/com.eu.evidence.rtdruid3.oil.cdt.ui/oil_gen
    2. RT-Druid copies the files from the local to the remote directory (using the Eclipse virtualization)