Commit Graph

123 Commits

Author SHA1 Message Date
Anas Nashif b95e4232b9 ext: move open-amp to an external module
Move open-amp to be an external module and add it manifest.

See https://github.com/zephyrproject-rtos/open-amp

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-05-30 19:39:35 -04:00
Anas Nashif 02ed9b19b5 mcumgr: move to an external module
Move MCUMGR to an external repository managed by west.

https://github.com/zephyrproject-rtos/mcumgr

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-05-28 08:28:57 -04:00
Paul Sokolovsky 1091b5b40d ext: mbedtls: Enable easy integration with POSIX API
If CONFIG_POSIX_API is defined, automatically use time() function.
The alternative to that is to explicitly configure mbedTLS' timing
source via API, as required for "raw code", but if user enables
POSIX API, we as well might use existing mbedTLS integration.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-05-27 20:28:53 +08:00
Paul Sokolovsky f0ea13d2a2 ext: mbedtls: Don't define MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
That means that when mbedTLS will need functions like snprintf(),
printf(), a few others, they will be used from libc, as done
normally by most of software. Note that mentioned functions
aren't normally used on code paths doing TLS communication per se.
Instead, they are used by debug logging, additional "print info"
style functions, etc.

Before, when MBEDTLS_PLATFORM_NO_STD_FUNCTIONS was defined, those
functions were stubbed out, so silently didn't work as expected
(a specific symptom seen was that some debug messages were printed
as garbage, because an buffer on stack was passed to dummy snprintf
stub, which didn't do anything to it, and its uninitialized contents
were printed afterwards. Instead, the expectation was that an
application would call a "setter" function to set snprintf, etc.
implementations as provided by application itself.

For Zephyr, we clearly don't need to burden applications with such
setup, instead Zephyr, as an OS, provides integrated environment
were matters like that "just work". So, we just switch to libc-based
functions. If there ever will be usecases for
MBEDTLS_PLATFORM_NO_STD_FUNCTIONS, it can be made configurable later.

Fixes: #16303

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-05-23 09:27:59 -04:00
Ulf Magnusson 5c69e9810a ext: open-amp: kconfig: Add missing OPENAMP dep. to OPENAMP_SRC_PATH
Prevents the OPENAMP_SRC_PATH symbol from showing up in the menu when
OPENAMP is disabled.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-05-14 06:13:18 -05:00
Ulf Magnusson dbc2406a05 ext: lib: mcumgr: Remove 'External Sources -> Management' menu
This menu contains just the MCUMGR symbol and its children. Get rid of
one menu level by removing it.

Makes the 'External Sources' menu look like this:

      HALs  --->
      Cryptography  --->
  [ ] Fnmatch Support
  [ ] OpenAMP Support
  (open-amp) OpenAMP library source path
  [ ] mcumgr Support

('OpenAMP library source path' being visible there might be a separate
issue.)

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-05-14 10:26:42 +02:00
Robert Lubos ffafa9c9c9 ext: lib: crypto: Extend mbedTLS generic config
Extend generic mbedTLS config with entries needed by OpenThread:
* MBEDTLS_CMAC_C
* MBEDTLS_ENTROPY_C
* MBEDTLS_SSL_EXPORT_KEYS
* MBEDTLS_SHA256_SMALLER

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2019-04-26 03:18:21 -07:00
Ulf Magnusson d5b0bd14e3 scripts: Remove unused imports in all Python scripts
Discovered with pylint3.

Upstream open-amp PR: https://github.com/OpenAMP/open-amp/pull/168

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-28 11:06:20 -05:00
Ulf Magnusson 95650fdefa ext: open-amp: Fix broken typo'd sys.exit()
s/exist/exit/

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-28 11:05:38 -05:00
Anas Nashif cb8fb2d705 modules: remove tinycbor from ext/ and use west module feature
Use tinycbor from the tinycbor repo directly and drop the library from
ext/.

Add entry to west.yml and update SHA.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-03-25 22:41:01 -04:00
Ulf Magnusson 9bf05a56e0 mbedtls: kconfig: Remove redundant 'depends on MBEDTLS'
Appears within an 'if MBEDTLS'.

'if FOO' is just shorthand for adding 'depends on FOO' to each item
within the 'if'.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-13 12:00:17 -05:00
Ulf Magnusson 53376394b7 kconfig: Remove blank lines at the beginning/end of files
Maybe this is some "just in case" thing that got copied around. There's
no need to have a blank line at the beginning or end of Kconfig files.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-13 07:29:42 -05:00
Kumar Gala 72af04ba1a open-amp: Fix build issue with newlib
If we enable newlib we run into an issue with fcntl.h and the openamp
proxy support.  We don't utilize the proxy support so just disable it by
default.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-03-11 14:37:57 -05:00
Andrew Boie e686aefe09 mbedtls: provide user mode access
The mbedtls library has some globals which results in faults
when user mode tries to access them.

Instantiate a memory partition for mbedtls's globals.
The linker will place all globals found by building this
library into this partition.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-03-05 08:27:20 -05:00
Radoslaw Koppel dbe775838a ext: encoding: tinycbor: Add missing files for pretty printing
This commits adds missing source files for tinycbor
library to allow pretty printing.

Signed-off-by: Radoslaw Koppel <radoslaw.koppel@nordicsemi.no>
2019-03-05 09:31:48 +01:00
Anas Nashif 3b745cc648 mbedtls: enable self-test in config-tls-generic.h
MBEDTLS_SELF_TEST is needed when setting CONFIG_MBEDTLS_TEST

Fixes #13919

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-03-04 17:32:08 -08:00
Ulf Magnusson 40436f730b kconfig: Use a short consistent prompt style
Same change as in commit 8cf8db3a73 ("Kconfig: Use a short, consistent
style for prompts"), fixing stuff that got introduced since then.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-27 09:23:30 +01:00
Flavio Ceolin 06d0b6a694 ext: tinycrypt: Update tinycrypt revision
Bump tincyrypt library revision.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2019-02-21 07:48:24 -05:00
Anas Nashif 996c252e51 dfu: mcuboot: rename boot_swap_type> mcuboot_swap_type
This function conflicts with a function of the same name in mcuboot.
This happens when building USB DFU support into mcuboot.

DFU over USB uses image manager and mcuboot internals to manage images
downloaded to the device.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-02-19 09:32:02 +01:00
Carlos Stuart 75f77db432 include: misc: util.h: Rename min/max to MIN/MAX
There are issues using lowercase min and max macros when compiling a C++
application with a third-party toolchain such as GNU ARM Embedded when
using some STL headers i.e. <chrono>.

This is because there are actual C++ functions called min and max
defined in some of the STL headers and these macros interfere with them.
By changing the macros to UPPERCASE, which is consistent with almost all
other pre-processor macros this naming conflict is avoided.

All files that use these macros have been updated.

Signed-off-by: Carlos Stuart <carlosstuart1970@gmail.com>
2019-02-14 22:16:03 -05:00
Andy Gross 18a7b84823 ext: crypto: mbedtls: Fix uninitialized variable
This patch fixes an issue with an uninitialized variable in the x509
mbedtls feature.  I sent a related patch to the mbedtls project so
that this can be fixed in the future.

https://github.com/ARMmbed/mbedtls/pull/2392

Signed-off-by: Andy Gross <andy.gross@linaro.org>
2019-02-08 15:32:58 -06:00
Findlay Feng 692b88ef36 ext/lib/mgmt/mcumgr: align zephyr port to changes in dfu sybsy'es
Changes in flash_map API makes flash_area structure proper
interface for point the image area instead of direct flash-bank-offsets.

This patch align code to changed APIa and allows to support operation
on the partition in any flash device.

Signed-off-by: Findlay Feng <i@fengch.me>
2019-02-08 09:13:09 -06:00
Robert Lubos 929c881db0 ext: lib: mbedtls: Fix MBEDTLS_PEM_PARSE_C definition in generic config
During recent refactoring of mbedTLS generic config file, a regression
slipped in that prevented MBEDTLS_PEM_PARSE_C from being set, even
though the option was selected in Kconfig. The reason for this is the
fact that this config has dependency to MBEDTLS_X509_CRT_PARSE_C but it
was moved above the line where MBEDTLS_X509_CRT_PARSE_C was actually
set. Therefore, this dependency was never satisfied.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2019-02-01 05:27:04 -06:00
Kumar Gala 85c5ca2f0f ext: open-amp: Update OpenAMP to v2018.10 release
Update to new OpenAMP v2018.10 release.  This release allows us to
utilize just rpmsg without remoteproc.  The API set has changed and
requires updates to the openamp sample.  Additionally, the changes
in this release reduce the code size footprint, and support a static
allocation memory model.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-30 15:55:47 -06:00
Aurelien Jarno a6d82db50f ext: lib: crypto: Extend generic mbedTLS config with HAVE_ASM
Extend generic mbedTLS configuration file with MBEDTLS_HAVE_ASM option,
to allow the use of assembly code. This improves the performances of
asymetric cryptography, however depending on the architecture and the
CPU, this might have an impact on the code size.

Set the default value ot the previous non-configurable value, ie enable
it by default except on ARM.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-01-23 04:34:15 -06:00
Robert Lubos ba4d08f328 ext: lib: crypto: Extend generic mbedTLS config
Extend generic mbedTLS configuration file with MBEDTLS_AES_ROM_TABLES
option. This allows to save some RAM (~8kB) in favour of ROM and
performance.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2019-01-22 07:44:42 -05:00
Sebastian Bøe 1b86fb9da3 cmake: Use variables for target names
There is an effort underway to make most of the Zephyr build script's
reentrant. Meaning, the build scripts can be executed multiple times
during the same CMake invocation.

Reentrancy enables several use-cases, the motivating one is the
ability to build several Zephyr executables, or images, for instance a
bootloader and an application.

For build scripts to be reentrant they cannot be directly referencing
global variables, like target names, but must instead reference
variables, which can vary from entry to entry.

Therefore, in this patch, we replace global targets with variables.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2019-01-19 07:21:55 -05:00
Anas Nashif 52b23a3b08 ext: fix path to source files with new cmake
New cmake does not like source files not relative to current directory.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-01-03 11:51:29 -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
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
Robert Lubos e8620e2cca ext: mbedtls: Unify mbedTLS Kconfig prefixes
Currently there is a mixed approach in prefixes from mbedTLS
configuration (MBEDTLS_ and TLS_). The latter was used in generic config
file and could bring up confusion that it can only be used with TLS
subsystem. Hence unify the approach to MBEDTLS_ prefix to avoid such
confusion.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-12-17 11:27:02 +01:00
Robert Lubos 41d57db4ac ext: mbedtls: Extend generic config file
Extend generic mbedTLS config file with additional algorithms. Add
separate RNG section. Add switches to enable all algorithms in specific
group.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-12-17 11:27:02 +01:00
Andrzej Głąbek 20202902f2 dts_fixups: Use DT_ prefix in all defined labels not related to Kconfig
These changes were obtained by running a script  created by
Ulf Magnusson <Ulf.Magnusson@nordicsemi.no> for the following
specification:

1. Read the contents of all dts_fixup.h files in Zephyr
2. Check the left-hand side of the #define macros (i.e. the X in
   #define X Y)
3. Check if that name is also the name of a Kconfig option
   3.a If it is, then do nothing
   3.b If it is not, then replace CONFIG_ with DT_ or add DT_ if it
       has neither of these two prefixes
4. Replace the use of the changed #define in the code itself
   (.c, .h, .ld)

Additionally, some tweaks had to be added to this script to catch some
of the macros used in the code in a parameterized form, e.g.:
- CONFIG_GPIO_STM32_GPIO##__SUFFIX##_BASE_ADDRESS
- CONFIG_UART_##idx##_TX_PIN
- I2C_SBCON_##_num##_BASE_ADDR
and to prevent adding DT_ prefix to the following symbols:
- FLASH_START
- FLASH_SIZE
- SRAM_START
- SRAM_SIZE
- _ROM_ADDR
- _ROM_SIZE
- _RAM_ADDR
- _RAM_SIZE
which are surprisingly also defined in some dts_fixup.h files.

Finally, some manual corrections had to be done as well:
- name##_IRQ -> DT_##name##_IRQ in uart_stm32.c

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-11-13 10:44:42 -06:00
Szymon Janc 18d9cd8831 ext: lib: mgmt: mcumgr: update to latest master
This patch introduce version which add two new features:
 - ability to resume partial upload
 - option to not compile taskstat and echo commands

Origin: mcumgr
License: Apache 2.0
URL: https://github.com/apache/mynewt-mcumgr
Commit: 6251689367fcfe92898b90978b877a242b6e4b24
Purpose: New features
Maintained-by: External

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2018-11-04 22:01:56 +01:00
Marti Bolivar a10f7a0653 lib: openamp: fix build info
The toolchain information is using out of date (and misspelled)
environment variables. Rather than duplicate information here which is
already present in the getting started guide, just link to it.

Clean up some other docs.

Signed-off-by: Marti Bolivar <marti@foundries.io>
2018-10-17 19:07:58 -04:00
Andrzej Puzdrowski 182669401f ext: lib: mgmt: mcumgr: update to latest master
This patch introduce version which fixes following bug:

It was possible to erase slot 1 while it stores confirmed image
while ongoing test run - this is unwanted behavior which allow
to even brick remote device accidentally.
This patch add check for such case of test run etc.
This also aligns condition required for erase command
execution to similar as upload command requires.

Origin: mcumgr
License: Apache 2.0
URL: https://github.com/apache/mynewt-mcumgr
Commit: 91a76b95b1b81aba06e30ee168e5ee5975cdfe93
Purpose: Bug Fix
Maintained-by: External

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-10-04 10:34:22 +02:00
Krzysztof Chruscinski 486b731b40 ext: lib: Add fnmatch library
Library will be used by new shell implementation.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-09-19 09:30:29 -04:00
Flavio Ceolin e05e251b81 ext: lib: crypto: Update mbedTLS to 2.12.0
Since 2.9.0 release mbedTLS has some minor functional improvements,
security fixes and bug fixed. A list with all changes can be found
in:

./ext/lib/crypto/mbedtls/ChangeLog

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-09-06 21:11:31 -04:00
Ulf Magnusson 8cf8db3a73 Kconfig: Use a short, consistent style for prompts
Consistently use

    config FOO
            bool/int/hex/string "Prompt text"

instead of

    config FOO
            bool/int/hex/string
            prompt "Prompt text"

(...and a bunch of other variations that e.g. swapped the order of the
type and the 'prompt', or put other properties between them).

The shorthand is fully equivalent to using 'prompt'. It saves lines and
avoids tricking people into thinking there is some semantic difference.

Most of the grunt work was done by a modified version of
https://unix.stackexchange.com/questions/26284/
how-can-i-use-sed-to-replace-a-multi-line-string/26290#26290, but some
of the rarer variations had to be converted manually.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-08-15 04:10:10 -07:00
Flavio Ceolin 263282b220 ext: tinycrypt: Update revision
Update tinycrypt to latest revision, two commits after 0.2.8 release.

These commits are only bug fixes and one of them is fixing incorrect
buffer size in decryption with CBC mode.

This algorithm is being used by tinycrypt shim and is tested in
samples/drivers/crypto/.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-08-02 19:18:58 +02:00
Ulf Magnusson d1684a83a4 Kconfig: Clean up some symbol definitions
- Remove redundant 'n' defaults. 'n' is the default value for bool
  symbols.

  This makes the auto-generated documentation clearer as well: You get
  "implicitly defaults to n" instead of
  "- n if <propagated dependencies>".

- Shorten

      <type>
      prompt "foo"

  to

      <type> "foo"

  This works for all types, not just bool.

- Various formatting nits.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-08-01 12:47:17 -04:00
Robert Lubos f1421b96df ext: lib: crypto: Make config-tls-generic.h default config
Default configuration of config-tls-generic.h mimics the current default
config file configuration - config-mini-tls1_2.h, thererfore it can be
safely used instead of it.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-07-13 10:56:40 +02:00
Robert Lubos a60af5c1ff ext: lib: crypto: Add generic mbedTLS config file
This commits provides a config file for mbedtls that can be modifed by
Kconfig. In result features like supported ciphersuites can be easily
adjusted from Kconfig.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-07-13 10:56:40 +02:00
Johannes Hutter 414291cc12 ext: lib: mgmt: mcumgr: update to latest master
This update to the latest master of mcumgr fixes a memory corruption in
the image management and updates the readme.

Fixes #7924

Origin: mcumgr
License: Apache 2.0
URL: https://github.com/apache/mynewt-mcumgr
commit: a837a731b94927c6198e39744cd6d979be23942a
Purpose: Fix memory corruption
Maintained-by: External

Signed-off-by: Johannes Hutter <johannes@proglove.de>
2018-07-04 11:59:12 +02:00
Ulf Magnusson fb6f9b78c9 ext: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' could make sense e.g. in a Kconfig.defconfig file, if you
wanted to override a 'default y' on the base definition of the symbol,
but it doesn't seem to be used like that on any of these symbols.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-06-18 15:26:38 -04:00
Ulf Magnusson 4db7cce06e ext: lib: mgmt: Remove MDLOG Kconfig reference
This symbol never seems to have been defined.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-06-13 13:35:56 -04:00
Maureen Helm 9550a7b17f ext: lib: crypto: Restore config macros removed in mbedTLS 2.9.0
mbedTLS 2.9.0 removed several macros from the config-ccm-psk-tls1_2.h
configuration that we need defined to build mbedTLS in zephyr. This
fixes the CI build failure in samples/net/mbedtls_sslclient

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-05-25 17:17:03 -04:00
Maureen Helm 1cd6373f21 ext: lib: crypto: Update mbedTLS to 2.9.0
Mbed TLS 2.9.0 introduces some minor functional improvements including
code size reductions with smaller AES tables, and initial support for
Curve448 along with some security fixes and bug fixes.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-05-25 17:17:03 -04:00
Kumar Gala 9a89f39b49 ext: hal: open-amp: Allow for open-amp source to be external
Introduce a Kconfig option (CONFIG_OPENAMP_SRC_PATH) that allows us to
point to an external copy of open-amp.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-05-24 11:22:05 -05:00
Kumar Gala 4e8438bc0e ext: open-amp: Change build integration so its not recursive
With recent changes to open-amp we can now include and build it directly
as a zephyr library rather than doing a recursive make.  We remove
ext/lib/ipc/open-amp.cmake as part of this change and introduce a
Kconfig option for open-amp.

Fixes: #7673

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-05-24 09:18:47 -05:00