Commit graph

41120 commits

Author SHA1 Message Date
Arthur Crepin-Leblond
1d36734799 Bluetooth: gatt: Reuse existing handles from a previously added service
When removing a service using bt_gatt_service_unregister, its attributes
handles will keep their value which can cause a problem when adding the
service again to the GATT database.
When re-adding, the gatt_register routine is taking the last handle of
the GATT database to compare it with the handles of the service to be
added.
If a service has handles with a lower value than the last handle of
the database an error will occur.
If we add/remove/add the last service, no error will occur as its
handles are always greater than the last one of the database.

Instead of resetting the handles when unregistering a service and
reassign new ones we make sure that the handles of the services are
not in use in the GATT database in order to place the service back
where it used to be.

Signed-off-by: Arthur Crepin-Leblond <arthur.crepin@proglove.de>
2019-05-30 17:17:30 -04:00
Brett Witherspoon
6cf806ac9a boards: cc1352r1_launchxl / cc26x2r1_launchxl: enable ROM bootloader
This enables the ROM bootloader on the CC13x2 / CC26x2 LaunchPad
development boards. The bootloader can be started by holding BTN-1
during reset. This can be useful during development to recover a board
if DAPs get disabled.

Signed-off-by: Brett Witherspoon <spoonb@cdspooner.com>
2019-05-30 17:15:53 -04:00
Brett Witherspoon
e8ac495660 soc: cc13x2_cc26x2: support setting CCFG values via Kconfig
Several customer configuration (CCFG) settings are useful for
development and deployment. This commit adds support for setting CCFG
values via Kconfig. It follows TI's recommendation of setting CCFG
values and then including the TI provided CCFG. This commit includes
support for enabling the ROM bootloader and additional settings can be
added as needed.

Signed-off-by: Brett Witherspoon <spoonb@cdspooner.com>
2019-05-30 17:15:53 -04:00
Asger Munk Nielsen
eb73a32bc1 Bluetooth: controller: Moved advanced settings in Kconfig
Moved some user defined Kconfig constants to advanced
settings menu.

Signed-off-by: Asger Munk Nielsen <asmk@oticon.com>
2019-05-30 17:14:54 -04:00
Asger Munk Nielsen
8844b7f5a5 Bluetooth: controller: Enable use of user defined protocols
Implements hooks to implement user protocols in ull.c
A user defined init function can now be called, this code is gated by
the CONFIG_BT_CTLR_USER_EXT define.
A user defined PDU length can now also be defined using the Kconfig
CONFIG_BT_RX_USER_PDU_LEN

Signed-off-by: Asger Munk Nielsen <asmk@oticon.com>
2019-05-30 17:14:54 -04:00
Maureen Helm
c8ae05dd80 tests: flash_map: Configure mpu to allow flash write
On boards that have the arm or nxp mpu, configure the mpu to allow flash
writes. Otherwise this test will fail with an mpu fault.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2019-05-30 17:13:13 -04:00
Nathaniel Graff
73a96c0052 soc/riscv32: Make clock init code common to SoC
The HiFive1 and HiFive1 Rev B share the same clock initialization
code, so put it in soc/riscv32/riscv-privilege/sifive-freedom.

Signed-off-by: Nathaniel Graff <nathaniel.graff@sifive.com>
2019-05-30 16:54:02 -04:00
Nathaniel Graff
8b40260283 boards/riscv32: Add support for the HiFive1 Rev B
The HiFive1 Rev B adds the following features to the
original HiFive1:

 - A second UART peripheral 'uart_1'
 - A hardware I2C peripheral 'i2c_0'
 - Segger J-Link OB
 - An ESP32-WROOM attached to the 'spi_1' peripheral bus

Signed-off-by: Nathaniel Graff <nathaniel.graff@sifive.com>
2019-05-30 16:54:02 -04:00
Nathaniel Graff
bd2919dcf1 runners/jlink: Add --tool-opt option for more args
Adds the --tool-opt option to allow additional arguments to be
passed to JLink Commander

Signed-off-by: Nathaniel Graff <nathaniel.graff@sifive.com>
2019-05-30 16:54:02 -04:00
Piotr Zięcik
2af4c1575b drivers: litex_timer: Do not hard code tick rate
The litex_timer driver used hard coded tick rate (set to 100 ticks
per second). This commit replaces the fixed value with a call to
system function which takes under account system configuration.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2019-05-30 11:21:44 -04:00
Lucas Peixoto
bc3d01cda5 fs: implemented unmount function to fatfs
There isn't a function to handle the unmount, so I implemented based
in f_mount comments. In the comments of f_mount we actually have
that f_mount is used to mount/unmount logic, is just necessary use
NULL pointer to fs argument.

Signed-off-by: Lucas Peixoto <lucaspeixotoac@gmail.com>
2019-05-30 11:19:36 -04:00
Michael Scott
46d3e86ee8 boards: rv32m1_vega_ri5cy: set shell UART in DTS
This fixes any sample which enabled CONFIG_SHELL.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-05-30 09:21:39 -05:00
Ioannis Glaropoulos
18e80aeb4a arch: arm: mpu: remove arm_core_mpu_enable/disable internal API
arm_core_mpu_enable() and arm_core_mpu_disable() functions are
effectively static functions, only used in the drivers for ARM
and NXP MPU, therefore, we do not need to expose them in the
arm_core_mpu_dev.h header.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-05-30 09:00:05 -05:00
Ioannis Glaropoulos
13a587756c tests: kernel: userspace: explicitly declare function for the test
In the wake of moving the internal API header arm_core_mpu_dev.h
into arch/arm/cortex_m/mpu, we need to explicitly declare the
arm_core_mpu_disable() function in the userspace test. Note that
arm_core_mpu_disable() (as any other function in this internal
API) is not supposed to be called directly by kernel/application
functions; an exception is allowed in this test suite, so we are
able to test the MPU disabling functionality.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-05-30 09:00:05 -05:00
Ioannis Glaropoulos
45a147c271 arch: arm: mpu: move internal API inside arch/arm/cortex_m/mpu
arm_core_mpu_dev.h is an internal API, and is not supposed to
be directly called by kernel / application functions, therefore,
we can move it inside arch/arm/core/cortex_m/mpu directory.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-05-30 09:00:05 -05:00
Ulf Magnusson
baf38e9cb8 doc: Add guiconfig documentation
Add documentation for the new GUI configuration interface in the
Application Development guide.

Also update all the images, touch up the language a bit, and tweak some
minor stuff:

 - Say *.conf instead of .conf to make it clearer that .conf isn't the
   literal name

 - Add a missing -D<board> argument when running cmake

 - Use figure:: instead of image::. Comes out left-aligned and with
   space between the images, which looks nicer.

 - Explain what '- -' and '-*-' means in the terminal menuconfig.

tkinter isn't included by default in many Python installations, despite
being part of the Python standard library, so also add the required
packages to the Development Environment Setup section of the manual. Add
a note to the Application Development section as well, to help
debugging.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-05-30 09:54:06 -04:00
Ulf Magnusson
a1c3cc6660 guiconfig: Add a graphical configuration interface
This is a graphical configuration interface written in Tkinter. Like
menuconfig.py, it supports showing all symbols (with invisible symbols
in red) and jumping directly to symbols. Symbol values can also be
changed directly from the jump-to dialog.

This interface should feel a lot smoother than menuconfig.py on Windows.

When single-menu mode is enabled, a single menu is shown at a time, like
in the terminal menuconfig. Only this mode distinguishes between symbols
defined with 'config' and symbols defined with 'menuconfig'.

Compatible with both Python 2 and Python 3. Has been tested on X11,
Windows, and macOS.

To avoid having to carry around a bunch of GIFs, the image data is
embedded in guiconfig.py. To use separate GIF files instead, change
_USE_EMBEDDED_IMAGES to False. The image files can be found in
https://github.com/ulfalizer/Kconfiglib/tree/screenshots/guiconfig.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-05-30 09:54:06 -04:00
Ulf Magnusson
6cfc13522c menuconfig: Small Space/Enter improvement + fix for obscure bug
Update menuconfig (and Kconfiglib, just to sync) to upstream revision
7e0b9f7ae1, to get these commits in:

  menuconfig: Improve space/enter behavior slightly

  Space toggles value is possible, and enters menus otherwise. Enter
  works the other way around.

  Make this explicit in the code, which also fixes some corner cases,
  like space doing nothing on a y-selected menuconfig symbol.

  -------------------------------------------------------------------

  menuconfig: Fix display issue for unsatisfied-deps selected symbol
  with children

  A symbol with unsatisfied direct dependencies can end up with visible
  children in an implicit submenu if it is selected (though that
  generates a warning), so the optimization in _shown_nodes() isn't
  safe, and causes the child nodes to not be shown outside show-all
  mode.

  Just remove the optimization. Trying things out some more,
  everything's plenty fast enough anyway.

  Checking the direct dependencies of the parent instead would be safe.

The menu path now says "(Top)" instead of "(top menu)" too, which is a
bit more compact. Make the same change in genrest.py.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-05-30 09:54:06 -04:00
Peter A. Bigot
be4c6ddd9c boards: arm: particle_*: enable PCB antenna on startup
All three boards use a Skyworks SPDT switch to control whether the
antenna is connected to a PCB antenna or an external u.FL connector.
None of them power up in a state that properly enables an antenna.
Add startup code to configure for the PCB antenna.

Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/14123

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
[mike@foundries.io: adjusted code to use Zephyr GPIO APIs.  boron is
now also based on DTS.]
Signed-off-by: Michael Scott <mike@foundries.io>
2019-05-30 09:46:55 -04:00
Peter A. Bigot
190c43ee5f dts: misc: add SKY13351 SPDT switch description
This devices is used on Particle boards to select between PCB and
external antennas.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-05-30 09:46:55 -04:00
Krzysztof Chruscinski
a448bfc040 CODEOWNERS: Adding tests/subsys/shell codeowners
Adding @jarz-nordic and @nordic-krch as shell codeowners.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-05-30 09:44:03 -04:00
Krzysztof Chruscinski
3555c81111 tests: shell: shell_history: Add more tests
Extended test suite with more tests for shell_history module.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-05-30 09:44:03 -04:00
Krzysztof Chruscinski
c2cb60f613 shell: Refactor shell_history to use less RW memory
Shell history module reworked to use ring buffer for storing
commands. Dedicated buffer is used to story all command lineary.
History capacity is in bytes not in number of entries, e.g.
many short commands can be stored or few long (depending on
CONFIG_SHELL_HISTORY_BUFFER).

Removed implicit command null termination from shell_history and
added it to shell after fetching command line from the history.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-05-30 09:44:03 -04:00
Krzysztof Chruscinski
0e8517e1b6 tests: lib: ring_buffer: Test for ring_buf_reset, ring_buf_capacity_get
Added tests for new API calls.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-05-30 09:44:03 -04:00
Krzysztof Chruscinski
6173fe7a73 ring_buffer: Add functions for getting capacity and reseting
Extend ring_buffer with following functions:
- getting capacity of the ring buffer (which is smaller than
  buffer size)
- resetting ring buffer to initial state

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-05-30 09:44:03 -04:00
Krzysztof Chruscinski
80f8481feb tests: subsys: shell: Add shell_history test
Add test suite for shell_history module.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-05-30 09:44:03 -04:00
Nicolas Pitre
0b5d9f71f2 thread_cpu: make it 64-bit compatible
This stores a combination of a pointer and a CPU number in the low
2 bits. On 64-bit systems, the pointer part won't fit in an int.
Let's use uintptr_t for this purpose.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-05-30 09:42:23 -04:00
Maksim Masalski
a58a852e80 drivers: added break in function stm32_clock_control_get_subsys_rate
Added a new break statement in switch

Coverity-CID: 198021
Fixes: #15763
Signed-off-by: Maksim Masalski <maxxliferobot@gmail.com>
2019-05-30 09:40:47 -04:00
Bernard Lee
591ed2677d samples: display: ili9340: Add 2 Arduino shield sample configurations.
Add 2 Arduino shield sample configurations.
1. nRF52 DK (PCA10040) with Seeed 2.8" TFT Touch Shield v2.0.
2. nRF52840 DK (PCA10056) with Adafruit 2.8" TFT Touch Shield (1947).

Signed-off-by: Bernard Lee <bernard.lee@nordicsemi.no>
2019-05-30 09:39:07 -04:00
Bernard Lee
3d2b994633 samples: display: ili9340: Add support of RGB565 pixel format.
ILI9340 display demo supports RGB565 as well as RGB888 pixel format.

Signed-off-by: Bernard Lee <bernard.lee@nordicsemi.no>
2019-05-30 09:39:07 -04:00
Bernard Lee
72fa9d9556 samples: display: ili9340: ST NUCLEO-L476RG config file.
Put ST NUCLEO-L476RG specific parameters to own configuration file.

Signed-off-by: Bernard Lee <bernard.lee@nordicsemi.no>
2019-05-30 09:39:07 -04:00
Bernard Lee
1b3b461265 samples: display: ili9340: Get ILI9340 device by DT label.
Get ILI9340 device by DT label instead of a fixed name.

Signed-off-by: Bernard Lee <bernard.lee@nordicsemi.no>
2019-05-30 09:39:07 -04:00
Bernard Lee
0744adf417 display: ili9340: Add support of Seeed 2.8" TFT Touch Shield v2.0.
Add support of Seeed 2.8" TFT Touch Shield v2.0 to ILI9340 driver.
This driver supports color pixel formats of RGB888 and RGB565.

Signed-off-by: Bernard Lee <bernard.lee@nordicsemi.no>
2019-05-30 09:39:07 -04:00
Bernard Lee
e934399835 display: ili9340: Adafruit LCD 1480 driver supports RGB565 pixel format.
Adafruit LCD 1480 driver supports RGB565 pixel format.

Signed-off-by: Bernard Lee <bernard.lee@nordicsemi.no>
2019-05-30 09:39:07 -04:00
Bernard Lee
1541d5f8c1 display: ili9340: Add RGB565 pixel format support.
Add support of RGB565 pixel format to ILI9340 driver.

Signed-off-by: Bernard Lee <bernard.lee@nordicsemi.no>
2019-05-30 09:39:07 -04:00
Bernard Lee
7ab3bc57b5 display: ili9340: Make reset gpio definition optional.
ILI9340 may not need a reset signal pin for certain LCD shields.

Signed-off-by: Bernard Lee <bernard.lee@nordicsemi.no>
2019-05-30 09:39:07 -04:00
Erwan Gouriou
35ecdf8af1 soc: stm32: Remove unused soc_register header file
soc_register.h is available in most of stm32 series.
It is sometime empty or contains includes to flash_registers.h,
which is included directly with direct reference in flash driver.
soc_register.h is also included in stm32 clock drivers, but this
driver do not use direct reference to any register anymore.

Clean up these files.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-05-30 09:37:51 -04:00
Peter A. Bigot
6fa058c994 boards: nrf52840_papyr: support nrfjprog flash runner
Add JLink via nrfjprog as an alternative to Black Magic.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-05-30 09:33:44 -04:00
Jan Van Winkel
539d16fca8 gui: Corrected RGB888 pointer in LVGL write function
Corrected buffer pointer in LVGL zephyr_vdb_write function for
converting RGBA8888 to RGB888 pixel format.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-05-30 09:33:07 -04:00
Johann Fischer
105fccfb2d drivers: usb_dc_nrfx: cleanup logging and fix style
Cleanup logging and fix style. Use hex format specifier
for endpoint address. Remove periods from log messages.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2019-05-30 09:31:48 -04:00
David B. Kinder
cfa08fbb48 doc: fix devicetree doc formatting
The directory tree description was missing a code-block shorthand so the
following lines weren't formatted correctly.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2019-05-30 09:30:33 -04:00
Stefan Kraus
f27c8c00a2 96b_nitrogen: Increase size of boot partition.
MCUboot needs nearly all 8 pages, on some commits even more. This leads
to a overwrite of parts of mcuboot code when an application is flashed.
By improving the size of the boot partition to 10 pages (from 8) and
decrease both application slots by 1 page, MCUboot fits in the boot
loader partition. This is also fixable by an extra .dts, but having an
out of the box working configuration is preferable.

Signed-off-by: Stefan Kraus <stefan.kraus@fau.de>
2019-05-30 09:29:57 -04:00
Leandro Pereira
05351dbf9d drivers: hwinfo: Add support for ESP32
ESP32 can sport up to 4 network interfaces: two 802.11 (station and
ap), ethernet, and bluetooth.  All of them derive from the same RDATA
register in efuse block 0.  However, in most cases, the last (sixth)
octet will change like so:

  - 802.11 station:  mac[5] += 0
  - 802.11 ap:       mac[5] += 1
  - bluetooth:       mac[5] += 2
  - ethernet:        mac[5] += 3

Read "Number of universally admnistered MAC address" section in esp-idf
documentation[1] for more information.

[1] https://docs.espressif.com/projects/esp-idf/en/latest/

Signed-off-by: Leandro Pereira <leandro@hardinfo.org>
2019-05-30 09:28:50 -04:00
Nicolas Pitre
e85b9315c2 ROUND_UP/DOWN macros: cast the entire align argument
Enclose the align argument in parents to make sure the cast applies to
the whole expression when expanded. This is especially important if the
argument contains a ternary operator.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-05-30 09:16:35 -04:00
Nicolas Pitre
df0b49cd4f kernel/init.c: remove needless casts
Memory boundaries are declared as extern char arrays which can be used
directly rather than casting their addresses. The cast to u32_t also
breaks 64-bit builds.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-05-30 09:16:35 -04:00
Nicolas Pitre
f94113d066 rand32_entropy_device.c: remove atomic_t misuse
There is no reason for storing a pointer into an atomic_t variable here.
Not only because this requires a dubious double cast that breaks on
64-bit builds as atomic_t is a 32-bit type, but also because the comment
in the code already admits that the whole operation isn't atomic anyway
and that it is fine. So let's keep things simple.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-05-30 09:16:35 -04:00
Marc Herbert
4afcc0f8af sanitycheck: CONFIG_TEST_USERSPACE / userspace tag cleanup
- Delete CONFIG_TEST_USERSPACE=n no-ops because it's the default
since commit 7b1ee5cf13

- Some tests have a "userspace" tag pretending to TEST_USERSPACE but
don't and vice versa: fix missing or spurious "userspace" tags in
testcase.yaml files.

Tests have a _spurious_ "userspace" tag when they PASS this command
cause none should pass:

  ./scripts/sanitycheck --tag=userspace -p qemu_x86 \
      --extra-args=CONFIG_TEST_USERSPACE=n  \
      --extra-args=CONFIG_USERSPACE=n | tee userspace.log

All tests run by this command must either fail to build or fail to run
with some userspace related error. Shortcut to look at all test
failures:

 zephyr_failure_logs() {
     awk '/see.*log/ {print $2}' "$@"
 }

Tests _missing_ "userspace" tag FAIL to either build or to run with some
userspace related error when running this:

  ./scripts/sanitycheck --exclude=userspace -p qemu_x86 \
      --extra-args=CONFIG_TEST_USERSPACE=n  \
      --extra-args=CONFIG_USERSPACE=n | tee excludeuserspace.log

Note the detection methods above are not 100% perfect because some
flexible tests like tests/kernel/queue/src/main.c evade them with #ifdef
CONFIG_USERSPACE smarts. Considering they never break, it is purely the
test author's decision to include or not such flexible tests in the
"userspace" subset.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-05-30 08:45:39 -04:00
Benjamin Valentin
3702d1a0d3 samples: nrf52: power_mgr: Fix build with prj_tickless.conf config
prj_tickless.conf lacks the CONFIG_PM_CONTROL_OS=y option which
results in the sample failing to build with this config as it leaves
sys_pm_ctrl_disable_state() and sys_pm_ctrl_enable_state()
undefined.

Add the relevant options from prj.conf to fix the build.

Tested on nrf52840_pca10056.

Signed-off-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2019-05-30 08:45:23 -04:00
Ryan C Johnson
d9e4512d86 drivers: flash: w25q: erase operations must be erase-size aligned
- Erase operations must be aligned to the erase-size.
 - Don't need to perform an alignment check on a full erase. The offset
   is not used in this case.
 - Don't need to perform alignment check on a sector sized erase, as
   this alignment is checked on entrance to the function.
 - Removed some whitespace.

Signed-off-by: Ryan C Johnson <ryan.johnson@flex.com>
2019-05-30 08:36:14 -04:00
Michael Zimmermann
8ae17cb206 drivers: i2c: i2c_esp32: fix configuring speed
the driver was actually using 1/4th instead of 1/2th and
1/8th instead of 1/4th periods.

Signed-off-by: Michael Zimmermann <sigmaepsilon92@gmail.com>
2019-05-30 08:29:17 -04:00