Commit graph

41120 commits

Author SHA1 Message Date
Vikrant More
6aaddb9922 sample: mesh: nrf52: complete inst. transition without timer
If transition time (tt) estimated equal to zero then transition
get completed without using timer.

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2019-11-13 11:29:14 +02:00
Vikrant More
0bf0eb7f76 samples: mesh: nrf52: Simplified implementation
Create single structure of light_ctl_state & simplified
state binding algorithm.

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
2019-11-13 11:29:14 +02:00
Carlo Caione
f2cc624915 subsystem: kernel_shell: Fix pointer cast to u32_t
The current code is assuming that the pointer to the thread structure is
32bit, casting it to u32_t before printing its address. This is wrong on
64bit architectures (CONFIG_64BIT) and the compiler complains.

Fix the problem by using '%p' to print the address.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2019-11-13 09:00:03 +01:00
Ulf Magnusson
d55ed93636 scripts: edtlib: Move imports after overview comment
Might make the comment easier to spot.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-11-12 17:57:50 -06:00
Ulf Magnusson
72158858ac scripts: dtlib/edtlib: Make output consistent on Python 3.5-
Python 3.5 and earlier do not preserve dictionary insertion order when
iterating over dictionaries, and do not give the same order between
runs. This broke the dtlib and edtlib test suites and made the output
jump around randomly between runs. It also made device INST_<n> numbers
non-deterministic, which broke some code on Python 3.5 (though
hardcoding device instance numbers in the code might be a bit shaky).

Fix it by using collections.OrderedDict instead of plain dict wherever
order matters. This makes the output identical on all supported Python
versions. It also allows testdtlib.py and testedtlib.py to run in CI,
which uses Python 3.5.

Fixes: #20571

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-11-12 17:57:50 -06:00
Ulf Magnusson
0e23994d23 scripts: edtlib: Avoid modifying the global yaml.(C)Loader
edtlib is a library, and modifying yaml.(C)Loader directly interferes
with any binding loading in edtlib clients. To avoid that, add a custom
loader for bindings.

Internally, PyYAML does this, which is why defining a separate class
works:

    @classmethod
    def add_constructor(cls, tag, constructor):
        if not 'yaml_constructors' in cls.__dict__:
            cls.yaml_constructors = cls.yaml_constructors.copy()
        cls.yaml_constructors[tag] = constructor

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-11-12 17:57:50 -06:00
Flavio Ceolin
03a93d521b arc: core: Fix possible overrun
dyn_reg_info has MPU_DYNAMIC_REGION_AREAS_NUM elements, just changing
the if check to be greater equal to this number to avoid access
MPU_DYNAMIC_REGION_AREAS_NUM element causing an out-of-bounds write.

CID: 205648
Fixes #20487

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2019-11-12 23:18:05 +01:00
Flavio Ceolin
d1acc1e3a2 doc: getting_started: Fix clang toolchain use
In order to use clang it is necessary to set the variable
ZEPHYR_TOOLCHAIN_VARIANT to llvm instead of clang.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2019-11-12 15:40:44 -05:00
Anas Nashif
c724033acc west: prepend -c to openocd commands
commit 0df4a53107 changed the behavior of
how openocd commands are passed to openocd. We used to add -c to each
command, now the commands are being added without -c causing an error.

This adds "-c" to all commands instead of just passing a list.

Also fixes #20449.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2019-11-12 14:37:34 -05:00
Stephanos Ioannidis
1ae7ae8c0b arch_interface: Remove duplicate irq_offload_routine_t typedef.
This commit removes duplicate 'irq_offload_routine_t' typedef
declaration in sys/arch_interface.h.

This typedef is provided by irq_offload.h and, since this header file
is included at the top of sys/arch_interface.h, it is guaranteed to be
defined for arch_irq_offload definition.

While this does not cause a compilation error when compiling with GCC
4.6 and above, GCC 4.5 and below strictly enforce the C99 standard and
do not allow redeclaration of the same typedef in the same scope.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2019-11-12 10:27:34 -08:00
Armando Visconti
fdf809d21c driver/sensor: lsm6dso: Fix unchecked return value
Cast to (void) the lsm6dso_mem_bank_set() calls as we
are not interested to the return value.

Coverity-CID: 205625

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-11-12 18:10:07 +01:00
Yannis Damigos
732b815f4b i2c_ll_stm32: Allow to send zero length message
Some applications, like i2c_scanner, require to
send zero length messages.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2019-11-12 16:58:00 +01:00
Piotr Zierhoffer
bb66b298e9 net: ip: ipv6_nbr: Fix uninitialized variable in ipv6_nbr
Setting it to UINT32_MAX, as it is subsequently overwritten with
MIN(oldest, something_else).

Signed-off-by: Piotr Zierhoffer <pzierhoffer@antmicro.com>
2019-11-12 16:12:10 +01:00
Johan Hedberg
1df9a2e1d3 Bluetooth: hci_raw: Fix buffer init after allocation
The code was not properly taking into account CONFIG_BT_HCI_RESERVE,
which would cause buffer underruns for any HCI driver where this value
defaults to non-zero. Also, all the allocation functions use the same
pool, so we can map them simply to bt_buf_get_rx() instead of
repeating the same code.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2019-11-12 16:59:43 +02:00
Andrei Emeltchenko
19e434d777 doc: usb: Update USB documentation
Update documentation, removing outdated usb_set_config()
initialization method.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-11-12 15:44:55 +01:00
Johann Fischer
0ee2f14948 samples: ipsp: use log_strdup(transient_string)
Use log_strdup(transient_string).

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2019-11-12 16:43:52 +02:00
Johann Fischer
0df5aa54ec samples: ipsp: fix build reply function
Fix build reply function. The sample uses return value
from net_pkt_read() to determine data length,
but the return value is 0 on success.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2019-11-12 16:43:52 +02:00
Francois Ramu
f9a3007029 driver: watchdog: Incorrect expression in wdt_wwdg_stm32.c #20504
[Coverity CID :205661]

Fixes #20504

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2019-11-12 15:10:34 +01:00
Maureen Helm
6fb97258aa doc: Add missing html redirect entries for mimxrt10{20,60,64}_evk boards
The mimxrt10{20,60,64}_evk board docs were renamed from <board>.rst to
index.rst in commit 0e4ff809d7 but were
missing entries in the html redirect list. Add them.

An entry for mimxrt1015_evk is not added because this board always had
an index.rst board doc.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2019-11-12 15:08:36 +01:00
François Delawarde
6990a3791a debug: tracing: Use proper API to fetch thread name
Use k_thread_name_get API to fetch thread name.

Fixes: #20509
Fixes: #20510

Signed-off-by: François Delawarde <fnde@oticon.com>
2019-11-12 14:27:21 +01:00
Peter A. Bigot
7dca60dfcb drivers: gpio: fix sifive interrupt management
The translation to encoded multi-level interrupts failed to account
for the GPIO interrupt number being encoded in at bit position 8,
and being offset by 1 in the base encoding.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-11-12 07:08:18 -06:00
Ioannis Glaropoulos
01a5ef2b9c tests: stack_random: fix reading volatile variable
Fix coverity issue 20534: read the status of a volatile
variable in an ASSERT statement via a stack variable
declared and defined for this purpose.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-11-12 07:07:01 -06:00
Morten Priess
087706498e bluetooth: controller: Perform synchronized LLL reset via mayfly
Use semaphore to synchronize lll_reset completion with HCI thread for
returning (command complete) only when all is done.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2019-11-12 11:34:28 +01:00
Erik Brockhoff
ed61065f2c Bluetooth: controller: ull_filter: RPA ADV refresh fix
local variable (idx) was used in conflicting contexts

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2019-11-12 11:30:05 +01:00
David B. Kinder
c68ae690b6 doc: fix misspelling in userspace doc
fix misspelling

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2019-11-12 08:47:14 +01:00
Vincent Wan
0297756342 drivers: i2c: use CPU clock frequency in configuration on CC13XX/CC26XX
The I2C peripheral should be configured using the CPU clock frequency
and not the system clock frequency. This used to be fine because they
were the same before #19232, but now that the system clock is
RTC-based (which has a different frequency), we can no longer make
that assumption.

Fixes #20480

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2019-11-11 08:19:28 -06:00
Vinayak Kariappa Chettimada
d1d603afc3 Bluetooth: controller: split: Fix conn update to be cacheable
Fix connection update procedure to be cacheable if any other
local or remote control procedure is in progress.

Relates to commit 9c14567ce2 ("Bluetooth: controller: Fix
conn update to be cacheable").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-11 14:17:35 +01:00
Carles Cufi
4657d8515a Bluetooth: controller: openisa: Fix radio ISR signature
Non-direct ISRs are supposed to take a void pointer as an argument,
unliike direct ones, which take no arguments. Since the radio ISR is not
declared as direct, the void pointer argument was missing, likely due to
a copy-paste mistake from the nordic LLL, which indeed uses a direct ISR
for the radio ISR.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-11-11 13:53:03 +01:00
Hosun Zhu
b479e914f8 zephyr-env.sh: reduce posixargzero side effects.
For example, when using zsh p9k theme will cause
some problems that affect the experience.

Fixes #20284.

Signed-off-by: Hosun Zhu <hosun@linux.com>
2019-11-11 10:31:19 +01:00
David Leach
0443c6d7ac release: Zephyr 2.1.0-rc1
Bumped to v2.1.0-rc1

Signed-off-by: David Leach <david.leach@nxp.com>
2019-11-10 19:46:29 -06:00
Johann Fischer
fd82d2b47c Bluetooth: l2cap: fix null pointer dereference
bt_conn_create_pdu_timeout() may return NULL if no buffer
is available, l2cap_chan_create_seg() does not check the
subsequent return value.
Fix possible null pointer dereference in l2cap_chan_create_seg()
and l2cap_chan_le_send().

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2019-11-10 19:18:53 +02:00
Anas Nashif
53f30bc3ac Bluetooth: controller: openisa: do not use instances for openisa IRQs
An issue with DT generation where instance defines are not determinstic
generating values that collide with existing IRQs.

Fixes #20558

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-11-10 11:17:35 -05:00
Peter A. Bigot
2d4d6f05e6 drivers: spi_nor: improve documentation and validation on flash layout size
The smallest region that can be erashed is one sector, so setting
SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=2048 will fail at runtime when the
flash page API is used to erase a single (or misaligned) page.  Add a
compile-time check that the requested layout page size is erasable.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-11-09 15:26:06 +01:00
Peter A. Bigot
98a344fe21 drivers: spi_nor: support deep-power-down mode
Add internal API to enter and exit deep power-down mode.  Add Kconfig
option to return to DPD whenever device is not active.

When device power management becomes more mature it should be possible
to implement it, which would allow use of DPD without having to enter
and exit DPD between consecutive transactions.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-11-09 15:26:06 +01:00
Peter A. Bigot
c2e9441ad5 drivers: spi_nor: refactor device mutex management
Convert the LOCK/UNLOCK macros to acquire/release functions in
preparation for extending those steps to include power management.

Also commit to always allocating a semophore, and use a more clean
way of conditionalizing the operations.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-11-09 15:26:06 +01:00
Peter A. Bigot
920d477264 dts: jedec,spi-nor: add support for deep-power-down specification
Provide information required to allow the driver to put the flash chip
into a deep power down mode.  This can reduce standby current by as
much as 90%.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-11-09 15:26:06 +01:00
Peter A. Bigot
e4c3729ba7 drivers: spi_nor: generalize support for ULBPR instruction
Replace the hard-coded check for JEDEC IDs with a property that must
be set in the devicetree entry.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-11-09 15:26:06 +01:00
Peter A. Bigot
f83ad78261 dts: jedec,spi-nor: require size property
The SPI NOR driver requires that the size (in bits) be provided in the
devicetree node.  Update the binding to make the property required,
and update all nodes based on the memory chip identified.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-11-09 15:26:06 +01:00
Peter A. Bigot
17945358e8 tests/subsys/fs/littlefs: correct flash partition unit address
Unit addresses for partitions should correspond to the start address.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-11-09 15:26:06 +01:00
Henrik Brix Andersen
b652739a94 tests: drivers: flash_simulator: fix project name
Fix the project name of the flash_simulator driver test suite.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2019-11-09 09:00:12 -05:00
Henrik Brix Andersen
0ea5503ce3 doc: reference: peripherals: add EEPROM API documentation
Add documentation for the EEPROM API to the peripheral reference
section.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2019-11-09 08:59:28 -05:00
Peter Bigot
80faac41bc coccinelle: update int literal to timeout
Re-run the int_literal_to_timeout script to update calls introduced
since the last cleanup.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-11-08 19:30:42 -05:00
Krzysztof Chruscinski
f831929cb5 kernel: Add assert to detect negative timeouts
Add assert when negative (except K_FOREVER) is passed as timeout.
Add negative timeout correction to 0.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-11-08 16:03:05 -08:00
Krzysztof Chruscinski
94f742e4c4 kernel: Clarify timeout and sleep API regarding negative inputs
Timeout and use s32_t as an argument but only positive values are
accepted (or special value like K_FOREVER). It was not specified in
the description which may lead to misinterpretation.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-11-08 16:03:05 -08:00
Peter Bigot
ae5e5b7753 kernel: restore size and signedness behavior in deprecated time-related API
The addition of API to correctly handle conversion between durations
in different clocks inadvertently changed the type of the value
produced by the API.  Specific changes were:

s32_t z_ms_to_ticks(s32_t t) =>
  u32_t k_ms_to_ticks_ceil32(u32_t t) : signedness change
s32_t __ticks_to_us(s32_t t) =>
  u64_t k_ticks_to_us_floor64(u64_t t) : signedness and rank change
s32_t z_us_to_ticks(s32_t t) =>
  u64_t k_us_to_ticks_ceil64(u64_t t) : signedness and rank change
int sys_clock_hw_cycles_per_tick() =>
  u32_t k_ticks_to_cyc_floor32(1) : signedness change

The effect of this is to change the essential type of operands in
existing expressions, potentially resulting in behavior changes when
calculations were promoted to unsigned types, or code size by
requiring 64-bot arithmetic.

Add casts as necessary to preserve the original return type, and to
explicitly recognize impact of passing macro parameters into a context
where a specific type will be used.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-11-08 18:37:46 -05:00
Peter Bigot
561db1da4a kernel: extend time unit conversion to high resolution scales
Some use cases require using high-resolution tick or cycle clocks to
measure sub-millisecond durations.  Generate the corresponding 32-bit
conversions to avoid the cost of 64-bit math in the common case where
the duration fits in 32 bits in both original and converted scale.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-11-08 18:37:46 -05:00
Peter Bigot
5f34700133 kernel: move time_units into sys subdirectory
This isn't something the user will ever include directory, so take
steps to hide it.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-11-08 18:37:46 -05:00
Andrew Boie
d2b8922fa3 kernel: allow threads to sleep forever
Previously, passing K_FOREVER to k_sleep() would return
immediately.

Forever is a long time. Even if woken up at some point,
we still had forever to sleep, so return K_FOREVER in this
case.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-11-09 00:36:34 +01:00
Andrew Boie
1c97851726 x86: enable MMU on 64-bit with SMP
The races are believed to be resolved with the patch to
irq_offload(). Allow the MMU to be turned on and enable
it for qemu_x86_64.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-11-08 15:16:43 -08:00
Andrew Boie
e09a0255da kernel: sychronize irq_offload() access
Entering irq_offload() on multiple CPUs can cause
difficult to debug/reproduce crashes. Demote irq_offload()
to non-inline (it never needed to be inline anyway) and
wrap the arch call in a semaphore.

Some tests which were unnecessarily killing threads
have been fixed; these threads exit by themselves anyway
and we won't leave the semaphore dangling.

The definition of z_arch_irq_offload() moved to
arch_interface.h as it only gets called by kernel C code.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-11-08 15:16:43 -08:00