Remote projects on RT-Druid

From ERIKA WIKI
Revision as of 17:52, 9 February 2018 by Nicola (talk | contribs)
Jump to: navigation, search

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

To add the support for remote projects, it is necessary to install two plugins:

  • 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 update site of Eclipse (e.g., neon)
  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

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.
  6. On the remote filesystem, select the directory that will host the project.
    Then, click the right mouse button and select Create Remote Project
    Figure 8: New remote project.
  7. 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.

OIL support

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 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
    • Specify the path on the local filesystem where the RT-Druid packet is located
      Figure 12: Specifying ERIKA files path.
  • Click Ok to complete the configuration

Generation

Currently, if the automatic build flag is checked (in the Project menu), RT-Druid tries to re-generate 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.

SSH console

Once the TM Terminal plugin has been installed (as explained above), it is possible to open a view containing an SSH console.
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. Run the make command to build ERIKA:
    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)