Commit graph

41120 commits

Author SHA1 Message Date
Flavio Ceolin
ce696e9aa2 lib: rb: Make operands have an appropriate essential type
MISRA-C 8.10.2 defines essential operand types and how to handle them
through rules 10.1 .. 10.5. This commit adds an U to unsigned constants
to avoid implicit casts and make if/while statements evaluate a boolean
to avoid other types being casted to boolean.

MISRA-C rules 10.1, 10.2 and 10.3

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2019-03-26 22:06:45 -04:00
Flavio Ceolin
fdfb2109a2 arch: Use macro BIT for shift operations
BIT macro uses an unsigned int avoiding implementation-defined behavior
when shifting signed types.

MISRA-C rule 10.1

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2019-03-26 22:06:45 -04:00
Anas Nashif
006b97de13 tests: no-multithreading: do not report success twice
We are reporting success twice, once by calling macro directly, and once
by using ztest test_main().

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-03-26 20:09:07 -04:00
Anas Nashif
42f4538e40 kernel: do not use k_busy_wait when on single thread
k_busy_wait() does not work when multithreading is disabled, so do not
try to wait during boot.

Fixes #14454

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-03-26 20:09:07 -04:00
Charles E. Youse
eaf1c3b8a6 drivers/pci: stop using LOG_DBG()
When the console UART is a PCI device, and PCI debug logging is enabled,
the system crashes because the UART is initialized before logging, but
the UART initialization invokes the PCI subsystem which invokes logging.
Reordering the initialization sequence will not fix this chicken/egg.

Luckily, the LOG_DBG() calls in the PCI subsystem appear to be bitrot
leftovers from early development, so they are simply removed.

Also mark myself as the owner of the PCI subsystem.

Fixes: #14763

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-03-26 23:56:02 +01:00
Jakub Rzeszutko
20e4ca48c7 shell: fix coverity issue in uart backend
Fixed coverity issue CID 196642

Fixes #14814

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2019-03-26 21:48:25 +01:00
Ravi kumar Veeramally
65d100e7f0 tests: net: Add more tests to ipv6 fragmentation
IPv6 fragmentation test case without any extra header (HBHO)
added.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-03-26 15:55:15 -04:00
Tedd Ho-Jeong An
b43ef2f4d9 samples: net: nats: Check null before dereferrencing the variable
This patch checks null before deferencing the variable.

Fix Bug: #14815
Coverity CID: 196641

Signed-off-by: Tedd Ho-Jeong An <tedd.an@intel.com>
2019-03-26 14:13:24 -05:00
Krzysztof Chruscinski
aa0c417e38 logging: defines clean up
RTT backend supports two modes blocking and drop. Apparently,
defines used lead to warning while clang compilation. Define
that caused warning has been changed together with clean up
which removed #ifdefs for definitions.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-03-26 13:55:59 -05:00
Wayne Ren
6b5bed6aa9 arch: arc: fix the handling of stack check exception
stack check exception may come out with other protection
vilation, e.g. MPU read/write. So the possible paramter
will be 0x02 | [0x4 | 0x8].

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2019-03-26 14:34:39 -04:00
Flavio Ceolin
b2b4f09bed include: Add U for unsigned constants
Add U for integer constants to avoid an implicit cast.

MISRA-C rule 10.1

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2019-03-26 14:31:29 -04:00
Flavio Ceolin
db990fc4e2 arch: arm: Use proper essential types in operands
MISRA defines a serie of essential types, boolean, signed/unsigned
integers, float, ... and operations must respect these  essential types.

MISRA-C rule 10.1

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2019-03-26 14:31:29 -04:00
Flavio Ceolin
abf27d57a3 kernel: Make statements evaluate boolean expressions
MISRA-C requires that the if statement has essentially Boolean type.

MISRA-C rule 14.4

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2019-03-26 14:31:29 -04:00
Flavio Ceolin
063a9ce8c3 include: Make statements evaluate boolean expressions
MISRA-C requires that the if statement has essentially Boolean type.

MISRA-C rule 14.4

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2019-03-26 14:31:29 -04:00
Flavio Ceolin
2ecc7cfa55 kernel: Make _is_thread_prevented_from_running return a bool
This function was returning an essentially boolean value. Just changing
the signature to return a bool.

MISRA-C rule 14.4

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2019-03-26 14:31:29 -04:00
Flavio Ceolin
39a50f6392 arch: x86: Use proper essential types in operands
MISRA defines a serie of essential types, boolean, signed/unsigned
integers, float, ... and operations must respect these essential types.

MISRA-C rule 10.1

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2019-03-26 14:31:29 -04:00
Flavio Ceolin
95eb2b4fed include: Use macro BIT for shift operations
Use a macro BIT when dealing with bit shift operations.

MISRA-C rule 10.1

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2019-03-26 14:31:29 -04:00
Flavio Ceolin
a996203739 kernel: Use macro BIT for shift operations
BIT macro uses an unsigned int avoiding implementation-defiend behavior
when shifting signed types.

MISRA-C rule 10.1

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2019-03-26 14:31:29 -04:00
Flavio Ceolin
d410611180 arch: Use macro BIT for shift operations
BIT macro uses an unsigned int avoiding implementation-defined behavior
when shifting signed types.

MISRA-C rule 10.1

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2019-03-26 14:31:29 -04:00
Paul Sokolovsky
85e64097e3 net: socket: Define flags for getaddrinfo()
Add various AI_* flags, similar to previously added flags for
getnameinfo(). All flags specified by POSIX are defined (with
values compatible with Linux), to allow to build existing
software which may refer to them. They can be implemented
gradually, as usecases arrive.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-03-26 14:29:48 -04:00
Vincent Wan
11739f72df samples: net: mqtt_publisher: Add section on connecting with TLS
Adding a section to the sample's documentation to give some specific
instructions on how to try it with TLS enabled. This should be helpful
for users who are not knowledgeable with regards to creating/setting up
TLS certificates.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2019-03-26 14:22:57 -04:00
Piotr Mienkowski
371aea8735 console: deprecate console_register_line_input()
console_register_line_input() is a legacy function which forces console
subsystem to keep dependency on drivers/console. The two console
implementations are meant to be independent.

Console subsystem provides console_getline() function, which should be
used instead.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-03-26 12:48:38 -05:00
Daniel Leung
c31e659165 codecov: avoid inlining functions for correct execution counts
This adds a compiler option -fno-inline for code coverage on
architectures which supports doing code coverage. This also
modifies the ALWAYS_INLINE macro to not do any inlining. This
needs to be done so code coverage can count the number of
executions to the correct lines.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-03-26 13:28:30 -04:00
Piotr Mienkowski
1b66d900a8 doc: update power management subystem documentation
This commit brings power management subystem documentation up to date
with the implementation. The main changes since the last time the
documentation was updated include introduction of power managment
policies.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-03-26 13:27:55 -04:00
Piotr Mienkowski
155e11ca2d power: rename residency policy Kconfig options
Rename power managment subsystem Kconfig options describing minimum
residency to make them easier to identify with respective policy.

Following is a detailed list of string replacements used:
s/SYS_PM_SLEEP_(\d)_MIN_RES/SYS_PM_MIN_RESIDENCY_SLEEP_$1/
s/SYS_PM_DEEP_SLEEP_(\d)_MIN_RES/SYS_PM_MIN_RESIDENCY_DEEP_SLEEP_$1/

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-03-26 13:27:55 -04:00
Piotr Mienkowski
a3082e49a1 power: modify HAS_STATE_SLEEP_ Kconfig options
Add SYS_POWER_ prefix to HAS_STATE_SLEEP_, HAS_STATE_DEEP_SLEEP_
options to align them with names of power states they control.
Following is a detailed list of string replacements used:
s/HAS_STATE_SLEEP_(\d)/HAS_SYS_POWER_STATE_SLEEP_$1/
s/HAS_STATE_DEEP_SLEEP_(\d)/HAS_SYS_POWER_STATE_DEEP_SLEEP_$1/

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-03-26 13:27:55 -04:00
Piotr Mienkowski
17b08ceca5 power: clean up system power managment function names
This commit cleans up names of system power management functions by
assuring that:
- all functions start with 'sys_pm_' prefix
- API functions which should not be exposed to the user start with '_'
- name of the function hints at its purpose

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-03-26 13:27:55 -04:00
Piotr Mienkowski
204311d004 power: rename Low Power States to Sleep States
There exists SoCs, e.g. STM32L4, where one of the low power modes
reduces CPU frequency and supply voltage but does not stop the CPU. Such
power modes are currently not supported by Zephyr.

To facilitate adding support for such class of power modes in the future
and to ensure the naming convention makes it clear that the currently
supported power modes stop the CPU this commit renames Low Power States
to Slep States and updates the documentation.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-03-26 13:27:55 -04:00
Tedd Ho-Jeong An
f5c4e369ea net: sockets: Update setsockopt to handle IPV6_V6ONLY
This patch adds a routine that handles IPV6_V6ONLY option in setsockopt
function.

Fixes #14657

Signed-off-by: Tedd Ho-Jeong An <tedd.an@intel.com>
2019-03-26 13:23:49 -04:00
Ulf Magnusson
e9c1d6d0ed scripts: gen_app_partition: Fix broken typo'd sys.exit()
os.exit() doesn't exist.

Also use the nifty sys.exit(msg) feature, which prints 'msg' to stderr
and exits with status 1.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-26 10:19:26 -05:00
Carles Cufi
42fcaf2df4 Bluetooth: shell: Add missing include path
When building ticker.c from the shell, it requires include access to the
Nordic HAL, so add the relevant folder to the include path.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-03-26 10:18:59 -05:00
Aaron Tsui
38dadb5fc5 samples: basic: disco_led without gpio driver
This sample did not enable gpio driver, so nothing happens after flash
firmware into a board.
By enabling gpio driver to fix it.

Signed-off-by: Aaron Tsui <aaron.tsui@outlook.com>
2019-03-26 09:00:44 -05:00
Anas Nashif
21de8733c6 doc: move usermode under references
Move usermode documentation to be under api reference and not under
kernel.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-03-26 09:50:16 -04:00
Alberto Escolar Piedras
46d9d3f6e9 arch: POSIX: Add Kconfig option to stop on all faults
Added an option to stop the execution of the posix arch based
executable on the first fault, even if the fault stemmed from a
non essential thread.
Having it fail faster, in the first fault, will ease debugging
in many cases.
The option is disabled by default to preserve the old behavior.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-03-26 08:03:15 -05:00
Ulf Magnusson
ba312fe844 scripts: Remove unnecessary () around if/while conditions in Python
Not needed in Python. Detected by check C0325 in pylint3.

Also replace an

  if len(tag):

with just

  if tag:

Empty strings, byte strings, lists, etc., are falsy in Python.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-26 07:59:59 -05:00
Ulf Magnusson
0eee1f699b doc: conf.py: Fix spacing typos
These are probably not deliberate. Fixes some pylint warnings.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-26 07:59:33 -05:00
Ulf Magnusson
d83141535c scripts: Remove accidental semicolons in Python scripts
Making a clean slate for some pylint CI tests. Only enabling relatively
uncontroversial stuff.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-26 07:57:52 -05:00
Ulf Magnusson
781e554cbd power: Fix reference to CONFIG_SYS_PM_LOG_LEVEL
CONFIG_PM_LOG_LEVEL was renamed to CONFIG_SYS_PM_LOG_LEVEL in commit
c45961daae ("power: Rework OS <-> Application interface"), but the old
name is still used here. Fix the name.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-26 07:57:00 -05:00
Ulf Magnusson
735de5fc38 soc: kconfig: Simplify SOC_*_LD deps. with an 'if'
'if FOO' is equivalent to adding 'depends on FOO' to each item within
the 'if'.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-26 07:56:39 -05:00
Ulf Magnusson
056199d5a1 kconfig: Remove blank line at end of Kconfig file
This one got away in
https://github.com/zephyrproject-rtos/zephyr/pull/14452. Didn't spot
there were two blank lines.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-26 07:56:09 -05:00
Ulf Magnusson
19626892b5 kconfig: Replace two leftover 'gsource' with 'source'
Plain 'source' is globbing. 'gsource' is a leftover from an older
design, and works as a synonym for 'source'.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-26 07:55:35 -05:00
Ulf Magnusson
5c8fd84d12 scripts: Remove extra trailing newlines from Python scripts
Fixing all instances so that it can be flagged in a pylint CI check
later.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-26 07:53:08 -05:00
Jun Li
48ee3ee837 board: nucleo_f429zi: fix wrong comment
the clock is 168MHz instead of 180MHz.

Signed-off-by: Jun Li <jun.r.li@intel.com>
2019-03-26 07:51:20 -05:00
Ulf Magnusson
7da0053a0c scripts: gitlint: Fix broken module docstring
Needs to be at the beginning of the file. Fixes a pylint warning:

    scripts/process_gperf.py:26:-1: W0105: String statement has no
    effect (pointless-string-statement)

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-26 07:50:06 -05:00
Ulf Magnusson
9822b1dd1b doc: application.py: Remove unused _mkdir() 'compact' parameter
Found with pylint.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-26 07:49:35 -05:00
Flavio Ceolin
a1bfaa907c drivers: counter: stm32: Fix possible overflow
Cast ts to u32_t could cause an overflow in that multiplication, since
time_t is 8 bytes it is not necessary to cast the multiplication's
result too.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2019-03-26 07:48:43 -05:00
Ulf Magnusson
1a27de0d31 scripts: gen_priv_stacks: Remove unused static kernel object stuff
Might've been a copy-paste from scripts/gen_kobject_list.py.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-26 07:47:36 -05:00
Ulf Magnusson
0aeba398fb doc: fix_tex: Remove redundant 'return'
Making a clean slate for some pylint CI tests.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-26 07:47:20 -05:00
Ulf Magnusson
2ce55e9e88 scripts: Fix bad indentation in Python scripts
Making a clean slate for some pylint CI tests.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-26 07:46:35 -05:00
Ulf Magnusson
605423f9b1 scripts: process_gperf: Fix broken module docstring
Needs to be at the beginning of the file. Fixes a pylint warning:

    scripts/process_gperf.py:26:-1: W0105: String statement has no
    effect (pointless-string-statement)

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-26 07:46:11 -05:00