Commit graph

99049 commits

Author SHA1 Message Date
Andrew Boie
a4c28f70bf ztest: setup a default app memory domain
If CONFIG_APP_SHARED_MEM is enabled, ztest will set up a
default memory domain with a single partition on startup.
Test case globals may be added to the partition via
ZTEST_BMEM/ZTEST_DMEM macros, add their own partitions,
or leave the domain and join another one.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-08 07:04:30 -05:00
Andrew Boie
84c808918b tests: set CONFIG_MAX_THREAD_BYTES for a few tests
Some tests instantiate a lot of thread objects. These
were not tagged with __kernel, and
CONFIG_APPLICATION_MEMORY was enabled, so the kernel was
not adding them to the kernel object database.

However, with CONFIG_APPLICATION_MEMORY disabled, this
overflowed the default max number of thread objects (16).
Increase the max to 32 for these particular tests.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-08 07:04:30 -05:00
Andrew Boie
7adff462e7 app_shmem: overhaul partition specification
* K_APP_DMEM_SECTION/K_MEM_BMEM_SECTION macros now exist
  to specifically define the name of the sections for data
  and bss respectively.

* All boards now use the gen_app_partitions.py script, the
  padding hacks for non-power-of-two arches didn't work right
  in all cases. Linker scripts have been updated.

* The defined k_mem_partition is now completely initialized
  at build time. The region data structures now only exist
  to zero BSS.

Based on some work submitted by Adithya Baglody
<adithya.baglody@intel.com>

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-08 07:04:30 -05:00
Adithya Baglody
c12381793a CMakeLists: fix app_shmem dependency
This particular rule of cmake was causing problems when run in
multi-threaded environment. This change in the dependency will
resolve all such issues and ensures that this script is executed
correctly.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2019-02-08 07:04:30 -05:00
Adithya Baglody
50950eb2c9 app_shmem: use script for all arches
This patch will run the python scripts for all architectures
to determine the partitions available. This is needed for correct
operation of the app_shared_mem feature.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-08 07:04:30 -05:00
Andrew Boie
62a6f87139 tests: remove app_memory test
CONFIG_APPLICATION_MEMORY is being removed from
Zephyr.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-08 07:04:30 -05:00
Andrew Boie
889b2377ef tests: userspace: remove extra_sections
This is unnecessary.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-08 07:04:30 -05:00
Adithya Baglody
9bebf4cb23 x86: fix app shared memory if XIP enabled
This is a separate data section which needs to be copied into
RAM.

Most arches just use the kernel's _data_copy(), but x86 has its
own optimized copying code.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-08 07:04:30 -05:00
Andrew Boie
8bfd8457ea tests: mem_protect: fix Kconfig
We want CONFIG_APPLICATION_MEMORY specifically disabled
for this test, but it was being transitively selected by
CONFIG_TEST_USERSPACE which defaults to on for CONFIG_TEST.

Turn it off so that disabling application memory in the
config actually has an effect.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-08 07:04:30 -05:00
Andrew Boie
7ecc359f2c userspace: do not auto-cleanup static objects
Dynamic kernel objects enforce that the permission state
of an object is also a reference count; using a kernel
object without permission regardless of caller privilege
level is a programming bug.

However, this is not the case for static objects. In
particular, supervisor threads are allowed to use any
object they like without worrying about permissions, and
the logic here was causing cleanup functions to be called
over and over again on kernel objects that were actually
in use.

The automatic cleanup mechanism was intended for
dynamic objects anyway, so just skip it entirely for
static objects.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-08 07:04:30 -05:00
Andrei Gansari
1d50a09575 drivers: eth_dw: changed stranded error message
Replaced CONFIG_NET_DEBUG_L2_ETHERNET with
CONFIG_ETHERNET_LOG_LEVEL >= LOG_LEVEL_DBG

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2019-02-08 13:57:55 +02:00
Andrei Gansari
0ceab99865 samples: net: removed unused common cmake
CONFIG_NET_TESTING never used, removed in this commit.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2019-02-08 13:57:55 +02:00
Andrei Gansari
220daa685b net: removed CONFIG_NET_APP
Removed unused CONFIG_NET_APP and parameter *net_app.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2019-02-08 13:57:55 +02:00
Andrei Gansari
fea80ca5c1 net: subsys: fixed comments CONFIG_NET*
Fixed stranded comments:
CONFIG_NET_TLS_DEBUG removed
CONFIG_NET_LLDP_MSG_TX_INTERVAL -> CONFIG_NET_LLDP_TX_INTERVAL

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2019-02-08 13:57:55 +02:00
Andrei Gansari
0730ab8bef tests: CONFIG_NET* fixup
Fixed typo: CONFIG_NET_NET_PKT_LOG_LEVEL_DBG, removed extra _NET.
Removed debug macro CONFIG_NET_DEBUG_NET_PKT that is not used.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2019-02-08 13:57:55 +02:00
Aurelien Jarno
fa91da4992 drivers: eth: gmac: only keep a reference to the packet when PTP is used
The SAM GMAC Ethernet driver currently keeps a reference to the packet
being sent in addition than keeping of references of the fragments. In
practice this is only needed when PTP is enabled, otherwise the driver
only need to prevent the fragment (or even their content) to be changed.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-02-08 12:41:11 +02:00
Aurelien Jarno
757d86b241 drivers: eth: gmac: keep a reference to the packet fragments
The SAM GMAC Ethernet driver uses scatter gather DMA to transmit data.
Each fragment of a network packet is mapped from a set of descriptors
that is used by the controller to do the DMA transfer. This means that
the packet is not necessary sent when the send() function returns. For
that reason the driver calls net_pkt_ref() on the packet to prevent it
from being freed. It is then unreferenced with net_pkt_unref() in the
TX ISR when the packet has effectively been sent.

However this doesn't work if the packet is modified in the meantime,
like it will be done in PR #12563 to remove the Ethernet header
contained in the first fragment. To avoid that, call net_pkt_frag_ref()
on each fragment of the packet, and unreferenced them with
net_pkt_frag_unref() in the TX ISR when the packet has effectively been
sent.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-02-08 12:41:11 +02:00
Ravi kumar Veeramally
2c3ecd8c51 net: samples: Disable IPv4 from packet socket sample
IPv4 is not needed for packet socket sample. Previous commit
helps to remove dependencies.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-02-08 12:35:03 +02:00
Ravi kumar Veeramally
36aa7d1878 net: Allow disabling IPv4, IPv6, UDP and TCP simultaneously
This commit fixes compilation warnings if user disables
CONFIG_NET_IPV4, CONFIG_NET_IPV6, CONFIG_NET_TCP and
CONFIG_NET_UDP.

E.g Samples like packet-socket doesn't need above configuration.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-02-08 12:35:03 +02:00
Piotr Mienkowski
8a86b5aaac api: counter: rename counter_disable_channel_alarm()
The function to set channel alarm is called counter_set_channel_alarm.
To match the name of the function performing the reverse operation this
commit renames counter_disable_channel_alarm() function to
counter_cancel_channel_alarm().

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-02-08 10:47:40 +01:00
Paul Sokolovsky
36e437f537 tests: socket: misc: Add test for gethostname()
Just a basic test.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-02-08 10:39:30 +02:00
Paul Sokolovsky
5bb2c7022e net: sockets: Add gethostname() call
Implemented via Zephyr's net_hostname_get(). As support for that call
is configurable and by default off, while many POSIX applications
assume that hostname is always available, we need a default value
in case CONFIG_NET_HOSTNAME_ENABLE is "n". Initial version of this
patch added that on the level of gethostname() call, but of was
suggested to move that down to net_hostname_get() instead.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-02-08 10:39:30 +02:00
Daniel Leung
d9da0b07cd gpio: gpio_sch: fix check for interrupt trigger
The controller does not support trigger. However, the check for
this condition was incorrectly (as GPIO_INT_LEVEL is 0). So fix
it.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-02-07 22:47:11 -06:00
Peter A. Bigot
d080d1d791 tests: gpio: basic_api: correct constant test for interrupt trigger
Interrupts default to trigger on level for historical reasons, so use of
GPIO_INT_LEVEL` as a mask results in a zero value.  Use a mask macro to
isolate the trigger configuration.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-02-07 22:46:37 -06:00
Peter A. Bigot
0a0e3cdea6 drivers: gpio: esp32: correct constant test for interrupt trigger
Interrupts default to trigger on level for historical reasons, so use of
GPIO_INT_LEVEL` as a mask results in a zero value.  Use a mask macro to
isolate the trigger configuration.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-02-07 22:46:37 -06:00
Anas Nashif
74c573635f samples/tests: filter based on toolchain features
Do not run with toolchains that do not support newlib.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-02-07 22:46:10 -06:00
Anas Nashif
fc3d8ac863 toolchain: espressif: mark newlib support false
newlib is not supported with this toolchain, so mark it as such and
filter tests based on the variable defined in the toolchain file.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-02-07 22:46:10 -06:00
Anas Nashif
45a9786a41 sanitycheck: support filtering based on cmake cache
Parse CMakeCache.txt and filter based on variables defined in CMake.
The CMakeCache.txt parsing is borrowed from west.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-02-07 22:46:10 -06:00
Ulf Magnusson
298f9e1e8a scripts/dts: Rename get_key_value() to define_str()
As in "#define string". More explicit.

Rename the parameters to name/value instead of k/v too.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-07 21:42:36 -06:00
Ulf Magnusson
638e89bb7c scripts/dts: Simplify tabstop logic in write_header()
A string can be repeated n times with n*'foo'.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-07 21:42:36 -06:00
Ulf Magnusson
0e922bff75 scripts/dts: Simplify write_header()
That the 'aliases' key isn't a regular property makes things a bit
confusing. Write the aliases separately, which should be a bit clearer.
That also makes it clear that the order doesn't matter.

The 'aliases' key always exists in defs[node], so use [] instead of
.get(). Also write "'aliases'" instead of "prop" when the value is
known.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-07 21:42:36 -06:00
Ulf Magnusson
98df8b99d6 scripts/dts: Remove unused os.listdir import
Unused.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-07 21:42:36 -06:00
Ulf Magnusson
72f0125b92 scripts/dts: Rename conf/header-writing functions to write_conf/header
Probably easier to understand.

Also rename 'fd' to 'f'. "File descriptor" might make it sound like an
integer.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-07 21:42:36 -06:00
Ulf Magnusson
00c43d4d08 scripts/dts: Simplify output_keyvalue_lines()
That the 'aliases' key isn't a regular property makes things a bit
confusing. Write the aliases separately, which should be a bit clearer.
That also makes it clear that the order doesn't matter.

Also write "'aliases'" instead of "prop" when the value is known.

The .get() seems to be needed to work around a bug, and sometimes you
get DT_...=None in the output. Might look into that later.

extract_string_prop() could generate 'defs' entries without 'aliases'
keys. Make it add an empty 'aliases' dict instead, to remove existence
checks elsewhere.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-07 21:42:36 -06:00
Ulf Magnusson
7b0ac7d303 scripts/dts: Simplify get_parent_address()
Returns the empty string for '/foo' and '/', but the old version did
that too, so maybe it's intended.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-07 21:42:36 -06:00
Ulf Magnusson
a776927250 scripts/dts: Simplify find_parent_prop()
Also replace a .get() where the key is known to exist.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-07 21:42:36 -06:00
Ulf Magnusson
87193b0e1b scripts/dts: Remove generate_node_definitions() return value
Unused.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-07 21:42:36 -06:00
Ulf Magnusson
4217de046b scripts/dts: Inline simple single-caller functions into main()
Inline load_and_parse_dts() and generate_{keyvalue,include}_file().

Also specify UTF-8 for writing files, and fix some mis-indentation.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-07 21:42:36 -06:00
Ulf Magnusson
2528b538a4 scripts/dts: Remove redundant nargs=1 argparse args
Flags take a single argument by default, and removing nargs=1 avoids
getting it as a single-element list.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-07 21:42:36 -06:00
Ulf Magnusson
6f5d5c56f2 scripts/dts: Simplify code around extract_bus_name() call
Get rid of the parent_label variable.

Also avoid using "label" in two different senses (DT label and name of
define macro) within the same comment.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-07 21:42:36 -06:00
Ulf Magnusson
7827c765aa scripts/dts: Rename extract_single() to extract_bus_name()
This matches the only way in which it's used.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-07 21:42:36 -06:00
Ulf Magnusson
6127f0a07f scripts/dts: Simplify extract_single()
Get rid of the 'prop' variable.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-07 21:42:36 -06:00
Ulf Magnusson
c631edddb8 scripts/dts: Inline 'prop' and 'key' params into extract_single()
These are always 'parent-label' (used as a flag) and 'bus-name',
respectively.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-07 21:42:36 -06:00
Ulf Magnusson
636b6be62d scripts/dts: Remove the prop_def variable in extract_single()
Shorter and still clear without it.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-07 21:42:36 -06:00
Ulf Magnusson
f5ee8f65a7 scripts/dts: Remove dead type-checking code in extract_single()
'prop' is always a string.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-07 21:42:36 -06:00
David B. Kinder
c1dce2f799 doc: fix misspellings in docs
Fix misspellings missed in regular reviews.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2019-02-07 22:06:14 -05:00
Peter A. Bigot
aa684363f0 drivers: sht3xd: update to new I2C API
Use the new i2c_write_read() wrapper to simplify the code.

Also add several overlays used to test the sensor on a variety of
boards, and conf file support for trigger testing.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-02-07 22:04:28 -05:00
Peter A. Bigot
46072632bd drivers: i2c: document problematic API and deprecated unused functions
The scatter/gather API for I2C assumes that all SoC implementations are
capable of supporting such operations, in particular performing a single
write (read) transaction that transfers from (to) multiple addresses in
memory.  This is not the case: for some driver implementations a write
of a device register address followed by a write of data to be stored in
that register will produce two bus transactions and be mis-interpreted
by the receiving device.

Extend the documentation of the I2C message flags to provide more
information about the breadth of implementation variation in their
interpretation.

i2c_burst_write cannot be deprecated because we have no replacement.
Clarify in the description that the behavior is not portable.

i2c_burst_read is not being deprecated because it is in use throughout
Zephyr.  The description is updated to reflect that it can be replaced
by i2c_write_read().

Deprecate unused convenience wrappers that depended on the burst APIs
but were never used in the tree.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-02-07 22:04:28 -05:00
Peter A. Bigot
4d7c06702c drivers: eth_sam_gmac: replace deprecated API
Replace the sole use of i2c_burst_read_addr with a more generic API
function to allow the former to be deprecated along with its unreliable
sibling write and update functions.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-02-07 22:04:28 -05:00
Peter A. Bigot
7f42423c7c drivers: i2c: add convenience wrapper for common I2C transaction pair
It is commonly necessary to execute a pair of I2C transactions where the
first is a write transaction that identifies information held on the
device and a second is a read transaction that retrieves the identified
information.

Add API that performs this operation generically, without restricting
the type or size of the identification or content messages.  Follow the
argument order of the existing i2c_write and i2c_read methods.

This reduces the need to explicitly construct buffers for i2c_transfer,
or to use more restrictive API functions that perform a gather write
that is not reliable on all I2C bus driver implementations.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-02-07 22:04:28 -05:00