Commit graph

466 commits

Author SHA1 Message Date
Simon Glass
7f251a7d08 board: arm: google_kukui: Add a sample for kukui
It is useful to use kukui with a shell to test out its features., Add a
sample for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-07-08 19:21:40 -04:00
Peter Bigot
1688f8c740 samples: nrf: system_off: show how to disable deep sleep
Due to a long standing difference of requirements enabling deep sleep
will by default cause any application that delays for an unbounded
period to power down.  On Nordic doing so turns the system off.  Show
how to prevent this from happening while still allowing deep sleep
states to be available for the application's controlled use.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-07-07 15:06:08 +02:00
Reto Schneider
0b4b3ae4dd cmake, samples, tests: Use semi-accurate project names
When using an IDE (e.g. Eclipse, Qt Creator), the project name gets
displayed. This greatly simplifies the navigation between projects when
having many of them open at the same time. Naming multiple projects
"NONE" defeats this functionality.

This patch tries to use sensible project names while not duplicating
too much of what is already represented in the path. This is done by
using the name of the directory the relevant CMakeLists.txt file is
stored in. To ensure unique project names, small, manual adjustments
have been done.

See also 7eabab2f5d ("samples, tests: Use semi-accurate project names")

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2020-06-09 08:18:29 -04:00
Kumar Gala
a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00
Vincent Wan
99a9aa4f7d samples: cc13x2_cc26x2: system_off: fix documentation formatting
Fix minor formatting issue in README to fully display console output.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-05-29 15:05:18 +02:00
Marc Herbert
2cd51a33ce samples: make find_package(Zephyr...) REQUIRED
This provides a better error message when building with CMake and
forgetting ZEPHYR_BASE or not registering Zephyr in the CMake package
registry. See parent commit for more details (split from parent for
better readability).

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-05-29 10:47:25 +02:00
Peter Bigot
24c1be3896 samples: nrf: system_off: demonstrate use of device pm to reduce power
Currently system power management does not automatically control
device power, and this example demonstrates high current draw due to
the UART being enabled.  Enable device power management and
demonstrate how to manually turn off greedy devices.

Also remove the 60 s delay that confirms we successfully turned off
the residency policy; that's not directly relevant to the purpose of
the sample.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-05-25 16:25:33 +02:00
Daniel Leung
ec9a413983 boards: x86: make up_squared default to x86_64
This makes the up_squared board default to x86_64.
This also adds a new board, up_squared_32, for when 32-bit
is desired.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-05-19 19:19:51 +02:00
Joakim Andersson
44bcf98962 samples: boards: intel_s1000_crb: Rename to README.rst
Rename the sample .rst files to README.rst to be consistent with other
samples.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-15 17:18:56 +02:00
Kumar Gala
ff579a3af3 flash: Convert DT_FLASH_AREA to FLASH_AREA macros
Convert with a combo of scripts and by hand fixups:

git grep -l DT_FLASH_AREA_.*_ID | \
 xargs sed -i -r 's/DT_FLASH_AREA_(.*)_ID/FLASH_AREA_ID(\L\1)/'

git grep -l DT_FLASH_AREA_.*_OFFSET | \
 xargs sed -i -r 's/DT_FLASH_AREA_(.*)_OFFSET/FLASH_AREA_OFFSET(\L\1)/'

git grep -l DT_FLASH_AREA_.*_SIZE | \
 xargs sed -i -r 's/DT_FLASH_AREA_(.*)_SIZE/FLASH_AREA_SIZE(\L\1)/'

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-13 21:22:53 +02:00
Martí Bolívar
6c3fb76698 samples: mesh_badge: remove dead code
PULL_UP is not used. The sw0 flags are read directly in
configure_button().

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-13 19:51:01 +02:00
Martí Bolívar
d42ef5e5da samples: bbc_microbit: cleanups
Clean up the board specific samples:

- Do not hard-code the i2c0 device label in the line follower sample.
- Miscellaneous docs cleanups.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-13 19:51:01 +02:00
Martí Bolívar
6e8775ff84 devicetree: remove DT_HAS_NODE_STATUS_OKAY
Several reviewers agreed that DT_HAS_NODE_STATUS_OKAY(...) was an
undesirable API for the following reasons:

- it's inconsistent with the rest of the DT_NODE_HAS_FOO names
- DT_NODE_HAS_FOO_BAR_BAZ(node) was agreed upon as a shorthand
  for macros which are equivalent to
  DT_NODE_HAS_FOO(node) && DT_NODE_HAS_BAR(node) &&
- DT_NODE_HAS_BAZ(node), and DT_HAS_NODE_STATUS_OKAY is an odd duck
- DT_NODE_HAS_STATUS(..., okay) was viewed as more readable anyway
- it is seen as a somewhat aesthetically challenged name

Replace all users with DT_NODE_HAS_STATUS(..., okay), which is
semantically equivalent.

This is mostly done with sed, but a few remaining cases were done by
hand, along with whitespace, docs, and comment changes. These special
cases include the Nordic SOC static assert files.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-13 18:24:42 +02:00
Jose Alberto Meza
98ce11676e samples: boards: mec15xxevb: Update power management test cases
Add indication when sleep entry/exit counter do not match the test
expectations.
Measure deep sleep entry latency.
Add sleep entry/exit indication via gpios to debug.
Remove unnecessary trailing \n when using logging.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-05-08 17:46:45 +02:00
Carles Cufi
b67a31e411 Bluetooth: controller: Remove legacy LL
Remove the legacy Link Layer implementation.

Closes #24187.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-05-08 15:07:00 +02:00
Carles Cufi
9ba20dd48e drivers: audio: Port to the new timeout API
Port the I2S and DMIC drivers to the new timeout API so that they do
not need to enable legacy timeouts.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-05-07 11:01:55 +02:00
Carles Cufi
9b04a99243 timeouts: Port BBC micro:bit to the new timeout API
Port the BBC micro:bit display driver to the new timeout API exposed by
the kernel.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-05-07 11:01:55 +02:00
Kumar Gala
fdd85d5ad7 dts: Rename DT_HAS_NODE macro to DT_HAS_NODE_STATUS_OKAY
Rename DT_HAS_NODE to DT_HAS_NODE_STATUS_OKAY so the semantics are
clear.  As going forward DT_HAS_NODE will report if a NODE exists
regardless of its status.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-06 05:25:41 -05:00
Kumar Gala
4e93b77552 samples: Convert DT_ALIAS_* to new DT_ALIAS() macro
Convert DT_ALIAS_* defines to use DT_ALIAS() plus other macros from
include/devicetree.h.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-04 15:28:20 -05:00
Kumar Gala
009ca36bb7 samples: cc13x2_cc26x2: system_off: Convert to use new dts macros
Convert DT_TI_CC13XX_CC26XX_GPIO_40022000_LABEL to
DT_LABEL(DT_NODELABEL(gpio0))

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-30 17:44:50 -05:00
Kumar Gala
50750bfa31 samples: nrf: battery: Convert to new dts macros
Change #ifdef DT_VOLTAGE_DIVIDER_VBATT_IO_CHANNELS to
 #if DT_NODE_HAS_PROP(DT_INST(0, voltage_divider), io_channels)

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-30 17:44:24 -04:00
Kumar Gala
aea994455a sample: boards: nrf: system_off: Convert to use new dts macros
Convert to use DT_GPIO_PIN(DT_NODELABEL(button0), gpios) to get the gpio
pin number.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-30 17:44:24 -04:00
Kumar Gala
c678f9c132 samples: boards: nrfx: Convert to new dts macros
Convert to use DT_IRQN() and DT_IRQ() to get the irq number and priority
for the DT_NODELABEL(gpiote) device.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-30 17:44:24 -04:00
Joakim Andersson
ab706b28d5 Bluetooth: samples: Convert to using k_timeout_t struct
Convert bluetooth samples or board samples using bluetooth to use the
new k_timeout_t struct.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-04-30 13:46:48 +03:00
Kumar Gala
7a15afc1d4 drivers: flash: replace DT_FLASH_DEV_NAME with DT macro
Replace DT_FLASH_DEV_NAME with DT_CHOSEN_ZEPHYR_FLASH_CONTROLLER_LABEL.
We now set zephyr,flash-controller in the chosen node of the device
tree to the flash controller device.

NOTE: For a SoCs with on die flash, this points to the controller and
      not the 'soc-nv-flash' node.  Typically the controller is the
      parent of the 'soc-nv-flash' node).

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-27 18:43:20 -05:00
Lingao Meng
be33f913ac Bluetooth: Mesh: Remove net_idx params when with app key
According Mesh Profile 1.0.1. A application key shall
binding single network key. And Device key shall bind all
network key, and dev key only known by cfg_cli and node self,
only used by cfg_cli & cfg_srv.

Fixes: #21088

Signed-off-by: Lingao Meng <mengabc1086@gmail.com>
2020-04-23 11:30:41 +03:00
Peter Bigot
cc3ccef40d samples: nrf: battery: add documentation
Provide a description of the sample and how it works with different
power supply source configurations.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-04-22 17:46:07 +02:00
Peter Bigot
628bd00168 samples: nrf: battery: extend to support measuring Vdd directly
When the system is powered directly a measurement of Vdd provides the
battery voltage.  This requires a different ADC configuration and
level curve.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-04-22 17:46:07 +02:00
Vincent Wan
eb78c3ff6c samples: system_off: turn off external flash
To obtain lower power measurements in general, we should turn off the
external flash which is on by default at boot.

Code is modeled based on examples shipped in the TI SimpleLink SDK.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-04-22 17:39:47 +02:00
Vincent Wan
d751d5674a samples: cc13x2_cc26x2: add system off power example
Adding an example that exercises the sleep modes, then powers off the
system by going into deep sleep.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-04-22 17:39:47 +02:00
Erwan Gouriou
81f27c2265 boards: stm32: Use dt API for serial peripheral configuration
Replace use of Kconfig UART_X symbols by calls to DT API.
Clean driver from symbols definitions

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-04-20 15:27:56 -05:00
Wayne Ren
470a48484f arch: arc: move ARC normal related configurations out of board dir
Now the ARC SecureShield related features are experimental. The ARC
normal application cannot run alone, need the secure service example to
initialize the context and boot.

Here move ARC normal related configurations out of board dir to
avoid the impact of CI test and the confusion to users.

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2020-04-20 15:42:26 +02:00
Peter Bigot
45f126f871 coccinelle: re-run timeout conversion semantic patch
This fixes a variety of K_THREAD_DEFINE issues that were missed.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-04-15 08:28:57 -05:00
Daniel Leung
2e7831562a samples: mec15xxevb_assy6853/pm: shorten wait after deep sleep
The origin for sleeping for 3ms after coming out of deep sleep
was to wait for PLL to lock so that UART would not send
garbage characters due to incorrect clock. In the deep sleep
code, it spins to wait for the PLL to lock so there is no need
to wait for 3ms in the app. So shorten it like other busy wait.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-04-10 07:48:33 -04:00
Daniel Leung
fd1d93e552 samples: mec15xxevb_assy6853/pm: abort threads before reuse
Threads are being re-used for multiple runs, so it is better to
stop the threads before reusing the variables for new threads.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-04-10 07:48:33 -04:00
Carles Cufi
0f9b3626c1 boards: nrf52_pca20020: Rename to thingy52_nrf52832
The board name for the Thingy:52, so far known as nrf52_pca20020, is
renamed to thingy52_nrf52832.  Its documentation and all references to
its name in the tree are updated accordingly. Overlay and configuration
files specific to this board are also renamed, to match the new board
name.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-04-06 13:09:07 +02:00
Carles Cufi
6656214af2 boards: nrf52_pca10040: Rename to nrf52dk_nrf52832
The board name for the nRF52 DK, so far known as nrf52_pca10040, is
renamed to nrf52dk_nrf52832.  Its documentation and all references
to its name in the tree are updated accordingly. Overlay and
configuration files specific to this board are also renamed, to
match the new board name.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-04-06 13:09:07 +02:00
Andy Ross
32bb2395c2 timeout: Fix up API usage
Kernel timeouts have always been a 32 bit integer despite the
existence of generation macros, and existing code has been
inconsistent about using them.  Upcoming commits are going to make the
timeout arguments opaque, so fix things up to be rigorously correct.
Changes include:

+ Adding a K_TIMEOUT_EQ() macro for code that needs to compare timeout
  values for equality (e.g. with K_FOREVER or K_NO_WAIT).

+ Adding a k_msleep() synonym for k_sleep() which can continue to take
  integral arguments as k_sleep() moves away to timeout arguments.

+ Pervasively using the K_MSEC(), K_SECONDS(), et. al. macros to
  generate timeout arguments.

+ Removing the usage of K_NO_WAIT as the final argument to
  K_THREAD_DEFINE().  This is just a count of milliseconds and we need
  to use a zero.

This patch include no logic changes and should not affect generated
code at all.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-03-31 19:40:47 -04:00
Ioannis Glaropoulos
e0b8158ca1 boards: arm: nrf9160_pca10090: rename board to nrf9160dk_nrf9160
We rename the nRF91 Dev Kit board target (nrf9160_pca10090)
to nrf9160dk_nrf9160. We update all associated references
in the supportive documentation and all nRF9160-related
cofigurations and overlay files in the samples and tests
in the tree.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-03-31 15:16:08 +02:00
Kumar Gala
f8f044249c samples: boards: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-31 07:14:21 -05:00
Joakim Andersson
f2d7b77e96 Bluetooth: host: Deprecate BT_LE_ADV defines in hci.h in favour of gap.h
Deprecate BT_LE_ADV defines in hci.h that are expected to be used by the
application in the scan received callback to identify the advertising
PDU type. These defines are mixing HCI input parameters and advertising
PDU types. Internally it is acceptable to mix these, but at the API we
should to mix in them.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-03-30 00:38:23 +03:00
Joakim Andersson
405ce842ab Bluetooth: host: Add new argument and return code to bt_create_conn_le
Deprecate bt_create_conn_le and rename it to in order to add return
code, new arguments and to follow the established naming convention.

Add API for the application to control the scan parameters of the
initiator role. This allows the application more scheduling control
of the initiator in multi-role scenarios. Also provides options to
configure the initiator for LE Coded PHY for long range support.
We deprecate the old way of creating connection to make the name more
consistent with the rest of the API.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-03-30 00:38:23 +03:00
Peter Bigot
090088d015 samples: boards: nrf: battery: Convert to new DT macros
Reference properties through the path to vbatt.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-03-27 11:41:04 -05:00
Torsten Rasmussen
407b49b35c cmake: use find_package to locate Zephyr
Using find_package to locate Zephyr.

Old behavior was to use $ENV{ZEPHYR_BASE} for inclusion of boiler plate
code.

Whenever an automatic run of CMake happend by the build system / IDE
then it was required that ZEPHYR_BASE was defined.
Using ZEPHYR_BASE only to locate the Zephyr package allows CMake to
cache the base variable and thus allowing subsequent invocation even
if ZEPHYR_BASE is not set in the environment.

It also removes the risk of strange build results if a user switchs
between different Zephyr based project folders and forgetting to reset
ZEPHYR_BASE before running ninja / make.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-03-27 16:23:46 +01:00
Andrzej Głąbek
4253eae005 boards: nrf52840_pca10056: Rename board to nrf52840dk_nrf52840
The nRF52840 DK board target, so far known as nrf52840_pca10056,
is renamed to nrf52840dk_nrf52840.
Its documentation and all references to its name in the tree are
updated accordingly. Overlay and configuration files specific to
this board are also renamed, to match the new board name.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-03-27 09:14:08 +01:00
Ioannis Glaropoulos
f3807f19dc boards: arm: nrf51_pca10028: rename board to nrf51dk_nrf51422
We rename the nRF51 Dev Kit board target (nrf51_pca10028)
to nrf51dk_nrf51422. We update all associated references
in the supportive documentation and all nRF51-related
cofigurations and overlay files in the samples and tests
in the tree.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-03-24 11:45:27 +01:00
Andrew Boie
f60563bbeb samples: pong: use log_stack_usage()
Don't use deprecated APIs.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-03-14 13:10:19 -04:00
Jose Alberto Meza
8b14807e55 samples: boards: mec15xxevb: Power management tests
Sample code that demonstrates power management features on
MEC15xx-based boards.
It showcases how an app can  enter into light and deep sleep.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-03-12 23:24:30 +02:00
Andrew Boie
c6d37eba7b samples: arc_secure_services: fix sample.yaml
This test can't be evaluated with sanitycheck, it
requires special set-up on multiple AMP cores to
function properly. Add build_only tag.

Fixes: #19643
Fixes: #22317

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-02-13 12:59:47 +02:00
Peter Bigot
86d1b7d2c8 samples: boards: nrf: update battery sample for new GPIO API
Replace legacy API and configuration.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00