Commit graph

41120 commits

Author SHA1 Message Date
Spoorthi K
0f375034da tests: cmsis_rtos_v2: Add tests for kernel management APIs
Add negative scenarios, API tests and improve
test coverage for kernel management APIs supported
in CMSIS RTOS V2 portability layer.

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2019-01-03 12:39:39 -05:00
David B. Kinder
67db1d5321 doc: add comment for API doxygen group check
add a comment for the scanner script for missing API doxygengroup
directives so it won't complain about a parent defgroup used only for
organization

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2019-01-03 12:38:28 -05:00
David B. Kinder
c8ba6fe41d doc: add missing networking APIs
As mentioned in issue #12265, some networking APIs
aren't included in the generated
API docs because doxygengroup directives were missing.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2019-01-03 12:38:28 -05:00
David B. Kinder
6d912bf035 doc: add missing cfb API
As mentioned in issue #12265, this API wasn't included in the generated
API docs because a doxygengroup directive was missing.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2019-01-03 12:38:28 -05:00
Daniel Leung
f542825558 boards: arm: nucleo_f746zg: fix empty image
The en.high-perf_nucleo-144_mbed.jpg is an empty file.
This causes error when generating PDF documentation
as the tool cannot deal with empty image files.
So replace it with the image with same filename from
nucleo_f765zg, as the images are identical from
the online product description pages.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-01-03 12:36:48 -05:00
Andrei Emeltchenko
eb6601e5f0 net: logs: Enable logging for NET_RAW
The patch allows to enable logs for NET_RAW configuration.
For example using wpanusb currently breaks build with logging enabled.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-01-03 12:33:54 -05:00
Andy Ross
b748d5219a tests/kernel/timer_api: Synchronize racy subtest
The test_timer_periodicity test is racy and subject to initial state
bugs.  The operation of that test is to:

1. Start a timer with a known period
2. Take the current time with k_uptime_get()
3. Wait for the timer to fire with k_timer_status_sync()
4. Check that the current time minus start time is the period

But that's wrong, because a tick expiring between any of the first
three steps is going to skew the math (i.e. the timer will have
started on a different tick than the "start time").

And taking an interrupt lock around the process can't fix the issue,
because in the tickless world we live in k_uptime_get() is actually a
realtime quanity based on a hardware counter and doesn't rely on
interrupt delivery.

Instead, use another timer object to synchronize the test start to a
driver tick, ensuring that even if the race is unfixable the initial
conditions are always correct.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-03 12:29:02 -05:00
Andy Ross
9eda9350d8 kernel/timeout: Don't reset imminent timeouts
The logic in z_set_timeout_expiry() missed the case where the ticks
argument could be zero (or lower), which can happen naturally due to
timing/interrupt slop.  In those circumstances, it would still try to
reset a timer that was "about to expire at the next tick", which would
run afoul of the drivers' internal decisions about how soon a timer
interrupt could be set, and then get pushed out to the next tick.

Explicitly detect this as an "imminent" predicate to make the logic
clearer.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-03 12:29:02 -05:00
Andy Ross
bb86f2019c kernel/sched: Remove stale comment
The recent change that added a locked z_set_timeout_expiry() API
obsoleted the subtle note about synchronization above
reset_time_slice().  None of that matters any more, the API is
synchronized internally in a conventional way.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-03 12:29:02 -05:00
Andy Ross
71f5e56545 kernel/timeout: Fix "not in list" predication in timeout handling
The use of dticks == INACTIVE to tell whether or not a timeout was
already in the list was insufficient.  There is a time period between
the moment a timeout is removed from the list and the end of its
handler where it is not in the list, yet its list node pointers still
point into it.  Doing things like aborting a thread while that is true
(which can be asynchronous too!)  would corrupt the list even though
all the operations on it were "atomic".

Set the timeout node pointers to nulls atomically when removed, and
check for double-remove conditions (which, again, might be perfectly
OK).

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-03 12:29:02 -05:00
Andy Ross
43ab8da953 kernel/timeout: Refactor z_clock_announce() loop
This loop was structured badly, as a while(true) with multiple "exit
if" cases in the body.  It was bad enough that I genuinely fooled
myself into rewriting it, having convinced myself there was a bug in
it when there wasn't.

So keep the rewritten loop which expresses the iteration in a more
invariant way (i.e. "while we have an element to expire" and not "test
if we have to exit the loop").  Shorter and easier.  Also makes the
locking clearer as we can simply release the lock around the callback
in a natural/obvious way.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-03 12:29:02 -05:00
Anas Nashif
52b23a3b08 ext: fix path to source files with new cmake
New cmake does not like source files not relative to current directory.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-01-03 11:51:29 -05:00
Anas Nashif
5060ca6a30 cmake: increase minimal required version to 3.13.1
Move to latest cmake version with many bug fixes and enhancements.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-01-03 11:51:29 -05:00
Vasili Slapik
b29a79402f boards: arm: stm32: Fix openocd warning
interface/stlink-v2-1.cfg and interface/stlink-v2.cfg are wrappers
around interface/stlink.cfg, their inclusion trigger warning which
this change addresses. Besides the warning there is nothing there
except sourcing iterface/stlink.cfg directly.

Signed-off-by: Vasili Slapik <vslapik@gmail.com>
2019-01-03 10:24:49 -06:00
Ulf Magnusson
cf3cddd1cd menuconfig: Prompt for save when Kconfig files change
Update menuconfig and Kconfiglib to upstream revision 16539b4f223fa, to
add the commit below.

    menuconfig: Prompt for save if a different .config would be saved

    Previously, menuconfig.py only prompted for saving the configuration
    if .config didn't exist or the user changed symbol values within the
    interface.

    Also make it prompt for save if Kconfig symbols have been added,
    removed, or have had their defaults changed, provided it would make
    the saved .config differ from the loaded one.

    This usually won't matter for correctness, because loading an
    outdated configuration performs an implicit olddefconfig, but it's
    less confusing.

    Also add a Kconfig.missing_syms attribute that records all
    assignments to undefined symbols in the most recently loaded .config
    file. This is needed to implement the check for whether the saved
    .config would be different.

    As an unrelated change, always prompt for saving if a .config has
    been loaded from within the menuconfig interface. The intention is
    probably often to save the configuration somewhere else, even if it
    isn't modified.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-01-03 13:55:31 +01:00
Luiz Augusto von Dentz
80bc21e03c Bluetooth: GATT: Fix warning when attempting to use read callback
When using bt_gatt_discover with BT_GATT_DISCOVER_CHARACTERISTIC the
read callback would be set to bt_gatt_attr_read_chrc which would attempt
to access the next attribute which in this case would not be set since
the value attribute is no fetched by the discovery, the spec actually
omit the value handle saying it should always be the first attribute to
appear after the characteristic thus we can assume it to be handle + 1.

Fixes #12159

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2019-01-03 12:12:10 +01:00
Luiz Augusto von Dentz
f06a20c25c Bluetooth: GATT: Add groups for server and client APIs
This should make it more clearer what APIs are intended to be used with
server and client instances, in addition to that mention on the function
documentation when operation is valid only for local attributes.

Fixes #12138

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2019-01-03 12:12:10 +01:00
Anas Nashif
07b221c24d ci: update to v0.5-rc5 docker file
New docker file with latest cmake 3.13.1.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-01-02 16:44:57 -05:00
Andrei Emeltchenko
e8ecd275a0 doc: usb: Move API documentation to usb_api
Move API documentation text to the right place.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-01-02 11:53:44 -05:00
Loic Poulain
1782e383a6 boards: disco_l475_iot1: Enable MSI PLL-Mode config
This mode allows the USB driver to use MSI clock as source clock.
MSI PLL-Mode permits +/-0,25% accuracy.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2019-01-02 09:33:21 -05:00
Loic Poulain
a32a39f3d2 drivers: usb_dc_stm32: Add support for MSI clock
When MSI clock is available and in PLL-Mode (high accuracy), use it as
USB source clock. This allows to enable USB on STM34l475 disco iot
board without having to add external oscillator.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2019-01-02 09:33:21 -05:00
Loic Poulain
85b8a6b84b clock_control: stm32: Add support for MSI PLL MODE
Add support for Low Speed External 32.768 kHz oscillator (LSE ).
Add support for MSI PLL-Mode offering an automatic calibration feature
in combination with the LSE. This allows the MSI to reach an accurate
+/-0,25% clock perfectly suitable for USB full-speed clock.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2019-01-02 09:33:21 -05:00
Loic Poulain
131a61d80b boards: disco_l475_iot1: Add USB OTGFS to DTS
Add USB OTG FS node.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2019-01-02 09:33:21 -05:00
Loic Poulain
b59eaf69b6 Revert "boards: disco_l475_iot1: Remove used pinmux configuration"
This reverts commit 9c1a2b515c.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2019-01-02 09:33:21 -05:00
Aurelien Jarno
d3b6c5a755 net: coap: return -EPERM for a resource without requested method
When walking through the coap resources in coap_handle_request, return
-EPERM if a resource exists but does not have the request method. This
allows the caller to catch the error and return a 4.05 message.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-01-02 13:04:46 +01:00
Aurelien Jarno
9e8bb61009 nvs: workaround a GCC and Coverity warning
Following the recent NVS changes, the following warning now appear with
GCC 7.3 when building with -O2:

ZEPHYROOT/subsys/fs/nvs/nvs.c: In function 'nvs_reinit':
ZEPHYROOT/subsys/fs/nvs/nvs.c:92:36: warning: 'addr' may be used
uninitialized in this function [-Wmaybe-uninitialized]
  offset += fs->sector_size * (addr >> ADDR_SECT_SHIFT);
                              ~~~~~~^~~~~~~~~~~~~~~~~~~
ZEPHYROOT/subsys/fs/nvs/nvs.c:606:8: note: 'addr' was declared here
  u32_t addr;
        ^~~~

This was already reported by Coverity earlier as CID:187903.

In practice this can only happen if fs->sector_count equals 0, which is
not possible as checked in nvs_init(). At least in the GCC case, it
believes that k_mutex_lock(&fs->nvs_lock, K_FOREVER) could modify
fs->sector_count.

Workaround the issue by initializing addr to 0.

Fixes #9767

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-01-02 13:03:09 +01:00
Aurelien Jarno
a169d90667 nvs: avoid reading multiple times the same area
The current NVS code checks for an empty ATE using th
_nvs_flash_cmp_const() function. This function loads the data and
compare them to a value. This means that when executed multiple on the
same area, the data get reloaded multiple time. This might have a
noticeable performance impact with an SPI flash.

Instead define a function _nvs_ate_cmp_const to compare an already read
struct nvs_ate with a constant value. Then replace the calls to
_nvs_flash_cmp_const() on struct nvs_ate by _nvs_flash_ate_rd() followed
by _nvs_ate_cmp_const(). This also has the advantage of explicitly
checking for errors instead of testing the error and the result of the
comparison at the same time.

Tested on a Nucleo L432KC board with the nvs sample. The maximum
initialization time (ie just before running the first garbage collector)
goes down to 6213 µs from 7350 µs.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-01-02 13:03:09 +01:00
Peter A. Bigot
173d07c6e5 samples: driver: i2c_scanner: use arduino-defined device if available
nucleo_l476rg uses I2C_3 rather than I2C_0, and uses special magic to
synthesize a corresponding define from a device tree node label.  Update
the sample to use the Arduino binding if that's present.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-02 13:02:38 +01:00
Peter A. Bigot
2705901460 boards: nucleo_l476rg: add corrected I2C pin assignments
The L476RG does not use the same I2C instance as the other L4 boards.
Correct the pinmux and add the peripheral.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-02 13:02:38 +01:00
Peter A. Bigot
c416f61974 samples: driver: i2c_scanner: fix support on Nordic TWIM driver
The Nordic TWIM driver uses DMA which requires that the source address
be located in RAM.  If it isn't the transfer will rejected as invalid.
Provide a RAM address even though it's never dereferenced.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-02 13:02:38 +01:00
Peter A. Bigot
75240aa504 samples: driver: i2c_scanner: fix upper bound on address range
0x77 is an available device address (and is the secondary address for
the BME280).  0x78 is a reserved address.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-02 13:02:38 +01:00
Peter A. Bigot
1c5cd92e12 soc: nordic: default GPIO when SPI enabled
SPI devices almost always require chip selects, which are configured
through GPIOs.  Make the GPIO infrastructure available by default when
SPI is enabled.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-02 13:01:41 +01:00
Sebastian Bøe
acb6486489 kconfig: Hide the Stellaris serial driver on unsupported platforms
Hide the Stellaris serial driver on unsupported platforms.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-12-30 16:24:50 -05:00
Sebastian Bøe
92ccd2ccd8 kconfig: Refactor the dependency on 'NET_L2_ETHERNET'
Refactor the dependency on 'NET_L2_ETHERNET'.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-12-30 16:24:50 -05:00
Sebastian Bøe
2b89316a52 kconfig: Fixed missing dependency for ETH_SAM_GMAC
The Kconfig option ETH_SAM_GMAC was missing it's dependency on
NET_L2_ETHERNET. Before this patch Kconfig was allowing users to
enable the driver, but the driver was not added because the CMake code
only adds the driver when NET_L2_ETHERNET.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-12-30 16:24:50 -05:00
Sebastian Bøe
204f05b23a kconfig: Minor comments and 'help' text fixes
Minor comments and 'help' text fixes.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-12-30 16:24:50 -05:00
Sebastian Bøe
f42ed32dc5 Kconfig: Hide SMP and USE_SWITCH from unsupported platforms
Don't present USE_SWITCH and SMP to user applications that are
configuring for platforms that do not support SMP or USE_SWITCH.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-12-30 16:24:50 -05:00
Sebastian Bøe
21d69579f5 kconfig: Have the 'SMP' option depend on 'USE_SWITCH'
SMP requires the new-style '_arch_switch' to be enabled. To prevent
users from creating invalid configurations where SMP is enabled while
_arch_switch is not, we add a dependency from SMP to USE_SWITCH.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-12-30 16:24:50 -05:00
Sebastian Bøe
4019bda695 kconfig: Disable 'RETPOLINE' on unsupported platforms
RETPOLINE has been enabled by default on most platforms, but it is
only supported on X86.

Features should only be enabled if they are supported and active on
the given platform. To rectify this we have RETPOLINE depend on X86,
the only platform on which it is implemented.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-12-30 16:24:50 -05:00
Sebastian Bøe
7201a1ba63 kconfig: Have the 'FLOAT' menu depend on it being enabled
As this was written before, a 'FLAOT' menu entry was present, and to
see what kind of features or configuration it had, one had to navigate
into the menu to determine if anything related to 'FLOAT' was enabled
at all.

Now there is an unchecked box on the 'FLOAT' menu when it is disabled,
which clearly expresses that it is disabled without the need to enter
the menu entry.

This change only changes the menu layout, and not the dependencies of
any options.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-12-30 16:24:50 -05:00
Sebastian Bøe
0438657193 kconfig: Have the 'framebuffer' menu depend on it being enabled
As this was written before, a 'Framebuffer' menu entry was present,
and to see what kind of features or configuration it had, one had to
navigate into the menu to determine if anything related to
'Framebuffer' was enabled at all.

Now there is an unchecked box on the 'framebuffer' menu when it is
disabled, which clearly expresses that it is disabled without the need
to enter the menu entry.

This change only changes the menu layout, and not the dependencies of
any options.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-12-30 16:24:50 -05:00
Sebastian Bøe
2f85b2fca8 kconfig: libmetal: Have LIBMETAL_SRC_PATH depend on LIBMETAL
Kconfig options are often either of the type 'feature' or
'configuration'. Meaning, either an option controls whether a feature
is enabled, or it adjusts/configures an already enabled feature.

Configuration of features should depend on the feature they are
configuring or else noise is created both in the Kconfig output and in
the Kconfig menu.

In this commit we add a dependency from a configuration option to it's
feature option.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-12-30 16:24:50 -05:00
Savinay Dharmappa
c99cb9d201 boards: xtensa: intel_s1000_crb: set USB_DFU_MAX_XFER_SIZE to 4096
patch set the config USB_DFU_MAX_XFER_SIZE to 4096. This will
reduce the time required for flashing.

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2018-12-30 16:24:33 -05:00
Savinay Dharmappa
f0c5470671 samples: subsys: usb: dfu: Add intel_s1000 to platform_whitelist
add intel_s1000 to platform_whitelist

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2018-12-30 16:24:33 -05:00
Savinay Dharmappa
0fb1a8a836 usb: class: dfu: Add a worker thread to flash data from usb to flash
The bulk of implementation in the current DFU arch is done in the ISR.
This works well when the Flash device is memory mapped as these writes
get done comparatively quickly. However, in case of platforms where
the flash device is sitting on the SPI Bus, this was observed to
cause an exception. This exception may be because there are multiple
function calls consuming larger processing time inside the ISR. The
ISR stack may also end up going deeper and risk stack corruption on
devices with low RAM. To resolve this, we deferred flash write to a
worker thread. Also, some handshaking was added to have synchronization
with the host in accordance with the Host-Device DFU protocol.

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2018-12-30 16:24:33 -05:00
Savinay Dharmappa
b9b8daa3bc samples: subsys: usb: dfu: Fix build error for intel_s1000
intel_s1000 uses DT_SPI_NOR_DRV_NAME instead of DT_FLASH_DEV_NAME
for device binding of flash device.

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2018-12-30 16:24:33 -05:00
Yannis Damigos
33f1951c9d crc: Move crc7 into CRC single header
Move crc7 into CRC single header

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-12-30 16:24:10 -05:00
Yannis Damigos
10cf2457b9 boards/arm/olimexino_stm32: Add SDHC support
Add SDHC support over SPI2 port.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-12-30 16:24:10 -05:00
Yannis Damigos
6c1af0e090 disk: disck_access_sdhc: Switch to new SPI API
Replace legacy API calls by news ones.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-12-30 16:24:10 -05:00
Yannis Damigos
937592ead8 disk: disk_access_sdhc: Enable multiple disk interfaces
Enable multiple disk interfaces for SDHC.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-12-30 16:24:10 -05:00