Skip to content
This repository has been archived by the owner on Dec 26, 2022. It is now read-only.

feat(endpoint): Integrate Legato AF #576

Closed
splasky opened this issue Apr 20, 2020 · 6 comments · Fixed by #630
Closed

feat(endpoint): Integrate Legato AF #576

splasky opened this issue Apr 20, 2020 · 6 comments · Fixed by #630
Assignees
Labels
A-endpoint Area - Endpoint of tangle-accelerator C-feature Category - feature

Comments

@splasky
Copy link
Contributor

splasky commented Apr 20, 2020

Build endpoint as legato app.

@marktwtn
Copy link
Contributor

marktwtn commented May 25, 2020

The cross compiler problem is hard to resolve even if I check the official Bazel document or the Bazel example.

The description is not enough and when I tried the example, there are some problems like the header inclusion.
The cross compiler headers are not under the system default inclusion path, hence Bazel requires them to be included explicitly.

Besides, we have 2 build system, Bazel and Makefile.
To build the libendpoint.so, we need to use the Makefile to build the third-party source code first and use Bazel to generate the libendpoint.so.
Therefore, we need to handle the cross compiler on the both side.

I decide to use Makefile only to build the libendpoint.so.
Using Bazel took me too much time.


Although we already have some cross compiler enabled in tangle-accelerator with Bazel, but it is hard to let Makefile use it.
Cross compile code example: $ bazel build --config=[armv7|aarch64] //XXXXXX.

@splasky
Copy link
Contributor Author

splasky commented May 25, 2020

If we move the mbedtls and the http-parser into bazel build system. Will it be easier?

@marktwtn
Copy link
Contributor

If we move the mbedtls and the http-parser into bazel build system. Will it be easier?

I don't think so. We have to study the building relation first and convert them to Bazel.
Especially the source code structure of mbedtls is kind of complicated.
Besides, these repositories are not maintained by us.

@marktwtn
Copy link
Contributor

marktwtn commented May 26, 2020

Here is another potential problem which should be taken care with.

In order to build the app with leaf, we have to create the Legato development environment and make sure the tangle-accelerator is under the directory.
However, when Bazel tries to use the cross compiler, it seems that the compiler should be located under the tangle-accelerator directory. But the compiler of Legato probably is located under another directory out of tangle-accelerator.

The real behaviour has not been run yet.
I just point out the potential problem for preparation.

@jserv jserv changed the title feat(endpoint): Integrate to legato runtime feat(endpoint): Integrate Legato AF May 26, 2020
@marktwtn
Copy link
Contributor

The recommended steps for building anything for Legato is to use the tools offer by it.

Using the Bazel to build the shared library directly for endpoint app would not work.
The reasons are:

  • It needs effort to do the cross compiler integration, and we are not sure about whether it is workable or not.
  • It is not recommended by Legato. Using their tools is better than using their compiler directly.

The possible steps:

  • Use Bazel to download the necessary files.
  • Use mkexe or mkcomp to build the libendpoint.so shared library.

@marktwtn
Copy link
Contributor

marktwtn commented May 27, 2020

Here are the experimented steps:

  • First, use the Bazel to build the libendpoint.so with the native compiler.
    For example:
    $ bazel --output_base=[the_assigned_path_of_external_source_code] build //endpoint:libendpoint.so
    The main purpose of the action is to download the external source code for the later usage.

  • Second, use Component.cdef to include all the required headers and source code.
    Then use the command $ mkapp -v -t wp77xx endpoint.adef to generate the app.

  • Last, update the app to mangOH Red
    $ update endpoint.wp77xx.update [IP address of mangOH Red]

marktwtn added a commit that referenced this issue May 30, 2020
The files and directory structure are changed.
The directory endpoint/endpointComp is for building the Legato app.
The endpoint/endpoint.c is renamed as endpoint/endpoint_core.c to
separate the core functions. Same as the endpoint/endpoint.h.

New:
To build the endpoint Legato app, use the command 'make legato'.
It is implemented with the mkapp command.

Besides, the shared library libendpoint.so can be generated with Bazel
as well.

Close #576.
marktwtn added a commit that referenced this issue May 30, 2020
The files and directory structure are changed.
The directory endpoint/endpointComp is for building the Legato app.
The endpoint/endpoint.c is renamed as endpoint/endpoint_core.c to
separate the core functions. Same as the endpoint/endpoint.h.

New:
To build the endpoint Legato app, use the command 'make legato'.
It is implemented with the mkapp command.

Besides, the shared library libendpoint.so can be generated with Bazel
as well.

Close #576.
marktwtn added a commit that referenced this issue Jun 1, 2020
The files and directory structure are changed.
The directory endpoint/endpointComp is for building the Legato app.
The endpoint/endpoint.c is renamed as endpoint/endpoint_core.c to
separate the core functions. Same as the endpoint/endpoint.h.

New:
To build the endpoint Legato app, use the command 'make legato'.
It is implemented with the mkapp command.

Besides, the shared library libendpoint.so can be generated with Bazel
as well.

Close #576.
@jserv jserv closed this as completed in #630 Jun 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-endpoint Area - Endpoint of tangle-accelerator C-feature Category - feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants