Commit graph

101 commits

Author SHA1 Message Date
Kumar Gala a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00
Marc Herbert 2cd51a33ce samples: make find_package(Zephyr...) REQUIRED
This provides a better error message when building with CMake and
forgetting ZEPHYR_BASE or not registering Zephyr in the CMake package
registry. See parent commit for more details (split from parent for
better readability).

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-05-29 10:47:25 +02:00
Martí Bolívar 8970e13f63 samples: lwm2m_client: cleanups
Make this code access the common led0 sample alias in the usual way.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-13 19:51:01 +02:00
Kumar Gala 4e93b77552 samples: Convert DT_ALIAS_* to new DT_ALIAS() macro
Convert DT_ALIAS_* defines to use DT_ALIAS() plus other macros from
include/devicetree.h.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-04 15:28:20 -05:00
Kumar Gala 188cf2331b samples: lwm2m_client: Rework to not define generated macros
Rather than redefining a macro which might be generated we should create
a new define name that should get used in the code.  Replace redefining
DT_ALIAS_LED0_GPIOS_* and just use the LED_GPIO_* defines that already
exist.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-04 15:28:20 -05:00
Carles Cufi 6656214af2 boards: nrf52_pca10040: Rename to nrf52dk_nrf52832
The board name for the nRF52 DK, so far known as nrf52_pca10040, is
renamed to nrf52dk_nrf52832.  Its documentation and all references
to its name in the tree are updated accordingly. Overlay and
configuration files specific to this board are also renamed, to
match the new board name.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-04-06 13:09:07 +02:00
Kumar Gala 3d2eb34e8e samples: lwm2m_client: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-30 16:40:01 -05:00
Torsten Rasmussen 407b49b35c cmake: use find_package to locate Zephyr
Using find_package to locate Zephyr.

Old behavior was to use $ENV{ZEPHYR_BASE} for inclusion of boiler plate
code.

Whenever an automatic run of CMake happend by the build system / IDE
then it was required that ZEPHYR_BASE was defined.
Using ZEPHYR_BASE only to locate the Zephyr package allows CMake to
cache the base variable and thus allowing subsequent invocation even
if ZEPHYR_BASE is not set in the environment.

It also removes the risk of strange build results if a user switchs
between different Zephyr based project folders and forgetting to reset
ZEPHYR_BASE before running ninja / make.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-03-27 16:23:46 +01:00
Andrzej Głąbek 4253eae005 boards: nrf52840_pca10056: Rename board to nrf52840dk_nrf52840
The nRF52840 DK board target, so far known as nrf52840_pca10056,
is renamed to nrf52840dk_nrf52840.
Its documentation and all references to its name in the tree are
updated accordingly. Overlay and configuration files specific to
this board are also renamed, to match the new board name.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-03-27 09:14:08 +01:00
Robert Lubos 2e80185b59 samples: lwm2m_client: Add support for queue mode
Add support for the queue mode in the lwm2m_client sample.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-03-10 14:57:29 +02:00
Carles Cufi af21f80d33 samples: net: lwm2m_client: Convert to new GPIO API
Convert the sample to use the new API and its features.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot 81ca8888db treewide: use full path to hwinfo.h header
The build infrastructure should not be adding the drivers subdirectory
to the include path.  Fix the legacy uses that depended on that
addition.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-01-26 17:52:12 +01:00
Michael Scott 7492555f88 samples: net: lwm2m: bootstrap support changes:
When LWM2M_RD_CLIENT_SUPPORT_BOOTSTRAP is enabled:
- Mark the first server as a bootstrap server
- Create second server and security instances (used by bootstrap
  server)

This allows bootstrap support to be tested out of the box with
the following:
- setup Leshan bss-server-demo (bootstrap server) on port 5783
- setup Leshan server-demo (lwm2m server) on port 5683
- add an entry into the bootstrap server:
  LWM2M Server=coap://[2001:db8::2]:5683
- build the sample like so:
  west build -t run -b qemu_x86 \
    -s zephyr/samples/net/lwm2m_client/ -- \
    -DCONFIG_LWM2M_RD_CLIENT_SUPPORT_BOOTSTRAP=y \
    -DCONFIG_LWM2M_PEER_PORT=5783

Signed-off-by: Michael Scott <mike@foundries.io>
2019-08-24 11:04:25 +02:00
Michael Scott efa1679806 samples: net: lwm2m_client: support for compiling in new objects
Let's add support for recently added LwM2M objects:
- Connectitiy Monitoring
- Location
- IPSO Accelerometer
- IPSO Buzzer
- IPSO On/Off Switch
- IPSO Push Button

Currently, this is limited to compile enabled and manual creation
of objects via LwM2M server.  Objects will respond to read/write
operations, but not have real HW backing.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-08-02 12:00:35 +03:00
Michael Scott 8817d930a8 net: lwm2m: rework resource instance storage / access methods
LwM2M allows for multiple instance resources such the power source
resources in the device object.  These types of resources have
always been very hard to work with, and frankly were poorly
implemented.

This led to other issues where it was very hard to have
non-sequential resource instances, and each resource of this type
needed special getter / setter methods such as:
lwm2m_device_add_pwrsrc()
lwm2m_device_set_pwrsrc_voltage_mv()

Going forward, as more LwM2M objects are implemented this just
doesn't scale well.

To fix this:
- split the resource instance data out from the resource data.
  This includes the data pointer information and resource
  instance id.
- add resource id and resource instance id to the event callback
  functions so user's can see in more detail what resources and
  resource instances are being handled.
- allow generic functions like lwm2m_engine_get_*() and
  lwm2m_engine_set_*() to access resource instance data.
- adjust object resource initialization  macros to map resource
  instances to resources at the time of object instance
  creation.
- fix up the lwm2m_client as a reflection of all of these changes.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-08-02 12:00:35 +03:00
Michael Scott 3217129f5d samples: net: lwm2m_client: send temp value back to engine
By sending the temp value back to the LwM2M engine, it allows all of
the min/max values to be updated over time.

Fixes an issue where min/max values were not being updated.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-08-02 12:00:35 +03:00
Michael Scott 7ac1cbfe21 samples: net: lwm2m_client: set LWM2M_COAP_BLOCK_SIZE to 512
The native Zephyr LwM2M client enables the JSON formatter which
can use more of the packet buffers than the default 256 with
TLV formatting.  Let's set the default to 512 in order to avoid
cutting off the output of larger READ operations.

In the future, we should establish block transfer buffers to
handler longer READ ops.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-08-02 12:00:35 +03:00
Michael Scott 9534bbd991 net: lwm2m: add missing application type to IPSO Light Control
Per IPSO Light Control definition from the OMA LwM2M registry:
http://www.openmobilealliance.org/tech/profiles/lwm2m/3311.xml

There is an optional "Application Type" string resource (5750) in the
Light Control object.  This was missed in the initial implementation.

NOTE: sample will assign reference if needed.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-08-02 12:00:35 +03:00
Michael Scott a33a6f7754 net: lwm2m: remove data storage for IPSO Timer application type
We are pre-allocating a storage variable for the application type
resource in the IPSO Timer object.  This is an optional resource
which won't always be set by samples.

Let's leave out the pre-allocated variable and let the sample set
this reference if needed (it's optional).

Signed-off-by: Michael Scott <mike@foundries.io>
2019-08-02 12:00:35 +03:00
Michael Scott 13086ccda8 net: lwm2m: dont select MBEDTLS or set MBEDTLS options in subsys
If a sample wants to use the Zephyr implementation of mbedtls, it
enables CONFIG_MBEDTLS and sets any needed Zephyr-specific mbedtls
options.

Currently, the LwM2M subsystem selects MBEDTLS automatically when
LWM2M_DTLS_SUPPORT is enabled.  Let's remove this and let the
LwM2M client sample enable mbedtls and it's options.

This mimics the behavior of several other network-related samples
and removes conflicts when selecting alternate implementations of
MBEDTLS.

Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/17399

Signed-off-by: Michael Scott <mike@foundries.io>
2019-07-09 21:08:47 +03:00
Kumar Gala db167c606d dts: Rename LED._GPIO_* -> DT_ALIAS_LED._GPIOS_*
We use the following commands to rename any
LED._GPIO_{CONTROLLER,PIN,FLAGS} to
DT_ALIAS_LED._GPIOS_{CONTROLLER,PIN,FLAGS}

git grep -l LED._GPIO_CONTROLLER | xargs sed -i 's/LED\(.\)_GPIO_CONTROLLER/DT_ALIAS_LED\1_GPIOS_CONTROLLER/g'
git grep -l LED._GPIO_PIN | xargs sed -i 's/LED\(.\)_GPIO_PIN/DT_ALIAS_LED\1_GPIOS_PIN/g'
git grep -l LED._GPIO_FLAGS | xargs sed -i 's/LED\(.\)_GPIO_FLAGS/DT_ALIAS_LED\1_GPIOS_FLAGS/g'

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-07-02 08:26:37 -04:00
Daniel Egger 08d10e1793 samples: net: lwm2m_client: If hwinfo interface is enabled, use it
Previously we always used the board identifier (via CONFIG_BOARD) as
identifier, however this causes troubles in case of tests with multiple
boards of the same kind on the same server. The device_id addresses that
problem nicely if enabled and supported by the architecture.

Signed-off-by: Daniel Egger <daniel@eggers-club.de>
2019-07-02 11:36:26 +03:00
Anas Nashif 8c1f89fa99 cleanup: include/: move sensor.h to drivers/sensor.h
move sensor.h to drivers/sensor.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 6aa9c3a68f cleanup: include/: move gpio.h to drivers/gpio.h
move gpio.h to drivers/gpio.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Kumar Gala a2693975d7 dts: Convert from DT_<COMPAT>_<INSTANCE>_<PROP> to DT_INST...
Change code from using now deprecated DT_<COMPAT>_<INSTANCE>_<PROP>
defines to using DT_INST_<INSTANCE>_<COMPAT>_<PROP>.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-06-14 08:02:15 -05:00
Daniel Egger 280daa3941 samples: net: lwm2m: use real temperature values instead of dummy
This changes the use of a static and fixed temperature value to using a
read_callback which will either return the previous dummy value or
gather real temperature data from a supported sensor (for now only
FXOS8700 which is available e.g. on a FRDM-K64F).

Signed-off-by: Daniel Egger <daniel@eggers-club.de>
2019-05-28 21:11:05 -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 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
Anas Nashif 3ae52624ff license: cleanup: add SPDX Apache-2.0 license identifier
Update the files which contain no license information with the
'Apache-2.0' SPDX license identifier.  Many source files in the tree are
missing licensing information, which makes it harder for compliance
tools to determine the correct license.

By default all files without license information are under the default
license of Zephyr, which is Apache version 2.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-04-07 08:45:22 -04:00
Anas Nashif da5f185e06 samples: add test identifier
Add unique identifier instead of just 'test' for samples.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-03-29 17:44:11 -04:00
Robert Lubos e39aed53a2 samples: net: Update overlay-bt.conf in various samples
`CONFIG_NET_L2_BT` no longer forces required BT configuration, but
depends on a user to set a valid configuration instead. Hence, we
need to select a proper configuration in the overlay config file.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2019-03-20 11:32:40 -05:00
David B. Kinder 505cc2bb0e doc: use :zephyr_file: where appropriate
A new role :zephyr_file: is available that renders to a link to the file
or folder in GitHub.  Find appropriate references using :file: and
convert to :zephyr_file: to take advantage of its linking capability.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2019-03-09 09:50:27 -05:00
Robert Lubos 756043c2b3 samples: net: lwm2m: Fix system workqueue stack size
System workqueue stack was not large enough to handle DTLS handshake,
which lead to system crash.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2019-02-23 07:42:38 -05:00
Michael Scott a10610eb9f samples: net: lwm2m: add timer object to lwm2m client
Let's provide example usage of the IPSO Timer object in our LwM2M
sample.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-02-12 21:19:49 -05:00
Michael Scott e50ad09325 samples: net: lwm2m: Add decimal value to dummy temp sensor
Now that float handling is fixed, let's display a decimal value
in our dummy temperature sensor.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-02-12 21:19:49 -05:00
Michael Scott 9cd0cfa564 samples: lwm2m: migrate to BSD socket APIs
The LwM2M library has moved from the network application library
APIs to BSD socket APIs.  Let's make the needed changes in the
LwM2M sample to follow those changes.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-01-31 23:02:56 -05:00
Michael Scott 180a365d2f net: lwm2m: support for LwM2M bootstrap
Now that the security data can be loaded into and used from the
security / server objects, we can add support for LwM2M bootstrap.

This is a mode where initially a connection can be made to a server
which can update several LwM2M (including security and server
data) and then trigger a "bootstrap complete".  Once this happens
the client will start it's connection process over but now with
the new information.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-01-31 23:02:56 -05:00
Michael Scott 54c10c04e5 net: lwm2m: use security data for connections
In order to support bootstrap mode, we need to store server data
in the security / server objects.  Once the connection to the
bootstrap server is made, it will clear these objects and add
new server connection data.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-01-31 23:02:56 -05:00
Michael Scott 3bfb7debb3 net: lwm2m: move to flat buffers
As part of the migration from net_app APIs to socket APIs, let's
stop referencing the net_pkt fragments throughout the LwM2M library.

Establish a msg_data flat buffer inside lwm2m_message and use that
instead.

NOTE: As a part of this change we remove the COAP_NET_PKT setting.
The COAP library reverts to COAP_SOCK behavior.

This doesn't mean we use sockets in LwM2M (yet), it only means we
use the socket-compatible COAP library which parses flat buffers
instead of net_pkt fragments.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-01-31 23:02:56 -05:00
Michael Scott d003910460 net: lwm2m: create DTLS config layer for LwM2M
Currently, this will select the needed configs for LwM2M and net_pkt.
During the migration to socket APIs, the net_pkt selections will change
to socket-based selects.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-01-31 23:02:56 -05:00
Michael Scott b0de8b88dd samples: lwm2m_client: enable HW flow control for WNC-M14A2A modem
The WNC-M14A2A modem is supposed to use HW flow control on the UART
connected to the MCU.  In the past, we were able to bypass this
requirement by using only the LTE-M firmware which supported pulling
the CTS line high via "send-ok" gpio.

This does NOT work for the LTE firmware.

Now that MCUX UART driver supports hw-flow-control setting, let's use
it in the modem overlay so that regardless of modem firmware
(LTE vs. LTE-M) the sample will "just work".

Signed-off-by: Michael Scott <mike@foundries.io>
2019-01-30 02:53:12 -06:00
Michael Scott 0ee0773abd net: lwm2m: remove unused CONFIG_NET_CONTEXT_NET_PKT_POOL config
CONFIG_NET_CONTEXT_NET_PKT_POOL is used by Zephyr's TCP stack as
a way of keeping the original packet data when compression and
other l2 specific actions make the data unusable for retries.

LwM2M uses UDP and this option was never used.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-01-30 10:35:54 +02:00
Kumar Gala 3e8fc3c0c1 modem: wncm14a2a: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert wncm14a2a driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-29 14:21:56 -06:00
Anas Nashif 5060ca6a30 cmake: increase minimal required version to 3.13.1
Move to latest cmake version with many bug fixes and enhancements.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-01-03 11:51:29 -05:00
Anas Nashif 3d906dc4c1 net: coap: Move both CoAP implementations into one Kconfig
Two separate folders and Kconfig options causing confusion on
CoAP and CoAP_SOCK implementations. This patch simplifies it.
Current CoAP Kconfig option moved to COAP_NET_PKT.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-11-22 09:08:46 -05:00
Michael Scott b010cd763e samples: net: lwm2m_client: expand sanity testing
Let's expand the sanity build testing for the lwm2m_client by
doing the following:

- Add variant builds for DTLS, bluetooth and modem
- Check various combinations of hardware across each of these
  variant builds: frdm_k64f, nrf52_pca10040, nrf52840_pca10056,
  disco_l475_iot1

Signed-off-by: Michael Scott <mike@foundries.io>
2018-11-17 00:50:15 -05:00
Michael Scott 7f6fcf2198 dts-binding: modem: wnc-14a2a: remove base_label to fix build errors
When the WNC-14A2A modem binding was originally introduced, I thought
the base_label would shorten the define keeping the result short and
easily portable.  Turns out with the latest changes, it has a side
effect of removing the "DT_*" prefix which is breaking the build.

Let's remove "base_label" from the modem binding and adjust all of
the dts_fixups referring to the WNC14A2A defines.

NOTE: This commit moves the left-over WNC14A2A dts_fixup defines from
the nRF52 soc into samples/net/lwm2m_client as the new values.
They will stay there until the modem can be re-configured as a shield.

Signed-off-by: Michael Scott <mike@foundries.io>
2018-11-17 00:50:15 -05:00
Michael Scott d80e6f24d4 samples: net: lwm2m_client: add "ok" and baud rate to k64f overlay
During the modem overlay move from the K64F board directory to the
LwM2M sample code, 2 DTS entries were dropped:
current-speed = <115200>;
status = "ok";

Without these entries the DTS defines for UART2 and CURRENT_SPEED
are missing from the generated_dts_board.h file.

Signed-off-by: Michael Scott <mike@foundries.io>
2018-11-17 00:50:15 -05:00
Kumar Gala edefd7dc7d boards: nrf52840_pca10056: move modem configurtion to overlay
The wncm14a2a modem is an add-on/shield and not part of the
nrf52840_pca10056 board and should be maintained and configured
outside of the board.

This needs to be moved to a shield, see #10965.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-15 16:31:35 -05:00
Kumar Gala 94bf29561e boards: nrf52840_mdk: move modem configurtion to overlay
The wncm14a2a modem is an add-on/shield and not part of the nrf52840_mdk
board and should be maintained and configured outside of the board.

This needs to be moved to a shield, see #10965.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-15 16:31:35 -05:00