Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt System layer to Zephyr OS #1594

Merged
merged 3 commits into from
Jul 17, 2020

Conversation

Damian-Nordic
Copy link
Contributor

Problem

Make System layer build on Zephyr OS

Summary of Changes

The system layer uses pipe() function to create a dummy data stream needed to wake a thread waiting for sockets. Unfortunately, pipe() is unavailable in Zephyr API, so create an abstract object - SystemWakeEvent - which can be implemented using any primitives available on a given platform.

Originally the change was part of #1494 PR, but it was requested as a separate change set by @rwalker-apple.

Damian-Nordic and others added 3 commits July 14, 2020 11:57
The System layer was based on the assumption that when
BSD socket API is available then other POSIX functions
can be used as well. Unfortunately, this is not the case
in Zephyr which only implements a subset of POSIX
requirements.

Replace usage of pipe() system call with an equivalent
usage of socketpair(). Update KConfig of the door-lock
example for nrfconnect platform to set up networking
properly.

This only makes sure that libSystemLayer.a builds correctly
when NCS and the socket-based Inet layer is used. However,
the Inet layer itself still has some build issues which
need to be resolved.
@Damian-Nordic Damian-Nordic changed the title Feature/systemwakeevent Adapt System layer to Zephyr OS Jul 14, 2020
@github-actions
Copy link

Size increase report for "nrf-example-build"

File Section File VM
Full report output
BLOAT REPORT

Files found only in the build output:
    report.csv

Comparing ./master_artifact/chip-nrf52840-lock-example.out and ./pull_artifact/chip-nrf52840-lock-example.out:

sections,vmsize,filesize
[Unmapped],0,7
.debug_info,0,-7


@github-actions
Copy link

Size increase report for "linux-example-build"

File Section File VM
chip-standalone-demo.out .eh_frame 152 152
chip-standalone-demo.out .text 64 64
chip-standalone-demo.out .eh_frame_hdr 40 40
Full report output
BLOAT REPORT

Files found only in the build output:
    report.csv

Comparing ./master_artifact/chip-standalone-demo.out and ./pull_artifact/chip-standalone-demo.out:

sections,vmsize,filesize
.debug_info,0,7333
.debug_line,0,2997
.debug_macro,0,1808
.debug_abbrev,0,985
.debug_loc,0,423
.debug_str,0,373
.strtab,0,238
.eh_frame,152,152
.symtab,0,144
.debug_aranges,0,112
.text,64,64
.eh_frame_hdr,40,40
.debug_ranges,0,-16
[Unmapped],0,-261


@github-actions
Copy link

Size increase report for "esp32-example-build"

File Section File VM
Full report output
BLOAT REPORT

Files found only in the build output:
    report.csv

Comparing ./master_artifact/chip-wifi-echo.elf and ./pull_artifact/chip-wifi-echo.elf:

sections,vmsize,filesize
[Unmapped],0,4
.debug_info,0,-4


@github-actions
Copy link

Size increase report for "gn_nrf-example-build"

File Section File VM
Full report output
BLOAT REPORT

Files found only in the build output:
    report.csv


@github-actions
Copy link

Size increase report for "gn_linux-example-build"

File Section File VM
Full report output
BLOAT REPORT

Files found only in the build output:
    report.csv


@rwalker-apple
Copy link
Contributor

lgtm


Error SystemWakeEvent::Open()
{
mFD = eventfd(0, EFD_NONBLOCK);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you verified this change on Zephyr?

@andy31415 andy31415 merged commit 6465fc7 into project-chip:master Jul 17, 2020
kedars pushed a commit to kedars/connectedhomeip that referenced this pull request Jul 21, 2020
* Adapt System layer to Zephyr socket API

The System layer was based on the assumption that when
BSD socket API is available then other POSIX functions
can be used as well. Unfortunately, this is not the case
in Zephyr which only implements a subset of POSIX
requirements.

Replace usage of pipe() system call with an equivalent
usage of socketpair(). Update KConfig of the door-lock
example for nrfconnect platform to set up networking
properly.

This only makes sure that libSystemLayer.a builds correctly
when NCS and the socket-based Inet layer is used. However,
the Inet layer itself still has some build issues which
need to be resolved.

* Use eventfd for system event

* Adapt to GN build system and add unit tests

Co-authored-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
kedars pushed a commit to kedars/connectedhomeip that referenced this pull request Jul 21, 2020
* Adapt System layer to Zephyr socket API

The System layer was based on the assumption that when
BSD socket API is available then other POSIX functions
can be used as well. Unfortunately, this is not the case
in Zephyr which only implements a subset of POSIX
requirements.

Replace usage of pipe() system call with an equivalent
usage of socketpair(). Update KConfig of the door-lock
example for nrfconnect platform to set up networking
properly.

This only makes sure that libSystemLayer.a builds correctly
when NCS and the socket-based Inet layer is used. However,
the Inet layer itself still has some build issues which
need to be resolved.

* Use eventfd for system event

* Adapt to GN build system and add unit tests

Co-authored-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
@Damian-Nordic Damian-Nordic deleted the feature/systemwakeevent branch July 21, 2020 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants