Introducing CMake is an important step in a larger effort to make
Zephyr easy to use for application developers working on different
platforms with different development environment needs.
Simplified, this change retains Kconfig as-is, and replaces all
Makefiles with CMakeLists.txt. The DSL-like Make language that KBuild
offers is replaced by a set of CMake extentions. These extentions have
either provided simple one-to-one translations of KBuild features or
introduced new concepts that replace KBuild concepts.
This is a breaking change for existing test infrastructure and build
scripts that are maintained out-of-tree. But for FW itself, no porting
should be necessary.
For users that just want to continue their work with minimal
disruption the following should suffice:
Install CMake 3.8.2+
Port any out-of-tree Makefiles to CMake.
Learn the absolute minimum about the new command line interface:
$ cd samples/hello_world
$ mkdir build && cd build
$ cmake -DBOARD=nrf52_pca10040 ..
$ cd build
$ make
PR: zephyrproject-rtos#4692
docs: http://docs.zephyrproject.org/getting_started/getting_started.html
Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
The addrlen of accept() and recvfrom() is a value-result argument. It
should be updated to the actual size of the source address after
calling accept() and recvfrom().
Signed-off-by: Aska Wu <aska.wu@linaro.org>
Due to parameters used, net_context_recv() call cannot fail (it just
installs a callback, no I/O performed).
Coverity-CID: 178247
Fixes: #4581
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
net_context_sendto() returns an error if dest address is NULL.
If dest address is available, net_conext_sendto() should be used.
Otherwise, net_context_send() should be used.
Fixes#4347
Signed-off-by: Aska Wu <aska.wu@linaro.org>
send()/sendto() aren't "front facing" functions, so when user calls
them, context type hopefully should be already validated by other
functions. They are also on critical path of app/network performance,
so getting rid of extra check helps a little bit too. This also
fixes a warning of "err" possibly being used non-initialized.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
sendto() and recvfrom() are often used with datagram socket.
sendto() is based on net_context_sendto() and recvfrom() is based on
zsock_recv() with parsing source address from the packet header.
Signed-off-by: Aska Wu <aska.wu@linaro.org>
This is useful to enable error/warning logging across the net
codebase (less useful for debug level logging, but that's true
for CONFIG_NET_LOG_GLOBAL already).
Implementation-wise, instead of keeping adding to long list of
"select"'s in CONFIG_NET_LOG_GLOBAL and thus introduce component
inter-dependencies, add "default y if NET_LOG_GLOBAL" to
individual components' logging options.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
When new socket context is created on accepting connection to a
listening socket, its recv_q FIFO should be initialized. Without
initialization, this worked by a chance when FIFO structure was
simple, but recent change to add dlist to it (which now needs
proper initialization) exposed this issue.
Jira: ZEP-2576
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
This is how it's called in the main docs, so use this same phrase in
Kconfig and samples too.
Also, added some articles to docs.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
For an accepted socket, we should set our receive callback and start
to queue packets ASAP (in the accept callback itself). Otherwise,
(if done in accept() call like before) we may miss to queue some
packets.
This issue wasn't exposed with slow SLIP and with emulated QEMU, but
easily exposed with Ethernet on a real hardware.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Coverity complains about non-checked return values here. This is false
positive as the return values do not need checking in this special
case because we are closing the socket.
Coverity-CID: 173646
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
As we buffer incoming packets in receive callbacks, we must decrease
receive window to avoid situation that incoming stream for one socket
uses up all buffers in the system and causes deadlock. Once user app
consumes queued data using recv() call, we increase window again.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
ReST defines interpreted text roles where text enclosed by single quotes
can be "intrepreted", for example :ref:`some name` becomes a link to
a label anywhere in the doc set named "some name", :c:func:`funcname()`
becomes a link to the API documentation for "funcname", and
:option:`CONFIG_NAME` becomes a link to, in our case, the documentation
for the generated Kconfig option.
This patch fixes uses of `some name` (without a role) by either adding
an explicit role, or changing to ``some name``, which indicates inline
code block formatting (most likely what was intended).
This is a precursor to changing the default behavior of interpreted
text to treat `some name` as :any:`some name` (as configured in
doc/conf.py), which would attempt to create a link to any available
definition of "some name".
We may not change this default role behavior, but it becomes an option
after the fixes in this patch. In any case, this patch fixes incorrect
uses of single-quoted text (possibly introduced because GitHub's
markdown language uses single-quoted text for inline code formatting).
Jira: ZEP-2414
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
poll() allows to (efficiently) wait for available data on sockets,
and is essential operation for working with non-blocking sockets.
This is initial, very basic implementation, effectively supporting
just POLLIN operation. (POLLOUT implementation is dummy - it's
assumed that socket is always writable, as there's currently no
reasonable way to test that.)
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
If a socket is closed without reading all data from peer or accepting
all pending connection, they will be leaked. So, flush queues
explicitly.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
With CONFIG_NET_SOCKETS_POSIX_NAMES=y, "raw" POSIX names like
socket(), recv(), close() will be exposed (using macro defines).
The close() is the biggest culprit here, because in POSIX it
applies to any file descriptor, but in this implementation -
only to sockets.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
This adds Kconfig and build infrastructure and implements
zsock_socket() and zsock_close() functions.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>