Commit graph

48120 commits

Author SHA1 Message Date
Flavio Ceolin
30de4b5dd9 power: Fix dummy policy states info
../../../../../include/power/power_state.h:280:41: warning: missing
braces around initializer [-Wmissing-braces]
  280 | #define PM_STATE_DT_ITEMS_LIST(node_id) {           \
      |                                         ^

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-01-28 20:24:46 -05:00
Flavio Ceolin
131913c5b6 power: Fix function return in dummy policy
There was one case where the dummy policy was returning a wrong type
in the function pm_policy_next_state.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-01-28 20:24:46 -05:00
Nicolas Pitre
7fcf5519d0 aarch64: mmu: cleanups and fixes
Major changes:

- move related functions together
- optimize add_map() not to walk the page tables *twice* on
  every loop
- properly handle leftover size when a range is already mapped
- don't overwrite existing mappings by default
- return an error when the mapping fails

and make the code clearer overall.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2021-01-28 20:24:30 -05:00
Peter Bigot
dfd8e7522d doc: release: 2.5: add regulators API
Document the existence of the new API that allows constrol of power
management infrastructure, and support for associating power management
dependencies in devicetree.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-28 17:46:15 -05:00
Marcin Niestroj
2a6ddd2d3b drivers: wifi: esp: fix AT+CWMODE_CUR compatibility with ESP AT 1.7
There was a regression when implementing automatic AT+CWMODE{,_CUR}
handling based on driver needs. ESP AT 1.7 firmware does not support
AT+CWMODE_CUR=0, which means that radio needs to be either in STA, AP or
STA+AP mode (no NONE state available).

Fix ESP AT 1.7 compatibility by keeping radio in STA mode whenever it is
not used.

Move also first AT+CWMODE_CUR invocation before AT+CWDHCP_CUR, so that
the latter executes successfully with ESP AT 1.7.

Fixes: 03ce61004b ("drivers: wifi: esp: control CWMODE depending on
  current needs")
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-01-28 17:23:06 -05:00
Peter Bigot
99a4af6c4a tests: lib: cbprintf_fp: add missed README
Basic explanation of what this test is doing, was missed in the commit
where the test was added.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-28 16:32:46 -05:00
Armando Visconti
4141705ad3 drivers/sensor: Fix typos in iis2dlpc/iis2iclx/lsm6dso
The ',' character was used as line terminator instead of ';'
in SPI routines. The three affected drivers were not showing
any issue, but the typo is fixed for clarity.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-01-28 13:56:42 -05:00
Tomi Ollila
66d1b3ce10 kconfig: kconfiglib.py: Backup files only
The _save_old() to return early if <filename> is not file (or symlink
to a file).

This is simplest alternative to avoid attempt to rename /dev/null
(which could succeed).

This also keeps fifos (perhaps nonexistent potential usage but
this is nicer).

If <filename> were directory or socket, after shutil.copyfile(),
writing to the file (by caller, _write_config()), would fail.

Fixes #31362

Co-authored-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
Signed-off-by: Tomi Ollila <tomi.ollila@iki.fi>
2021-01-28 10:40:24 -05:00
Anas Nashif
3c3504f7e5 CODEOWNERS: Remove inactive users and minor cleanup
Remove wentong and other changes based on MAINTAINER file.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-01-28 10:10:45 -05:00
Dominik Ermel
a910b26587 tests/fs/fa_api: Fix order of checks and broken zassert messages
The commit fixes three things:
 - the order of zassert_* checks has been often incorrect, and some
   checks of values have been done after some other operations has
   been performed;
 - some operations have been missing checks at all;
 - most of zassert_* messages have been given ret parameter to be
   printed but it has been missing from format string.

This addresses:
Coverity CID :215714
GH Issue: #31668

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-01-28 09:28:20 -05:00
Martí Bolívar
de73db9dbc doc-build: build with west 0.9
This is required to get the relevant API docstrings.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-01-28 08:23:52 -05:00
Martí Bolívar
ac9fde5be6 doc: west reserves refs/west/
These Git refs are used by west as a scratch space. Let that be known,
but don't make any other guarantees.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-01-28 08:23:52 -05:00
Martí Bolívar
ed4d218abe doc: west: release notes for 0.9.0
The main new features are submodule support and project groups.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-01-28 08:23:52 -05:00
Martí Bolívar
fbcdb7e554 doc: west: API changes for 0.9.0
These are minimal.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-01-28 08:23:52 -05:00
Martí Bolívar
43a7f71332 doc: west: update schema version
West 0.9 has a new schema version; document it and fix a missed update
from 0.8. Whoops.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-01-28 08:23:52 -05:00
Martí Bolívar
8725ba8ae3 doc: west: add submodules
West 0.9, now with submodules!

This is a new feature which allows you to incorporate a project's Git
submodules into the workspace.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-01-28 08:23:52 -05:00
Martí Bolívar
a4bb1faec5 doc: west: add project groups
This is a new feature that allows you to associate projects with
groups, then force west to ignore a subset of the projects list by
disabling project groups. This can be selectively overridden via
configuration file to make west stop ignoring the projects within an
individual workspace.

An example use case is to define a project whose Git repository
requires credentials to pull. Putting such a project in a group named
"foo" and disabling group "foo" would make "west update" ignore the
project unless the user specifically configures the workspace to allow
"foo". After that, "west update" will pull the project as usual.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-01-28 08:23:52 -05:00
Martí Bolívar
560f685213 doc: west has moved to allowlist/blocklist
The west manifest import feature now uses the terms "allowlist" and
"blocklist" instead of "whitelist" and "blacklist", respectively.

The old terms are still supported by the tool for compatibility, but
the docs for this feature are going to use the new terms exclusively.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-01-28 08:23:52 -05:00
Martí Bolívar
3262b09b05 doc: re-work west update to prep for new features
The west update docs mix together the steps for updating a project
with the set of projects that are being updated. This is inconvenient
now that west 0.9 has a concept of inactive projects.

Split the content into a part that describes *which* projects are
updated, and a separate part that describes how *each* project is
updated.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-01-28 08:23:52 -05:00
Martí Bolívar
04f8bb7e78 doc: west: add manifest.file config option
I never added documentation for this option; whoops.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-01-28 08:23:52 -05:00
Martí Bolívar
7fe7695d01 doc: west update can create loose commits
Try to spell out the implications of that a bit more clearly.

Suggested-by: Marc Herbert <marc.herbert@intel.com>
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-01-28 08:23:52 -05:00
Rubin Gerritsen
4f034740eb sensor: nrf5: temp: Allow alternative temp driver
This allows out-of-tree libraries to implement their own temperature
driver.

We allow selecting TEMP_NRF5 to aviod dependency loops

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-01-28 08:19:34 -05:00
Rubin Gerritsen
bf5d48af84 drivers: clock_control: Clock calibtration with alt driver
With this change it is possible to share all configurations
related to CLOCK_CONTROL_NRF_K32SRC_RC_CALIBRATION without
including the clock calibration configurations.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-01-28 08:19:34 -05:00
Rubin Gerritsen
2a95e9a136 drivers: clock_control: Clock calibration depends on RC
Clock calibration should only be used when RC source is used.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-01-28 08:19:34 -05:00
Jedrzej Ciupis
1d922f4995 drivers: gpio_nrfx: Allocate GPIOTE channels with nrfx
The GPIO driver uses a proprietary GPIOTE channel allocator.
This commit makes it use the allocation mechanism provided by nrfx.

Signed-off-by: Jedrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
2021-01-28 08:19:16 -05:00
Vincent Wan
41a726dac8 samples: cc13x2_cc26x2: system_off: force soft off state
In the last step of the example, the system should go into soft off
state in order to match the original intent in the example to go
into the hardware's SHUTDOWN mode.

Fixes #31727

Signed-off-by: Vincent Wan <vanti.coder@gmail.com>
2021-01-28 08:15:55 -05:00
Vincent Wan
66ed8d53e5 soc: cc13x2_cc26x2: add support for soft off power state
The soft off power state should be supported as it is closest to what
used to be deep sleep state 1, which corresponds to the device off
state supported by hardware.

Fixes #31727.

Signed-off-by: Vincent Wan <vanti.coder@gmail.com>
2021-01-28 08:15:55 -05:00
Nicolas LANTZ
3ff1eb618f Bluetooth: Mesh: Fix mod app key get vnd
pass cid instead of CID_NVAL in parameters of mod_member_list_get

Signed-off-by: Nicolas LANTZ <nicolas.lantz@ubicore.net>
2021-01-28 07:52:06 -05:00
Marek Pieta
2a7ccc563e include: Add missing extern "C" to spinlock.h
Change adds missing extern "C" to spinlock.h file. This is
required to use spinlock from C++ code.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2021-01-28 07:50:24 -05:00
Scott Worley
af67564573 soc: mchp: Update 32KHz programming sequence
Based upon discussions with HW designers the 32KHz
    programming sequence can be simplified. When FW writes
    a value to the VBAT 32KHz Clock Enable register HW checks
    if the value is the same as the current value. If the same
    the HW does nothing. If different HW begins a sequence to
    switch off the current 32KHz source, revert to ring oscillator,
    and switch to the new source. FW should program the new value
    and then spin until the PCR OSC ID PLL Lock bit goes to 1.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2021-01-27 21:37:39 -05:00
Flavio Ceolin
2712d74cdc tests: power: Fix Coverity error about uninitialized variable
Just initialize a variable with sane values.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-01-27 18:36:19 -05:00
Kasun Hewage
7dad85695e net: coap: Fixed discovery response formatting according to RFC6690
CoAP RFC (RFC7252) states that end points should support
the CoRE Link Format of discoverable resources as described in RFC6690
(refer section 7.2 of the RFC7252).

Fixes #31609

Signed-off-by: Kasun Hewage <kasun.ch@gmail.com>
2021-01-27 18:26:13 -05:00
Flavio Ceolin
4ab6dd003e timer: arm: Mark ticks as unused
When TICKLESS_KERNEL is disabled the parameter ticks is not used.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-01-27 16:55:58 -05:00
Flavio Ceolin
cd0caced65 timer: arm: idle is used when CONFIG_TICKLESS_KERNEL
Only mark idle parameter unused when building without TICKLESS_KERNEL
enabled.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-01-27 16:55:58 -05:00
Flavio Ceolin
345849052a timer: arm: Fix idle usage option
idle is only considered in other timer implementations if ticks ==
K_TICKS_FOREVER but in arm_arch_timer. Just fix it.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-01-27 16:55:58 -05:00
Flavio Ceolin
e58024b45a doc: scheduling: Remove ambiguous sentence
The documentation example was giving the impression that time slices are
not reset when a thread is scheduled.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-01-27 16:55:58 -05:00
Flavio Ceolin
148769c715 sched: timeout: Do not miss slice timeouts
Time slices don't have a timeout struct associated and stored in
timeout_list. Time slice timeout is direct programmed in the system
clock and tracked in _current_cpu->slice_ticks.

There is one issue where the time slice timeout can be missed because
the system clock is re-programmed to a longer timeout. To this happens,
it is only necessary that the timeout_list is empty (any timeout set)
and a new timeout longer than remaining time slice is set. This is cause
because z_add_timeout does not check for the slice ticks.

The following example spots the issue:

K_THREAD_STACK_DEFINE(tstack, STACK_SIZE);
K_THREAD_STACK_ARRAY_DEFINE(tstacks, NUM_THREAD, STACK_SIZE);
K_SEM_DEFINE(sema, 0, NUM_THREAD);

static inline void spin_for_ms(int ms)
{
	uint32_t t32 = k_uptime_get_32();

	while (k_uptime_get_32() - t32 < ms) {
	}
}

static void thread_time_slice(void *p1, void *p2, void *p3)
{
	printk("thread[%d] - Before spin\n", (int)(uintptr_t)p1);

	/* Spinning for longer than slice */
	spin_for_ms(SLICE_SIZE + 20);

	/* The following print should not happen before another
	 * same priority thread starts.
	 */
	printk("thread[%d] - After spinning\n", (int)(uintptr_t)p1);
	k_sem_give(&sema);
}

void main(void)
{
	k_tid_t tid[NUM_THREAD];
	struct k_thread t[NUM_THREAD];
	uint32_t slice_ticks = k_ms_to_ticks_ceil32(SLICE_SIZE);
	int old_prio = k_thread_priority_get(k_current_get());

	/* disable timeslice */
	k_sched_time_slice_set(0, K_PRIO_PREEMPT(0));

	for (int j = 0; j < 2; j++) {
		k_sem_reset(&sema);

		/* update priority for current thread */
		k_thread_priority_set(k_current_get(), K_PRIO_PREEMPT(j));

		/* synchronize to tick boundary */
		k_usleep(1);

		/* create delayed threads with equal preemptive priority */
		for (int i = 0; i < NUM_THREAD; i++) {
			tid[i] = k_thread_create(&t[i], tstacks[i], STACK_SIZE,
						 thread_time_slice, (void *)i, NULL,
						 NULL, K_PRIO_PREEMPT(j), 0,
						 K_NO_WAIT);
		}

		/* enable time slice (and reset the counter!) */
		k_sched_time_slice_set(SLICE_SIZE, K_PRIO_PREEMPT(0));

		/* Spins for while to spend this thread time but not longer */
		/* than a slice. This is important  */
		spin_for_ms(100);

		printk("before sleep\n");
		/* relinquish CPU and wait for each thread to complete */
		k_sleep(K_TICKS(slice_ticks * (NUM_THREAD + 1)));

		for (int i = 0; i < NUM_THREAD; i++) {
			k_sem_take(&sema, K_FOREVER);
		}

		/* test case teardown */
		for (int i = 0; i < NUM_THREAD; i++) {
			k_thread_abort(tid[i]);
		}
		/* disable time slice */
		k_sched_time_slice_set(0, K_PRIO_PREEMPT(0));
	}
	k_thread_priority_set(k_current_get(), old_prio);
}

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-01-27 16:55:58 -05:00
Flavio Ceolin
be2f447f61 tests: schedule_api: Improve log on error
Increase thread counter before the assert, otherwise in case of fail
the output will give the impression that the same thread ran more than
once.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-01-27 16:55:58 -05:00
Flavio Ceolin
e34f104693 tests: schedule_api: Do not mess ms with ticks
TASK_SWITCH_TOLERANCE is set in ms but it was being used directly as
ticks.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-01-27 16:55:58 -05:00
Andy Ross
2f6b202ed5 tests/schedule_api: Correct tick/ms math for non-divisible clocks
Adjusting the tick alignment of this test caused it to start breaking
on nRF5 platforms, which use a 32768 Hz clock that doesn't divide
evenly into the millisecond precision used by the test.  The "half
slice" math ended up being wrong by a bit.

Convert to ticks first before computing the cycle delay needed.

Fixes #29705

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-01-27 16:55:58 -05:00
Peter Bigot
10180af38d lib: cbprintf: avoid referencing distinct union fields in a statement
An assignment from one multi-word union field to another was not safe
from corruption.  Copy the value out to a local value before storing it
to the preferred union field.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-27 16:45:38 -05:00
Shlomi Vaknin
0129dd6f28 tests: cmsis-dsp: Add native_posix to ci
Add support for compiling native_posix platform
in cmsis-dsp tests on ci.

Signed-off-by: Shlomi Vaknin <shlomi.39sd@gmail.com>
2021-01-27 14:48:37 -05:00
Shlomi Vaknin
cca4e89c1f modules: cmsis-dsp: Support compiling on native posix
Support compiling cmsis-dsp on native posix
architectures, as cmsis-dsp allows that.

Signed-off-by: Shlomi Vaknin <shlomi.39sd@gmail.com>
2021-01-27 14:48:37 -05:00
Shlomi Vaknin
6913d11920 west.yml: Update cmsis revision
DSP: Support compiling on native posix.

Signed-off-by: Shlomi Vaknin <shlomi.39sd@gmail.com>
2021-01-27 14:48:37 -05:00
Peter Bigot
6bdd4c1cb6 tests: littlefs: check unmount return value
Most tests are checking this; make littlefs conform.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-27 14:46:12 -05:00
Francois Ramu
1280e9817c drivers: timer: stm32 lptim fix Potentially overflow
Fix Unintentional integer overflow in the calculation
Integer handling issues (OVERFLOW_BEFORE_WIDEN)
Potentially overflowing expression

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-01-27 14:45:20 -05:00
Vinayak Kariappa Chettimada
7712caa1a7 Bluetooth: controller: Fix peripheral conditional compilation
Fix regression in peripheral only build conditional
compilation introduced in commit 8a9bda307cc1 ("Bluetooth:
controller: Fix CPR conditional compilation").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-01-27 13:35:48 -05:00
Vinayak Kariappa Chettimada
7295204af9 Bluetooth: controller: Fix CPR conditional compilation
Move the newly added Connection Parameter Request reject
state implementation under conditional compilation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-01-27 13:35:48 -05:00
Vinayak Kariappa Chettimada
804419592f Bluetooth: controller: Fix incorrect reset of CPR reject state
Fix regression in adding the state for Connection Parameter
Request being rejected where in Connection Parameter Request
Procedure state machine was prematurely reset before the
reject PDU was enqueued.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-01-27 13:35:48 -05:00
Vinayak Kariappa Chettimada
7bf202791f Bluetooth: controller: Fix missing initialization
Fix missing initialization of ticks_to_offset value on
instantiation of new peripheral context.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-01-27 13:35:48 -05:00