Commit graph

41266 commits

Author SHA1 Message Date
Andrew Boie 20962612f6 x86: dump the right page tables
If KPTI is not enabled, the current value of CR3 is the correct
page tables when the exception happened in all cases.

If KPTI is enabled, and the excepting thread was in user mode,
then a page table switch happened and the current value of CR3
is not the page tables when the fault happened. Get it out of the
thread object instead.

Fixes two problems:
- Divergent exception loop if we crash when _current is a dummy
  thread or its page table pointer stored in the thread object is
  NULL or uninitialized
- Printing the wrong CR3 value on exceptions from user mode in
  the register dump

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-05-26 14:37:00 +02:00
chao an 2f15e3901a Bluetooth: Mesh: correct the return type
CC:  mesh/access.c
mesh/access.c: In function 'model_has_dst':
mesh/access.c:483:10:
	warning: returning 'u16_t *' {aka 'short unsigned int *'} from
	a function with return type '_Bool8' {aka 'unsigned char'} makes
	integer from pointer without a cast [-Wint-conversion]
  483 |   return bt_mesh_model_find_group(&mod, dst);
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: chao an <anchao@xiaomi.com>
2020-05-26 14:36:40 +02:00
chao an bb5ce8ae30 Bluetooth: Mesh: fix shadow declare
CC:  mesh/adv.c
mesh/adv.c: In function 'bt_mesh_scan_cb':
mesh/adv.c:247:13: warning: declaration of 'adv_type'
                   shadows a global declaration [-Wshadow]
  247 |        u8_t adv_type, struct net_buf_simple *buf)
      |        ~~~~~^~~~~~~~
mesh/adv.c:58:19: note: shadowed declaration is here
   58 | static const u8_t adv_type[] = {
      |                   ^~~~~~~~

CC:  mesh/prov.c
mesh/prov.c: In function 'bt_mesh_prov_enable':
mesh/prov.c:1203:30: warning: declaration of 'prov'
                     shadows a global declaration [-Wshadow]
 1203 |   const struct bt_mesh_prov *prov = bt_mesh_prov_get();
      |                              ^~~~
mesh/prov.c:129:35: note: shadowed declaration is here
  129 | static const struct bt_mesh_prov *prov;
      |                                   ^~~~

Signed-off-by: chao an <anchao@xiaomi.com>
2020-05-26 14:36:40 +02:00
Andries Kruithof 6a2f50aba2 Bluetooth: controller: split: Update feature exchange to BTCore V5.0
The existing feature exchange procedure does not give the proper
response as specified in the BT core spec 5.0.
The old behaviour is that the feature-response returns the logical and
of the features for both peers.
The behaviour implemented here is that the feature-response returns the
featureset of the peer, except for octet 0 which is the logical and of
the supported features.
Tested by using the bt shell, and having different featuresets
on the 2 peers.

This fixes #25483

Signed-off-by: Andries Kruithof <Andries.Kruithof@nordicsemi.no>
2020-05-26 14:34:39 +02:00
Carles Cufi 855b6c1a5d tests: logging: Add a clean ouput test and clarify output
Add a new test with clean output and warn the user that the version
without clean output will output garbled text.

Fixes #23799

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-05-25 21:41:46 +02:00
Eduardo Montoya dd1a71f0c4 net: config: align Kconfig debug levels with OpenThread ones
OpenThread moved from 4 to 5 debug levels and it was not possible
to configure all of them with Kconfig.

Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
2020-05-25 20:41:42 +02:00
Andrzej Głąbek d000ff38dc drivers: serial: nrfx: Force poll_out when lock attempts are over
When the loop that tries to obtain the lock in poll_out() finishes
because of hitting the max number of trials (what normally should
never happen), force the lock to be taken instead of just giving up
with sending the data. The latter approach that was in use so far
could not deal with a situation when some thread was aborted while
keeping the lock. Other threads would then have no chance to send
anything with poll_out() until it was called from an ISR.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-05-25 18:46:28 +02:00
Wentong Wu 6c9d4a5c57 scripts: use debug function instead of debug_die to dump objs
In step 4 of find_kobjects, use func debug instead of debug_die
to dump debug info to avoid dump wrong info.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2020-05-25 18:07:20 +02:00
Wentong Wu 0bf5113c6b Revert "scripts: add DW_AT_abstract_origin check"
This reverts commit 2593a919ee.

This commit wasn't the root cause of the found bug in dwarf analyze.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2020-05-25 18:07:20 +02:00
Flavio Ceolin c07f71e3fe drivers: peci: Add verification handlers
Add verification handlers for syscalls defined in peci driver.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-05-25 18:06:22 +02:00
Anas Nashif 3e4cd1853e drivers: pwm: fix doxygen docs
When referencing parameters, use @p and not @param.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-25 17:16:56 +02:00
Ioannis Glaropoulos 9d4d415c21 boards: nrf5340pdk: fix list of board DTS 'compatibles'
We only need a 'compatible' entry for the DK,
not the SoC and part-number. This commit fixes
this and aligns the nRF5340 PDK DTS with the
remainder of nRF-based boards.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-05-25 16:57:44 +02:00
Peter Bigot 24c1be3896 samples: nrf: system_off: demonstrate use of device pm to reduce power
Currently system power management does not automatically control
device power, and this example demonstrates high current draw due to
the UART being enabled.  Enable device power management and
demonstrate how to manually turn off greedy devices.

Also remove the 60 s delay that confirms we successfully turned off
the residency policy; that's not directly relevant to the purpose of
the sample.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-05-25 16:25:33 +02:00
Andrzej Głąbek f766a3e18b sensor: temp_nrf5: Allow use only when the TEMP peripheral is present
Correct dependency of the TEMP_NRF5 Kconfig option so that it can be
enabled only on nRF SoCs that feature the TEMP peripheral.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-05-25 16:03:02 +02:00
Maciej Perkowski b2fa99caf8 sanitycheck: Add filtered test cases to the JUnit full report
If a test instance from .yaml file was skipped due to being on
a filtered list then there are no entries about it in the
sanitycheck_report.xml for a given platform. This commit fills
instance.results with skipped test cases also for skipped instances so
those test cases are visible when the full report is generated. Tested
for ./tests/kernel/mem_protect/userspace on nrf52dk_nrf52832 where
userspace.gap_filling is filtered out.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2020-05-25 15:52:17 +02:00
Henrik Brix Andersen 4e4139cf9e canbus: canopen: program: add missing include for FLASH_AREA
Add missing include after the conversion from DT_FLASH_AREA to
FLASH_AREA.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-05-25 13:26:28 +02:00
Oleg Zhurakivskyy 6096efb3da net: tcp2: Implement the retransmission for the outgoing data
In order to support the retransmission for the outgoing data:

1. The outgoing data packet is appended to the send_data queue
   in net_tcp_queue_data().

2. tcp_send_queued_data() is called and will use tcp_send_data()
   to sends queued but unsent data packet by packet
   until there's an unsent data and the receiver's window isn't full.

   tcp_send_queued_data() subscribes send_data_timer
   that will handle retrasmissions with tcp_resend_data().

3. tcp_send_data() peeks a single chunk of data from the send_data
   queue that will not exceed the maximum segment size
   until the the receiver's window is full.

   tcp_send_data() uses conn->seq and conn->unack_len as the sequence
   number for the TCP packet.

   conn->unacked_len is advanced on each send.

4. On data acknowledgment:

   - acknowledged amount of data is removed from the beginning
     of the send_data queue
   - conn->seq is advanced by the acknowledged amount
   - conn->unacked_len is decremented by the acknowledged amount
   - send_data_timer is cancelled
   - tcp_send_queued_data() is called to send queued but
     prevoiusly unsent data

5. On timeout, tcp_resend_data() will reset conn->unack_len,
   peek one packet from the beginning of the send_queue and resend,
   terminating the connection on retries exceeded.

   Meanwhile the outgoing data tcp_send_queued_data() is just
   appended to the send_data but not sent.

   In case of the acknowledgement, tcp_send_queued_data() will
   start sending multiple packets until the receiver's window
   is full.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-05-25 12:42:22 +02:00
Oleg Zhurakivskyy f779678ff4 net: tcp2: Add send_data queue into the TCP connection
In order to support the retransmission for the outgoind data,
add the following into the TCP connection:

- struct net_pkt *send_data (used as a queue)
- send_data_total
- unack_len
- send_data_timer
- send_data_retries

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-05-25 12:42:22 +02:00
Oleg Zhurakivskyy 58b7847afb net: tcp2: Extract the MSS from the TCP option value
Extract the maximum segment size (MSS) from the TCP option value.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-05-25 12:42:22 +02:00
Oleg Zhurakivskyy 9efdbe19dd net: tcp2: Add send_win into the TCP connection
In order to support the send window, add send_win into
the TCP connection.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-05-25 12:42:22 +02:00
Oleg Zhurakivskyy 5b54daea36 net: tcp2: Refactor tcp_out()
In order to support the data retransmission, refactor tcp_out()
into tcp_out_ext() which supports passing the sequence number.

In addition drop modifications of the connection sequence number
from tcp_out_ext(), this is the responsibility of data retransmission.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-05-25 12:42:22 +02:00
Oleg Zhurakivskyy 762b0aeb5a net: tcp2: Update tcp_pkt_alloc() macros
In order to use struct net_pkt for the outgoing data queue,
update tcp_pkt_alloc() macros, so they support allocation
without buffer.

Additionally, merge tcp_pkt_alloc() macros macros into one.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-05-25 12:42:22 +02:00
Oleg Zhurakivskyy aac4261e73 net: tcp2: Handle the packet clone failure
Handle the packet clone failure in tcp_send_process() and
terminate the connection.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-05-25 12:42:22 +02:00
Oleg Zhurakivskyy 13bcfc165a net: tcp2: Handle the packet clone error in tcp_data_get()
Unsuccessfull packet clone in tcp_data_get() isn't handled,
add an error handling and don't ACK the incoming data in this case.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-05-25 12:42:22 +02:00
Oleg Zhurakivskyy d65e654766 net: tcp2: Update the sequence compare on peer resend
In order to handle sequence overflow cases, use
net_tcp_seq_greater() to check if the sequence is greater/lower.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-05-25 12:42:22 +02:00
Oleg Zhurakivskyy 42ef3861d4 net: tcp2: Randomize the initial sequence number
The initial sequence number for a connection should be randomized
to prevent easy guesses.

Do not randomize the sequence number if network test or
test protocol is enabled.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-05-25 12:42:22 +02:00
Oleg Zhurakivskyy 502842297e net: tcp2: Eliminate/remove extra prototypes
To improve readability, eliminate/remove extra prototypes.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-05-25 12:42:22 +02:00
Oleg Zhurakivskyy 593f7c4556 tests: net: tcp2: Avoid trying to free net_pkt twice
For success cases, the net_pkt is handled by the IP stack
so no need to free the net_pkt. The double free is not causing
any issues as the net_pkt code will just ignore the request but
we should avoid doing it because of error prints that are printed.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-05-25 12:42:22 +02:00
Erwan Gouriou 2716cbcaa6 drivers: susbsys: Check errors on devices selected using dt macro
Some Kconfig defined devices may be defined using dt_chosen_label
function. Since there is no way to ensure a device enabled in dts
is also defined in Kconfig, it may happen that instance is not
actually defined.
In this case device_get_binding might return 0, leading to undefined
behavior in the function that calls it.
When not already done, systematically check return of function
device_get_binding on devices defined through dt_chosen_label macro.
Trigger ASSERT when required and return error when possible.

Fixes #20068

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-05-25 11:43:14 +02:00
Peter Bigot 8fbc83c651 tests: timer_api: avoid compounding errors in imprecise conversions
When the timer frequency is not a multiple of 1000 converting between
ticks and milliseconds introduces error.  Avoid propagating the error
by converting divided values rather than dividing converted values.

Also compensate for observed rate differences between the busywait
clock and the timeout clock.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-05-24 20:28:58 +02:00
Peter Bigot a44bc7026e tests: timer_api: compensate for fast clocks
A fast timer clock can advance before or after the remaining time
until an event is captured.  Verify the expected relationship between
current and remaining time holds for at least one captured current
time.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-05-24 20:28:58 +02:00
Peter Bigot 46e402dd6e tests: timer_api: fix for inexact ms/tick conversions
When one millisecond is not an integral number of ticks measuring
durations between tick events will sometimes be less than expected to
correct for error that was accumulated between other events.  Allow
for that in the duration and period comparisons.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-05-24 20:28:58 +02:00
Peter Bigot 6a79436f05 kernel: document that busy-wait clock may differ from timeout clock
Some tests assumed that a delay with k_busy_wait() could be precisely
timed by a tick or cycle count, and vice versa.  This is not true for
all clock configurations on all Zephyr targets, so highlight the
potential variation.

As an example: on some platforms busy-wait is performed by a loop with
known duration in cycles of a known CPU frequency.  The CPU clock may
be unrelated to the clock that drives the system timer.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-05-24 20:28:58 +02:00
Anas Nashif ed44f0575b doc: sanitycheck: fixture documentation
Add documentation about fixtures and how to use them in the hardware
map.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-24 20:25:51 +02:00
Anas Nashif 0c908e124e tests: gpio_basic: this test requires a fixture
This test requires a fixture to be installed, in this case a wire
connecting two GPIO pins.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-24 20:25:51 +02:00
Anas Nashif 3b86f13fab sanitycheck: add fixture support to hardware map
It is now possible to add a list of fixture a platform supports which is
matched to testcases requesting fixtures to be avaiable to be able to
run.

For example:

- available: true
  connected: true
  id: 0240000026334e450015400f5e0e000b4eb1000097969900
  platform: frdm_k64f
  product: DAPLink CMSIS-DAP
  runner: pyocd
  serial: /dev/ttyACM9
  fixtures:
    - gpio_loopback

Fixes #24943

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-24 20:25:51 +02:00
Anas Nashif cefb9a170f sanitycheck: support fixtures
Add fixtures to hardware map schema.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-24 20:25:51 +02:00
Anas Nashif 8067663671 tests: maxim_ds3231_api: use fixture
This test depends on additional hardware being connected to the board,
add a fixture and cleanup whitelist.

Fixes #25177

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-24 20:25:51 +02:00
Anas Nashif ce8c12eb5a sanitycheck: cleanup fixture processing
Cleanup fixture processing and allow ztest testcases to support
harness_config with fixture definition.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-24 20:25:51 +02:00
François Delawarde 24729bb7c6 bluetooth: host: fix wrong bt/cf settings loading
This commits fixes the loading of bt/cf settings into memory. Only data
was loaded and not the address.

Signed-off-by: François Delawarde <fnde@demant.com>
2020-05-23 22:42:25 +02:00
Maureen Helm 1a89ca1238 boards: arm: Conditionalize csi pinmuxes on nxp boards
Conditionalizes csi pinmuxes on CONFIG_VIDEO for all nxp boards
(kinetis, lpc, and imx families) to avoid possible conflicts between
peripherals.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-05-22 14:56:00 +02:00
Maureen Helm de22784ce1 boards: arm: Conditionalize display pinmuxes on nxp boards
Conditionalizes display pinmuxes on CONFIG_DISPLAY for all nxp boards
(kinetis, lpc, and imx families) to avoid possible conflicts between
peripherals.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-05-22 14:56:00 +02:00
Maureen Helm 94900be53c boards: arm: Conditionalize dac pinmuxes on nxp boards
Conditionalizes dac pinmuxes on CONFIG_DAC for all nxp boards (kinetis,
lpc, and imx families) to avoid possible conflicts between peripherals.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-05-22 14:56:00 +02:00
Maureen Helm aa2a7b9dee boards: arm: Conditionalize can pinmuxes on nxp boards
Conditionalizes can pinmuxes on CONFIG_CAN for all nxp boards (kinetis,
lpc, and imx families) to avoid possible conflicts between peripherals.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-05-22 14:56:00 +02:00
Maureen Helm 572f44090b boards: arm: Conditionalize ethernet pinmuxes on nxp boards
Conditionalizes ethernet pinmuxes on CONFIG_NET_L2_ETHERNET for all nxp
boards (kinetis, lpc, and imx families) to avoid possible conflicts
between peripherals.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-05-22 14:56:00 +02:00
Maureen Helm 78eab7f3f2 boards: arm: Conditionalize pwm pinmuxes on nxp boards
Conditionalizes pwm pinmuxes on CONFIG_PWM for all nxp boards (kinetis,
lpc, and imx families) to avoid possible conflicts between peripherals.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-05-22 14:56:00 +02:00
Maureen Helm 54f606eec0 boards: arm: Conditionalize adc pinmuxes on nxp boards
Conditionalizes adc pinmuxes on CONFIG_ADC for all nxp boards (kinetis,
lpc, and imx families) to avoid possible conflicts between peripherals.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-05-22 14:56:00 +02:00
Maureen Helm 5c2d8f3e2a boards: arm: Conditionalize i2c pinmuxes on nxp boards
Conditionalizes i2c pinmuxes on CONFIG_I2C for all nxp boards (kinetis,
lpc, and imx families) to avoid possible conflicts between peripherals.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-05-22 14:56:00 +02:00
Maureen Helm 49debeb636 boards: arm: Conditionalize spi pinmuxes on nxp boards
Conditionalizes spi pinmuxes on CONFIG_SPI for all nxp boards (kinetis,
lpc, and imx families) to avoid possible conflicts between peripherals.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-05-22 14:56:00 +02:00
Maureen Helm ab2d73379a boards: arm: Conditionalize serial pinmuxes on nxp boards
Conditionalizes serial pinmuxes on CONFIG_SERIAL for all nxp boards
(kinetis, lpc, and imx families) to avoid possible conflicts between
peripherals.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-05-22 14:56:00 +02:00