Commit Graph

51791 Commits

Author SHA1 Message Date
Martí Bolívar a8f7bfbbd4 edtlib: silence type checker issue
Mypy is complaining about this line for some reason I didn't have time
to figure out. Just shut it up for now; I'll look into this when I get
around to type annotating edtlib.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-05-05 13:13:12 -05:00
Martí Bolívar 8e30289b84 dtlib: type annotate DT fields and public methods
Now that all the other code it depends on is annotated, we can finish
up the type annotation of this module in the main DT class.

It's not worth it to try to annotate the private methods (the ones
that begin with '_'). Most of these are low level lexing helpers that
aren't particularly amenable to static type checking, because the type
of a token's value is often dependent on the token ID in ways that
static type annotations are not well equipped to capture.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-05-05 13:13:12 -05:00
Martí Bolívar c6bb336bc1 dtlib: add type checking for DT.root
We'd like users of this API to know that DT.root is always a Node,
and not an Optional[Node].

However, although DT.__init__ throws an exception if the resulting DT
object would have no root node, static analysis can't tell that since
the root instance attribute starts out as None during initialization,
so checkers like mypy are convinced it's Optional[Node].

Since this is really OK, we'll quiet the type checker down by stashing
the instance attribute in self._root instead, and providing a root
property accessor that is annotated to return Node instead of
Optional[Node]. We can tell mypy to ignore what looks like a potential
None here to allow callers to treat the result as a Node.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-05-05 13:13:12 -05:00
Martí Bolívar b13b5b8b3a dtlib: fix include_path edge case
The documentation says DT.__init__ takes any iterable for the
include_path, but this leads to bad results when you pass it something
other than a 'real' sequence (list/tuple/etc), like a generator:

>>> dt = DT('/tmp/foo.dts', (x for x in ['a', 'b', 'c']))
>>> repr(dt)
"DT(filename='/tmp/foo.dts', include_path=<generator object ...>)"

Make a copy in list form just to avoid things like this.

Add a test for this and relax the regular expression in the existing
test case related to this.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-05-05 13:13:12 -05:00
Martí Bolívar 628fb90412 dtlib: type annotate public functions
Some of these are also tripping up a python 2 / python 3 warning
in mypy in the way that '{}'.format(b'foo') works, which we silence by
explicitly requesting the python 3 behavior.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-05-05 13:13:12 -05:00
Martí Bolívar 9d4ccf23ec dtlib: use IntEnum for token IDs
The way that _init_tokens() is manipulating globals() defeats static
analyses of the file that are trying to infer a type for the 'tok_id'
variable in assignment expressions like 'tok_id = _T_INCLUDE'.

To make it easier on the analyser, define the token types as an
enum.IntEnum named _T. This means we can write e.g. '_T.INCLUDE'
instead of '_T_INCLUDE', avoiding line length increases in the lexing
code.

While we're here, use '==' and '!=' instead of 'is' and 'is not'
when comparing a tok_id that is obtained from an re.Match.lastindex
with a _T.FOO value.

This is now necessary since an int object and a _T object definitely
don't point to the same memory. It worked previously because CPython
interns all integer instances from -5 to 256, but that's an
implementation detail and not a language feature. Since we're getting
the ints from an re.Match.lastindex instead of putting the exact
_T_FOO values into some list, this code probably should not strictly
speaking have been using 'is'.

Explicitly initialize the global _token_re also, to make it more
visible for static analysis.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-05-05 13:13:12 -05:00
Martí Bolívar 8427259ca2 dtlib: type annotate Property class
Continue annotating the module. In some cases mypy will miss that
_err() calls means the function will not return, so we return an
unnecessary local variable to appease it.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-05-05 13:13:12 -05:00
Martí Bolívar a7e7964b14 dtlib: use IntEnum for marker types
Add a _MarkerType enum. A subsequent commit will use it for type
annotations in the Property class.

Fix an incorrect type in a comment while we're here.

We continue to use 'marker_type is _MarkerType.FOO' instead of
'marker_type == _MarkerType.FOO' because we are adding those actual
_MarkerType.FOO objects to each property, so 'is' comparison
is legitimate.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-05-05 13:13:12 -05:00
Martí Bolívar f663521e4a dtlib: type annotate Node class
A step along the way towards typing the whole module.

Fix an incorrect (or at best misleading) comment while we're here,
which was noticed by the type checker when I originally annotated
'props' as a Dict[str, bytes].

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-05-05 13:13:12 -05:00
Martí Bolívar a6ed7b262e dtlib: type annotate _err()
Marking this NoReturn helps the type checker figure out that functions
which call it are only returning valid values or failing to
return. (It unfortunately doesn't always work as mypy's control flow
analysis seems to treat a direct 'raise DTError(...)' differently than
calling _err() in some situations, but it helps.)

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-05-05 13:13:12 -05:00
Martí Bolívar 587b3248dc dtlib: code order and whitespace refactoring
Move the DTError, Node, Type, and Property definitions to the top.

This way, class definitions occur before methods which use those
classes. This will be useful to avoid string literals in type
annotations that will be added later. Some can't be avoided due to
circular dependencies, but this will help.

Adjust whitespace.

No functional changes expected.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-05-05 13:13:12 -05:00
Martí Bolívar 22fd259ce1 devicetree: fix stale comments
Update stale script comments from the package reorganization.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-05-05 13:13:12 -05:00
Kumar Gala 6f8f08a6a3 drivers: i2s: i2s_sam_ssc: Fix build issue
Change to make i2s_config const missed a case in the SAM driver.
Without this we get build errors when building in CI.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-05-05 13:01:01 -05:00
Kumar Gala 5f423d45cf boards: hexiwear_k64: Drop SPI as supported board feature
We don't currently configure any SPI interface on the hexiwear_k64 so
remove 'spi' as a listed supported feature in the board YAML.

This can be added back if SPI support is added for the board in the
future.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-05-05 11:08:33 -05:00
Anas Nashif c8a2432955 ci: use new docker image based on ubuntu 20.04
Update to new docker image with various updates including renode, llvm
and the base distro (moving from ubuntu 18.04 to 20.04).

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-05-05 11:04:36 -05:00
Steve Winslow fd31b9b4ac west: spdx: Generate SPDX 2.2 tag-value documents
This adds support to generate SPDX 2.2 tag-value documents via the
new west spdx command. The CMake file-based APIs are leveraged to
create relationships from source files to the corresponding
generated build files. SPDX-License-Identifier comments in source
files are scanned and filled into the SPDX documents.

Before `west build` is run, a specific file must be created in the
build directory so that the CMake API reply will run. This can be
done by running:

    west spdx --init -d BUILD_DIR

After `west build` is run, SPDX generation is then activated by
calling `west spdx`; currently this requires passing the build
directory as a parameter again:

    west spdx -d BUILD_DIR

This will generate three SPDX documents in `BUILD_DIR/spdx/`:

1) `app.spdx`: This contains the bill-of-materials for the
application source files used for the build.

2) `zephyr.spdx`: This contains the bill-of-materials for the
specific Zephyr source code files that are used for the build.

3) `build.spdx`: This contains the bill-of-materials for the built
output files.

Each file in the bill-of-materials is scanned, so that its hashes
(SHA256 and SHA1) can be recorded, along with any detected licenses
if an `SPDX-License-Identifier` appears in the file.

SPDX Relationships are created to indicate dependencies between
CMake build targets; build targets that are linked together; and
source files that are compiled to generate the built library files.

`west spdx` can be called with optional parameters for further
configuration:

* `-n PREFIX`: specifies a prefix for the Document Namespaces that
will be included in the generated SPDX documents. See SPDX spec 2.2
section 2.5 at
https://spdx.github.io/spdx-spec/2-document-creation-information/.
If -n is omitted, a default namespace will be generated according
to the default format described in section 2.5 using a random UUID.

* `-s SPDX_DIR`: specifies an alternate directory where the SPDX
documents should be written. If not specified, they will be saved
in `BUILD_DIR/spdx/`.

* `--analyze-includes`: in addition to recording the compiled
source code files (e.g. `.c`, `.S`) in the bills-of-materials, if
this flag is specified, `west spdx` will attempt to determine the
specific header files that are included for each `.c` file. This
will take longer, as it performs a dry run using the C compiler
for each `.c` file (using the same arguments that were passed to it
for the actual build).

* `--include-sdk`: if `--analyze-includes` is used, then adding
`--include-sdk` will create a fourth SPDX document, `sdk.spdx`,
which will list any header files included from the SDK.

Signed-off-by: Steve Winslow <steve@swinslow.net>
2021-05-05 11:14:06 -04:00
Vinayak Kariappa Chettimada 167e83df49 Bluetooth: controller: Move le_adv_ext_terminate under broadcaster
Move le_adv_ext_terminate under broadcaster conditional
compilation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-05 17:05:52 +02:00
Jennifer Williams ca75bbef3c tests: boot_time: remove all the code and instrumentation feeding into test
Remove the config BOOT_TIME_MEASUREMENT and corresponding #ifdef'd code
throughout (kernel/init.c, idle.c, core/common.S , reset.S, ... ) which
hold the extern hooks for z_timestamp_main and z_timestamp_idle in the
removed boot_time test suite.

Signed-off-by: Jennifer Williams <jennifer.m.williams@intel.com>
2021-05-05 10:41:15 -04:00
Jennifer Williams 502d7bd116 tests: benchmarks: remove obsolete boot_time test suite
This test for boot time was sufficient when it was originally
introduced, but is no longer appropriate as the code and
ecosystem grew.

Signed-off-by: Jennifer Williams <jennifer.m.williams@intel.com>
2021-05-05 10:41:15 -04:00
Marek Metelski 1a927b5fbf Bluetooth: shell: Fix implicit gatt client requirement for bt shell
`write_stats` functionality implementation is guarded by
`BT_GATT_CLIENT`, but is also called from commands defined when
`BT_GATT_DYNAMIC_DB` is set. This means that now application will not
build with `BT_SHELL` used, when we set `BT_GATT_DYNAMIC_CB` solely.

Move this functionality to top of the file without guarding
ifdefs, so it can be used in all gatt shell commands.

Signed-off-by: Marek Metelski <marek.metelski01@gmail.com>
2021-05-05 16:03:51 +02:00
Magdalena Kasenberg d0e0af74da Bluetooth: Add option to log btsnoops over RTT
There is a choice to log btmon logs over UART or RTT.
You can choose number of RTT buffer, set its name and size.

Replaced CONFIG_BT_DEBUG_MONITOR with CONFIG_BT_DEBUG_MONITOR_UART
for UART usage and CONFIG_BT_DEBUG_MONITOR_RTT for RTT.

Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
2021-05-05 16:03:38 +02:00
Krzysztof Kopyściński ae935a7a37 Bluetooth/tester: fix coverity issue in l2cap
i is of uint type, so it'll never be negative. Thus, while loop
condition i >= 0 will always be true.
This patch also fixes issue with marking unused l2cap channels
as free by freeing only these that were marked as in_use by
get_free_channel(), and not all of them.

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2021-05-05 16:03:22 +02:00
Gerson Fernando Budke bb39e9fcb4 boards: arm: cy8ckit_062_ble: Add spi config
Create a common dtsi file to share peripherals between both CPU cores.
The spi is the initial shared peripheral.

Signed-off-by: Gerson Fernando Budke <gerson.budke@atl-electronics.com>
2021-05-05 16:01:28 +02:00
Gerson Fernando Budke d999531f7f drivers: spi: Add cypress PSoC-6 scb spi driver
Add Cypress PSoC-6 SCB[spi] driver.

Signed-off-by: Gerson Fernando Budke <gerson.budke@atl-electronics.com>
2021-05-05 16:01:28 +02:00
Gerson Fernando Budke 3155b762a6 dts: spi: Add cypress PSoC-6 controller
Add Cypress PSoC-6 SPI controller and pinctrl nodes.

Signed-off-by: Gerson Fernando Budke <gerson.budke@atl-electronics.com>
2021-05-05 16:01:28 +02:00
Gerson Fernando Budke a0466a6757 west.yml: Sync hal_cypress
Sync hal_cypress to allow use of SCB[spi] and SCB[i2c] APIs.

Signed-off-by: Gerson Fernando Budke <gerson.budke@atl-electronics.com>
2021-05-05 16:01:28 +02:00
Gerson Fernando Budke 7a1f26b005 drivers: ieee802154: rf2xx: Add pan coordinator mode
Enable pan coordinator mode.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-05-05 15:55:45 +02:00
Gerson Fernando Budke 0ae119ef3f drivers: ieee802154: rf2xx: Add promiscuous mode
The current rf2xx driver not implement any configuration.  Add
the minimal structre to implement rf2xx driver configuration and
implement IEEE802154_CONFIG_PROMISCUOUS mode.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-05-05 15:55:45 +02:00
Gerson Fernando Budke 2f3644ee0c drivers: ieee802154: rf2xx: Add tx mode CCA
Configure transceiver to create a 0 period backoff and perform only one
time the CCA without transmission retires for failures.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-05-05 15:55:45 +02:00
Gerson Fernando Budke 195800145e drivers: ieee802154: rf2xx: Add tx mode direct
The current RF2XX driver only support IEEE802154_TX_MODE_CSMA_CA.  Add
IEEE802154_TX_MODE_DIRECT to allow transmit packets immediately without
performing random backoff, CCA and retransmission process.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-05-05 15:55:45 +02:00
Kumar Gala 84064f00ea clock_control: Replace device_is_ready with device_usable_check
Use device_usable_check instead of device_is_ready so we can propagate
back whatever error that device_usable_check() determined to the caller
of the clock API.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-05-05 15:54:44 +02:00
Matija Tudan d2c503f202 sensor: add MAX17262 fuel gauge driver and sample application
The MAX17262 is an ultra-low power fuel-gauge IC which implements the
Maxim ModelGauge m5 algorithm. The IC monitors a single-cell battery
pack and supports internal current sensing for up to 3.1A pulse
current. The IC provides best performance for batteries with 100mAhr
to 6Ahr capacity.

Signed-off-by: Matija Tudan <mtudan@mobilisis.hr>
2021-05-05 15:54:29 +02:00
Øyvind Rønningstad 0500d75c3a tfm: Fix cmake library handling
Make tfm_api a proper Zephyr library and add all sources to it.

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2021-05-05 15:36:32 +02:00
Øyvind Rønningstad c08d0a3629 samples: tfm_integration: Remove setting of QEMU file
This is done elsewhere now.

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2021-05-05 15:36:32 +02:00
Shubham Kulkarni 0719973436 esp32: Add SPIRAM test application
Adds application to test SPIRAM

Signed-off-by: Shubham Kulkarni <shubham.kulkarni@espressif.com>
2021-05-05 08:46:35 -04:00
Shubham Kulkarni a24707a4bd esp32: Add config options in Kconfig.board, remove _heap_start symbol
This commit adds config options for supporting multiple memory
allocation using k_malloc()

Update west.yml with hal_espressif change

Signed-off-by: Shubham Kulkarni <shubham.kulkarni@espressif.com>
2021-05-05 08:46:35 -04:00
Shubham Kulkarni 67d2368398 esp32: SPIRAM Support
Adds SPIRAM support for ESP32

Configures k_heap for SPIRAM memory range

Signed-off-by: Shubham Kulkarni <shubham.kulkarni@espressif.com>
2021-05-05 08:46:35 -04:00
Krzysztof Chruscinski 61a2e8cee3 tests: lib: cbprintf: Extended to test C++
Extended test suite to be run for C++

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-05-05 08:45:43 -04:00
Krzysztof Chruscinski 6f227698bb lib: os: cbprintf: Improve C++ support in static packaging
Added C++ replacements for macros that are using _Generic
keyword.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-05-05 08:45:43 -04:00
Tim Lin caa3328cc7 ite: drivers/pinmux: modify pinmux driver
Modify the pinmux control method and add support the fun3
& fun4 alternation function.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-05-05 08:45:16 -04:00
Maureen Helm 05a68b1604 samples: fs: Extend littlefs sample to mimxrt1060_evk board
Adds the mimxrt1060_evk board to the platform_allow list for the
littlefs sample application.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2021-05-05 08:44:00 -04:00
Maureen Helm b1cd3e8ed6 samples: mgmt: Extend smp_svr sample to mimxrt106x_evk boards
Adds mimxrt1060_evk and mimxrt1064_evk boards to the platform_allow list
for the smp_svr sample application.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2021-05-05 08:44:00 -04:00
Maureen Helm dd9c656961 boards: arm: Document flash driver support on mimxrt106x_evk boards
Documents QSPI flash driver support on mimxrt1060_evk and mimxrt1064_evk
boards.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2021-05-05 08:44:00 -04:00
Maureen Helm 62e3298bed boards: arm: Add mcuboot and flash storage partitions to mimxrt1060_evk
Adds flash partitions and chosen nodes to the mimxrt1060_evk device tree
to support mcuboot and storage on the external QSPI flash. This flash is
rated for 100K minimum program-erase cycles per sector, therefore this
partition configuration supports approximately 100K / (3072/128) = 4167
upgrades.

Also enables FlexSPI flash driver XIP mode support on this board to
support mcuboot.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2021-05-05 08:44:00 -04:00
Maureen Helm 6a9dc2ae57 boards: arm: Add mcuboot flash partitions to mimxrt1064_evk
Adds flash partitions and chosen nodes to the mimxrt1064_evk device tree
to support mcuboot on the internal QSPI flash. This flash is rated for
100K minimum program-erase cycles per sector, therefore this partition
configuration supports approximately 100K / (1984/64) = 3225 upgrades.

Also enables FlexSPI flash driver XIP mode support on this board to
support mcuboot.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2021-05-05 08:44:00 -04:00
Fabio Baltieri 0a56ced423 boards: stm32_min_dev: convert to dt based clock config
Convert the stm32_min_dev boards to the new device tree based config
setup.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-05-05 08:42:53 -04:00
Fabio Baltieri 525a235fb3 clock_control: stm32f1: fix STM32_PLL_XTPRE check
This is always defined since:

755d09e149 include/drivers/clock_control: stm32: Update for STM32F1
support

So the condition has currently no effect and causes the prescaler to
always be set to /2.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-05-05 08:42:53 -04:00
Francois Ramu 3a93f9bcc9 dts: arm: stm32l1 has a fixed lsi clock of 37kHz
Correct the clock freq of the lsi for the stm32l1

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-05-05 08:42:21 -04:00
Vinayak Kariappa Chettimada 08a679dc4c Bluetooth: controller: Add Broadcast ISO related timing macros
Added Broadcast ISO related timing macros, like T_MSS
Minimum Subevent Space.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-05 08:41:40 -04:00
Vinayak Kariappa Chettimada 03c191c281 Bluetooth: controller: Add function to calculate BIS access address
Added a function to calculate the BIS SubEvent access
addresses.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-05 08:41:09 -04:00