Commit graph

41120 commits

Author SHA1 Message Date
Georgij Cernysiov
2234621d9e drivers: modem: receiver: fix sending
Send implementation shall return 0 for ok,
or < 0 for an error.

Signed-off-by: Georgij Cernysiov <g.cernysiov@elco-automation.de>
2019-03-01 09:46:48 +01:00
Georgij Cernysiov
de8b39f6eb drivers: modem: receiver: rearrange and comment
Rearranges functions to public and private groups,
and adds missing function comments.

Signed-off-by: Georgij Cernysiov <g.cernysiov@elco-automation.de>
2019-03-01 09:46:48 +01:00
Georgij Cernysiov
94ee0ddbde drivers: modem: receiver: switch to ring buffer from pipe api
Replaces used k_pipe with ring_buffer API which is safe for ISR.

Signed-off-by: Georgij Cernysiov <g.cernysiov@elco-automation.de>
2019-03-01 09:46:48 +01:00
Georgij Cernysiov
23b64b0d35 drivers: modem: receiver: correct device bind error type
Log possible uart device binding error and change
the error type to a more correct one.

Signed-off-by: Georgij Cernysiov <g.cernysiov@elco-automation.de>
2019-03-01 09:46:48 +01:00
Jukka Rissanen
52dc50dc6b net: lldp: Allow generation of documentation
No need to hide the symbols in the header file if CONFIG_NET_LLDP
is not enabled. This also allows the documentation to be generated
properly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-01 09:45:06 +01:00
Jukka Rissanen
35e744ff1c doc: net: Enhance LLDP documentation
The Link Layer Discovery Protocol chapter was missing Overview
and also the API reference was not populated properly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-01 09:45:06 +01:00
Michael Scott
0482b66f0b net: lwm2m: fix json NULL deref / code flow in read_number()
Per Coverity report, we are assigning the value1 and value2
s64_t pointers a value of 0.  Later when we go to use value1
and value2, they are of course ... NULL.

Fix the typos in the initial assignment of 0 to the
references of value1 and value2.

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

Signed-off-by: Michael Scott <mike@foundries.io>
2019-03-01 09:44:46 +01:00
Sebastian Bøe
4e5300ba7f cmake: Drop all in-tree usage 'set_conf_file'
Port all users of 'set_conf_file' to use the built-in rules
instead. This follows the convention-over-configuration principle to
make the system as a whole simpler and more consistent.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2019-03-01 09:44:09 +01:00
Sebastian Bøe
6d4ba3490f cmake: Deprecate 'set_conf_file'
In-tree, all usage of 'set_conf_file' is implementing the same
pattern (with some inconsequential differences).

To reduce copy-paste and get closer to dropping support for
'set_conf_file', we include this pattern into the built-in set of
patterns.

'set_conf_file' is causing issues for future extensions,
e.g. multi-image support, and is also the source of a lot of
duplicated code.

Note support for 'set_conf_file' is not dropped, it is only marked as
deprecated.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2019-03-01 09:44:09 +01:00
Flavio Ceolin
ed7fb7548f tests: hwinfo: Fix invalid assertion
The return of hwinfo_get_device_id is a signed size and it returns a
negative number in case of error. This test was using an unsigned
variable invalidating the errror check.

CID 190929

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2019-03-01 09:41:48 +01:00
Marc Herbert
6b4cda9b25 run_ci.sh: git log what [base] version is being tested
Zephyr Continuous Integration made the choice of rebasing pull requests
on its fast moving master branch before testing them. Unfortunately the
Shippable interface assumes the other choice[*] and highlights the SHA1
of the pull request _before_ rebasing which is very misleading.  For now
the only way to realize this disconnect is to scrutinize the build logs
and/or this source code (or tribal knowledge).

To mitigate and reduce a bit this confusion, run a short:
  git log -n 5 --oneline --decorate
before and after rebase.

Making it worse, Shippable sub-runs are not pegged to a common base
version. For instance the reason why shippable sub-run 35578.1 passed
while all other 35578.x sub runs failed is very likely because PR #13803
was merged to master in the mean time. This commit would have been able
to prove that.

[*] In an ideal world with infinite time and resources, Continuous
Integration would test pull requests BOTH alone and combined with the
moving tip.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-03-01 09:39:31 +01:00
Marc Herbert
f7e995c075 run_ci.sh: run pytest-3 if found
On (at least) Fedora "pytest" is python2 and python2 only.

Also update remote name in sample invocation from "upstream" to "origin"
because that's how west sets things up by default (and this script
requires west)

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-03-01 09:39:31 +01:00
Flavio Ceolin
b3dc27552d drivers: can: Z_SYCALL_HANDLER should return int
can_handlers.c:65:1: warning: control reaches end of non-void function
[-Wreturn-type]

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2019-03-01 09:22:55 +01:00
Flavio Ceolin
1556fce845 libc: ctype: Fix operations between signed and unsigned types
MISRA-C says that char type should not be used in arithmetically as the
data doesn't represent numbers.

MISRA-C rules 10.1 and 10.2

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2019-03-01 09:22:24 +01:00
Ulf Magnusson
2141cb740d drivers/serial: ns16550: Remove unused Kconfig symbols
These symbols are not referenced anywhere. The values always come from
DTS, at least if https://github.com/zephyrproject-rtos/zephyr/pull/13760
was correct.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-01 09:20:12 +01:00
Flavio Ceolin
23e75c1492 bluetooth: shell: Fix uninitialized variable
Variable evt_prop could be used without being initialized. This problem
was spotted by coverity.

CID 190970

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2019-03-01 09:19:31 +01:00
Marc Herbert
c78be1bb7b CODEOWNERS: fix 3 check-compliance.py issues not reported by github
- PR #13722 moved 3 gen_*.py to /arch/x86/ without updating CODEOWNERS
- PR #13745 forgot a trailing slash in /dts/bindings/can
- PR #13675 forgot a trailing slash in /samples/boards/intel_s1000_crb

No idea why github doesn't keep reporting these every time and
impossible to tell as CI hides most of its logs.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-03-01 09:16:25 +01:00
Paul Sokolovsky
9ec9c430b3 console: tty: Remove dependency on older "consoles"
Console subsystem doesn't depend on older consoles-in-drivers, the
only common thing between them is CONFIG_UART_CONSOLE_ON_DEV_NAME
setting, so make it so (by depending on either UART_CONSOLE or
CONSOLE_SUBSYS.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-02-28 16:57:50 -08:00
Maksim Masalski
9f8db3d729 can: cast value 1U to type ULL in function can_stm32_set_filter
Potentially overflowing expression 1U << register_demand
changed to the 1ULL << register_demand to avoid overflow.

Coverity-CID: 190996
Fixes: #13829
Signed-off-by: Maksim Masalski <maxxliferobot@gmail.com>
2019-02-28 16:57:08 -08:00
Maksim Masalski
f32b94c46e can: cast value 1U to type u64_t in function can_stm32_set_filter
Potentially overflowing expression 1U << register_demand
I changed to (u64_t)1U << register_demand
To avoid overflow, I casted 1U to type u64_t.

Coverity-CID: 190996
Fixes: #13829
Signed-off-by: Maksim Masalski <maxxliferobot@gmail.com>
2019-02-28 16:57:08 -08:00
Andy Ross
7cbdb6c5c0 drivers/timer: Restore non-tickless tick count behavior
The newer series of timer drivers will compare counters vs. the last
tick boundary to compute a number of ticks to announce to the kernel.
In the case of CONFIG_TICKLESS=n, this actually represents a change of
behavior from our old scheme where "ticks" always reflected the number
of interrupts received.

The distinction only matters when an interrupt is delayed more than a
full tick, of course.  But that actually makes a difference to some
timekeeping code.  Restore the old behavior.

This also has the benefit of further reducing code size when !TICKLESS
and improving performance of the ISR by removing the division
(remember Cortex M0 has no hardware divide!).

Fixes #12409

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-02-28 16:11:02 -08:00
Andrew Boie
ad2d7ca081 x86: fix page directory out of bounds
PAE page tables (the only kind we support) have 512
entries per page directory, not 1024.

Fixes: #13838

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-28 15:03:06 -08:00
Daniel Leung
adb9f0e02e xtensa: intel_s1000: turn on XTENSA_ASM2
Turns on XTENSA_ASM2 by default for intel_s1000.

Fixes #11034

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-02-28 14:53:52 -08:00
Andy Ross
fc3ca95ba7 tests: Mass SMP disablement on non-SMP-safe tests
(Chunk 2 of 3 - this patch was split across pull requests to address
CI build time limitations)

Zephyr has always been a uniprocessor system, and its kernel tests are
rife with assumptions and outright dependence on single-CPU operation
(for example: "low priority threads will never run until this high
priority thread blocks" -- not true if there's another processor to
run it!)

About 1/3 of our tests fail right now on x86_64 when dual processor
operation is made default.  Most of those can probably be recovered on
a case-by-case basis with simple changes (and a few of them might
represent real bugs in SMP!), but for now let's make sure the full
test suite passes by turning the second CPU off.  There's still plenty
of SMP coverage in the remaining cases.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-02-28 12:47:12 -08:00
Tim Sørensen (TIMS)
ed80be5281 doc: Fixed a link in CONTRIBUTING.rst
Corrected "Contribution Guidelines" link in CONTRIBUTING.rst.

Signed-off-by: Tim Sørensen (TIMS) <tims@oticon.com>
2019-02-28 12:46:04 -08:00
Daniel Leung
1af5fa174b gpio: gpio_intel_apl: fix if condition leading to dead code
GPIO_INT_ACTIVE_LOW is 0 which means it cannot be simply AND-ed.
So fix the condition.

Fixes #13880

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-02-28 12:44:45 -08:00
Ioannis Glaropoulos
ca3b6c680f tests: kernel: fatal: remove #ifdefs for ARM platforms
This commit removes the #ifdefs for ARM platforms in
tests/kernel/fatal/main.c, as all the tests suite can be
executed for platforms supporting the ARM and the NXP MPU.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-02-28 11:57:25 -08:00
Ioannis Glaropoulos
1f8c57e0f9 arch: arm: core arch function to evaluate stack corruption
This commit introduces a generic arch/arm function to evaluate
thread stack corruption. The function shall be used upon
occurrence of MemManage and Bus Faults.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-02-28 11:57:25 -08:00
Ioannis Glaropoulos
1735d8794e arch: arm: stress that IRQ tail-chaining cannot always be guaranteed
This commit adds an explanatory note in the places
where we manually adjust the PSP after stacking Bus
and MemManage errors, stressing that this is due to
the fact that interrupt tail-chaining cannot always
be guaranteed by the processor.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-02-28 11:57:25 -08:00
Ioannis Glaropoulos
602001d938 arch: arm: remove redundant check for imprecise error
The commit removes a redundant check for imprecise bus fault,
when a precise bus fault has occurred, now that we have
re-worked the BusFault handler to iterate through all possible
bus errors.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-02-28 11:57:25 -08:00
Ioannis Glaropoulos
69b06a464c arch: arm: nxp: properly assess stack corruptions upon BusFaults
This commit reworks the logic, based on which we assess
thread stack corruptions upon BusFault exceptions triggered
by the NXP MPU module. BusFaults rely on calling external
function to assess whether a thread stack corruption due to
overflow has occurred. Upon detection of stack corruption,
the current stack pointer is manually adjusted upwards, to
prevent un-stacking errors from firing up upon returning from
the exception.

Additionally, the commit allows to be checking for all different
types of BusFault occurrences that are reported through BFSR,
without stopping after having spotted the first BusFault type.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-02-28 11:57:25 -08:00
Ioannis Glaropoulos
2201490ab6 arch: arm: properly assess stack corruptions upon MPU faults
This commit reworks the logic, based on which we assess
thread stack corruptions upon MemManageFault exceptions.
Furthermore, it takes out all kernel-related logic and relies
on calling external function 'evaluate_thread_stack_corruption'
to assess whether a thread stack overflow has occurred. Upon
detection of stack corruption, the current stack pointer is
manually adjusted upwards, to prevent un-stacking errors from
firing up upon returning from the exception.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-02-28 11:57:25 -08:00
Ioannis Glaropoulos
4311b5e563 arch: arm: improve debug message and help test for UsageFault
This commit improves the debug message on UsageFaults
related to Stack overflow, stating that the context
area is not valid. An inline comment is added, with
more detailed explanation.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-02-28 11:57:25 -08:00
Ioannis Glaropoulos
0348c53574 arch: minor white-space fix in Kconfig
A minor space removal in help test off FLASH_BASE_ADDRESS.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-02-28 11:57:25 -08:00
Maureen Helm
a0335b5223 soc: openisa_rv32m1: Implement sys_arch_reboot()
Implements sys_arch_reboot() on the openisa_rv32m1 soc to enable zephyr
micropython on the rv32m1_vega board.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2019-02-28 13:15:41 -06:00
Andy Ross
3f4aa6316c tests/kernel/sched/schedule_api: Restore spinning for timer alignment
Commit 0cc362f873 ("tests/kernel: Simplify timer spinning") was
added to work around a qemu bug with dropped interrupts on x86_64.
But it turns out that the tick alignment that the original
implementation provided (fundamentally, it spins waiting on the timer
driver to report tick changes) was needed for correct operation on
nRF52.

The effectively revert that commit (and refactors all the spinning
into a single utility) and replaces it with a workaround targeted to
qemu on x86_64 only.  Fixes #11721

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-02-28 13:06:48 -06:00
Andy Ross
a334ac2045 tests: Mass SMP disablement on non-SMP-safe tests
(Chunk 1 of 3 - this patch was split across pull requests to address
CI build time limitations)

Zephyr has always been a uniprocessor system, and its kernel tests are
rife with assumptions and outright dependence on single-CPU operation
(for example: "low priority threads will never run until this high
priority thread blocks" -- not true if there's another processor to
run it!)

About 1/3 of our tests fail right now on x86_64 when dual processor
operation is made default.  Most of those can probably be recovered on
a case-by-case basis with simple changes (and a few of them might
represent real bugs in SMP!), but for now let's make sure the full
test suite passes by turning the second CPU off.  There's still plenty
of SMP coverage in the remaining cases.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-02-28 13:02:20 -06:00
Andy Ross
85d895c60e lib/os: Remove recursion from mempool and rbtree
MISRA rules (see #11425) forbid recursive algorithms.  In the case of
rb_walk(), it's not actually used anywhere but a test right now, so we
can simply disable the API when CONFIG_MISRA_SANE is defined.  Mempool
had a (IMHO, fairly clever) tail recursive loop in bfree_recombine()
which can be trivially transformed into an only slightly uglier
iterative version.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-02-28 10:06:35 -08:00
Andy Ross
fe04adf99b lib/os: Conditionally eliminate alloca/VLA usage
MISRA rules (see #9892) forbid alloca() and family, even though those
features can be valuable performance and memory size optimizations
useful to Zephyr.

Introduce a MISRA_SANE kconfig, which when true enables a gcc error
condition whenever a variable length array is used.

When enabled, the mempool code will use a theoretical-maximum array
size on the stack instead of one tailored to the current pool
configuration.

The rbtree code will do similarly, but because the theoretical maximum
is quite a bit larger (236 bytes on 32 bit platforms) the array is
placed into struct rbtree instead so it can live in static data (and
also so I don't have to go and retune all the test stack sizes!).
Current code only uses at most two of these (one in the scheduler when
SCHED_SCALABLE is selected, and one for dynamic kernel objects when
USERSPACE and DYNAMIC_OBJECTS are set).

This tunable is false by default, but is selected in a single test (a
subcase of tests/kernel/common) for coverage.  Note that the I2C and
SPI subsystems contain uncorrected VLAs, so a few platforms need to be
blacklisted with a filter.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-02-28 10:06:35 -08:00
Kumar Gala
846dfd4b86 spi: spi_intel: Fix missing 'break' in case
Coverity scan found issue with a missing 'break' statement.  Fix
push_data by adding the break after handling the 1 byte case.

Coverity CID: 190978
Fixes #13842

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-28 09:33:25 -08:00
Paul Sokolovsky
c2a70a2710 scripts: size_report: Fix output of header break line
Was apparently an artifact of Python2 to Python3 conversion. Led to
printing of literal '='*110i instead of a line of ='s.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-02-28 09:23:16 -08:00
Ruth Fuchss
340fabedbf doc: boards: fix board target
Board target was changed but not updated in documentation.

Signed-off-by: Ruth Fuchss <ruth.fuchss@nordicsemi.no>
2019-02-28 18:19:03 +01:00
Marc Herbert
29c19c1b0f filter-known-issues.py: clarify what "new" means
When building incrementally, filter-known-issues.py reports a varying
and totally different set of "new" issues than when building from
scratch. Warnings for unrelated upstream code disappearing and
re-appearing are especially confusing. Expand the messages a bit to
clarify.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-02-28 18:18:30 +01:00
Ioannis Glaropoulos
7926cf24b6 tests: kernel: arm_irq_vector_table: extend the test for nRF9160
This commit extends the arm_irq_vector_table test,
so it can run successfully in nRF9160-based platforms.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-02-28 18:17:03 +01:00
Ioannis Glaropoulos
1e74007606 tests: kernel: arm_irq_vector_table: add clock ISR in the IRQ vector
This commit adds the Clock Control Interrupt Service
Routine into the customized vector table, when building
for nRF52X-based platforms. As a result, the interrupts
generated by the clock control will not interfere with
the test.

Fixes #13823.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-02-28 18:17:03 +01:00
Ioannis Glaropoulos
3dc81a40bc tests: kernel: arm_irq_vector_table: minor typo and style fixes
Minor typo and style fixes in the test logging, stressing
that the test is applicable for Cortex-M MCUs, in general.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-02-28 18:17:03 +01:00
Ioannis Glaropoulos
bc902954e4 tests: kernel: arm_irq_vector_table: refactor custom IRQ settings
In order to make this test easy to extend for additional
Cortex-M-based platforms, we apply the following minor
refactoring to the test:
- we introduce the _ISR_OFFSET macro to denote the offset
  inside the interrupts' vector table (starting from IRQ
  line 0) of the first manually installed ISR.
- we move the asserts that ensure the validity of the custom
  vector table to build-time and place them in the beginning
  of the text, outside source code.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-02-28 18:17:03 +01:00
Daniel Leung
ee50b49621 boards: up_squared: turn on PCI enumeration
The MMIO addresses for peripherals are being assigned by BIOS
at boot. Different BIOS versions and number of enabled peripherals
affect how those addresses are assigned. This invalidates
the addresses for UART defined in DTS. Turn on PCI enumeration
so UART addresses are probed at boot to avoid non-usable
UART and black console.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-02-28 18:13:43 +01:00
Ioannis Glaropoulos
dd4754ebe9 arch: arm: nxp: mpu: fix constant expression result errors
This commit fixes two Constant Expression Result errors,
in the NXP MPU driver due to incompatible integer types.

Fixes #13836.
Fixes #13865.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-02-28 10:57:37 -06:00
Anas Nashif
29f04767e9 arch: move common app_data_alignment.ld file
This file is being used by different architectures and is not ARC
specific.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-02-28 08:53:16 -08:00