Commit graph

99553 commits

Author SHA1 Message Date
Jukka Rissanen
7c7cfdda50 net: core: Always have a timeout when allocating a net_buf
Instead of waiting forever for a network buffer, have a timeout
when allocating net_buf. This way we cannot left hanging for a
long time waiting for a buffer and possibly deadlock the system.
This commit only adds checks to core IP stack in subsys/net/ip

Fixes #7571

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-08-14 12:17:00 +03:00
Jukka Rissanen
4b9d980980 net: if: Lower memory usage for IPv6 address, prefix and router info
Use bitfields for boolean values instead of full bytes.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-08-14 09:06:01 +03:00
Xuan Ze
96abe861a7 net/mqtt: Fix function mqtt_parser
There have a funtion mqtt_rx_unsuback defined but not used.
So add it into mqtt_parser and fix the missing case.

Fixes #8431

Signed-off-by: Xuan Ze <119524428@qq.com>
2018-08-13 19:37:36 -07:00
Subramanian Meenakshi Sundaram
df20ebd64a samples: boards: Fix incorrect min max range validation
Fixing the min max range validation where condtions on
upper and lower bound are logically 'ANDed'. Fixing it
by logical ORing the result.

CID: 18325, 18326
Fixes Issue #9289
Fixes Issue #9290

Signed-off-by: Subramanian Meenakshi Sundaram <subbu147@gmail.com>
2018-08-13 19:35:13 -07:00
Ulf Magnusson
f24d4bb369 check-compliance: Simplify undefined Kconfig symbol check
Use the new KCONFIG_STRICT Kconfiglib functionality, which makes the
library itself warn for references to undefined Kconfig symbols.

Also get rid of the chdir() hack. Kconfiglib now only looks up Kconfig
files relative to $srctree when it's set, so the hack is no longer
needed.

Remove list_undef_kconfig_refs.py. It's no longer needed.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-08-13 19:31:46 -07:00
Ulf Magnusson
bf8efdbf5b genrest: Generate RST links in a less hacky way
Use the new Kconfiglib expression printing customization functionality
to get rid of the hacky expr_str() overriding.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-08-13 19:31:46 -07:00
Ulf Magnusson
6686efb838 kconfiglib/menuconfig: Add functionality and improve symbol information
Update Kconfiglib and menuconfig to upstream revision 6aea8d06b637e.

Kconfiglib changes:

 - Kconfig files are now looked up just relative to $srctree (if set).
   Previously, each source'd Kconfig file was also looked up in the
   current directory, and Kconfig files there could override Kconfig
   files in $srctree. This is what the C tools do.

   I'm pretty sure that behavior was a bug in the C tools all along, and
   only meant for .config files. It caused problems (and an ugly
   workaround) for the undefined Kconfig symbol CI check in an external
   project.

   The new behavior also saves a bunch of open()'s, though it's probably
   not noticeable.

 - Setting the KCONFIG_STRICT environment variable to 'y' now makes
   Kconfiglib itself warn for references to undefined symbols. This
   isn't safe in general, as some projects use multiple Kconfig trees
   with shared Kconfig files (e.g. the Linux kernel).

   This will be used to simplify the undefined Kconfig symbol CI check.

 - It's now possible to customize how symbols and choices are printed
   within expressions.

   This will be used to make the RST link generation in genrest.py less
   hacky.

 - Instead of having 'gsource', a plain 'source' is now globbing, and
   requires at least one match. There's also 'osource', for when it's
   okay for a glob pattern to match no files.

   'gsource' had the design flaw that there was no way to require at
   least one file to match. I plan on replacing all 'gsource' statements
   with plain 'source's later, but 'gsource' is still supported for
   backwards compatibility.

 - def_int, def_hex, and def_string are now available as a Kconfig
   extensions, analogous to def_bool (set type and add default).

 - Misc. internal cleanup.

menuconfig changes:

 - Boolean value hints are no longer shown to the right of defaults in
   the symbol information for int/hex symbols. Stuff like
   '- 74 (value: "n")' wasn't helpful, and looked confusing.

 - Symbol information has been made more compact in general, e.g. by
   skipping value hints where they aren't helpful
   ('FOO(=y)' instead of 'FOO(=y) (=y)'), and by shortening stuff like
   '(value: "y")' to just '(=y)'.

 - Misc. internal cleanup.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-08-13 19:31:46 -07:00
David Lamparter
c4703661e6 arch: arm: soc: add STM32L433
The L433 chip is a superset of the L432, just grabbing a few additional
interfaces (LCD, I2C2, USART3, SPI2, SDMMC).  All the support/HAL files
are already there, so enabling these is just a matter of build system
setup.

Tested on an application specific board (builds correctly and I2C2
works.)  I unfortunately don't have a nucleo/discovery board to create a
reference board for.

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-08-13 18:59:17 -07:00
Ioannis Glaropoulos
f2bdee356b arch: arm: export entry veneers
When building a Secure firmware image, instruct the linker to
generate a symbol table with the entry veneers, to allow a Non
Secure firmware image to access Secure Entry functions via the
entry veneers.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2018-08-13 18:58:11 -07:00
Ioannis Glaropoulos
db3f6aab02 arch: arm: add option to define an NSC region
This commit adds K-config options that allow the user to
signify an ARM Secure Firmware that contains Secure Entry
functions and to define the starting address of the linker
section that will contain the Secure Entry functions. It
also instructs the linker to append the NSC section if
instructed so by the user.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2018-08-13 18:58:11 -07:00
Ioannis Glaropoulos
3b79b283f9 arch: arm: API & implementation of SAU region configuration
This commit contribute an internal ARM API that enables the
user to confgure an ARM Security Attribution Unit region. It
also defines ARM_SAU as a K-config option to indicate that
an MCU implements the ARM SAU.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2018-08-13 18:58:11 -07:00
Ioannis Glaropoulos
6e93eea3a3 arch: arm: api to permit/block NS system reset requests
This commit contributes a simple API to allow the TrustZone
user to block or permit Non-Secure System Reset requests.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2018-08-13 18:58:11 -07:00
Ioannis Glaropoulos
d9cfbc280f arch: arm: macro API for defining non-secure entry functions
This commit introduces an internal ARM macro API to allow the
TrustZone user to define Non-Secure entry functions.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2018-08-13 18:58:11 -07:00
Ioannis Glaropoulos
a05081804a arch: arm: API macros for CMSE non-secure function pointers
This commit defines and implements and internal ARM macro API
that allows the TrustZone user to declare, define, and evaluate
pointers of non-secure function type.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2018-08-13 18:58:11 -07:00
Ioannis Glaropoulos
f8b5046b13 arch: arm: include GCC -mcmse compile option for secure firmware
Make GCC compile with the -mcmse compile option, if we are
building a Secure firmware. The option will make Security
Extensions for secure executables available, and will set
the corresponding compile-time indicator flag, accordingly:
(i.e. __ARM_FEATURE_CMSE=3).

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2018-08-13 18:58:11 -07:00
Ioannis Glaropoulos
ba02c6d91e arch: arm: api for reading MCU SAU regions
Define and implement a function to read the number of
SAU regions configued for the MCU.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2018-08-13 18:58:11 -07:00
Ioannis Glaropoulos
5bb3d01580 arch: arm: API to configure Secure exception boost
This commit defines and implements an internal ARMv8-M TrustZone
API to allow the user to select whether Secure exceptions will
have priority boosting over Non-Secure exceptions.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2018-08-13 18:58:11 -07:00
Ioannis Glaropoulos
179b8d15f1 arch: arm: API to configure fault target state
This commit defines and implements an internal ARMv8-M TrustZone
API to allow the user to configure the target state of fault
exceptions that are not banked between security states.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2018-08-13 18:58:11 -07:00
Ioannis Glaropoulos
28acaeadc9 arch: arm: add macro definition for vector key write permit value
This commit adds a macro definition for the Vector Key value of
AIRCR register that permits the accompanying writes. The macro
is then used instead of the hard-coded numerical value.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2018-08-13 18:58:11 -07:00
Ioannis Glaropoulos
97d5f60afb arch: arm: configure NS stack pointer limit registers
This commit adds and implements an ARM internal API function
to configure the Non-Secure instance of MSPLIM or PSPLIM.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2018-08-13 18:58:11 -07:00
Ioannis Glaropoulos
de78430072 arch: arm: internal API to enable/disable SAU
This commit defines and implements the internal ARM TrustZone
API to enable or disable the Security Attribution Unit.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2018-08-13 18:58:11 -07:00
Ioannis Glaropoulos
034499af1a arch: arm: configure non-secure registers from secure firmware
Define and implement an API to configure the Non-Secure instances
of core registers in ARM Cortex-M23 and Cortex-M33.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2018-08-13 18:58:11 -07:00
Erwan Gouriou
ee29e60325 ext/hal: stm32cube: STM32L4: Enable legacy CAN API
A new CAN API has been delivered on recent L4 stm32cube.
This new API breaks current CAN driver. Disable the new API and
enable the legacy API.

Fixes #8931

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-08-13 18:46:20 -07:00
Erwan Gouriou
6409f9a944 ext/hal: stm32cube: STM32F7: Enable legacy CAN API
A new CAN API has been delivered on recent F7 stm32cube.
This new API breaks current CAN driver. Disable the new API and
enable the legacy API.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-08-13 18:46:20 -07:00
Erwan Gouriou
57fda14f97 ext/hal: stm32cube: STM32F4: Enable legacy CAN API
A new CAN API has been delivered on recent F4 stm32cube.
This new API breaks current CAN driver. Disable the new API and
enable the legacy API.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-08-13 18:46:20 -07:00
Andrzej Głąbek
2469097b34 drivers: nrfx: Allow simultaneous use of SPI_0 and I2C_0 on nRF52810
In most Nordic SoCs the SPI and TWI peripherals with the same instance
number share certain resources and cannot be used at the same time.
In nRF52810 there are only single instances of these peripherals and
they are arranged in a different way so this limitation does not apply.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-08-13 18:45:04 -07:00
Sebastian Bøe
83d2a47d9b cmake: Don't propagate zephyr_library_compile_options
zephyr_library_compile_options will apply compile options to a library
with high priority. Due to bug #8438 these compile options have been
applied not only to the library, but also to it's public interface and
therefore to any library that has been linking with the library.

To resolve #8438 we use PRIVATE linking instead of PUBLIC linking.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-08-13 18:43:53 -07:00
Paul Sokolovsky
028aae1ec9 net: config: Rename Kconfig options to correspond to library name
This finishes refactor of splitting off net_config library name from
net_app library, started in c60df1311, c89a06dbc. This commit makes
sure that Kconfig options are prefixed with CONFIG_NET_CONFIG_
instead of CONFIG_NET_APP_, and propagates these changes thru the
app configs in the tree.

Also, minor dependency, etc. tweaks are made.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-08-13 18:42:31 -07:00
Andrew Boie
06c23f157f i2s: expose i2s APIs to user mode
User mode may now access the read, write, and trigger APIs.
Unlike supervisor mode, memory slabs are not dealt with directly,
the data is always copied.

A new driver API added to fetch the current channel configuration,
used by the system call handlers.

The i2s_sam_ssc driver updated for the new API. CAVS driver not
modified as there is no user mode port to Xtensa yet.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-08-13 16:44:09 -07:00
Sebastian Bøe
1a40990b2d syscalls: Define the syscall id's with '#define' instead of enum
We use the code generator 'gen_syscalls.py' to assign numeric
id's to each syscall. These id's have been defined using an enum
like this:

enum {
	K_SYSCALL_ADC_DISABLE,
	K_SYSCALL_ADC_ENABLE,
	K_SYSCALL_LIMIT
};

but enums can not be included by assembly files. So we have been
compiling the enum values and then extracting them into #define's when
needed.

In this situation there happen to not be any benefits of using
'enum' over #define's so we can simplify by initially defining
them with #define instead.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-08-13 16:43:40 -07:00
Nathaniel Graff
45d5d5db48 boards: riscv: Convert HiFive1 to DTS
Adds DTS bindings for sifive,pwm0, sifive,uart0, sifive,spi0, and
riscv,plic0.

Signed-off-by: Nathaniel Graff <nathaniel.graff@sifive.com>
Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
2018-08-13 18:35:38 -05:00
Krzysztof Chruscinski
c859e2a254 logging: Replace ifdefs with if
Replacing preprocessor with compiler in UART backend initialization.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2018-08-13 13:20:27 -07:00
Maureen Helm
ecd7504d0b tests: spi_loopback: Increase k_poll timeout
The frdm_kw41z runs at a much slower clock frequency than the frdm_k64f.
Increase the k_poll timeout in the asynchronous callback thread to allow
the spi transaction to complete on frdm_kw41z.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-08-13 13:18:53 -07:00
Maureen Helm
f15bca29c3 tests: spi_loopback: Add zasserts to fix false passes
The testcase was using only SYS_LOG_ERR() to signal error conditions,
which would print useful error information to the console, but allow the
test to pass when it should fail. Add zasserts after every SYS_LOG_ERR()
to make the test fail properly.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-08-13 13:18:53 -07:00
Maureen Helm
7dc09636f1 tests: spi_loopback: Increase size of async callback thread stack
The asynchronous callback thread was overflowing its stack and causing a
bus/mpu fault when hardware stack checking is enabled. Increase the size
of the stack.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-08-13 13:18:53 -07:00
Piotr Zięcik
24abedbd14 driver: timer: nrf: Remove redundant RTC_COUNTER reads.
This commit removes redundant reads of RTC_COUNTER register
propagating optimizations made in the k_cycle_get_32() function.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2018-08-13 13:10:50 -07:00
Piotr Zięcik
1dfd33b7ad drivers: timer: nrf: Optimize k_cycle_get_32().
The previous implementation of _timer_cycle_get_32() (which is directly
mapped to k_cycle_get_32()) taken from 87 to 132 cycles. As result it
was too heavy for using it as source of time for logger.

This commit makes this function faster by removing redundant access
to the RTC register (each access consumed 28 CPU cycles) as well as
loop, which made this call non-deterministic.

After these changes the k_cycle_get_32() needs only 50-52 cycles
in to calculate 32-bit timestamp.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2018-08-13 13:10:50 -07:00
Rajavardhan Gundi
f7779895fd tests/cmsis_rtos_v1: Introduce tests to make use of Signal APIs
Some test programs to illustrate the usage of Signal Event APIs.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-08-13 13:08:07 -07:00
Rajavardhan Gundi
b5df23e423 lib/cmsis_rtos_v1: Implement support for Signal Event APIs
Signals are used to trigger execution states between threads.
These APIs provide functionalities like signal set, clear and
wait.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-08-13 13:08:07 -07:00
Rajavardhan Gundi
f4999f7949 tests/cmsis_rtos_v1: Introduce tests to make use of messageQ APIs
Some test programs to illustrate the usage of msgq APIs.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-08-13 13:08:07 -07:00
Rajavardhan Gundi
3bb243c6bb lib/cmsis_rtos_v1: Implement support for Message Queue APIs
These APIs provide message queue functionality like create,
put and get.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-08-13 13:08:07 -07:00
Rajavardhan Gundi
1b6eb7d1ad tests/cmsis_rtos_v1: Introduce tests to make use of mailq APIs
Some test programs to illustrate the usage of mailq APIs.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-08-13 13:08:07 -07:00
Rajavardhan Gundi
7c67140baf lib/cmsis_rtos_v1: Implement support for Mail Queue APIs
These APIs provide mail queue functionality like create, put and get.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-08-13 13:08:07 -07:00
Rajavardhan Gundi
76fc443b1e lib/cmsis_rtos_v1: Implement support for kernel APIs
These APIs allow for checking whether the kernel is initialized,
started or running.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-08-13 13:08:07 -07:00
Rajavardhan Gundi
d543e8c835 tests/cmsis_rtos_v1: Introduce tests to make use of mempool APIs
Some test programs to illustrate the usage of mempool APIs.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-08-13 13:08:07 -07:00
Rajavardhan Gundi
aff8c51128 lib/cmsis_rtos_v1: Implement support for mempool APIs
These APIs allow creating, allocating and freeing
of mempools.

Note: "Mempool" in CMSIS actually means memslabs in Zephyr.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-08-13 13:08:07 -07:00
Rajavardhan Gundi
c996d0581f tests/cmsis_rtos_v1: Introduce tests to make use of Semaphore APIs
Some test programs to illustrate the usage of Semaphore APIs.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-08-13 13:08:07 -07:00
Rajavardhan Gundi
45e67150f6 lib/cmsis_rtos_v1: Implement support for semaphore APIs
These APIs allow creating, acquiring, releasing and deleting
of semaphores.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-08-13 13:08:07 -07:00
Rajavardhan Gundi
a76556a22c tests/cmsis_rtos_v1: Introduce tests to make use of Mutex APIs
Some test programs to illustrate the usage of Mutex APIs.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-08-13 13:08:07 -07:00
Rajavardhan Gundi
055da73184 lib/cmsis_rtos_v1: Implement support for mutex APIs
These APIs allow creating, acquiring, releasing and deleting
the mutexes.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-08-13 13:08:07 -07:00