Commit graph

42554 commits

Author SHA1 Message Date
Andrzej Głąbek
c79620b722 drivers/flash/spi_flash_at45: Fix compilation errors
For some reason, use of the DT_NUM_INST macro in this driver was not
replaced with DT_NUM_INST_STATUS_OKAY. In consequence, this driver
could not be compiled successfully. Furthermore, because this now
undefined macro had been used inside UTIL_LISTIFY, gcc was not even
able to report an error, instead the compilation just "froze".
This patch replaces UTIL_LISTIFY(DT_NUM_INST()) with more appropriate
in this context DT_INST_FOREACH_STATUS_OKAY. It also adds an apparently
missing inclusion of sys/byteorder.h.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-06-25 19:33:41 +02:00
Anas Nashif
f42cddf083 boards: qemu_cortex_a53: do not run on net/bt tests
Those are covered by other qemu variants..

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-06-25 11:05:29 -04:00
Anas Nashif
3791ec1491 tests: jwt: increase timeout for test
Some platforms need some more time here.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-06-25 11:05:29 -04:00
Wentong Wu
6fae53c044 sanitycheck: handle timeouts correctly with qemu
In some cases we were not handling return code correctly and evaluating
timeouts as a pass. Report failure correctly.

Fixes #26065

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2020-06-25 11:05:29 -04:00
Peter Bigot
1105aa521c west: update to fix littlefs report configuration problem
Reference an updated head that removes references to reporting
infrastructure when reporting is disabled.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-06-25 15:09:28 +02:00
Joakim Andersson
f7f164468b templates: Encourage attaching log files over screenshots
Rewrite console log section to encourage bug-reporters to obtain the
console output in text-format over screenshots, as well as hinting
about other debug information that can be attached.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-06-25 08:53:42 -04:00
Marcin Niestroj
398f22b34a tests: eventfd: drop POSIX_API ifdeffery
Test is configured with CONFIG_POSIX_API=y, so there is no reason to
check for it being enabled in C. Additionally when CONFIG_POSIX_API=n a
much "bigger" posix/sys/socket.h was included instead of net/socket.h,
which should be rather opposite.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-06-25 12:14:40 +02:00
Martí Bolívar
bd491fbb97 runners: promote --erase to common option
Move the --erase option to core.py from nrfjprog.py and jlink.py,
where it is currently supported.

Using the RunnerCaps option enforcement mechanism introduced earlier,
enforce that it will only be given to runners that support it.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-06-25 12:14:25 +02:00
Martí Bolívar
f8e8e9229d runners: enforce RunnerCaps via create() indirection
Require all implementations to provide a do_create(), a new
ZephyrBinaryRunner abstract class method, and make create() itself
concrete.

This allows us to enforce common conventions related to individual
runner capabilities as each runner provides to the core via
RunnerCaps.

For now, just enforce that:

- common options related to capabilities are always added, so runners
  can't reuse them for different ends

- common options provided for runners which don't support them emit
  sensible error messages that should be easy to diagnose and support

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-06-25 12:14:25 +02:00
Martí Bolívar
7b93bd54d4 scripts: runners: clean up super() calls
We can just call super() instead of super(MyClassName, self). The
original extra verbosity is likely due to old habits of mine from
Python 2 which are no longer necessary, but got copy/pasted around.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-06-25 12:14:25 +02:00
Dominik Ermel
4c122dd42a subsys/fs/fatfs: Fix missing memory free on error
fatfs_open and fatfs_opendir fail to free reserved memory on error
which may lead to memory exhaustion, when too many file/dir open errors
are caused, and will cause all subsequent open attempts to fail with
ENOMEM error.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-06-25 12:13:51 +02:00
Joakim Andersson
0b1af81daa Bluetooth: controller: Fix non-privacy directed advertiser
Fix issue with directed advertiser not accepting connection request
from non-privacy enabled peer that has given us a non-zero IRK.
When device privacy is enabled then ull_filter_lll_rl_addr_allowed will
return true, and update the rl_idx to entry in the resolving list.
When the directed advertiser is not privacy enabled then lll->rl_idx is
set to FILTER_IDX_NONE and will not use RPA for the target address.
The check rl_idx != lll->rl_idx will then fail (0 != 0xff) and the
connect request is denied, even though all addresses matches on-air.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-06-25 12:11:02 +02:00
Carles Cufi
363d3e53bc manifest: hal_stm32: Replace pull reference with SHA
This was merged with the pull reference by mistake.

Fixes #26424.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-06-25 12:10:33 +02:00
Anas Nashif
3f8bdf16f9 shell: kernel: select dependencies
The kernel shell module is useless without those options being enabled.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-06-24 21:37:12 -04:00
Anas Nashif
be0dff6844 test: remove TEST_SHELL
No need for this now, all shells are enabled if CONFIG_SHELL is set.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-06-24 21:37:12 -04:00
Anas Nashif
de57d60732 pcie: shell: add subcommands
pcie has an all in one command for listing pci devices. Make it support
additional commands and move lspcie to `pcie ls`.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-06-24 21:37:12 -04:00
Anas Nashif
ee985d81aa shell: enable modules by default if shell is enabled
If shell is enabled then enable all sub-shells if their dependencies are
satisfied. This was done for some modules and subsystems but was not
consistent.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-06-24 21:37:12 -04:00
Anas Nashif
7c85f4b2f5 samples: remove board_shell
This sample is not working on all boards anymore. Adding every single
shell we have to the prj.conf does not work on every board, due to
missing features.

Instead, we now change how shell modules are enabled and make it
possible to enable shell command and modules for any application when
CONFIG_SHELL is enabled.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-06-24 21:37:12 -04:00
Ioannis Glaropoulos
cd8f46b998 boards: arm: qemu_cortex_m0: remove ENTROPY_NRF_FORCE_ALT default set
No need to specify a default configuration for
ENTROPY_NRF_FORCE_ALT Kconfig symbol in the
qemu_cortex_m0 board definition.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-06-24 18:04:17 -07:00
Ioannis Glaropoulos
422ba1f11b tests: kernel: timer_api: add timer label for this test
Add timer label for this test suite, so it is included
in sanity check runs with -t timer.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-06-24 18:04:17 -07:00
Ioannis Glaropoulos
6209610820 tests: kernel: timer_api: enabling test-suite for Qemu Cortex-M0
After the Qemu Cortex-M0 timer driver rework, we may
enable the test-suite that had been (always) excluded
from running on this platform.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-06-24 18:04:17 -07:00
Ioannis Glaropoulos
cfda90d32f tests: kernel: tickless: re-enabled test-suite for Qemu Cortex-M0
After the Qemu Cortex-M0 timer driver rework, we may
re-enable the test-suite that had been excluded for this
platform.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-06-24 18:04:17 -07:00
Ioannis Glaropoulos
6a3d460916 tests: kernel: common: re-enabled test-cases for Qemu Cortex-M0
After the Qemu Cortex-M0 timer driver rework, we may
re-enable the test-cases that had been skipped for this
platform.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-06-24 18:04:17 -07:00
Ioannis Glaropoulos
21ae8c177b boards: arm: qemu_cortex_m0: rework timer driver
We rework the timer driver for Cortex-M0 QEMU Board.
The driver is adapted to follow the (recent) nRF RTC
driver logic, and adaptations are made simply because
the driver is based on the TIMER peripheral instead of
the RTC.

A couple of tweaks are added due to QEMU issues with the
simulation of the TIMER peripheral.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-06-24 18:04:17 -07:00
Andrew Boie
eec6b2673d tests: benchmarks: sched: remove icount notes
icount is on by default for all QEMU targets where it works
properly.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-06-24 20:28:36 -04:00
Andrew Boie
a9670ab5cf boards: centralize QEMU icount management
Instead of endlessly repeating the same command line args,
centralize this and tune the shift value on a per-board
basis.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-06-24 20:28:36 -04:00
Andrew Boie
45979dafb4 linker: add iterable section macros
For iterable areas defined with Z_STRUCT_SECTION_ITERABLE(),
the corresponding output section in the linker script is just
boilerplate. Add macros to make these definitions simpler.

Unfortunately, we have a fair number of iterable sections not
defined with Z_STRUCT_SECTION_ITERABLE(), this patch does not
address this.

The output sections are all named <struct name>_area, update
sanitylib.py with this.

sys_sem with no userspace, and k_lifo/k_fifo are special cases
where different data types that are all equivalent need to be
put in the same iterable area. Add
Z_STRUCT_SECTION_ITERABLE_ALTERNATE() for this special case.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-06-24 17:09:22 -04:00
Andy Ross
973487fdad lib/os: Rework/shrink printk conversions, add 64 bit support
Add support for 64 bit conversions in a uniformly expressable way by
printing values backwards into a buffer on the stack first.  This
allows all operations to work on the low bits of the value and so the
code doesn't need to care (beyond the size of that buffer) about the
word size.  This trick also doesn't care about the specifics of the
base value, so in the process this unifies the decimal and hex printk
conversion code to a single function.

This comes at a mild cost in CPU cycles to the decimal converter and
somewhat higher cost to hex (because it's now doing a full div/mod
operation instead of shifting and masking).  And stack usage has grown
by a few words to hold the temporary.  But the benefits in code size
are substantial (e.g. ~250 bytes of .text on arm32).

Note that this also contains a change to tests/kernel/common to
address what appears to have been a bug in the original converters.
The printk test uses a format string that looks like "%-4x%-2p" and
feeds it the literal arguments "0xABCDEF" and "(char *)42".
Now... clearly both those results are going to overflow the 4 and
2-byte field sizes, so there shouldn't be any whitespace between these
fields.  But the test was written to expect two spaces, inexplicably
(yes, I checked: POSIX-compatible printf implementations don't have
those spaces either).

The new code is definitely doing the right thing, so fix the test
instead.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-06-24 13:43:40 -07:00
Jukka Rissanen
da2db1ce53 drivers: eth: native_posix: Print errno when interface creation fails
Printing the file descriptor does not give any information when
the network interface creation fails, so print errno here instead.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-06-24 23:34:27 +03:00
Jukka Rissanen
6ecea4b3dd net: conn: Handle multi interface AF_PACKET recv() properly
If we have multiple network interfaces and we are waiting incoming
network packets, make sure to honor the bind of the socket so that
correct socket will receive data in certain network interface.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-06-24 23:34:27 +03:00
Jukka Rissanen
4363c566ed doc: kernel: Add sys_sem APIs to kernel documentation
The kernel documentation was missing sys_sem APIs.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-06-24 15:38:47 -04:00
ad7ea0d498 drivers: usb: fix usb_dc_ep_mps() for the SAM0 for IN endpoints
The driver was returning zero due to accessing the, say, 0x81'th
endpoint instead of the 0x01'th endpoint.

Signed-off-by: Michael Hope <mlhx@google.com>
2020-06-24 21:00:59 +02:00
Francois Ramu
1228a525c1 boards: arm: stm32f3 disco board enables the iwdg
This patch enables the Independent watchdog (iwdg)
so that the testcase tests/drivers/watchdog/wdt_basic_api
can run on this stm32f3_disco board

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-06-24 21:00:23 +02:00
Ningx Zhao
d7d2cd5086 tests: queue modifying and adding test case
1.Add a new testcase to verify multiple queues can be defined
2.Add some code comments to describe function performance.

Signed-off-by: Ningx Zhao <ningx.zhao@intel.com>
2020-06-24 20:59:52 +02:00
Nicolas Pitre
8a6b02b5bf lib/os/heap: some code simplification in sys_heap_aligned_alloc()
It is clearer to apply the alignment in the memory address space
rather than the chunk space.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2020-06-24 11:53:50 -07:00
David Leach
5385d49029 doc: release: Document release quality metrics
Document the bug count metrics used to gate the release process

Signed-off-by: David Leach <david.leach@nxp.com>
2020-06-24 09:47:34 -04:00
Peter Bigot
5ea2eaa765 samples: usb: mass: do application configuration before usb starts
USB access to the flash device is not synchronized with the
application, so if the application needs to create a new file system
USB may read configuration state that is incorrect.  Wait until the
the application is done with the flash before starting USB.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-06-24 09:46:56 -04:00
Martí Bolívar
e2b72a0ede doc: clarify how to set $FOO_ROOT in CMakeLists.txt
I received feedback that setting e.g. BOARD_ROOT in CMakeLists.txt is
not quite well specified; in particular, it's important to do so
before pulling in the boilerplate via find_package(). Clear that up.

Reported-by: Pete Skeggs <peter.skeggs@nordicsemi.no>
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-06-24 09:44:48 -04:00
Alberto Escolar Piedras
de168b9bc2 native_posix: timer: Ignore nanosleep return
Explicitly ignore the nanosleep() return value.
nanosleep() is called to slow down native_posix in real time
mode.
There is no real reason to handle this call returning too early:
The call may return earlier if a signal was sent to the process
(e.g. the user pressed Ctrl+C), or in case of errors.
In case of SIGKILL, SIGTERM, what we do is what we should do
(not wait, but terminate the program as requested by the user ASAP)
In case of another signal, we will wait the appropriate
amount of time in the next systick (so we won't accumulate any
error over time)
So there is no real need to add extra code here to handle
those cases.

Solves coverity CID 211046

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2020-06-24 08:57:10 -04:00
Daniel Leung
11afec76d1 boards: qemu_x86_64: enable icount for CONFIG_MP_NUM_CPUS=1
QEMU icount does not work correctly when more than 1 CPU is used,
but works fine with only 1 CPU enabled. So we can enable icount
on qemu_x86_64 when CONFIG_MP_NUM_CPUS=1. Sanitycheck goes from
~158 seconds to ~113 seconds on my dev machine.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-06-24 08:52:49 -04:00
Daniel Leung
2959ed35c1 west: runners/misc-flasher: fix passing extra args to script
The argparse module, by default, complains about non-defined
arguments. This prevents passing arguments prefixed with '-'
or '--' to the target script (e.g. calling another Python
script using argparse). This changes the misc-flasher script
so that any arguments not recognized by west will be passed
to the target script.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-06-24 08:51:53 -04:00
Jian Kang
979e124e21 tests: lib: Add some new test cases for libc
Add some new test cases to verify lib API which not be test
in existing test cases

Signed-off-by: Jian Kang <jianx.kang@intel.com>
2020-06-23 22:42:25 -04:00
Tomasz Bursztyka
871c7105f6 device: Fix structure documentation
Switching to proper documentation format for structures.

Fixes #26284

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-06-23 18:57:23 -04:00
Ningx Zhao
2c92af5a80 tests: dlist to add a testcase and add some tags
Add a testcase to verify some operations running
in constant time.
Add new informative Doxygen tags

Signed-off-by: Ningx Zhao <ningx.zhao@intel.com>
2020-06-23 18:55:47 -04:00
Enjia Mai
ce31b89e50 tests: adding test cases of spinlock
Add test case for testing achieve mutual exclusion using interrupt
masking, and initialize at runtime.

Signed-off-by: Enjia Mai <enjiax.mai@intel.com>
2020-06-23 16:14:55 -04:00
Trond Einar Snekvik
5ea787c794 Bluetooth: Mesh: Keep PB-GATT callback through disconnect
Removes the memset of the prov_bearer_cb in PB-GATT during resets. This
allows the provisioning link to disconnect and reconnect again without
having to call pb_gatt_open.

Fixes #26343.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-06-23 19:22:58 +02:00
Venkataramana Kotakonda
69aa4eeee6 driver: espi: Enable espi uart port sirq based on uart mapping.
Espi has three uart port from 0 to 2 and uart sirq need to enabled for
the port which is active in the hardware. An active uart sirq shoudl be
enabled based on uart mapping configuration.

Signed-off-by: Venkataramana Kotakonda <venkataramana.kotakonda@intel.com>
2020-06-23 19:22:46 +02:00
Gerson Fernando Budke
3add3d7b60 lib: updatehub: Add download block check
The current CoAP implementation not perform any checks including
duplicated packets. This add block sequency verification and a
timer to ensures that slow networks works apropriately.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2020-06-23 19:22:31 +02:00
Gerson Fernando Budke
092b962350 lib: updatehub: Kconfig: Add coap block size option
Allow select max CoAP block size for exchange data using coap protocol.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2020-06-23 19:22:31 +02:00
Gerson Fernando Budke
6c4c12d531 lib: updatehub: Kconfig: Add coap max retry option
The current implementation uses a fixed value for max retries. That
value could be good for an wired network like Ethernet. However,
wireless network can suffer with higher packet collision, low reception
signal etc. This refacts the variable to be defined at Kconfig. This
way max retries can be adjust conform the current media.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2020-06-23 19:22:31 +02:00