Commit graph

99049 commits

Author SHA1 Message Date
Jukka Rissanen
6f79b019c4 net: if: Select global IPv4 address if needed
The net_if_ipv4_select_src_addr() should return global address
in the interface if nothing else is being found.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-05-21 15:37:53 +03:00
Tomasz Bursztyka
426764ebcf net/iface: Add a function to get IPv4 global address
As for IPv6, let's create the same function on IPv4 side.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-05-21 15:37:53 +03:00
Tomasz Bursztyka
979aedfab4 net/iface: Modify function to get IPv6 global address
Let's filter out on a state parameter.

There is no impact as this function is not used anywhere yet.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-05-21 15:37:53 +03:00
Jukka Rissanen
60cb25d198 net: ipv4: Send multicast ICMPv4 reply with correct src address
If we receive a multicast ICMPv4 packet, then send the reply back
with correct source address and not with multicast address.

Fixes #16257

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-05-21 15:37:53 +03:00
Ioannis Glaropoulos
9a31f28b80 tests: benchmarks: timing_info: fix start of swap time
In all architectures, except x86, __start_swap_time is directly
updated by function read_timer_start_of_swap(), and it shall not
be registered via __temp_start_swap_time.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-05-21 08:29:25 -04:00
Marc Herbert
75276a7d97 sanitycheck: when present, point at handler.log instead of run.log
When Zephyr crashes immediately QEMU reports an error immediately. This
is immediately reported by "make run". Then sanitycheck points the user
at the output of "make run". However the error message(s) are in QEMU's
output which is in a different .log file.

To address this situation point the error message at handler.log
instead of run.log if and only if handler.log is not empty.

To reproduce here's an artificial but very simple crash:

  sanitycheck --extra-args=CONFIG_TEST_USERSPACE=n \
    -p qemu_x86 -T tests/kernel/mem_protect/stackprot/

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-05-21 08:28:07 -04:00
Greg S. Woods
c0204b929e entropy: fix C++ compiler warnings
Move includes to outside of the extern "C" statements to fix C linkage
issue.
| /include/misc/util.h:53:1: error: template with C linkage
|  template < class T, size_t N >
|  ^~~~~~~~

Signed-off-by: Greg S. Woods <gwoods@lexmark.com>
2019-05-21 08:26:12 -04:00
Johann Fischer
0b2a9b1bdd boards: reel_board: enable pull-up on UART TX pin
Enable pull-up on UART TX pin to reduce power consumption.
If the board is powered by battery the SoC consumes more
power than expected.
The consumption increases because TX pin is floating
(High-Impedance state of pin B from Dual-Supply Bus Transceiver).

Similar to commit b5b728495b
("boards: reel_board: enable pull-up on UART RX pin")

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2019-05-21 08:25:50 -04:00
Alexander Mihajlovic
f19787bb84 posix: Fix calculation of clock base in clock_settime
Previous version calculated rt_clock_base incorrectly by subtracting
clock_gettime from the specified time. Effectively the following
formula was used.

    rt_clock_base := new_time - clock_gettime()

This is clearly incorrect when we consider what should happen if we
call clock_settime with the result of clock_gettime. It ought to be
approximately a no-op, but instead we end up zeroing the clock.

    rt_clock_base := clock_gettime() - clock_gettime() = 0

This patch fixes clock_settime by instead using k_uptime_get to
calculate rt_clock_base, like so:

    rt_clock_base := new_time - k_uptime_get()

Trying the earlier thought experiment we get:

    rt_clock_base := clock_gettime() - k_uptime_get()

Using the definition of clock_gettime this expands to:

    rt_clock_base := (rt_clock_base + k_uptime_get()) - k_uptime_get()

The two k_uptime_get() terms cancel out, leaving:

    rt_clock_base := rt_clock_base

I.e. the no-op that we expect when calling clock_settime with
the result of clock_gettime.

Note: The bug is only observable when rt_clock_base is non-zero.
So when clock_settime is called for the first time, it will appear
to work correctly since rt_clock_base is initialized to 0.

Signed-off-by: Alexander Mihajlovic <alexander.mihajlovic@endian.se>
2019-05-21 08:24:59 -04:00
Marcin Szymczyk
8f0c3b80cf usb: cdc_acm: reset to default after disconnect
Return to default values after USB is reset or disconnected.

Signed-off-by: Marcin Szymczyk <Marcin.Szymczyk@nordicsemi.no>
2019-05-21 08:23:46 -04:00
Marcin Szymczyk
2eb99ea38c usb: cdc_acm: fix typo in CDC_ACM_DEFAULT_BAUDRATE
From CDC_ACM_DEFAUL_BAUDRATE to CDC_ACM_DEFAULT_BAUDRATE.

Signed-off-by: Marcin Szymczyk <Marcin.Szymczyk@nordicsemi.no>
2019-05-21 08:23:46 -04:00
Charles E. Youse
7b8f8ba5c8 drivers/i2c_dw: update CODEOWNERS
Mark myself (reluctant) owner of the Designware I2C driver.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-05-21 08:23:22 -04:00
Charles E. Youse
96961476c1 boards/up_squared: I2C support added (back) in
I2C support has been added back into the up_squared, leveraging the
new PCIe support in the DesignWare I2C driver.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-05-21 08:23:22 -04:00
Charles E. Youse
6b5f05fe20 x86/apollo_lake: add I2C interfaces to devicetree
The Apollo Lake devicetree is augmented with its 8 I2C interfaces.
The default number of dynamic IRQ stubs is increased to deal with
these new interfaces having IRQ vector detection at runtime.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-05-21 08:23:22 -04:00
Charles E. Youse
309dfef511 drivers/i2c/i2c_dw.c: rewrite for PCI(e) support
The legacy PCI support in the DesignWare I2C driver is replaced with
the new PCIe support. The Intel Quark X1000 SoC and the galileo board
configurations are updated accordingly.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-05-21 08:23:22 -04:00
Charles E. Youse
59ebe6a072 drivers/i2c/i2c_dw.c: templatize device configuration boilerplate
The 50-odd lines of boilerplate per I2C port is moved into a template
which is generated by CMake as needed at build-time.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-05-21 08:23:22 -04:00
Charles E. Youse
a8dcb8b623 boards/up_squared: remove SBL-specific board configuration
The SBL configuration no longer differs in any detail (except its name)
from the "standard" UpSquared configuration, so it is removed.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-05-21 08:23:22 -04:00
Charles E. Youse
35d0ae39d8 boards/up_squared: temporarily remove I2C support
This needs to be pushed down to the SoC level, as it's an Apollo Lake
feature, not a feature of the UpSquared. Remove the Apollo Lake
references to the PCI devices because these will not be used when I2C
support is restored.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-05-21 08:23:22 -04:00
Charles E. Youse
f9d7bc2977 boards/up_squared: remove CONFIG_SBL_FIXUP
This option is no longer used in the dts_fixup.h file since there
are no SBL-specific fixups.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-05-21 08:23:22 -04:00
Jukka Rissanen
f521996d71 uart: native_posix: Add support for another serial port
The second serial port (UART_1) can be used for connecting to
host serial port. This is used for example by PPP (Point-to-Point
Protocol) implementation in which case the pppd running in Linux host
connects to a pty that is linked to UART_1 in Zephyr.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-05-21 08:21:31 -04:00
Thomas Stilwell
538e12e5c3 cmake: fix regex for west version check in host-tools.cmake
'west --version' output has the path to the west manifest directory.
If there is a semantic version string in this path name, it will
raise a false version check failure.

Signed-off-by: Thomas Stilwell <Thomas.Stilwell@nordicsemi.no>
2019-05-21 08:19:09 -04:00
Michael Scott
e2b45e6b1d boards: arm: particle_boron: enable SARA-R4 modem
The Particle.io Boron is an nRF52840-based board with a connected
u-blox SARA-R4 modem.  The main board was previously upstreamed
without modem support.

Now that we have a driver to support the SARA-R4 modem, let's enable
it for the Boron board.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-05-21 08:17:20 -04:00
Michael Scott
4c490759c9 boards: shields: introduce SparkFun u-blox SARA-R4 shield
SparkFun offers an Arduino-R3 compatible shield using the SARA-R410M-02B
LTE Cat M1/NB-IoT modem.

Now, that the basic SARA-R4 modem driver is implemented, let's enable
the shield for several MCUs supporting Arduino-R3 compatible headers.

Product Link:
https://www.sparkfun.com/products/14997

Signed-off-by: Michael Scott <mike@foundries.io>
2019-05-21 08:17:20 -04:00
Michael Scott
35590c6d70 boards: arm: frdm_k64f: add pinmux for SARA-R4 modem
Setup the SARA-R4 POWER and RESET pins as gpios.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-05-21 08:17:20 -04:00
Michael Scott
759d1d6408 drivers: modem: introduce u-blox SARA-R4 modem driver
The u-blox SARA-R4 modem modules are Ultra-compact LTE Cat
M1 / NB1 ready:

- Configurable with a single hardware version
- Flexible mode selection as LTE Cat M1, LTE Cat NB1, EGPRS -
  only/preferred
- Low power consumption and longer battery life
- Extended range in buildings, basements, and with NB1,
  underground

This driver introduces support for basic AT commands to
query modem information as well as socket connection
for TCP/UDP communication.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-05-21 08:17:20 -04:00
Michael Scott
769b65ef98 dts: bindings: add modem binding for u-blox SARA-R4
The SARA-R4 series modules from U-Blox are size-optimized LTE-M /
NB-IoT and EGPRS modules designed for low power consumption and
longer battery life.

The binding identifies the UART device, power GPIO and reset GPIO
lines.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-05-21 08:17:20 -04:00
Michael Scott
3fce0f214e samples: lwm2m_client: re-add sanity check for WNC-M14A2A build
Instead of using the now removed overlay files, use the SHIELD=
command-line option for testing the WNC-M14A2A modem.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-05-21 08:17:20 -04:00
Michael Scott
8611837ef5 boards: arm: frdm_k64f: don't use ETH if MODEM is enabled
Let's change the specific WNC-M14A2A check into a more generic
MODEM check for enabling ethernet.  Many of these pins are used
on the Arduino headers.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-05-21 08:17:20 -04:00
Michael Scott
fd69094656 drivers: modem: wncm14a2a: remove HW specific Kconfig settings
The WNC-M14A2A shield configuration has HW specific settings in place.
We can remove those settings here.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-05-21 08:17:20 -04:00
Michael Scott
c0d9e7fcb5 shields: introduce shield-based WNC-M14A2A modem setup
This shield uses a non-standard UART exposed via Arduino-R3
compatible header pins.

It has configurations for FRDM_K64F and nRF52840_PCA10056.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-05-21 08:17:20 -04:00
Michael Scott
421b426281 cmake: add handling for shield config and shield/board overlays
Shields can often be very complex to setup in a generic way for several
boards to support.  Let's allow shields to have their own .conf files
as well as specialized overlays per board (when needed).

Signed-off-by: Michael Scott <mike@foundries.io>
2019-05-21 08:17:20 -04:00
Michael Scott
21e9b0f510 samples: lwm2m_client: cleanup shield overlay files
Let's remove the sample-specific overlay files dealing with the
WNC-M14A2A modem.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-05-21 08:17:20 -04:00
Michael Scott
9ab20bfd85 board: disco_l475_iot1: add Arduino header definition to DTS
Let's expose the Arduino R3-compatible pin definition as DTS
for the disco_l475_iot1 board.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-05-21 08:17:20 -04:00
Michael Scott
8548517b88 boards: nrf52840_pca10056: add Arduino header definition to DTS
Let's expose the Arduino R3-compatible pin definition as DTS
for the nrf542840_pca10056 board.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-05-21 08:17:20 -04:00
Michael Scott
ce1e990c30 boards: arm: frdm_k64f: add Arduino header definition to DTS
Let's expose the Arduino R3-compatible pin definition as DTS
for the frdm_k64f board.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-05-21 08:17:20 -04:00
Michael Scott
cf5b08131d dts/bindings: introduce Arduino-header-R3 GPIO binding
This allows HW with compatible headers to define the related GPIOs

Signed-off-by: Michael Scott <mike@foundries.io>
2019-05-21 08:17:20 -04:00
Michael Scott
11b3b22652 dts-binding: modem: wnc-14a2a: add label binding
The label binding was missed during initial development of the
WNC-M14A2A modem.  Let's add the binding so that during the
migration to a shield, we can update the DTS correctly.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-05-21 08:17:20 -04:00
Michael Scott
bd2d03923e drivers: modem: wncm14a2a: correct pinconfig assert check
Assert is checking the array size of pinconfig.  Not the actual
size of the structure.

Fixes issue reported by Github User @weinholtendian

Signed-off-by: Michael Scott <mike@foundries.io>
2019-05-21 08:17:20 -04:00
Michael Scott
d8f8f0f253 drivers: modem: wncm14a2a: dont free packet on error
Caller will handle freeing packet if error is encountered.

Fixes issue reported by Github User @weinholtendian:
<err> net_pkt: *** ERROR *** pkt 0x20027e78 is freed already
by offload_sendto():1717 (context_sendto():1473).

Signed-off-by: Michael Scott <mike@foundries.io>
2019-05-21 08:17:20 -04:00
Øyvind Rønningstad
fb0faaa123 testsuite: coverage: Port GCOV linker code to Cmake.
From linker.ld and common-rom.ld

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2019-05-20 22:28:28 -04:00
Øyvind Rønningstad
c760ca02eb arch: Put intlist.ld into Cmake
Remove from linker.ld

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2019-05-20 22:28:28 -04:00
Øyvind Rønningstad
1d3b6e7c9c arch: arm: cortex_m: Port some vector_relay linker code to Cmake
Sections before the vector table remain in linker.ld

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2019-05-20 22:28:28 -04:00
Øyvind Rønningstad
e4024e274b arch: port nocache linker code to use Cmake function
Remove from linker.ld

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2019-05-20 22:28:28 -04:00
Øyvind Rønningstad
5bebf2ae5c soc: Port usage of soc-*.ld to use Cmake
Mark the feature as deprecated

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2019-05-20 22:28:28 -04:00
Øyvind Rønningstad
901c0a1cfd linker: Port usage of custom-sections to use Cmake
Mark custom-sections as deprecated

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2019-05-20 22:28:28 -04:00
Øyvind Rønningstad
6d0039444c arch: Port the ramfunc section to the Cmake function
Remove it from linker.ld

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2019-05-20 22:28:28 -04:00
Øyvind Rønningstad
000103906a soc: arm: st_stm32: Port CCM sections to use the Cmake function
Remove them from linker.ld

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2019-05-20 22:28:28 -04:00
Øyvind Rønningstad
f2a1572ac2 cmake: Add function for adding snippets to the linker file
Allows snippets to be placed in different locations:
 - The noinit, rwdata and rodata output sections
 - Two different locations for placing custom output sections,
   one location for RAM and another for all other sections.

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2019-05-20 22:28:28 -04:00
Bradley Bolen
f888f9ab27 arch: arm: Fix checks of CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT
The compiler generates errors of the form
error: "CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT" is not defined,
evaluates to 0 [-Werror=undef]
when -Wundef is used and the config option was turned off.  Change
check to if defined().

Signed-off-by: Bradley Bolen <bbolen@lexmark.com>
2019-05-20 22:27:56 -04:00
Bradley Bolen
5c8faf890d arch: arm: Fix checks of CONFIG_ZERO_LATENCY_IRQS
The compiler generates errors of the form
error: "CONFIG_ZERO_LATENCY_IRQS" is not defined, evaluates to 0
[-Werror=undef]
when -Wundef is used and the config option was turned off.  Change
check to if defined().

Signed-off-by: Bradley Bolen <bbolen@lexmark.com>
2019-05-20 22:27:56 -04:00