Commit graph

41120 commits

Author SHA1 Message Date
Yannis Damigos
b28cd8a141 disk: disk_access_sdhc: Move to new logger subsystem
Move to new logger subsystem.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-12-30 16:24:10 -05:00
42accf2e64 disk: add a SDHC card over SPI driver.
Features:

- Uses the SPI bus to communicate with the card
- Detects and safely rejects SDSC (<= 2 GiB) cards
- Uses the optional CRC support for data integrity
- Retries resumable errors like CRC failure or temporary IO failure
- Works well with ELMFAT
- When used on a device with a FIFO or DMA, achieves >= 310 KiB/s on a
  4 MHz bus

Tested on a mix of SanDisk, Samsung, 4V, and ADATA cards from 4 GiB to
32 GiB.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-12-30 16:24:10 -05:00
bbafc36b1c lib: add crc7.
Used as a checksum on command messages when talking with MMC cards.

Implemented using the unwound bytewise implementation from
https://en.wikipedia.org/wiki/Computation_of_cyclic_redundancy_checks
which is a good mix of size and speed.

The API and naming matches lib/crc7.c in Linux.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-12-30 16:24:10 -05:00
Aurelien Jarno
ef9361fca0 ext: lib: crypto: Update mbedTLS 2.16.0
Since 2.14.1 release mbedTLS has a few API changes and deprecation which
do not affect the Zephyr code and a new MBEDTLS_CHECK_PARAMS option that
enables validation of parameters in the API. A list with all changes can
be found in:

  ./ext/lib/crypto/mbedtls/ChangeLog

Note that this version will become the basis of the next LTS (Long Term
Support) branch that will be maintained for the next 3 years until at
least the end of 2021.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-12-30 15:55:01 -05:00
Jan Van Winkel
848b0844dd driver: display: Added dummy display driver
Added dummy display driver.

fixes: #12001

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2018-12-30 15:53:39 -05:00
Adithya Baglody
65f79cdc21 scripts: gen_relocate_app: Use linker provided size variable.
This seems to solve the issue with GH-12033. There seems to be
some compiler optimization that was causing this issue. This
occurs only when the build is re-run by invoking cmake without
clearing the previous build.

Fixes:GH-12033

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-12-29 09:23:34 -05:00
Vincent Wan
8bbe325868 doc: boards: cc3220sf_launchxl: update link to XDS110 firmware update
The link was changed by TI, so we are updating the Zephyr
documentation.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2018-12-29 09:22:33 -05:00
Flavio Ceolin
6bed8fc241 shell: Changing shell_history_get signature
Change arg_len to be u16_t in shell_history_get since it is returning
a value that can be hold by u16_t.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-12-28 17:47:46 -05:00
Flavio Ceolin
80c03550ba shell: Make shell_strlen return u16_t
Everywhere the return of this function was being assigned to u16_t to
save space on stack. Instead of casting in all these places (and may
end up with overflow), just changing this function's return.

Note that the function itself is not checking for overflow yet since
I'm not sure this can happen and/or is a problem. Though now we have
only one single point to fix this problem.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-12-28 17:47:46 -05:00
Flavio Ceolin
bc4cb76df5 shell: Fix return error in shell_execute_cmd
ENOEXEC should be used for executable file format error.
While is undertandable return it when the command is wrong, this
function is returning it two cases where other errors are more
descriptive. When parameter is NULL, is better return EINVAL.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-12-28 17:47:46 -05:00
Anas Nashif
74a74bb6b8 power: rename api sys_soc -> sys_
sys_soc is just redundant, just call APIs with sys_*.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-12-28 16:16:28 -05:00
Anas Nashif
9151fbebf2 power: rename APIs and removing leading _
Remove leading underscore from PM APIs. _ was used for internal APIs.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-12-28 16:16:28 -05:00
Aurelien Jarno
68086c09ad ext: lib: crypto: Update mbedTLS 2.14.1
Since 2.12.0 release mbedTLS has an important security fix concerning
RSA PKCS#1 v1.5 decryption (CVE-2018-19608). Besides that it has very
few API changes, and the usual set of functional improvements, security
fixes and bug fixes. A list with all changes can be found in:

  ./ext/lib/crypto/mbedtls/ChangeLog

It should also be noted that the small change concerning _POSIX_C_SOURCE
applied to x509.c has been moved to platform_util.c, this time with a
proper define guard.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-12-28 11:39:18 -05:00
David B. Kinder
2e1021d3e7 doc: update doc footer copyright year
Happy 2019!

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-12-28 10:42:23 -05:00
Krzysztof Chruscinski
16e7e82af8 shell: Fix code style errors in shell.c
Fixed errors and warnings reported by checkpatch.pl

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2018-12-28 10:42:06 -05:00
Krzysztof Chruscinski
49bf4300bc samples: subsys: shell: Add foreground command example
Exteneded shell sample with example how to use shell_fprintf from
any context with 'foreground' command.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2018-12-28 10:42:06 -05:00
Krzysztof Chruscinski
d653a5182c shell: Allow calling shell_fprintf from various contexts
Extended shell to allow command to indicate that shell should
halt not accepting any input until termination sequence is
received (CTRL+C) or shell_command_exit() is called. While shell
is in that state it is allowed to print to shell from any thread
context.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2018-12-28 10:42:06 -05:00
Andrew Boie
74f114caef userspace: easy checking for specific driver
In general driver system calls are implemented at a subsystem
layer. However, some drivers may have capabilities specific to
the hardware not covered by the subsystem API. Such drivers may
want to define their own system calls.

This macro makes it simple to validate in the driver-specific
system call handlers that not only does the untrusted device
pointer correspond to the expected subsystem, initialization
state, and caller permissions, but also that the device object
is an instance of a specific driver (and not just any driver in
that subsystem).

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-12-27 20:31:58 -05:00
Erwan Gouriou
a4605ebaad boards: nucleo_l432kc: Document CAN support
Document CAN support for board nucleo_l432kc and
add can to board yaml "support" section.

Fixes #12052

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-12-27 19:41:27 -05:00
Erwan Gouriou
be5444d0f3 boards: stm32072b_disco: Document CAN support
Document CAN support for board stm32072b_disco.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-12-27 19:41:27 -05:00
Sebastian Bøe
ef9b08a1d4 test: code_relocation: Fixed CI failure
The test 'samples/application_development/code_relocation' was failing
in master because it was not declaring that it was defining additional
sections.

The CI error is attached below.

This patch fixes the CI failure by declaring in 'sample.yaml' that
these additional sections are expected.

FAILED:
qemu_cortex_m3/samples/application_development/code_relocation/test
has unrecognized binary sections: ['_SRAM2_RODATA_SECTION_NAME',
'_SRAM_TEXT_SECTION_NAME', '_SRAM_RODATA_SECTION_NAME',
'_SRAM_DATA_SECTION_NAME', '_CUSTOM_SECTION_NAME2']

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-12-27 19:25:34 -05:00
Mark Ruvald Pedersen
55d6b4cd7c cmake: boilerplate: Move out finding git+python to separate cmake files
Follow the same convention as that of ccache.
Improve readability of boilerplate.cmake file.
Move inclusion of version.cmake up to satisfy git.cmake dependency.

Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
2018-12-27 19:24:51 -05:00
Paul Sokolovsky
dcf824b1d8 CODEOWNERS: Add for drivers/wifi same reviewers as for drivers/ethernet
drivers/wifi/ is closely related to the (IP) network stack, so
shouldn't be left without owners, so use the same as for Ethernet.

Also, extend, don't replace reviewers for drivers/wifi/eswifi based
on the above change and CODEOWNERS processing order.

Also, add a reminder about this processing order at the top of file.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-12-27 19:22:44 -05:00
David B. Kinder
06d78354ae doc: regular misspelling scan
Fix misspellings in documentation (.rst, Kconfig help text, and .h
doxygen API comments), missed during regular reviews.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-12-26 13:27:14 -05:00
Erwan Gouriou
bb7d8261d7 samples/basic: Update readme for blinky/button/disco
blinky/button and disco samples are now using definitions
generated from  boards dts files.
Update samples README files accordingly.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-12-26 09:46:59 -05:00
Erwan Gouriou
bb92c54884 boards: stm32f3_disco: Add LD7 as led1
stm32f3_disco has multiple leds.
Use LD7 has Zephyr led1.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-12-26 09:43:36 -05:00
Erwan Gouriou
52ddd99db5 boards: stm32f3_disco: LD7 GPIO port is E
Fix LED7 gpio port to E instead of D.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-12-26 09:43:36 -05:00
Erwan Gouriou
a2668f587d dts: stm32f3: GPIO clocks are actually handled from AHB1 bus
Unlike stated in CMSIS file STM32F3 clock should be handled
from AHB1 bus. Update dtsi files accordingly.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-12-26 09:43:36 -05:00
Vincent Wan
0f64ec5c31 drivers: wifi: simplelink: Fix strings used in assertions
Samples for cc3220sf_launchxl where assertions are enabled
(e.g. http_get) fail to build because some of the strings used in the
simplelink wifi driver have parentheses around them. This breaks the
current implementation of the __ASSERT macro. This commit removes
the parentheses, which are unnecessary.

http_get has been verified to build after this change.

Fixes #12192

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2018-12-26 09:42:29 -05:00
Jan Van Winkel
1f1ea26cdc driver: display: sdl: Return correct pixel format
Return actual pixel format that is in use by the SDL display driver
instead of returning a hard coded value.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2018-12-26 09:42:05 -05:00
Andy Ross
0d4954fafc lib/cmsis_rtos_v2: Fix overflow in osKernelGetInfo()
If any of the Zephyr version numbers went beyond 99, the "%2d" printf
specifiers would expand to fit and the string would run over the
memory on the stack used for os_str[].

Recent GCC versions (remember native_posix and x86_64 use the host
compiler) were actually detecting this and correctly issuing a warning
(but only if the 3-digit char value would overflow the actual array
size!), which was breaking sanitycheck for me on Fedora 28 and Ubuntu
18.04 build hosts.  Pretty impresive warning.

As it happens this was wasteful anyway; we were spending bytes on the
stack (and in rodata to store the constant which, and the cycles
needed to copy it into place on the stack where it would be
overwritten immediately) when we could just snprintf() directly into
the buffer the user gave us.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-12-26 09:41:41 -05:00
Laczen JMS
bebdf2a479 fs/nvs: Speed Improvement
NVS with modified flash layout. At the end of a sector a special ate is
placed that points to the last ate that was written. This special ate
is written when a sector is closed. This allows nvs to travel through
the fs much quicker as it doesn't have to search for the last ate in
a sector.

This modification also speeds up the nvs_init procedure that was very
slow on external (spi) flash.

Remark: As the layout of data in flash is changed old data in the flash
cannot be recovered. It is advised to erase the nvs flash area before
using the changed nvs.

Modification after review by @nvlsianpu applied

Modification after review by @aurel32:

_nvs_prev_ate(): provide a backup search of a valid ate when the sector
close_ate has a bad CRC8. Tested on nrf81522 by making flash writing
bad data to the sector closing ate. Also validated that if a valid ate
is overwritten the filesystem keeps working.

_nvs_gc(): return error if _nvs_flash_cmp_const() is < 0.

Signed-off-by: Laczen JMS <laczenjms@gmail.com>
2018-12-23 12:23:25 +01:00
Alberto Escolar Piedras
3980e0cf64 sanitycheck: Use supression file for valgrind and dump log
When running valgrind in sanitycheck, use the suppression file
and dump the log in its own file.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-12-21 21:07:18 +01:00
Alberto Escolar Piedras
661bc8206f sanitycheck: Fail test if the process returns != 0
If the test process returns an error (return code != 0),
it should be considered a failure, even if the handler
considers the test passed.
But this is not done when we are killing (SIGTERM) the processes,
as then the return code is not necessarily sensible.

Without this, for example, when running with valgrind, all valgrind
errors are missed.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-12-21 21:07:18 +01:00
Alberto Escolar Piedras
ace7bf9508 valgrind: Add error supression file for POSIX arch
Added a valgrind error supression file which can be used when
running in the POSIX arch.

So far we are supressing 2 types of errors:
* One very normal in glibc, which will be triggered in the nrf52_bsim
* 2 due to the posix arch prioritizing terminating fast over terminating
cleanly. The posix arch, when posix_core_clean_up() is called, will
pthread_cancel all Zephyr threads. But it will NOT wait for them to
finnish, in case any of them was hung or there is any other problem
which would prevent it. Therefore, depending on the execution, some
times the threads will be still lingering when the main thread exits
Somethign similar applies to posix_soc_clean_up().
These 2 are not errors, but conscious choices => Therefore we
supress them

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-12-21 21:07:18 +01:00
Flavio Ceolin
1036edcfbb log: Fix switch statement
MISRA-C has several rules about switch statements like each clause
end with an unconditional break. This commit fix these problems to
be in accordance with the standard.

MISRA-C rules 16.1, 16.3 and 16.4

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-12-21 21:06:18 +01:00
Spoorthi K
e62e54bdcd tests: interrupt: Change IRQ priorities in test
Keeping IRQ0 priority as 1 and IRQ1 priority as 0
so that system timer which of priority 0 in ARC
will be interrupted by IRQ1 of same priority.
In ARM, system timer is of priority 1, hence
making ISR0 priority as 2 and ISR1 priority as 1.
Thus system timer will always be interrupted by
ISR1 in both the architectures.

Fixes: #12147

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-12-21 21:04:36 +01:00
Sebastian Bøe
bdda09ee93 cmake: Remove dead code LTO references
LTO is not supported yet, but there are a handful of references to the
flag '-flto' and the non-existent Kconfig option 'LTO'. To not confuse
users about whether LTO is supported or not, we should remove this
dead code.

As an aside, prototyping has shown that supporting LTO will give
signicant (10%) code size improvments, but will not be trivial to
support due to how we process object files with python.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-12-21 21:04:18 +01:00
Ioannis Glaropoulos
c8ff1fd27f soc: nordic: add Kconfig options for several peripherals
In the wake of introducing nRF9160 .dtsi header, we are
adding several HAS_HW_NRF_xxxx Kconfig symbols, for the
peripherals present in nrf9160 SoC.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2018-12-21 21:03:55 +01:00
Ioannis Glaropoulos
b3299891ed dts: nordic: nrf91: DTS include headers for nRF9160 SOC
This commit introduces the main device tree header files (.dtsi)
for Nordic nRF9160 SOC, for both Secure and Non-Secure domains.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2018-12-21 21:03:55 +01:00
Andrzej Głąbek
23d28ab400 samples: Remove redundant Kconfig adjustments for nRF boards
The options selecting nRF drivers are now enabled by default when
an nRF SoC is selected as the build target.
The options selecting given hardware instances are now enabled at
the board level.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-12-21 21:01:37 +01:00
Andrzej Głąbek
03f7569a16 tests: drivers: Remove redundant Kconfig adjustments for nRF boards
The options selecting nRF drivers are now enabled by default when
an nRF SoC is selected as the build target.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-12-21 21:01:37 +01:00
Andrzej Głąbek
9d44cad921 boards: nrf: Enable ADC, I2C, and SPI instances by default
Enable by default the following hardware instances in Kconfig:
- ADC_0
- I2C_0
- SPI_1 (SPI_0 for nRF52810)
for all nRF development kit boards having the corresponding DT nodes
enabled. This way there is no need to enable these instances in
particular applications, like samples for sensors or tests for drivers.

I2C_0 and SPI_0 cannot be used simultaneously in most of nRF SoCs,
nRF52810 is the only exception so far (and in this SoC SPI_1 is not
present, hence SPI_0 is enabled for it).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-12-21 21:01:37 +01:00
Andrzej Głąbek
326be98f74 boards: nrf: Remove redundant Kconfig adjustments
The options selecting nRF drivers are now enabled by default when
an nRF SoC is selected as the build target.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-12-21 21:01:37 +01:00
Andrzej Głąbek
46b7633878 drivers: spi: nrfx: Set default value of SPIM3 RX delay to 2
To make it consistent with the default value set in hardware
after reset.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-12-21 21:01:37 +01:00
Andrzej Głąbek
4b43065cfc drivers: nrf: Enable nRF drivers by default in Kconfig
Make the following nRF peripheral drivers:
- ADC
- GPIO
- I2C
- SPI
- UART
- USB_DEVICE
enabled by default so that users do not need to explicitly enable them
in their applications after choosing an nRF SoC as the build target.

Kconfig options enabling these drivers depend on both a given hardware
feature (e.g. I2C) and an nRF family SoC selected, so effectively they
will be automatically enabled only when it is adequate (and in most
cases these drivers are the only option for a given hardware feature
on nRF SoCs).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-12-21 21:01:37 +01:00
Andrzej Głąbek
7c13ba9965 drivers: serial: nrf: Remove false dependency on the gpio driver
Implementations of both flavors of serial drivers for Nordic SoCs
are no longer dependent on the gpio driver. Remove the dependency
from Kconfig.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-12-21 21:01:37 +01:00
Tomasz Gorochowik
754ab1d1b0 net/pkt: Fix debug logs checking
The slab2str function which is used in the debug log call is not defined
unless NET_LOG_PKT_LOG_LEVEL >= LOG_LEVEL_DEBUG.

It looks like this change was accidentally introduced in #11374.

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2018-12-21 21:00:54 +01:00
Sebastian Bøe
56d144cd70 cmake: Fixed python detection bug
Fixed a bug where an old version of python on path would break the
python detection mechanism.

This fixes #12066

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-12-21 11:13:03 +01:00
Spoorthi K
b1e912bdb3 samples: cmsis_rtos_v2: Demo on msgq and timers synchronization
The sample application demonstrates usage of threads, message queue
and timer APIs in CMSIS RTOS V2.

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-12-21 10:28:10 +01:00