Commit graph

41120 commits

Author SHA1 Message Date
Nicolas Pitre
8c5c5a9452 native_posix: introduce a native_posix_64 board configuration
Because the only difference between native_posix and native_posix_64
should be 32-bit vs 64-bit compilation, the NATIVE_POSIX menu option
is turned into NATIVE_POSIX_32 and the NATIVE_POSIX_64 is added, with
both selecting NATIVE_POSIX. This way nothing changes for the existing
native_posix target, allowing it to share almost everything with the
64-bit version.

Both flavors are made available for CI tests to pick them. This assumes
both 32-bit and 64-bit build environments are available.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-16 10:41:11 -07:00
Nicolas Pitre
1f783d9256 arch/posix: 64-bit build flags
We need to pass -m64 instead of -m32 when CONFIG_64BIT is set.
This is pretty x86 centric. Many platforms don't have the ability
to select between 32-bits or 64-bits builds and either of those should
be dropped in that case with restriction on the available configuration
done elsewhere. But for the time being this allows for testing both.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-16 10:41:11 -07:00
Nicolas Pitre
74db5ce203 native_posix: fix hw_irq_ctrl_get_irq_status() conflicting type
My compiler is rather fussy:

zephyr/boards/posix/native_posix/irq_ctrl.c:133:7:
error: conflicting types for ‘hw_irq_ctrl_get_irq_status’
 u64_t hw_irq_ctrl_get_irq_status(void)
       ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from zephyr/boards/posix/native_posix/irq_ctrl.c:11:
zephyr/boards/posix/native_posix/irq_ctrl.h:29:10:
note: previous declaration of ‘hw_irq_ctrl_get_irq_status’ was here
 uint64_t hw_irq_ctrl_get_irq_status(void);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~

Make the definition match its declaration.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-16 10:41:11 -07:00
Francois Ramu
474c99c9ef drivers: usb/stm32: use dts information to populate clock settings
This patch populates "clocks" property in stm32 usb nodes
for clock related usb configuration code of each  dtsi files

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2019-07-16 09:08:51 -04:00
Nicolas Pitre
8e11970378 realloc(): struct sys_mem_pool_block is word aligned
Since commit 39cd2ebef7 ("malloc: make sure returned memory is
properly aligned") the size of struct sys_mem_pool_block size is
rounded up to the next word boundary.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-16 14:42:37 +02:00
Kumar Gala
fbb21beedd dts/bindings: Remove unused required dts props from st,stm32-can
The st,stm32-can binding specified several required properties that were
never set in actual .dts files and not used by the code.  Remove them at
this time since they aren't being used.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-07-16 08:35:56 -04:00
Kumar Gala
da02634778 dts/bindings: remove stale cell_string
We removed support for cell_string some time ago, so we have some stale
references in a number of bindings that we can remove.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-07-16 08:35:13 -04:00
Ulf Magnusson
d4b33813d8 dts: bindings: Remove dead 'label:' keys on properties
Note that these appear as

  properties: {erase,write}-block-size: label: ...

rather than as

  properties: label: ...

I can't see anything looking at 'label' for individual properties in
bindings, so it's probably dead code. Labels are fetched from the device
tree in extract/flash.py.

Piggyback removal of some 'generation: define's and a redundant pair of
YAML document separators.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-07-16 08:34:54 -04:00
Vinayak Kariappa Chettimada
e0965fa53c Bluetooth: controller: Update Bluetooth version to 5.1
Update the Bluetooth HCI Version to 5.1.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-16 12:53:10 +02:00
Vinayak Kariappa Chettimada
6f2476caa1 Bluetooth: controller: Fix DLE during data transmission
Fix bug in Data Length Update procedure that caused the
connection to drop due to the implementation sending bigger
PDU before the peer has acknowledged the receipt of Length
Response PDU.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-16 12:53:10 +02:00
Vinayak Kariappa Chettimada
35bbf148f2 Bluetooth: controller: Add deferred procedure complete event
Added implementation to defer procedure complete event until
actual on-air connection event instant.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-16 12:53:10 +02:00
Vinayak Kariappa Chettimada
b60fa21f93 Bluetooth: controller: Enable Fast Enc and RSSI features
Enable the Fast Encryption design and connection RSSI
measurement when CONFIG_BT_HCI_RAW is selected.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-16 12:53:10 +02:00
Vinayak Kariappa Chettimada
fa4b4932b9 Bluetooth: controller: Fix post DLE/PHY update event length
Fix the controller implementation to perform connection
event length reservation based on the completed Data Length
Update and/or PHY Update Procedure.

This fix with avoid states/roles from stepping on each
others event length. Connection would have supervision timed
out or have stalled data transmissions due to insufficient
reserved air time.

Relates to #15171.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-16 12:53:10 +02:00
Vinayak Kariappa Chettimada
70a89876d0 Bluetooth: controller: Fix missing data length update event
Fix missing generation of data length update HCI event when
effective tx and rx timings change due to PHY update
procedure.

Fixes BT LL TS 5.1.0 test:
LL/CON/MAS/BV-52-C [Master Receiving Data, LE Coded, CI
Change]

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-16 12:53:10 +02:00
Vinayak Kariappa Chettimada
dbb3c7f702 Bluetooth: controller: Fix packet timing restriction reset
Fixed a bug related to missing reset of packet timing
restriction variable.

Fixes BT LL TS 5.1.0 test:
LL/CON/SLA/BV-55-C [Initiating PHY Update Procedure - Packet
Time Restrictions, LE Coded]

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-16 12:53:10 +02:00
Vinayak Kariappa Chettimada
3f576360ae Bluetooth: controller: Fix PHY update proc symmetric rsp
Fix PHY update procedure to correctly handle master
requesting asymmetrical and slave symmetrical.

Fixes BT LL TS 5.1.0 conformance test:
LL/CON/MAS/BV-117-C [PHY Update Procedure - Master
Requests Asymmetrical, Slave Symmetrical]

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-16 12:53:10 +02:00
Joakim Andersson
e03bdba8a7 Bluetooth: shell: Add support for LE SC OOB authentication in shell
Add support for for LE secure connection using OOB authentication in the
shell.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-07-16 12:44:18 +02:00
Joakim Andersson
f8b7f2ab6a Bluetooth: smp: Add LE SC OOB support for central side
Add support for LE secure connections using OOB authentication for the
central role.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-07-16 12:44:18 +02:00
Joakim Andersson
0ac83180fd Bluetooth: host: Move address string parsing to bluetooth API
Bluetooth address parsing has been duplicated across the different
sub-shell files. Also missing parsing of identity/resolved addresses.
Move parsing of string close to parsing to string for a symmetrical API

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-07-16 12:44:18 +02:00
Joakim Andersson
7a93e948a9 kernel: lib: Add convert functions for hex strings and binary arrays
Move duplicate hex2bin and add bin2hex function so that application can
use the functions and avoid code duplication.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-07-16 12:44:18 +02:00
Andrzej Puzdrowski
743f3dbae0 drivers/flash: add read alignment requirement comment
Added note on read alignment requirement in order to make
a user more conscious of restrictions.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-07-16 12:23:57 +03:00
Kumar Gala
108a4b385e dts: nxp: mimxrt: Add missing jedec-id property to flash nodes
The spi-nor flash nodes require a jedec-id property as per the binding.
We add the jedec-id's as best we can determine based on the data sheets
for the various flash modules on these boards.

However these id's should be validated by actually reading the value to
ensure they are correct.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-07-16 18:15:59 +09:00
Jan Van Winkel
90badd53b3 dts: posix: Added dummy serial current-speed entry
Added dummy current-speed entry for uart0

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-07-16 18:14:06 +09:00
Kumar Gala
f79de4c05e dts/bindings: Remove unused property num-irq-priority-bits
We define "arc,num-irq-priority-bits" and "intel,num-irq-priority-bits"
as required properties in the bindings for the interrupt controllers
however we never specify these properties in any .dts files or use them
in any code.

Remove them as stale properties in the binding files.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-07-16 11:49:17 +03:00
Marc Herbert
2371679528 Revert "toolchain/zephyr: invoke ar with -D for deterministic .a files"
This reverts commit b4078c557d / zephyrproject-rtos/zephyr#17495

This revert is needed for two reasons:

1. As reported by Lawrence King at
   https://lists.zephyrproject.org/g/users/message/1566
this breaks incremental builds with ninja:

  cd sample/hello_world
  west build -b qemu_x86
  touch src/main.c
  west build -b qemu_x86

  hello_world/build/../src/main.c:11: multiple definition of main';
  app/libapp.a(main.c.obj):samples/hello_world/build/../src/main.c:11:
  first defined here
  collect2: error: ld returned 1 exit status

  ar tf build/app/libapp.a
   main.c.obj
   main.c.obj

This does NOT break incremental builds with GNU Make, not sure why not.

2. Less urgently, I finally got someone from the CMake team to help me
and point me at an alternative solution that doesn't rely on CMake
internals: https://gitlab.kitware.com/cmake/cmake/issues/19474
I was about to try it when Lawrence reported the regression above.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-07-16 10:27:37 +02:00
Kumar Gala
1c6952c4f6 dts/extract: Mark DT_FLASH_AREA_*_LABEL defines as deprecated
We don't use the DT_FLASH_AREA_*_LABEL defines today so lets mark them
deprecated until we actually need something.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-07-15 13:40:33 -04:00
Kumar Gala
4d2625cd79 scripts/dts: Add option to generate only deprecated defines
Add a --deprecate-only flag to only generate the deprecated defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-07-15 13:40:07 -04:00
Vinayak Kariappa Chettimada
8401fda961 Bluetooth: controller: split: Fix continuous initiator
Fix the implementation of initiator to use correct anchor
tick and remainder microseconds when sending out CONNECT_REQ
PDU and then to scheduling the first connection event. This
is a fix when initiator is in continuous scan.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-15 16:11:06 +02:00
Joakim Andersson
479edc9b51 Bluetooth: shell: Fix argument count of bt clear shell command
The bt clear command accepts either 'all' or a bluetooth address.
If it is an LE address then type is also needed.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-07-15 15:42:36 +02:00
Vinayak Kariappa Chettimada
803739cd80 Bluetooth: controller: split: Fix incorrect CU under latency
Fix bug in the ported code of the connection update, when
the slave events are skipped due to other overlapping state
or role the connection update at the instant used wrong
latency calculations. This lead to connection disconnection.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-15 15:22:23 +02:00
François Delawarde
88a2fb87ac bluetooth: fix GATT database hash done too many times
Submit GATT database hash as a delayed work to prevent it being run
twice if we register dynamic services.

Signed-off-by: François Delawarde <fnde@oticon.com>
2019-07-15 15:11:27 +02:00
Marc Herbert
c429051380 tests/net/: samples/net/: add a few 'userspace' tags
See commit message 4afcc0f8af for the long story.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-07-15 09:05:10 -04:00
Alberto Escolar Piedras
f16ea52e11 native_posix: Replace system timer driver
The native_posix timer driver was still using the
legacy timer API.
Replace it with a new version, which is aligned with
the new kernel<->system timer driver API,
and which has TICKLESS_CAPABLE support

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-07-15 14:15:16 +02:00
Mieszko Mierunski
914daf4ec7 drivers: nrf: Fix PM for TWI and TWIM in case of multi instance
TWI and TWIM used single static variable for multiple instances.
It would cause problems in case of multiple instances of peripheral.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2019-07-15 12:05:19 +02:00
Mieszko Mierunski
f4b999a389 drivers: nrf: Add power management to nrf SPI driver.
Add power management to nrf SPI driver.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2019-07-15 12:05:19 +02:00
Mieszko Mierunski
23992a0614 drivers: nrf: Add power management to nrf SPIM driver.
Add power management functions to nrf SPIM driver.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2019-07-15 12:05:19 +02:00
Nicolas Pitre
3c0cc08657 prf.c: handle denormals properly
Denormals need to be normalized to be displayed properly.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-14 23:07:44 -04:00
Nicolas Pitre
53169743d2 prf.c: properly format INF/NAN/zero with prefix
The space or plus prefix must appear when requested even with INF and
NAN. And no zero-padding in that case.

Also, 0.0 and -0.0  are distinct values. It is necessary to display
the minus sign with a negative zero.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-14 23:07:44 -04:00
Nicolas Pitre
90ec5360be prf.c: fix wrong results with %g conversion
The precision parameter to the %g conversion indicates the maximum
number of significant digits and not the number of digits to appear
after the radix character. Here's a few examples this patch fixes:

                                expected        before
----------------------------------------------------------
printf("%.3g", 150.12)          150             150.12
printf("%.2g", 150.1)           1.5e+02         150.1
printf("%#.3g", 150.)           150.            150.000
printf("%#.2g", 15e-5)          0.00015         0.00
printf("%#.4g", 1505e-7)        0.0001505       0.0002
printf("%#.4g", 1505e-8)        1.505e-05       1.5050e-05

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-14 23:07:44 -04:00
Nicolas Pitre
132a286c39 prf.c: fix display of float exponent >= 100
The code accounts only for 2 exponent digits even though the exponent
may grow up to 308. Before this change, printf("%g", 1e300) would
produce "1e+N0".

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-14 23:07:44 -04:00
Nicolas Pitre
f286eda6f0 prf.c: remove arbitrary large stack buffer usage
The on-stack work buffer occupies 201 bytes by default. Now that we've
made the code able to cope with virtually unlimited width and precision
values, we can reduce stack usage to its strict minimum i.e. 25 bytes.

This allows for some additional sprintf tests exercizing wide results.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-14 23:07:44 -04:00
Nicolas Pitre
d28434b4fa prf.c: remove buffer limitation on precision and padding for floats
Even if the code used to limit the precision to the on-stack buffer
size, it was still possible to do:

    printf("%f", 1.0e300);

which would overflow the stack and crash the program. Let fix this issue
and remove the precision limitation by recording the number of zeroes to
insert while converting the value and generating those zeroes only
when outputting the data.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-14 23:07:44 -04:00
Nicolas Pitre
7c7f107885 prf.c: remove buffer limitation on field width and padding for integers
Zero-padding of integers took place in the on-stack buffer before
justification. Let's perform that padding on the fly while sending
out data instead.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-14 23:07:44 -04:00
Nicolas Pitre
33312cfd98 prf.c: remove buffer limitation on field width and string copy
The z_prf() function currently allocates a 200-byte buffer on the
stack to copy strings into, and then perform left/right alignment
and padding. Not only this is a pretty large chunk of stack usage,
but this imposes limitations on field width and string length. Also
the string is copied not only once but _thrice_ making this code
less than optimal.

Let's rework the code to get rid of both the field width limit and
string length limit, as well as the two extra memory copy instances.

While at it, let's fixes printf("%08s", "abcd") which used to
produce "0000abcd".

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-14 23:07:44 -04:00
Nicolas Pitre
4ad2a8f990 prf.c: don't be silent with unknown conversion specifiers
Mimic the glibc behavior when encountering an unknown conversion
specifier rather than silently skipping it.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-14 23:07:44 -04:00
Nicolas Pitre
ab59209ea6 prf.c: abstract output method call
This makes for nicer code by avoiding repetitions of the same pattern.
Changes to come will make more use of it.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-14 23:07:44 -04:00
Nicolas Pitre
e1d8c1f8ca prf.c: implement the "hh" length modifier
For completeness.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-14 23:07:44 -04:00
Nicolas Pitre
e9b1cc5f31 prf.c: code and style cleanup
Some cleanups before further changes:

- Remove dead leftover from the "case 's'" code.

- Remove needless parents and casts.

- Remove "register" qualifier as it is ignored. The compiler knows
  better these days.

- Adjust tabs assuming standard 8-columns tab spacing.

- Make multi-line comments start with "/*" on a line of its own.

- Make the format string const to match  prototypes in other files.

- Declare boolean variable and parameters as bool.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-14 23:07:44 -04:00
Henrik Brix Andersen
4a50e1f8b3 tests: board_shell: enable ADC shell
Enable the ADC shell in the board_shell test.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2019-07-14 05:06:38 -07:00
Nicholas Lowell
f9ae2d8e64 Includes: #ifdef CONFIG_USE_SWITCH instead of #if to avoid undef warning
Hitting wundef in kernel_structs.h, switching to match other instances
where #ifdef is used instead of #if

Signed-off-by: Nicholas Lowell <nlowell@lexmark.com>
2019-07-14 04:58:47 -07:00