mbedOS client example, modified to push X-Nucleo-IKS01A1/2 Environmental Sensor data to mbed Cloud Connector.

Dependencies:   X_NUCLEO_IKS01A1 X_NUCLEO_IKS01A2

The application is derived from the official mbedOS client example (link) and has been tested using a X-NUCLEO-IKS01A2 (default) or a X-NUCLEO-IKS01A1 motion and environmental sensors expansion board connected to a ST NUCLEO-F429ZI platform.
The following steps should be performed to make the application work:

  • Register and login into ARM mbed Connector.
  • Replace the default and empty security.h file with the one associated with your account and provided by the Connector (Security Credentials menu).
  • In order to use X-NUCLEO-IKS01A1 instead of default X-NUCLEO-IKS02A1 comment out the IKS01A2 macro definition in main.cpp file.
  • Choose NUCLEO-F429ZI as a target either from online compiler or from CLI, compile and flash.
  • Connect the board to your ethernet network, open a serial terminal (params 115200N1) and wait that the client is connected to the mbed Connector.
  • Press user button to start acquiring and pushing the environmental (pressure, temperature and humidity) data.

Note: environmental data are expressed using IPSO representation based on OMA LWM2M standard.

Committer:
nikapov
Date:
Wed Apr 26 18:23:56 2017 +0200
Revision:
0:003e60a0deb8
First version.
Original repository: https://github.com/ARMmbed/mbed-os-example-client
Version hash: 629b972f41109fd1b54bb755ea454d736a50069b

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nikapov 0:003e60a0deb8 1 /**
nikapov 0:003e60a0deb8 2 * Minimal configuration for using mbedtls as part of mbed-client
nikapov 0:003e60a0deb8 3 *
nikapov 0:003e60a0deb8 4 * NOTE! This is an optimized, minimal configuration for mbed Client.
nikapov 0:003e60a0deb8 5 * We know it works with mbed Client but if you want to add more
nikapov 0:003e60a0deb8 6 * services/communications to the application yourself - please ensure
nikapov 0:003e60a0deb8 7 * you update this configuration accordingly. The default configuration
nikapov 0:003e60a0deb8 8 * can be found from mbedTLS Github:
nikapov 0:003e60a0deb8 9 *
nikapov 0:003e60a0deb8 10 * https://github.com/ARMmbed/mbedtls/blob/development/include/mbedtls/config.h
nikapov 0:003e60a0deb8 11 *
nikapov 0:003e60a0deb8 12 *
nikapov 0:003e60a0deb8 13 * Copyright (C) 2006-2016, ARM Limited, All Rights Reserved
nikapov 0:003e60a0deb8 14 * SPDX-License-Identifier: Apache-2.0
nikapov 0:003e60a0deb8 15 *
nikapov 0:003e60a0deb8 16 * Licensed under the Apache License, Version 2.0 (the "License"); you may
nikapov 0:003e60a0deb8 17 * not use this file except in compliance with the License.
nikapov 0:003e60a0deb8 18 * You may obtain a copy of the License at
nikapov 0:003e60a0deb8 19 *
nikapov 0:003e60a0deb8 20 * http://www.apache.org/licenses/LICENSE-2.0
nikapov 0:003e60a0deb8 21 *
nikapov 0:003e60a0deb8 22 * Unless required by applicable law or agreed to in writing, software
nikapov 0:003e60a0deb8 23 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
nikapov 0:003e60a0deb8 24 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
nikapov 0:003e60a0deb8 25 * See the License for the specific language governing permissions and
nikapov 0:003e60a0deb8 26 * limitations under the License.
nikapov 0:003e60a0deb8 27 *
nikapov 0:003e60a0deb8 28 * This file is part of mbed TLS (https://tls.mbed.org)
nikapov 0:003e60a0deb8 29 */
nikapov 0:003e60a0deb8 30
nikapov 0:003e60a0deb8 31
nikapov 0:003e60a0deb8 32 #ifndef MBEDTLS_CUSTOM_CONFIG_H
nikapov 0:003e60a0deb8 33 #define MBEDTLS_CUSTOM_CONFIG_H
nikapov 0:003e60a0deb8 34
nikapov 0:003e60a0deb8 35 /* System support */
nikapov 0:003e60a0deb8 36 #define MBEDTLS_HAVE_ASM
nikapov 0:003e60a0deb8 37
nikapov 0:003e60a0deb8 38 /* mbed TLS feature support */
nikapov 0:003e60a0deb8 39 #define MBEDTLS_ECP_DP_SECP256R1_ENABLED
nikapov 0:003e60a0deb8 40 #define MBEDTLS_ECP_NIST_OPTIM
nikapov 0:003e60a0deb8 41 #define MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
nikapov 0:003e60a0deb8 42 #define MBEDTLS_SSL_PROTO_TLS1_2
nikapov 0:003e60a0deb8 43 #define MBEDTLS_SSL_PROTO_DTLS
nikapov 0:003e60a0deb8 44 #define MBEDTLS_SSL_DTLS_ANTI_REPLAY
nikapov 0:003e60a0deb8 45 #define MBEDTLS_SSL_DTLS_HELLO_VERIFY
nikapov 0:003e60a0deb8 46 #define MBEDTLS_SSL_EXPORT_KEYS
nikapov 0:003e60a0deb8 47
nikapov 0:003e60a0deb8 48 /* mbed TLS modules */
nikapov 0:003e60a0deb8 49 #define MBEDTLS_AES_C
nikapov 0:003e60a0deb8 50 #define MBEDTLS_ASN1_PARSE_C
nikapov 0:003e60a0deb8 51 #define MBEDTLS_ASN1_WRITE_C
nikapov 0:003e60a0deb8 52 #define MBEDTLS_BIGNUM_C
nikapov 0:003e60a0deb8 53 #define MBEDTLS_CIPHER_C
nikapov 0:003e60a0deb8 54 #define MBEDTLS_CTR_DRBG_C
nikapov 0:003e60a0deb8 55 #define MBEDTLS_ECP_C
nikapov 0:003e60a0deb8 56 #define MBEDTLS_ENTROPY_C
nikapov 0:003e60a0deb8 57 #define MBEDTLS_MD_C
nikapov 0:003e60a0deb8 58 #define MBEDTLS_OID_C
nikapov 0:003e60a0deb8 59 #define MBEDTLS_PK_C
nikapov 0:003e60a0deb8 60 #define MBEDTLS_PK_PARSE_C
nikapov 0:003e60a0deb8 61 #define MBEDTLS_SHA256_C
nikapov 0:003e60a0deb8 62 #define MBEDTLS_SSL_COOKIE_C
nikapov 0:003e60a0deb8 63 #define MBEDTLS_SSL_CLI_C
nikapov 0:003e60a0deb8 64 #define MBEDTLS_SSL_SRV_C
nikapov 0:003e60a0deb8 65 #define MBEDTLS_SSL_TLS_C
nikapov 0:003e60a0deb8 66
nikapov 0:003e60a0deb8 67 // XXX mbedclient needs these: mbedtls_x509_crt_free, mbedtls_x509_crt_init, mbedtls_x509_crt_parse
nikapov 0:003e60a0deb8 68 #define MBEDTLS_X509_USE_C
nikapov 0:003e60a0deb8 69 #define MBEDTLS_X509_CRT_PARSE_C
nikapov 0:003e60a0deb8 70
nikapov 0:003e60a0deb8 71 // XXX: clean these up!!
nikapov 0:003e60a0deb8 72 #define MBEDTLS_SHA512_C
nikapov 0:003e60a0deb8 73 #define MBEDTLS_ECDH_C
nikapov 0:003e60a0deb8 74 #define MBEDTLS_GCM_C
nikapov 0:003e60a0deb8 75
nikapov 0:003e60a0deb8 76 #define MBEDTLS_ECDH_C
nikapov 0:003e60a0deb8 77 #define MBEDTLS_ECDSA_C
nikapov 0:003e60a0deb8 78 #define MBEDTLS_X509_CRT_PARSE_C
nikapov 0:003e60a0deb8 79
nikapov 0:003e60a0deb8 80 // Remove RSA, save 20KB at total
nikapov 0:003e60a0deb8 81 #undef MBEDTLS_RSA_C
nikapov 0:003e60a0deb8 82 #undef MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED
nikapov 0:003e60a0deb8 83
nikapov 0:003e60a0deb8 84 // Remove error messages, save 10KB of ROM
nikapov 0:003e60a0deb8 85 #undef MBEDTLS_ERROR_C
nikapov 0:003e60a0deb8 86
nikapov 0:003e60a0deb8 87 // Remove selftesting and save 11KB of ROM
nikapov 0:003e60a0deb8 88 #undef MBEDTLS_SELF_TEST
nikapov 0:003e60a0deb8 89
nikapov 0:003e60a0deb8 90 // Reduces ROM size by 30 kB
nikapov 0:003e60a0deb8 91 #undef MBEDTLS_ERROR_STRERROR_DUMMY
nikapov 0:003e60a0deb8 92 #undef MBEDTLS_VERSION_FEATURES
nikapov 0:003e60a0deb8 93 #undef MBEDTLS_DEBUG_C
nikapov 0:003e60a0deb8 94
nikapov 0:003e60a0deb8 95 // needed for parsing the certificates
nikapov 0:003e60a0deb8 96 #define MBEDTLS_PEM_PARSE_C
nikapov 0:003e60a0deb8 97 // dep of the previous
nikapov 0:003e60a0deb8 98 #define MBEDTLS_BASE64_C
nikapov 0:003e60a0deb8 99
nikapov 0:003e60a0deb8 100 // Reduce IO buffer to save RAM, default is 16KB
nikapov 0:003e60a0deb8 101 #define MBEDTLS_SSL_MAX_CONTENT_LEN 2048
nikapov 0:003e60a0deb8 102
nikapov 0:003e60a0deb8 103 // define to save 8KB RAM at the expense of ROM
nikapov 0:003e60a0deb8 104 #undef MBEDTLS_AES_ROM_TABLES
nikapov 0:003e60a0deb8 105
nikapov 0:003e60a0deb8 106 // Save ROM and a few bytes of RAM by specifying our own ciphersuite list
nikapov 0:003e60a0deb8 107 #define MBEDTLS_SSL_CIPHERSUITES MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
nikapov 0:003e60a0deb8 108
nikapov 0:003e60a0deb8 109 #include "mbedtls/check_config.h"
nikapov 0:003e60a0deb8 110
nikapov 0:003e60a0deb8 111 #endif /* MBEDTLS_CUSTOM_CONFIG_H */