Commit graph

41120 commits

Author SHA1 Message Date
Youvedeep Singh
2341bf93de kernel: posix: reorganize posix internal function.
calculate_timeout function calcualtes timeout in msecs
from timespec. It is used multiple place inside posix
code. So moving it under pthead_common.c file.

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2018-04-03 15:30:44 -04:00
Jukka Rissanen
5e6c2c3a9b tests: net: tc: Run the tests only for qemu_x86
Speedup the CI by only running the tests in qemu_x86 instead of
almost all boards.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-04-03 09:38:14 -04:00
Anas Nashif
fdadb501f7 scripts: cleanup scripts directory
Remove unused and obsolete scripts we used with Kbuild or scripts that
were copied from Linux but never used or modified for Zephyr:

- vercomp: not needed with cmake, version comparison is built-in
- mksysmap: Linux script
- make-ll parallel build script, something that is more suitable in
  $HOME/bin, not in Zephyr tree
- headerdep.pl: Linux specific, not adapted or used with Zephyr
- timestamp: used by other checkpatch scripts under scripts/checkpatch
- move uncrustify.cfg to .uncrustify.cfg in top tree for easy access and
  alongside other configuration files.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-03 09:28:09 -04:00
Andrei Emeltchenko
6f979c39eb Bluetooth: hci_usb: Simplify write function
Use net_buf primitives

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-04-03 15:04:18 +03:00
Mariusz Skamra
276d17df04 Bluetooth: L2CAP: Update LE specific connection result values
This updates result values for LE Credit Based Connection
Response according to Table 4.20 from Core 5.0 Vol 3 Part A.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-04-03 14:30:10 +03:00
Mariusz Skamra
d458f1e7a2 Bluetooth: L2CAP: Use BR definition on connection success
This fixes BR L2CAP to use BT_L2CAP_BR_SUCCESS.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-04-03 14:30:10 +03:00
Ruslan Mstoi
9705f4af46 net: tcp: Fix crash from SYN flood
SYN flood causes crash in RX thread due to NULL pointer access. After
the crash available RX memory is zero, hence echo server does not
respond to echo request.

Signed-off-by: Ruslan Mstoi <ruslan.mstoi@intel.com>
2018-04-03 14:17:24 +03:00
Stig Bjørlykke
97b83ffc2c net: sockets: Check for errors from dns_get_addr_info
When dns_get_addr_info() returns an error it does not call the
resolve callback, and thus the semaphore will not be given.

This fix will avoid a deadlock situation for various errors.

Added some small tests for getaddrinfo().

Signed-off-by: Stig Bjørlykke <stig.bjorlykke@nordicsemi.no>
2018-04-03 14:15:43 +03:00
Stig Bjørlykke
5da0d2928f net: dns: Fix end-of-results callback on error
Callers of dns_get_addr_info() depends on receiving an end-of-results
callback (where 'info' is NULL) when finished. Do this on failure in
cb_recv() instead of pointing to an empty object.

This fix will avoid a deadlock situation in getaddrinfo().

A reply code other than "no error" in the DNS response is a typical
case when the lookup failed and this occurs.

Moved "struct dns_addrinfo info" variable from cb_recv() to dns_read()
because it was now unused in cb_recv().

Adding tests for this requires network access and a DNS server,
or a mechanism for generating a DNS response with a reply code.

Signed-off-by: Stig Bjørlykke <stig.bjorlykke@nordicsemi.no>
2018-04-03 14:14:00 +03:00
Stig Bjørlykke
e652b74860 net: sockets: Do not lookup DNS AAAA entries if IPv6 is disabled
Do not lookup DNS AAAA entries if IPv6 is disabled. The result can not
be used anyway because "struct sockaddr" does not have enough space for
IPv6 address in that case.

Signed-off-by: Stig Bjørlykke <stig.bjorlykke@nordicsemi.no>
2018-04-03 10:23:06 +03:00
Andrew Boie
0a1ea32437 mpu: arm: restrict access to PPB/IO regions
User mode shouldn't be able to read/write to this memory directly,
needs to be done on its behalf by driver system calls.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-04-02 19:54:08 -07:00
Stig Bjørlykke
cde9c00c76 doc: Show a command to enable IPv4 forwarding
Using QEMU host on a Zephyr application using IPv4 to access Internet
requires IPv4 forwarding, so show a command to enable IPv4 forwarding.

Signed-off-by: Stig Bjørlykke <stig.bjorlykke@nordicsemi.no>
2018-04-02 15:26:28 -04:00
Anas Nashif
fe476cc036 tests: ztest: test_main takes no arguments
Some tests were using test_main with arguments causing conflicts during
build.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-01 14:14:16 -04:00
Anas Nashif
e9cc4ac3db samples: fix sample yaml file syntax
Add test definition correctly.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-03-31 11:23:49 -04:00
Ulf Magnusson
c9c18fa8b0 kconfig: Do not source "arch/posix/core/Kconfig"
This file never existed.

'source' currently ignores missing files instead of throwing an error,
due to Zephyr's custom globbing logic.

Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
2018-03-30 17:51:39 -04:00
Ulf Magnusson
96d703f9c2 scripts: Fix misspelled CMake project name
s/Zehpyr/Zephyr/

Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
2018-03-30 17:51:27 -04:00
Ramakrishna Pallala
2b8cf4c98e include: kernel: Fix documentation for TICKLESS_KERNEL API's
Fix documentation scope for TICKLESS_KERNEL API's.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-03-30 12:15:15 -04:00
Ramakrishna Pallala
92489ea4dd include: kernel: Fix typo in fifo API description
Fix typo FIF -> FIFO in API description of k_fifo_peek_head

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-03-30 12:15:15 -04:00
Inaky Perez-Gonzalez
5e7a104e7b tests/kernel/gen_isr_table: fix mispelled 'kerne'
There is a typo in the area description of the testcase (kerne.XYZ vs
kernel.XYZ).

Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2018-03-30 07:56:46 -04:00
Ulf Magnusson
af1ad986b9 drivers: spi: Format SYS_LOG_SPI_LEVEL help nicer
The previous help text rendered as a single paragraph in the Kconfig RST
reference. The new help text renders as a bullet list and matches the
format of SYS_LOG_CRYPTO_LEVEL.

Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
2018-03-29 14:25:24 -04:00
Ulf Magnusson
4703ba7d31 doc: genrest: Use Kconfiglib 2 and improve output
The new version of the reference page for a symbol lists the following
essential and generally useful information at the top of the page:

 - Prompt

 - Type

 - Help text

 - Direct dependencies (from 'depends on', and inherited from if's and
   menus)

 - Defaults

 - Other symbols selecting or implying the symbol

The current symbol value and visibility are no longer displayed. They
don't make much sense in a reference document, as they depend on user
values from configuration files.

The bottom of the reference page also includes the symbol represented in
Kconfig format (including propagated dependencies).

All references to defined symbols appearing in expressions are turned
into links, which can be clicked on to jump to the reference page for
that symbol.

The following (slightly outdated) screenshot gives an idea of the
format:
https://www.dropbox.com/s/a34tlk2ncyus8po/promptandtype.png?dl=0

This commit also removes Kconfiglib 1, since it is no longer used.

Fixes #5622
Fixes #6821

Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
2018-03-29 14:25:24 -04:00
Maureen Helm
c33087d336 build: doc: Add support for a Windows equivalent to .zephyrrc
Adds support for setting user environment variables in the file
%userprofile%\zephyrrc.cmd

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-03-29 10:35:19 -04:00
Jukka Rissanen
217c0edddd samples: net: http_server: Send final chunk
The final ending chunk was not sent after the request was served.
This caused the remote client to constantly send the same request
to the server.

Fixes #6356

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-03-29 16:54:04 +03:00
Tarun Kumar Agarwal
17234a9f59 samples: net: add put and post methods to coap
In sample application of COAP put and post
methods are implemented in coap-server.c
and coap-client.c

Signed-off-by: Tarun Kumar Agarwal <tarun.kumar.agarwal@intel.com>
2018-03-29 09:30:45 -04:00
Ulf Magnusson
93689bdc80 kconfig: Remove no-op selects of choice symbols
Selecting a choice symbol is always a no-op, and the latest version of
Kconfiglib prints a warning. This commit removes all selects of choice
symbols, which might make the Kconfig files a bit clearer and gets rid
of the warnings.

This is just a dumb removal. I did not try to guess the intent of each
select.

Fixes #6849

Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
2018-03-29 08:57:39 -04:00
Ulf Magnusson
6188579063 filter-doc-log.sh: Fix error for empty log file
Running 'make html' in doc/ when doc.log is missing or empty gives the
following error if sphinx-build doesn't write anything on stdout/stderr:

    Error in ./scripts/filter-doc-log.sh: logfile "doc.log" not found.
    Makefile:84: recipe for target ”html” failed
    make: *** [html] Error 1

The problem is that scripts/filter-doc-log.sh tests for the existence of
the log file with [ -s ${LOG_FILE} ], which requires it to be nonempty.

Fix it by using -e instead, which only checks if the log file exists.
scripts/filter-known-issues.py ($KI_SCRIPT) seems to be able to deal
with empty files (and runs quickly).

Fixes #6854

Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
2018-03-29 08:26:47 -04:00
Ulf Magnusson
80c28dbf5e doc: sphinx: Fix broken import of lexer.DtsLexer
When sphinx-build is run under Python 2, running e.g. 'make html' in
doc/ currently causes the following error:

    Exception occurred:
      File "conf.py", line 128, in <module>
        from lexer.DtsLexer import DtsLexer
    ImportError: No module named lexer.DtsLexer

The problem is that doc/extensions/lexer/ contains no __init__.py file,
which prevents Python 2 from finding submodules in it[1].

The problem does not occur for Python 3, due to implicit namespaces
packages:
https://www.python.org/dev/peps/pep-0420/

Add an empty __init__.py to doc/extensions/lexer/ to fix building when
sphinx-build uses Python 2 (2.7 is still the version recommended on the
Sphinx homepage). This won't alter the behavior for Python 3.

(doc/extensions is added to the search path at the beginning of conf.py
and so doesn't need an __init__.py. doc/extensions/zephyr already has an
empty __init__.py.)

[1] https://docs.python.org/2/tutorial/modules.html#packages

Fixes #6851

Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
2018-03-29 08:16:04 -04:00
Anas Nashif
566172f57a ci: update docker image
- g++-multilib
- python serial module

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-03-29 07:51:51 -04:00
Patrik Flykt
e9b00eae75 net: tcp: Move TCP stack to tcp.c
Move core TCP functionality from net_context.c to tcp.c. Create empty
functions that the compiler can remove if TCP is not configured. As a
result remove TCP ifdefs from net_context.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2018-03-29 12:39:43 +03:00
Patrik Flykt
2c748ae6b5 net: context: Fix connect for UDP contexts
Similar to the socket connect() call, calling connect for a UDP
context needs to set both local and remote addresses and port
number. Fix this not to be exclusive for TCP.

Similarly, the remote destination can be a multicast address when
UDP is used.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2018-03-29 12:39:43 +03:00
Patrik Flykt
cfc6b56203 net: context: Factor out TCP receive window handling
Receive window is needed only for TCP.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2018-03-29 12:39:43 +03:00
Patrik Flykt
08110d8295 net: context: Factor out TCP context listen state
Factor out TCP context listening state change.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2018-03-29 12:39:43 +03:00
Patrik Flykt
b5c74b9706 net: context: Refactor queueing of a TCP FIN when closing socket
Queue a TCP FIN packet when needed if the socket was connected or
listening and where FIN wasn't already received.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2018-03-29 12:39:43 +03:00
Patrik Flykt
aed6a227a6 net: context: Remove unnecessary callback clearing
A new context cannot have callbacks set, as it was freshly created
in the beginning of the function. Thus the extra callback clearing
can be removed. This is a left-over from commit ce41d5f432.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2018-03-29 12:39:43 +03:00
Patrik Flykt
081e0eb8af net: context: Refactor net_tcp_send_data()
Refactor net_tcp_send_data() by adding callback information in the
function.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2018-03-29 12:39:43 +03:00
Patrik Flykt
34d82eb949 net: context: Factor out code for TCP receive
Create a function for TCP receive.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2018-03-29 12:39:43 +03:00
Patrik Flykt
d8522657bd net: context: Remove unnecessary ifdefs
Ifdefs around TCP code can be removed since the TCP code will compile
to empty functions when not enabled.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2018-03-29 12:39:43 +03:00
Patrik Flykt
8236e1e5cd net: context: Factor out TCP header length checking
TCP header length checking is needed by net_context.c.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2018-03-29 12:39:43 +03:00
Patrik Flykt
3b579ffb90 net: context: Refactor sendto()
Refactor sendto() code so that destination address and its validity
is checked first, followed by offloading verification. Move context
and shutdown checks into TCP queueing function.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2018-03-29 12:39:43 +03:00
Patrik Flykt
09b67a4825 net: context: Update net_context_sendto()
Only #ifdefs are removed in net_context_sendto().

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2018-03-29 12:39:43 +03:00
Patrik Flykt
7f8b2fc5ce net: tcp: Define empty static functions when TCP is disabled
With CONFIG_NET_TCP is not set, provide empty static inline
prototypes for all TCP functions available to other parts of
the IP stack.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2018-03-29 12:39:43 +03:00
Patrik Flykt
41d21bd123 tests: socket: Enable loopback and net tests
Enable the loopback driver and set up network testing so that it
will not require a SLIP driver. Move values from the extra test
config so that they are always enabled.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2018-03-29 12:39:43 +03:00
Andrew Boie
d5a2400b9f gen_syscall_header.py: fix include issue
This header uses definitions in include/syscall.h but wasn't
explicitly including it.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-03-28 20:52:08 -04:00
Andrew Boie
c67eb56355 gen_syscalls.py: fix include issue
The generated header uses Zephyr's custom integer type
definitions but wasn't including the proper header.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-03-28 20:52:08 -04:00
Ulf Magnusson
4b35875719 kconfiglib: Update to 7245bad9ebb58
Update Kconfiglib to upstream revision 7245bad9ebb58 (+ local Zephyr
modifications), to get the following improvements/fixes in:

 - Print a warning if an int or hex symbol is assigned a value that lies
   outside an active 'range' constraint.

 - Turn 'FOO' into a link in 'select FOO' when generating the Kconfig
   reference documentation.

 - Parenthesize '&&' expressions within '||' expressions --
   (A && B) || (C && D) is more readable than A && B || C && D.

The final two fixes will only be visible once the fix for #5622 gets in.

Fixes #6749
Fixes #6844

Origin: https://github.com/zephyrproject-rtos/Kconfiglib/tree/zephyr

Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
2018-03-28 23:56:49 +02:00
Jukka Rissanen
adb05df4ca net: if: Bring back __net_if_align
The __net_if_align was removed in earlier commits but it needs
to come back as in some arch the alignment of net_if section
will be wrong.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-03-28 17:52:31 +03:00
qianfan Zhao
b2570d2a55 samples: usb: add usb hid mouse sample
this sample expect there has a button in you board, that was
the mouse's left button, tested in linux by using evtest.

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
2018-03-28 10:44:58 -04:00
qianfan Zhao
3cac6b249c usb: hid: Add macros for REPORT descriptor
Add macros for constructing HID Report Descriptors

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
2018-03-28 10:44:58 -04:00
Andrzej Puzdrowski
94ff339cbf subsys: Add a new settings subsystem
Adapt the MyNewt non-volatile configuration system to become a settings
system in Zephyr.
The original code was modifed in the following ways:

* Renamed from config to settings
* Use the zephyr FCB, FS API, and base64 subsystems
* lltoa like function was added to sources as it was required but not
  included in Zephyr itself.
* The original code was modified to use Zephyr's slist.h as single
  linked list implementation.
* Reworked code which was using strtok_r, added function
  for decoding a string to a s64_t value.
* Thank to the above the settings subsys doesn't require newlibc anymore.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-03-28 10:44:20 -04:00
Andrzej Puzdrowski
e33aa5509a subsys: fs: add NFFS rename API implementation
Added file/directory rename implementation basing on NFFS
native support.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-03-28 10:44:20 -04:00