Commit graph

41120 commits

Author SHA1 Message Date
Kumar Gala
3b9147df3f scripts/dts/extract: Fliter duplicates values inserted into defs
If an aliases already exists in the defs we should filter it out.  Also
if an alias exists in the new_def we should filter the alias out.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-14 06:33:29 -06:00
Kumar Gala
94240aebb2 scripts/dts/extract: Add an instance ID for each compatiable
Add a unique instance starting at 0 for each compatiable in the dts.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-14 06:33:29 -06:00
Sebastian Bøe
b72fb4e9e8 cmake: Remove dead code 'FindRegex.cmake'
When Zephyr was building the C implementation of KConfig it used the
build script 'FindRegex.cmake' to satisfy a regex dependency.

Now that we no longer use the C implementation of Kconfig we no longer
use this build script, and it is safe to remove it.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2019-01-14 13:02:03 +01:00
Paweł Zadrożniak
480b728d52 drivers: usb: nordic: Fix IN transfer fragmentation
Currently, when usb_dc_ep_write is called, data is copied to the
internal buffer, hence the requirement for fragmentation, regardless
of low-level nrfx_usbd driver. This commit forces the fragmentation
and prevents potential internal buffer overflow. Adittional
fragmentation flag was added to prevent triggering status stage
(it is handled by hardware completely on nRF chips).

Fixes #12339

Signed-off-by: Paweł Zadrożniak <pawel.zadrozniak@nordicsemi.no>
2019-01-14 11:02:47 +01:00
Johan Hedberg
61ff1bda2f Bluetooth: Mesh: Remove redundant stack variable
The msg->prev_addr is already stored in frnd->clear.frnd, so there's
no need to have an extra stack variable for this (in the form of
prev_addr).

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2019-01-14 11:38:51 +02:00
Wolfgang Puffitsch
3159049c39 bluetooth: controller: Update ticker_user_op for predictable layout.
Use fixed-width type instead of enum for field op in struct
ticker_user_op to avoid struct layout differences between
compilers. Also make check whether struct sizes match size definitions
build-time asserts.

Signed-off-by: Wolfgang Puffitsch <wopu@oticon.com>
2019-01-14 10:12:15 +01:00
Emanuele Di Santo
a72f113bae boards: arm: nrf52840_pca10059: update fstab-debugger.dts
Increase the size of the MCUBoot flash partition in the fstab-debugger
partition table, to accommodate for the RTT console and logs.

Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
2019-01-14 09:56:55 +01:00
Emanuele Di Santo
9661cbf9e5 boards: arm: nrf52840_pca10059: update comment in fstab-stock.dts
The MCUBoot partition in the default partition table (fstab-stock)
is not meant to accommodate an RTT console, since the board does
not have a SEGGER chip.

Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
2019-01-14 09:56:55 +01:00
Emanuele Di Santo
32d5247aef boards: arm: nrf52840_pca10059: remove RTT_CONSOLE from defaults
The board does not have a SEGGER chip.
Remove RTT_CONSOLE from board defaults.

Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
2019-01-14 09:56:55 +01:00
Jiahao Li
5b9d5a217c Bluetooth: Fixes length limit in bt_hex_real
Since `str` is the output buffer, `bt_hex_real` should limit its output
length according to the `str` size, not the `hex` size.

Signed-off-by: Jiahao Li <reg@ljh.me>
2019-01-13 23:19:30 +02:00
Jukka Rissanen
a7afdc3512 net: rpl: Remove the deprecated code
The RPL was deprecated earlier so remove it by this commit.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-01-13 09:40:36 -05:00
Kumar Gala
728ca62d0b boards: arm: Cleanup xtools toolchain support
Add 'xtools' as supported toolchain for new boards and remove duplicate
entry from mps2_an385

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-13 09:35:59 -05:00
Paul Sokolovsky
c885cb533e net: buf: linearize: Get rid of useless memset()
net_buf_linearize() used to clear the contents of output buffer,
just to fill it with data as the next step. The only effect that
would have is if less data was written to the output buffer. But
it's not reliable for a caller to rely on net_buf_linearize() for
that, instead callers should take care to handle any conditions
like that themselves. For example, a caller which wants to process
the data as zero-terminated string, must reserve a byte for it
in the output buffer explicitly (and set it to zero).

The only in-tree user which relied on clearing output buffer was
wncm14a2a.c. But either had buffer sizes calculated very precisely
to always accommodate extra trailing zero byte (without providing
code comments about this), or arguably could suffer from buffer
overruns (at least if data received from a modem was invalid and
filled up all destination buffer, leaving no space for trailing
zero).

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-01-12 15:24:29 -06:00
David Leach
afcfa11ce0 scripts: extract_dts_includes: Enhance message information
The information message when processing the yaml files is
cryptic when there is an override. This change adds filenmae
of yaml file being processed and the parent tuple with
the override.

Signed-off-by: David Leach <david.leach@nxp.com>
2019-01-12 15:23:11 -06:00
Jiahao Li
6a5623566e Bluetooth: Mesh: Fixes existing friend lookup in Friend Request handling
Currently, when handling a Friend Request message with `prev_addr` set,
we look up existing friend entry using `prev_addr` as the address.
However, `prev_addr` is the address of the requesting node's previous
friend, NOT the address of the requesting node itself. Therefore, we
should always look up existing friend entry using `rx->ctx.addr` as the
address.

Signed-off-by: Jiahao Li <reg@ljh.me>
2019-01-12 22:07:41 +02:00
Tavish Naruka
19b968a0c7 boards: add new board Electronut-labs Blip
Added config for https://github.com/electronut/ElectronutLabs-blip/

Signed-off-by: Tavish Naruka <tavishnaruka@gmail.com>
2019-01-12 09:15:26 -05:00
Peter A. Bigot
e0e9beee04 boards: arm: particle: refactor for commonalities
Provide a dtsi file that sets up common capabilities for all
Feather-based Particle Mesh devices.  Provide additional dtsi files for
some obvious peripheral options.

Remove the xtensa esp32 image: it didn't build, and there's no
indication of how the ESP32 firmware can be updated on the Argon board.
Use particle_argon as the nRF52840 side of the board.

Add Particle Boron support.

Note that dtsi files must be replicated in each board directory until
tooling supports DTS includes from a shared area.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-12 09:10:43 -05:00
Matthias Boesl
a600b138c4 boards: particle: add board support for particle argon
initial support for particle argon nrf52 and esp32

Signed-off-by: Matthias Boesl <matthias.boesl@gmail.com>
2019-01-12 09:10:43 -05:00
Endre Karlson
714ffe623c boards: particle_xenon: Add support Xenon
This patch adds support for the Particle Xenon dev board that
has a nrf52840 mcu.

Signed-off-by: Endre Karlson <endre.karlson@gmail.com>
2019-01-12 09:10:43 -05:00
Maureen Helm
73956a398e scripts: Update pyocd version to 0.14.3
pyocd recently merged its command-line tools into a unified pyocd tool
with subcommands. The separate command-line tools still remain, but are
deprecated. Update the pyocd version required by zephyr in preparation
for updating the pyocd runner to use the new unified tool commands.

Pin pyocd to a specific version rather than allowing any version greater
than or equal to 0.14.0 because there have been a few unstable releases
recently. Version 0.14.3 is what I have been using locally and know to
be stable.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2019-01-11 21:33:28 -06:00
Daniel Leung
c17d0dc2c5 esp32: fix build error regarding multiplt BIT() definitions
This partially reverts commit 5a47c60dbf.
The soc.h is now only included when _soc_irq_*() is being referred.

Fixes #11077.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-01-11 15:05:31 -08:00
Kumar Gala
381c7bd519 dts: silabs: Add SoC level compatible
Add compatible for all the SoC dtsi files.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-11 15:11:36 -06:00
Andy Ross
c2c9265b7d tests: cmsis: Disable two cmsis portability tests on x86_64
These two tests are hitting a stack overflow on x86_64 (not entirely
surprisingly), but can't just increase stack size because there is an
assert in the CMSIS compatibility layer that stacks be under 512
bytes.  Just disable for now.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-11 15:18:52 -05:00
Andy Ross
f033d542ad tests: samples: Disable newlib tests on x86_64
This builds with a host compiler, not one from the SDK, and so no
newlib library is available.  There is work to enable newlib detection
at and above the cmake level.  This patch can be reverted when that
lands.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-11 15:18:52 -05:00
Andy Ross
0cc362f873 tests/kernel: Simplify timer spinning
There is actually nothing wrong with this test code idiom.  But it's
tickling a qemu emulator bug with the hpet driver and x86_64[1].  The
rapidly spinning calls to k_uptime_get_32() need to disable
interrupts, read timer hardware state and enable them.  Something goes
wrong in qemu with this process and the timer interrupt gets lost.
The counter blows right past the comparator without delivering its
interrupt, and thus the interrupt won't be delivered until the counter
is next reset in idle after exit from the busy loop, which is
obviously too late to interrupt the timeslicing thread.

Just replace the loops with a single call to k_busy_wait().  The
resulting code ends up being much simpler anyway.  An added bonus is
that we can remove the special case handling for native_posix (which
was an entirely unrelated thing, but with a similar symptom).

[1] But oddly not the same emulated hardware running with the same
driver under the same qemu binary when used with a 32 bit kernel.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-11 15:18:52 -05:00
Andy Ross
870e8188a8 tests/kernel/sched/schedule_api: Honor TEST_EXTRA_STACKSIZE
Stacks created by tests should add this amount so thread-hungry
architectures can tune it.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-11 15:18:52 -05:00
Andy Ross
31e79a791e tests/kernel/mem_protect/stackprot: Whitelist x86_64
This architecture doesn't support stack canaries.  In fact the gcc
-fstack-protect features don't seem to be working at all.  I'm
guessing it's an x32 ABI mismatch?

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-11 15:18:52 -05:00
Andy Ross
3119d2973a tests/posix/common: Correct TEST_EXTRA_STACKSIZE usage
This is intended to be a value set by the platform to adjust the size
of stacks created by tests.  This test was setting it explicitly, and
failing to honor it when creating its own stacks.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-11 15:18:52 -05:00
Andy Ross
d6eeb85046 samples/mpu/mpu_stack_guard_test: Whitelist x86_64
No MPU support there yet.  This test should really be predicated on a
kconfig variable, not architecture.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-11 15:18:52 -05:00
Andy Ross
3642f67b05 drivers/timer/hpet: Fix logic for !TICKLESS
When tickless was disabled, this inverted test would never fire the
first interrupt and the timer would be silent.  Just remove it.
There's no harm in unconditionally enabling a single timer interrupt
at boot.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-11 15:18:52 -05:00
Andy Ross
762ff2f428 kernel/swap: Simply/robustify return value handling
The call to _arch_switch is a giant screaming sign inviting optimizer
bugs.  The code that appears before is what happened long ago when we
were switched out, but the version that EXECUTED just now is actually
in a different thread.  So the assignment to _current before the
switch actually assigned OUR thread (the "new_thread" of the old
context!) to _current.

But obviously the optimizer looks at that code and assumes that the
_current which got assigned to the thread we were switching to long
ago is still correct, and used it when retrieving the swap return
value.

Obviously the real bug here is that the _arch_switch() in question
lacked a memory clobber (and it's getting one).

But we can remove two lines, remove code from inside the interrupt
lock and make the implementation more robust by moving the read to
after the irq_unlock() (which generally also has a memory clobber).

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-11 15:18:52 -05:00
Andy Ross
b69d0da82d arch/x86_64: New architecture added
This patch adds a x86_64 architecture and qemu_x86_64 board to Zephyr.
Only the basic architecture support needed to run 64 bit code is
added; no drivers are added, though a low-level console exists and is
wired to printk().

The support is built on top of a "X86 underkernel" layer, which can be
built in isolation as a unit test on a Linux host.

Limitations:

+ Right now the SDK lacks an x86_64 toolchain.  The build will fall
  back to a host toolchain if it finds no cross compiler defined,
  which is tested to work on gcc 8.2.1 right now.

+ No x87/SSE/AVX usage is allowed.  This is a stronger limitation than
  other architectures where the instructions work from one thread even
  if the context switch code doesn't support it.  We are passing
  -no-sse to prevent gcc from automatically generating SSE
  instructions for non-floating-point purposes, which has the side
  effect of changing the ABI.  Future work to handle the FPU registers
  will need to be combined with an "application" ABI distinct from the
  kernel one (or just to require USERSPACE).

+ Paging is enabled (it has to be in long mode), but is a 1:1 mapping
  of all memory.  No MMU/USERSPACE support yet.

+ We are building with -mno-red-zone for stack size reasons, but this
  is a valuable optimization.  Enabling it requires automatic stack
  switching, which requires a TSS, which means it has to happen after
  MMU support.

+ The OS runs in 64 bit mode, but for compatibility reasons is
  compiled to the 32 bit "X32" ABI.  So while the full 64 bit
  registers and instruction set are available, C pointers are 32 bits
  long and Zephyr is constrained to run in the bottom 4G of memory.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-11 15:18:52 -05:00
Andy Ross
ff0ab5dc7a cmake/compiler/gcc: Fall back to host compiler for x86_64
If we don't have a detected cross compiler for x86_64, use the host
compiler instead.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-11 15:18:52 -05:00
Andy Ross
9c24867512 arch/x86_64: cmake: Make libgcc detection optional
Host toolchains don't tend to provide an x32 libgcc.  But we don't
actually need one for existing code.  This is fragile, but better to
work for all but obscure cases than break outright.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-11 15:18:52 -05:00
Andy Ross
1041ef0925 tests/benchmarks/timing: Unify the "standard zephyr timing" cases
It's worth using custom timing information on a few systems to save
cycles or gain precision.  But make the use of k_cycle_get_32() a
proper default instead of hardcoding all the platforms and failing to
build on new ones.  On Xtensa and RISC-V (and now x86_64) the cycle
informatoin from that call is a very fast wrapper around the native
counters anyway -- all you would save would be the function call
overhead.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-11 15:18:52 -05:00
Andy Ross
0f075753b8 tests/kernel/threads/thread_apis: Fix include hygine
These files were relying on _thread_essential_set() from
kernel_internal.h, but not including it directly.  New architectures
won't transitively include things the same way.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-11 15:18:52 -05:00
Andy Ross
2399c5bfbe include/arch: Steal native_posix bit manipulation routines
I was half way through typing up my own one of these when I realized
there was one already in the tree.  Move it to a shared header.

(FWIW: I really doubt that most architectures actually benefit from
their own versions of these tools -- GCC's optimizer is really good,
and custom assembly defeats optimization and factorizations of the
expressions in context.)

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-11 15:18:52 -05:00
Andy Ross
f2d0591830 drivers/timer/hpet: Fix default IRQ
The HPET default is to deliver events on the same INTIn as the legacy
PIT IRQ, and in fact our code requires that because it uses the
"legacy routing" option.  So this isn't really a configurable and has
to be set correctly.  Do it right in the kconfig default instead of
forcing boards to set it.

(No, I have no idea where "20" came from either.)

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-11 15:18:52 -05:00
Andy Ross
7740f73079 include/linker_defs.h: Remove noop architecture detection
This was apparently intended to allow for per-arch linker includes,
but no such includes ever existed.  All it does is senselessly throw
an error on unrecognized architectures. Yank.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-11 15:18:52 -05:00
Andy Ross
4f911e192f kernel: Add missing include
These files were using z_thread_malloc() without including
kernel_internal.h.  On existing architectures that works due to
transitive includes, but x86_64 has a thinner include layer and
doesn't do it for us.  Include the files required for the APIs we use.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-11 15:18:52 -05:00
Kumar Gala
d3e27f518f boards: arm: nxp: imxrt: Fix SPI nodes on flexspi controller
Fix the QSPI and hyperflash nodes to be proper SPI children and expose
the address range for direct access as part of the controller's reg
region.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-11 13:12:18 -06:00
Kumar Gala
e57a596a0c scripts/dts/extract: Support QSPI memory mapped flash
We need to refactor how we determine CONFIG_FLASH_{SIZE,BASE_ADDRESS}
for when we have a QSPI that is memory mapped. "zephyr,flash" is going
to point the actual flash component that will be on a SPI bus and thus
the device node's reg property tells us which CS on the SPI bus its on,
not the memory mapped address/size of the flash.

So we make a few assumptions to handle this case:
1. If the #size-cells for the flash node is 0, we assume its a QSPI
   memory mapped flash
2. That the QSPI memory mapped node (parent of what "zephyr,flash" is
   point to, will contain a reg propery where the second reg pair will
   be the memory mapped region for the flash.

We move handling of CONFIG_FLASH_{SIZE,BASE_ADDRESS} into flash.extract
so its all in one place.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-11 13:12:18 -06:00
Anas Nashif
4426bfd7f7 doc: remove unused theme
Remove old and unused theme.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-01-11 11:34:31 -05:00
Anas Nashif
63bdb805e0 doc: Add top-level navigation grid
Make the documentation page a little bit more interesting with top-level
navigation grid highlighting the most important sections with a brief
description.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-01-11 11:34:31 -05:00
Tavish Naruka
2e76eaa8fa runners: add Black Magic Probe runner cmake file
Added required cmake file for blackmagicprobe
runner added in #12380.

Signed-off-by: Tavish Naruka <tavishnaruka@gmail.com>
2019-01-11 17:19:56 +01:00
Andrei Emeltchenko
ad875f0026 samples: sensors: Add accelerometer based HID mouse
Add Accelerometer mouse by using fxos8700 accelerometer and using data
to control USB HID mouse.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-01-11 11:06:02 -05:00
Sean Nyekjaer
3d880dd155 boards: arm: frdm_k64f: remove default n configs
Bool configs are default n, unless explicitly set otherwise.

Signed-off-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
2019-01-11 08:58:50 -06:00
Anas Nashif
960de8c873 doc: move development process from the wiki
move development model from the wiki to the main documentation to keep
it in sync and updated all the time and to get proper reviews.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-01-11 09:34:37 -05:00
Anas Nashif
6c5ed261a4 doc: remove SYS_LOG from documentation
Make old and obsoleted SYS_LOG orphan until we completely remove it.

Fixes #12235

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-01-11 08:48:24 -05:00
Johan Hedberg
a886229c2b Bluetooth: shell: Fix incorrect indentation
This line was indented using four spaces instead of a tab.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2019-01-11 15:27:38 +02:00