Commit graph

96296 commits

Author SHA1 Message Date
Inaky Perez-Gonzalez b073b29688 tests/booting/stub: remove CONFIG_ARC_INIT
This stub was forcing this configuration option that is not neccesary
and the configuration system is complaining about it, failing most
Arduino101 stub builds.

Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2018-08-12 06:52:48 -07:00
Daniel Egger f3a6e8aa89 sanitycheck: Recommend installing "ply" instead of "python3-ply"
Since a distributions name for the ply package may change, the only
constant name which can be used for a recommendation is the name on
PyPi which happens to be "ply".

Signed-off-by: Daniel Egger <daniel@eggers-club.de>
2018-08-12 11:39:36 +02:00
Laczen JMS 7d2e59813f subsys: fs/nvs: Rewrite for improved robustness
On flash NVS was stored one entry after another including the metadata
of each entry. This has the disadvantage that when an incomplete write
is performed (e.g. due to power failure) the complete sector had to be
rewritten to get a completely functional system.

The present rewrite changed the storage in flash of the data. For each
sector the data is now written as follows: the data itself at the
beginning of the sector (one after the other), the metadata (id, length,
data offset in the sector, and a crc of the metadata) is written from
the end of the sector. The metadata is of fixed size (8 byte) and for
a sector that is completely occupied a metadata entry of all zeros is
used.

Writing data to flash always is done by:
1. Writing the data,
2. Writing the metadata.

If an incomplete write is done NVS will ignore this incomplete write.

At the same time the following improvements were done:
1. NVS now support 65536 sectors of each 65536 byte.
2. The sector size no longer requires to be a power of 2 (but it
still needs to be a multiple of the flash erase page size).
3. NVS now also keeps track of the free space available.

Signed-off-by: Laczen JMS <laczenjms@gmail.com>
2018-08-10 14:16:06 -07:00
Laczen JMS b9dead0a42 subsys: fs/nvs: Improved nvs for larger blocksizes
The nvs module has some disadvantages for larger block size. The data
header and slot are taking up to much space. A rewrite is proposed that
reduces the used storage space for systems with write block size > 4.

The data storage in flash is now one unit consisting of: data_length,
data_id, data and data_length again in a multiple of the write block
size. The data_length at the end is used to validate the correctness of
the flash write and also allows to travel backwards in the filesystem.

As a comparison, on a system with block size 8 byte, a 32 bit values
now fits 1 block including the metadata (length and id). This used to
be 3 blocks.

The data_length will occupy 1 byte if the data length is less than 128
byte, it will occupy 2 byte if the data length is 128 byte or more. The
data length is limited to 16383 byte.

Each write to flash is verified by a read back of the data.

The read performance is improved because reading is done backwards so
the latest items are found first.

When the filesystem is locked it can be unlocked by calling
reinit(), this will clear flash and setup everything for storage.

add sample documentation - README.rst

Update dtsi to include erase_block_size, use erase_block_size in sample

Update prj.conf to include CONFIG_MPU_ALLOW_FLASH_WRITE

Signed-off-by: Laczen JMS <laczenjms@gmail.com>
2018-08-10 14:16:06 -07:00
Ulf Magnusson 9c93e8e87b Kconfig: Have CMake print a note about the changed 'default' behavior
Always print the note to make sure it isn't missed, but make it easy to
disable (by creating an empty file).

The note will be removed later.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-08-10 12:38:28 -07:00
Ulf Magnusson d08a212ea2 Kconfig: Document the new prefer-earlier-defaults behavior
Update the documentation to say that earlier defaults are preferred,
while explaining Kconfig.defconfig files.

Keep the section that covered the Zephyr prefer-later-defaults patch as
documentation for the behavior having changed. It will be linked in a
warning later.

Also add documentation explaining how to configure choices, including
using multiple definition locations to change a choice 'default'.
Document that 'range's can be added/overriden as well. This works
reliably now.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-08-10 12:38:28 -07:00
Ulf Magnusson a8aba2f8d0 Kconfig: Include Kconfig.zephyr last in sample Kconfig files
This will make adding properties to symbols in the base Zephyr Kconfig
files work the same as before.

I didn't actually spot any such cases, so this is just to play it safe.
It also makes the sample Kconfig symbols appear at the top in the
menuconfig interface, which might be nice.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-08-10 12:38:28 -07:00
Ulf Magnusson 3ed9328d33 Kconfig: Get rid of some leftover 'option env's
These are no longer required. Kconfiglib expands references to
environment variables directly.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-08-10 12:38:28 -07:00
Ulf Magnusson ec3eff57e0 Kconfig: Use the first default with a satisfied condition
Up until now, Zephyr has patched Kconfig to use the last 'default' with
a satisfied condition, instead of the first one. I'm not sure why the
patch was added (it predates Kconfiglib), but I suspect it's related to
Kconfig.defconfig files.

There are at least three problems with the patch:

  1. It's inconsistent with how Kconfig works in other projects, which
     might confuse newcomers.

  2. Due to oversights, earlier 'range' properties are still preferred,
     as well as earlier 'default' properties on choices.

     In addition to being inconsistent, this makes it impossible to
     override 'range' properties and choice 'default' properties if the
     base definition of the symbol/choice already has 'range'/'default'
     properties.

     I've seen errors caused by the inconsistency, and I suspect there
     are more.

  3. A fork of Kconfiglib that adds the patch needs to be maintained.

Get rid of the patch and go back to standard Kconfig behavior, as
follows:

  1. Include the Kconfig.defconfig files first instead of last in
     Kconfig.zephyr.

  2. Include boards/Kconfig and arch/<arch>/Kconfig first instead of
     last in arch/Kconfig.

  3. Include arch/<arch>/soc/*/Kconfig first instead of last in
     arch/<arch>/Kconfig.

  4. Swap a few other 'source's to preserve behavior for some scattered
     symbols with multiple definitions.

     Swap 'source's in some no-op cases too, where it might match the
     intent.

  5. Reverse the defaults on symbol definitions that have more than one
     default.

     Skip defaults that are mutually exclusive, e.g. where each default
     has an 'if <some board>' condition. They are already safe.

  6. Remove the prefer-later-defaults patch from Kconfiglib.

Testing was done with a Python script that lists all Kconfig
symbols/choices with multiple defaults, along with a whitelist of fixed
symbols. The script also verifies that there are no "unreachable"
defaults hidden by defaults without conditions

As an additional test, zephyr/.config was generated before and after the
change for several samples and checked to be identical (after sorting).

This commit includes some default-related cleanups as well:

  - Simplify some symbol definitions, e.g. where a default has 'if FOO'
    when the symbol already has 'depends on FOO'.

  - Remove some redundant 'default ""' for string symbols. This is the
    implicit default.

Piggyback fixes for swapped ranges on BT_L2CAP_RX_MTU and
BT_L2CAP_TX_MTU (caused by confusing inconsistency).

Piggyback some fixes for style nits too, e.g. unindented help texts.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-08-10 12:38:28 -07:00
Vinayak Kariappa Chettimada ddb7f88f9e drivers: entropy: nrf5: Fix ENTROPY_BUSYWAIT implementation
Fixed the ENTROPY_BUSYWAIT implementation from vectoring to
RNG ISR which was preventing the busywait loop to hang
waiting on the VALRDY event which was getting cleared in the
ISR.

Fixes #9356.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-08-10 15:16:18 +02:00
Praful Swarnakar 68bde79ee5 tests: kernel: device: Add RTM link, description and doxygen group
Add RTM links, description and doxygen group for device test cases.

Signed-off-by: Praful Swarnakar <praful.swarnakar@intel.com>
2018-08-10 04:06:42 -07:00
Ajay Kishore b3f4d6b057 tests: lifo: Add description and RTM links
Add doxygen groups, description and RTM links for
lifo test cases

Signed-off-by: Ajay Kishore <ajay.kishore@intel.com>
2018-08-10 04:03:59 -07:00
Ajay Kishore dec8b9e559 tests: msgq: Add description and RTM links
Add doxygen groups, description and RTM links for
msgq test cases

Signed-off-by: Ajay Kishore <ajay.kishore@intel.com>
2018-08-10 04:03:16 -07:00
Spoorthi K 234f48e1ef tests: userspace: Add description and doxygen links
Add description and doxygen links to userspace test cases

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-08-10 03:55:44 -07:00
Spoorthi K 6910f15fcf tests: protection: Add description and doxygen group
Add description and doxygen groups for protection
test cases

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-08-10 03:55:44 -07:00
Spoorthi K b32b39af05 tests: userspace: Remove extra call to same testcase
The test read_kobject_user_pipe() is called twice in
the test suite. There is no need of calling same test
twice. Removing the extra call.

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-08-10 03:54:43 -07:00
Spoorthi K 0975663e3f tests: x86_mmu_api: Add description and doxygen groups
Add description, RTM links and doxygen groups for
x86_mmu_api test cases.

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-08-10 03:53:57 -07:00
Spoorthi K 477219b2dc tests: syscall: Add description and RTM links
Add description, RTM links and doxygen groups for
syscall test cases

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-08-10 03:52:47 -07:00
Spoorthi K 4ae9dd5a7c tests: mp: Add description, RTM links and doxygen group
Add description, RTM links and doxygen group for
test cases in mp.

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-08-10 03:51:35 -07:00
Marcin Niestroj 6521b9e4fa net: tcp: Fix net_buf leak in case of low available net_buf count
This net_buf leak happends when we are low on available net_buf
count. During TCP segment preparation we do allocate IP header
successfully, but we fail to allocate TCP header. In such case
pkt->frags is not NULL anymore (it contains IP header), but we
override it during TCP header allocation error path. This results
in net_buf containing IP header to never be deallocated, because
it does not belong to any net_pkt anymore.

Use net_pkt_frag_add() function to add tail for future net_pkt
deallocation, instead of assigning tail to pkt->frags pointer.

Fixes: c6407659f3 ("net: tcp: Add the frag back to caller allocated
  net_pkt")
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2018-08-10 13:38:08 +03:00
Ravi kumar Veeramally 06c4a9504f net: icmpv6: Simplify the flow at net_icmpv6_get/set_xxx() calls
Instead of reading or writing different icmpv6 header's individual
variables, better to read or write whole struct at a time. This
minimizes the calls to net_frag_read() or net_frag_write().
changes also removed slow and fast paths. Changes should optimize
the total flow.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2018-08-10 12:53:59 +03:00
Jukka Rissanen f9aa9783d0 drivers: eth: native_posix: Allow user to manipulate zeth status
User can take the zeth interface down by issuing "net iface down <idx>"
shell command. It is possible to take the interface up by typing
"net iface up <idx>" in shell. These commands are important for
native_posix as there is no physical cable that can be connected
or disconnected.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-08-10 12:36:19 +03:00
Jukka Rissanen 31f89b0303 net: eth: Add start and stop L2 functions
If the driver has created start() and stop() functions, then those
are called when ethernet L2 is enabled or disabled.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-08-10 12:36:19 +03:00
Jukka Rissanen 45a1c1fb67 tests: net: ipv6: Wrong API struct was used for ethernet device
As ethernet_api is larger than net_if_api, and we are accessing
ethernet_api elements in ethernet L2 driver, then invalid memory
was accessed in L2 ethernet.c.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-08-10 12:36:19 +03:00
Kumar Gala d04eaf3baf doc: Fix warning associated with GNU ARM embedded rename
We missed one reference to GCC ARM Embedded when we renamed it to GNU
ARM Embedded.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-08-09 19:13:15 +02:00
Praful Swarnakar 3a82aef5df tests: lib: mem_alloc: Add tests to validate dynamic allocation
Add new test cases to validate dynamic memory allocation
functions such as malloc, calloc, realloc using minimal libc
and newlibc implementation of standard C library.

Signed-off-by: Praful Swarnakar <praful.swarnakar@intel.com>
2018-08-09 09:41:00 -07:00
Daniel Leung b16b4e6e4b tests: kernel: add tests for dynamic threads
This adds two test cases to create dynamic threads, and one test
case to make sure permissions are set correctly.

Origin: Original

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2018-08-09 09:20:14 -07:00
Daniel Leung e58b65427e kernel: threads: assign index no. to dynamically created threads
Kernel threads created at build time have unique indexes to map them
into various bitarrays. This patch extends these indexes to
dynamically created threads where the associated  kernel objects are
allocated at runtime.

Fixes: #9081

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2018-08-09 09:20:14 -07:00
Daniel Leung cd3e5b561d tests/kernel: kernel.queue.poll: fails if MAX_THREAD_BYTES > 2
The kernel.queue.poll test fails if CONFIG_MAX_THREAD_BYTES is larger
than 2, complaining about no memory for semaphore object. Turns out
the memory pool is not large enough. So make it a bit larger.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2018-08-09 09:20:14 -07:00
Diego Sueiro 9283ee7acc arch: i.MX add RDC peripheral permission setting for applications cores
This patch adds the RDC (Resource Domain Controller) peripheral
permissions settings for the i.MX applications cores (Cortex A9 on
i.MX6 and Cortex A7 on i.MX7).

This will enable both Linux (on application's core) and Zephyr (on M4
core) to share the peripherals and coexist.

The settings are defined at devicetree level and applied in the soc.c.

A complete solution should involve the SEMA4 to control the peripherals
access and prevent resource deadlocking and misusage.

Signed-off-by: Diego Sueiro <diego.sueiro@gmail.com>
2018-08-09 10:17:32 -05:00
Ravi kumar Veeramally c8b589045d net: ipv6: Fix memory leak
IPv6 fragmentation splits the packet into two parts, one is header
and another is payload. Every time header is cloned and part of
payload is appended. At the end original header packet is not freed.
Causes memory leak.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2018-08-09 16:25:52 +03:00
Ravi kumar Veeramally bfa7516851 net: Do not set appdata on a cloned packet
Current implementation only considers IP header length while setting
appdata value on a cloned packet. It will give bogus value if original
packet contains extension headers and if extension headers are large
(i.e. more than one fragment). Only consider appdata length from the
original packet.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2018-08-09 16:25:52 +03:00
Oleg Zhurakivskyy fbac80bb94 net: ipv4: Refactor IPv4 header length handling
Change the length to uint16_t and work with it
through standard htons/ntohs() macros.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2018-08-09 16:25:17 +03:00
Oleg Zhurakivskyy 33e06441ba net: ipv4: Minor refactoring
Trivial refactoring, no functionality changes.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2018-08-09 16:25:17 +03:00
Sebastian Bøe b9e8cd1133 cmake: Refactor usage of target_link_libraries on Zephyr libraries
CMake has several prototypes/signatures for the function
'target_link_libraries'. This commit migrates the usage of
'target_link_libraries' on Zephyr CMake libraries from the old 'plain'
signature to the new '<PRIVATE|PUBLIC|INTERFACE>' signature.

For technical reasons the two signatures can not be mixed. Each
library must exclusively use either the old or new signature.

The 'old' plain signature is equivalent to using the PUBLIC
signature. Migrating to use 'PUBLIC' is therefore expected to be a
safe change.

After the migration it will be possible to use the PRIVATE and
INTERFACE signatures on Zephyr CMake libraries. This is useful for
instance to fix issue 8438.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-08-09 14:03:10 +02:00
Carles Cufi 957262e37d build: Replace GCC ARM Embedded with GNU Arm Embedded
The old GCC ARM Embedded website on launchpad
(https://launchpad.net/gcc-arm-embedded) has been superseeded by the new
GNU Arm Embedded one
(https://developer.arm.com/open-source/gnu-toolchain/gnu-rm).

This also means a change of name from "GCC" to "GNU". Reflect this in
the enviroment variables so that the proper term is used henceforth.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-08-09 13:57:55 +02:00
Alberto Escolar Piedras 3712fd3415 Bluetooth: controller: remove unnecessary guards in hal headers
After a dedicated header is allocated to the simulated SOC versions
there is no need anymore to have guards in these other files

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-08-09 12:15:45 +02:00
Alberto Escolar Piedras e0864a9338 Bluetooth: controller: HAL: Separate simulated SOC in own header
To avoid issues with differences between the simulated and the real
SOC let's separate the simulated one into its own header

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-08-09 12:15:45 +02:00
Sebastian Bøe d46e2c7ec9 ld: Don't use --start-group and --end-group
Remove the usage of --start-group and --end-group. Perhaps it had a
function previously, but as it is used here it has no effect.

--start-group and --end-group is used to designate that a set of libs
should be searched repeatedly until all unresolved references among
them are resolved. From the documentation:

     --start-group archives --end-group
         The specified archives are searched repeatedly until no
         new undefined references are created.  Normally, an
         archive is searched only once in the order that it is
         specified on the command line.  If a symbol in that
         archive is needed to resolve an undefined symbol
         referred to by an object in an archive that appears
         later on the command line, the linker would not be able
         to resolve that reference.  By grouping the archives,
         they all be searched repeatedly until all possible
         references are resolved.

         Using this option has a significant performance cost.
         It is best to use it only when there are unavoidable
         circular references between two or more archives.

Currently it is used on the 'ZEPHYR_LIBS_PROPERTY' libs, but this has
no effect, because they are being --whole-archive'd anyway. It is also
used on 'kernel' and 'OFFSETS_O_PATH'. But these libraries have no
circular references, so this has no effect either.

Consequently, removing these two flags is expected to simplify the
link command line and have no adverse effects.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-08-09 12:15:07 +02:00
Jukka Rissanen d003d0e6a6 net: ipv4: Corrupted ARP pkt was sent instead of real IPv4 pkt
The ethernet sending routine sent a corrupted ARP packet instead
of the actual IPv4 packet.

Fixes #9348

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-08-09 11:56:44 +03:00
David B. Kinder 2300a5929f doc: fix errors in ipv4_autoconf sample doc
Some reST syntax errors and doc edits got missed during the review
of PR #561 causing problems in the generated HTML.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-08-09 09:53:15 +03:00
David B. Kinder 5c8398da05 doc: switch to use RTD theme
This PR removes use of the customized zephyr_docs_theme, replacing it
with the new read_the_docs theme.  It ignores the tags that were
previously used to switch the theme for "development" vs. "daily" or
"release" and always uses the RTD theme.  (The "daily" vs. "release" is
still honored to change the breadcrumb and doc version to "latest" if
"daily" is specified (as we did for the current doc build process),
otherwise it uses the version extracted from the
VERSION file in the source code (as would be appropriate for the docs
for a tagged release.)

This also pulls in using template extensions for breadcrumb and the
notice about latest having more up-to-date content when the "release"
tag is set.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-08-08 17:48:27 +02:00
Andrzej Głąbek ead399914e drivers: watchdog: nrfx: Remove false dependency on CLOCK_CONTROL_NRF5
This driver no longer uses any clock control API, so the dependency
became outdated.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-08-08 17:23:55 +02:00
Andrzej Głąbek 16e8860f6c drivers: i2c: nrfx: Use HAS_HW_NRF_* in driver options dependencies
Use the HAS_HW_NRF_* symbols instead of the SOC_SERIES_NRF* ones
to filter out the driver options unavailable on particular SoCs.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-08-08 17:23:55 +02:00
Andrzej Głąbek 841b8400e2 drivers: spi: nrfx: Remove "optional" from driver type choices
Selecting the type of driver (SPI, SPIM, or SPIS) to be used for
a given SPI instance is mandatory, so the "optional" modifier is
inappropriate for related choice options in the driver's Kconfig.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-08-08 17:23:55 +02:00
Andrzej Głąbek a2bfd819c8 drivers: spi: nrfx: Use HAS_HW_NRF_* in driver options dependencies
Use the HAS_HW_NRF_* symbols instead of the SOC_SERIES_NRF* ones
to filter out the driver options unavailable on particular SoCs.

Add comments explaining why the SPIM driver is not available for
nRF52832.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-08-08 17:23:55 +02:00
Paul Sokolovsky 2681199c29 drivers: serial: uart_sam: Fix typo in param name.
The refactor to add callback user data param in 57286afd, contained
typo just for this driver. It sneaked past the PR CI due to the fact
that issue affected just a couple of platforms, and we select just
a few of them randomly for PR CI (vs full CI).

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-08-08 07:54:46 -05:00
Jukka Rissanen f39ff76ced net: if: Do not inline net_if_ipv6_addr_lookup_by_iface()
No need to inline the net_if_ipv6_addr_lookup_by_iface() function
as it is used multiple times in ipv6.c

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-08-08 14:54:27 +03:00
Jukka Rissanen 297efa514d tests: net: iface: Add test for net_if_select_src_iface() function
Make sure net_if_select_src_iface() function works ok for both IPv4
and IPv6 addresses.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-08-08 14:54:27 +03:00
Jukka Rissanen d0205693ae net: if: Add net_if_select_src_iface() function
Add a function which returns proper network interface to send either
IPv4 or IPv6 network packet to corresponding destination address.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-08-08 14:54:27 +03:00