Commit graph

43269 commits

Author SHA1 Message Date
Anas Nashif d4930f71fc kconfig: top level menu item for subsystems
Move all subsystems into one single menu entry to reduce the clutter in
the top level menuconfig.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-24 10:24:30 +02:00
Anas Nashif 35c239cbb9 Kconfig: move THREAD_ANALYZER under Monitoring menu
This one was appearing in the top level Kconfig menu when viewed in
menuconfig. Move it to where it belongs.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-24 10:24:30 +02:00
Fabio Utzig 716ab47dcc west: try image-1's size as slot size in imgtool
When MCUBoot is built using the swap-move strategy, the secondary slot
can be one sector smaller than the primary slot, because the primary
slot's last "useful" image sector must be "reserved" for the move
operation; this impacts the generation of padded images, so when
signing an image, the proper size to use is the secondary slot's,
unless a secondary image is not defined which is the case when using
single image DFU.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-08-24 10:18:56 +02:00
Joakim Andersson c7ad66157d Bluetooth: host: Elevate security to L4 when SC only is enabled
Elevate connections always to security mode 1 level 4 when
Secure Connections Only Mode has been enabled in the Security Manager.

Elevate connections always to security mode 1 level 3 when
Legacy pairing with OOB only has been enabled in the Security Manager.

Fixes: #27338

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-08-24 10:16:51 +02:00
Roman Vaughan 127e82e3b8 drivers: can: Wait for MCP2515 to reset
The device may be prematurely configured before it is ready during
reset without first checking. After the driver writes to the registers
and normal mode gets selected, CANSTAT is read back to ensure the
device is now configured in normal mode (0x00). However, an
unresponsive device will be read as 0x00, the driver then assumes it is
configured correctly.

The MCP2515 will reset into configuration mode (0x04) to allow bit
timings to be configured. Adding a check for this mode prevents the
device from being misconfigured.

Signed-off-by: Roman Vaughan <nzsmartie@gmail.com>
2020-08-21 14:47:01 -05:00
Henrik Brix Andersen f7cfa7c38e tests: drivers: build_all: add mcp320x adc driver
Add the MCP320x ADC driver to the build_all drivers build test.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-08-21 14:31:40 -05:00
Henrik Brix Andersen 768482cb6a drivers: adc: mcp320x: fix compilation when using spi cs-gpios
Fix compilation of the MCP320x ADC driver when using SPI cs-gpios.

Fixes 0f7acb1dc3.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-08-21 14:31:40 -05:00
Hake Huang 99c707241a counter: enable pit counter driver on frdmk64f
enable pit counter driver in frdmk64f

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2020-08-21 14:27:59 -05:00
Hake Huang ebd0a3759e counter: enable k6s pit support support
enable k6s pit counter support

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2020-08-21 14:27:59 -05:00
Hake Huang 93efb9a8f4 dts: enable pit0 in k6s device tree
enable pit0 in NXP k6s

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2020-08-21 14:27:59 -05:00
Hake Huang 3d0767c36e test: update counter test to support pit
update counter_basic_api to support kinetis PIT
update counter to support multi coutner driver

select PERIOD_TO_US by device name at runtime

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2020-08-21 14:27:59 -05:00
Hake Huang f6677b77fa counter: add pit counter driver
add Kinetis PIT as counter driver

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2020-08-21 14:27:59 -05:00
Hake Huang f976de4767 counter: enable pit support for k8x series
enable PIT in k8x series

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2020-08-21 14:27:59 -05:00
Hake Huang 5382673bea counter: add pit in k8s board support
enable frdm_k82f with pit counter driver
this driver can be used as period hardware trigger

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2020-08-21 14:27:59 -05:00
Hake Huang 7fb938710b dts: add pit as counter
add dts for kinetis pit counter driver

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2020-08-21 14:27:59 -05:00
Wenbo Yang 17216128ab hardening: remove the empty line before EOF
The extra empty line broke the "ninja hardenconfig" on my machine with
Python 3.7.5, it complains:

"
... ...
File "/home/zephyrproject/zephyr/scripts/kconfig/hardenconfig.py",
line 46, in compare_with_hardened_conf

name = row[0]
IndexError: list index out of range
FAILED: CMakeFiles/hardenconfig
"

The csv.reader reads this empty line and gets an empty list which will
not be successfully "de-referenced".  Removing it to improve the
out-of-box experience when pepople try out the hardening options.

Signed-off-by: Wenbo Yang <wenbo.yangcn@gmail.com>
2020-08-21 15:09:07 -04:00
Meng xianglin 560b8d9fe0 test: thread: add a test case for essential thread abort
Abort a essential thread and handle the fatal error.

Signed-off-by: Meng xianglin <xianglinx.meng@intel.com>
2020-08-21 13:58:35 -04:00
Peter A. Bigot ea8432b92e samples: jesd216: update output to reflect recent bug fix
An off-by-one error calculating the number of parameter headers caused
a third table to not be displayed.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-08-21 13:57:46 -04:00
Peter A. Bigot c04c40a34e samples: jesd216: fix printf argument to match format
The relative offset will always be small so downcast it to avoid
cross-platform size differences.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-08-21 13:57:46 -04:00
Peter A. Bigot e32ecab7af checkpatch: disable REPEATED_WORD
A new check in Linux checks for repeated words, which spews false
positives from text like:

* @param param the parameter
* @param device device instance

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-08-21 13:57:02 -04:00
Peter A. Bigot e49e3c8fef scripts: update checkpatch based on current linux kernel version
This squashes and applies the Linux diffs to scripts/checkpatch.pl
between Linux commit 16fbf79b0f83bc75 ("Linux 5.6-rc7") and
9123e3a74ec7b93 ("Linux 5.9-rc1") except for commits identified below.

The last 1000 commits to Zephyr master were compared for checkpatch
output differences between the previous Zephyr version and this
version.  One new diagnostic about function declarations with an empty
parameter-list was introduced (FUNCTION_WITHOUT_ARGS).  The text of an
existing diagnostic was changed (DT_SPLIT_BINDING_PATCH).  The text of
LONG_LINE diagnostics was enhanced to provide the actual line length.

Linux commit dfa05c28ca7ffc0a ("checkpatch: remove email address
comment from email address comparisons") was removed because
differences in the scripts resulted in false signed-off-by check
diagnostics when a full name included characters not in Basic Latin,
due to changes in how the author name was extracted.  Earlier upstream
changes not integrated into Zephyr may be required.

Linux commit b95692f8b3000166 ("checkpatch: prefer fallthrough; over
fallthrough comments") was removed because Zephyr doesn't support the
upstream pseudo keyword.

Linux commit bdc48fa11e46f867 ("checkpatch/coding-style: deprecate
80-column warning") was edited to not actually change the 80-column
maximum line limit as this change has not been mooted for Zephyr.

Linux commit ced69da1db0b57bb ("checkpatch: fix CONST_STRUCT when
const_structs.checkpatch is missing") was edited to the CONST_STRUCT
file as that's not supported in Zephyr.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-08-21 13:57:02 -04:00
Jukka Rissanen 34ddb8cfa8 net: includes: Fix indentation in header files
The indentation went wrong when the integer types was changed
from the type "u8_t" to type "uint8_t". This changed the length
of the type and caused the code to look bad in places.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-08-21 13:56:13 -04:00
Peter A. Bigot d75e1a8f32 doc: guides: portability: fix misspellings in POSIX C LANG table
Fix various missing letters and inconsistent parentheses.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-08-21 13:55:32 -04:00
Marcin Niestroj 1e6679a23b drivers: console: uart_mux: consume ringbuf until it is empty
ringbuf claim API returns pointer to contiguous area. In cases when data
in ringbuf wraps the end of internal buffer, then single call to claim
data is not enough to get all data - there is remaining part on the
beginning of internal buffer. Those remaining bytes will need to wait
for next ISR handler to trigger workqueue. Theoretically this means that
data on the beginning of ringbuf can wait there forever.

Consume data from ringbuf in a loop, stopping only when claiming results
in empty buffer. This will make sure that there is no stale data in the
ringbuf.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-08-21 13:51:45 -04:00
Matija Tudan efae88ce3a sensor: fxos8700: implement magnetic vector magnitude function
The magnetometer vector-magnitude function will generate an interrupt
when magnitude is greater than specified threshold value. The user
may program the threshold value to establish the conditions needed
to detect a magnetic vector-magnitude change event. Depending on the
values chosen for the reference values, this function may be
configured to detect a magnetic field magnitude that is above
a preset threshold (with reference values = 0), or a change in magnitude
between two magnetic vectors greater than the preset threshold
(with reference values non-zero).

Default configuration of M_VECM_CFG register (address 0x69) is 0x4e.

Signed-off-by: Matija Tudan <mtudan@mobilisis.hr>
2020-08-21 12:30:50 -05:00
Jukka Rissanen 3e1491de26 samples: net: echo-client: Add userspace support
Allow echo-client to run in user mode for testing purposes.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-08-21 14:45:35 +03:00
Loic Poulain 9eb46d95a7 net: shell: TCP stack agnostic shell
Now that TCP2 is the default stack, make the shell compatible
with both stacks.

Note: net_tcp_foreach is not implemented in TCP2, so related
code depends on TCP1.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-08-21 12:15:32 +03:00
Marcin Niestroj 4c8d1496ea net: l2: ppp: don't move back to NETWORK state when link goes down
PPP Phase Diagram [1] allows only one way phase change. In current
implementation there is an additional RUNNING phase, which is entered
just after NETWORK phase.

Prevent going back from RUNNING to NETWORK phase when Term-Req was
received, as this is meaningless for overall PPP operation and violates
PPP Phase Diagram property of having one way direction change.

This change also improves Adminitrative Close handling (calling
lcp_close()). This request results in moving into TERMINATE phase. Then
LCP is put down (by calling lcp_down()) and then ppp_link_down() is
called, which so far (before this patch) resulted in moving back to
NETWORK and then to DEAD. Right now (after this patch) we move directly
from TERMINATE to DEAD phase, which is exactly how [1] specifies it.

[1] https://tools.ietf.org/html/rfc1661#section-3.2

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-08-21 11:53:59 +03:00
Marcin Niestroj 47a39b567e net: l2: ppp: lcp: do not force STOPPED state after Adminitrative Close
State Transition Table [1] specifies that Administrative Close should
result in CLOSING state. This is not respected in case of LCP, as
STOPPED state was forced in lcp_close().

Don't force going into STOPPED state in lcp_close() and rely on
ppp_fsm_close() to move to CLOSING state instead.

This patch fixes overall Adminitrative Close procedure and allows to
move back into fully operating PPP connection once again after
Adminitrative Open.

[1] https://tools.ietf.org/html/rfc1661#section-4.1

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-08-21 11:53:38 +03:00
Henrik Brix Andersen b3aca735f7 doc: guides: porting: shields: fix directory layout examples
Fix the directory layout examples to use "<board>" when referring to a
board name, and "boards" when referring to the boards directory.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2020-08-21 10:27:57 +02:00
Siddharth Chandrasekaran b5f7706009 doc: portability/posix: Indicate presence of strtok_r
Commit 0637595e added strtok_r implementation but missed updating this
document.

Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
2020-08-20 19:40:18 -04:00
Martí Bolívar af4566b21e devicetree: spi: fix typo in docstring
s/one/none/ in a critical place.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-08-20 19:40:03 -04:00
Daniel Leung 16c4090487 tests: tinycrypt_hmac_prng: exclude MEC1501-based boards
MEC1501 SoC has 256KB of SRAM, but it is split into 224/32KB
for code and data, as each partition is optimized for
the access pattern. There the DTS only specifies 32KB as
data ram. The tinycrypt_hmac_prng test requires 40KB for
ztest stack. This obviously won't fit so exclude the boards
based on MEC1501 from the test.

Fixes #27572

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-08-20 14:56:10 -04:00
Henrik Brix Andersen 96a39f00c2 west: runners: jlink: add support for -nogui 1 command line parameter
Add support for the J-Link Commander "-NoGui 1" command line parameter
in the West J-Link runner.

This command line parameter suppresses GUI dialogs (except for license
dialogs) in J-Link Commander starting from v6.80.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-08-20 13:04:37 -05:00
Andrew Boie 72792a5e63 userspace: cleanup mem domain assertions
The memory domain APIs document that overlapping regions are
not allowed, check for this unconditionally.

Cleanup assertion error messages. Use __ASSERT_NO_MSG for
blindingly obvious NULL checks.

We now have a `check_add_partition()` function to perform
all the necessary sanity checks on adding a partition to a
domain. This returns true or false, which will help later
when we implement #24609

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-20 13:58:54 -04:00
Andrew Boie 6f32dd7110 x86: add missing memory domain checks
These macros are used to validate that regions aren't
programmed that allow both writes and execution.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-20 13:58:54 -04:00
Andrew Boie 86ad13d960 userspace: clarify some mem domain doxyen
Make a few miscellaneous comments clearer.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-20 13:58:54 -04:00
Andrew Boie bc35b0b780 userspace: add optional member to memory domains
Some systems may need to associate arch-specific data to
a memory domain. Add a Kconfig and `arch` field for this,
and a new arch API to initialize it.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-20 13:58:54 -04:00
Andrew Boie f8d743a1cb userspace: fix ifdef for k_mem_partition
Wrap the entire definition around CONFIG_MEMORY_PROTECTION.
Add incomplete declaration for IS_ENABLED() purposes.

Some arch code uses struct k_mem_partition internally for
MPU management, even if userspace isn't enabled.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-20 13:58:54 -04:00
Andrew Boie ca1921aaa3 userspace: fix ifdef for k_mem_domain
ifdef the entire struct k_mem_domain around CONFIG_USERSPACE,
this is specifically and only a userspace feature.

Add an incomplete definition for purposes of allowing the APIs
to be used with IS_ENABLED().

Prevents accidental useless instatiation of k_mem_domain structs.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-20 13:58:54 -04:00
Andrew Boie 75d5c0bc4b userspace: move mem domain defines
This now has its own header instead of kernel.h. The code is
unchanged other than a forward declaration of k_tid_t.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-20 13:58:54 -04:00
Meng xianglin 2660878f14 test: power: Test cases for power subsystem
Add test cases for power managment transactions when system enter
idle thread.

Signed-off-by: Meng xianglin <xianglinx.meng@intel.com>
2020-08-20 09:20:14 -04:00
Andrew Boie 44ed730724 x86: static scope for exception handlers
These just need `__used` to avoid compiler warnings.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-20 10:19:41 +02:00
Maureen Helm 654a49a9f8 soc: nxp_imx: Set entry to _vector_start in boot header
Commit e80e655b01 introduced linker script
enforcement of Cortex-M vector table alignment. Update the i.MX RT boot
header to account for the possibility that the vector table may not be
placed at the address CONFIG_FLASH_BASE_ADDRESS +
CONFIG_ROM_START_OFFSET anymore.

For example, the RT1060 vector table has 176 entries and therefore must
be aligned to 0x400 bytes. If CONFIG_FLASH_BASE_ADDRESS=0x60000000 and
CONFIG_ROM_START_OFFSET=0x2200, the linker script will place the vector
table at 0x60002400 instead of 0x60002200.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-08-20 09:20:38 +02:00
Kamil Kasperczyk b07c2f8463 logging: Fix holding coherence of log levels in Spinel backend.
LOG_BACKEND_SPINEL_LEVEL turned out to be useless and was removed.
Also changes to keep coherence between Zephyr log level and OT log
level added by otPlatLog() were introduced.

Signed-off-by: Kamil Kasperczyk <kamil.kasperczyk@nordicsemi.no>
2020-08-20 09:19:12 +02:00
Simon Glass c5d85e175f subsys/testsuite: Add an assert for a zero return code
Many functions signal success by returning a return code of zero. Add
an assertion for this.

Some functions can return a positive value to indicate success, where
they want to convey some information. This is not handled by this
assert function.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-08-19 19:20:35 -04:00
Peter Bigot bf04c61f6e tests: gpio_basic_api: disconnect output in initial setup
One driver (mchp_xec) appears to have problems with setting the output
value before setting the direction, which can be caught if the order
of checks in the port setup function are reversed.  Reconfigure the
output to a non-output state before the second test to see if that
catches the problem.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-08-19 19:18:43 -04:00
Martí Bolívar 2ed2d3bfa9 scripts: runners: add --no-erase support
If a runner supports the --erase option, make it so that the user can
add --no-erase to the command line to explicitly disable it.

Add a diagnostic at info() level whenever this option is requested.

The intent of this commit is to make it more obvious when a mass erase
was requested, especially in situations (like MCUboot with
CONFIG_MCUBOOT_TRY_MASS_ERASE=y) where this option may be turned on by
default.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-08-19 16:38:26 -05:00
Gerard Marull-Paretas 82e58a0707 boards: arm: adafruit_feather_nrf52840: add support for QSPI flash
Add DT entry for the embedded QSPI NOR flash (GD25Q16) in the Adafruit
nRF52840 feather. Also added support for the spi_flash sample, which has
been used to verify the device.

NOTE: Device seems to fail when using high clock frequencies (e.g.
maximum QSPI frequency). It may be due to PCB layout issues.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-08-19 15:43:57 -05:00
Gerard Marull-Paretas 48585cb745 boards: arm: adafruit_feather_nrf52840: add missing SPI compatible
DT compatible was missing from Adafruit nRF52840 feather board thus
preventing samples depending on SPI to build correctly.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-08-19 15:43:57 -05:00