2 * Amazon FreeRTOS V201906.00 Major
\r
3 * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
\r
5 * Permission is hereby granted, free of charge, to any person obtaining a copy of
\r
6 * this software and associated documentation files (the "Software"), to deal in
\r
7 * the Software without restriction, including without limitation the rights to
\r
8 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
\r
9 * the Software, and to permit persons to whom the Software is furnished to do so,
\r
10 * subject to the following conditions:
\r
12 * The above copyright notice and this permission notice shall be included in all
\r
13 * copies or substantial portions of the Software.
\r
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
\r
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
\r
17 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
\r
18 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
\r
19 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
\r
20 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\r
22 * http://aws.amazon.com/freertos
\r
23 * http://www.FreeRTOS.org
\r
26 /* This file contains default configuration settings for the demos on FreeRTOS. */
\r
28 #ifndef IOT_CONFIG_COMMON_H_
\r
29 #define IOT_CONFIG_COMMON_H_
\r
31 /* FreeRTOS include. */
\r
32 #include "FreeRTOS.h" //_RB_Makes common config file FreeRTOS specific
\r
34 /* Use platform types on FreeRTOS. */
\r
35 #include "platform/iot_platform_types_freertos.h" //_RB_Makes common config file FreeRTOS specific
\r
37 /* Used to get the cloud broker endpoint for FreeRTOS. */
\r
38 //_RB_#include "aws_clientcredential.h"
\r
41 #define IOT_SDK_VERSION "4.0.0"
\r
43 /* This config file is for the demos; disable any test code. */
\r
44 #define IOT_BUILD_TESTS ( 0 )
\r
46 /* Logging puts function. */
\r
47 #define IotLogging_Puts( str ) configPRINTF( ( "%s\r\n", str ) )
\r
49 /* Enable asserts in libraries by default. */
\r
50 #ifndef IOT_METRICS_ENABLE_ASSERTS
\r
51 #define IOT_METRICS_ENABLE_ASSERTS ( 1 )
\r
53 #ifndef IOT_CONTAINERS_ENABLE_ASSERTS
\r
54 #define IOT_CONTAINERS_ENABLE_ASSERTS ( 1 )
\r
56 #ifndef IOT_TASKPOOL_ENABLE_ASSERTS
\r
57 #define IOT_TASKPOOL_ENABLE_ASSERTS ( 1 )
\r
59 #ifndef IOT_MQTT_ENABLE_ASSERTS
\r
60 #define IOT_MQTT_ENABLE_ASSERTS ( 1 )
\r
62 #ifndef AWS_IOT_SHADOW_ENABLE_ASSERTS
\r
63 #define AWS_IOT_SHADOW_ENABLE_ASSERTS ( 1 )
\r
65 #ifndef AWS_IOT_DEFENDER_ENABLE_ASSERTS
\r
66 #define AWS_IOT_DEFENDER_ENABLE_ASSERTS ( 1 )
\r
68 #ifndef IOT_BLE_ENABLE_ASSERTS
\r
69 #define IOT_BLE_ENABLE_ASSERTS ( 1 )
\r
72 /* Assert functions. */
\r
73 #define IotMetrics_Assert( expression ) configASSERT( expression )
\r
74 #define IotContainers_Assert( expression ) configASSERT( expression )
\r
75 #define IotTaskPool_Assert( expression ) configASSERT( expression )
\r
76 #define IotMqtt_Assert( expression ) configASSERT( expression )
\r
77 #define AwsIotShadow_Assert( expression ) configASSERT( expression )
\r
78 #define AwsIotDefender_Assert( expression ) configASSERT( expression )
\r
79 #define IotBle_Assert( expression ) configASSERT( expression )
\r
81 /* Control the usage of dynamic memory allocation. */
\r
82 #ifndef IOT_STATIC_MEMORY_ONLY
\r
83 #define IOT_STATIC_MEMORY_ONLY ( 0 )
\r
86 /* Memory allocation configuration. Note that these functions will not be affected
\r
87 * by IOT_STATIC_MEMORY_ONLY. */
\r
88 #define IotNetwork_Malloc pvPortMalloc
\r
89 #define IotNetwork_Free vPortFree
\r
90 #define IotThreads_Malloc pvPortMalloc
\r
91 #define IotThreads_Free vPortFree
\r
92 #define IotLogging_Malloc pvPortMalloc
\r
93 #define IotLogging_Free vPortFree
\r
94 #define IotBle_Malloc pvPortMalloc
\r
95 #define IotBle_Free vPortFree
\r
96 /* #define IotLogging_StaticBufferSize */
\r
98 /* Memory allocation function configuration for the MQTT and Defender library.
\r
99 * These libraries will be affected by IOT_STATIC_MEMORY_ONLY. */
\r
100 #if IOT_STATIC_MEMORY_ONLY == 0
\r
101 #define IotMetrics_MallocTcpConnection pvPortMalloc
\r
102 #define IotMetrics_FreeTcpConnection vPortFree
\r
103 #define IotMetrics_MallocIpAddress pvPortMalloc
\r
104 #define IotMetrics_FreeIpAddress vPortFree
\r
106 #define IotTaskPool_MallocTaskPool pvPortMalloc
\r
107 #define IotTaskPool_FreeTaskPool vPortFree
\r
108 #define IotTaskPool_MallocJob pvPortMalloc
\r
109 #define IotTaskPool_FreeJob vPortFree
\r
110 #define IotTaskPool_MallocTimerEvent pvPortMalloc
\r
111 #define IotTaskPool_FreeTimerEvent vPortFree
\r
113 #define IotMqtt_MallocConnection pvPortMalloc
\r
114 #define IotMqtt_FreeConnection vPortFree
\r
115 #define IotMqtt_MallocMessage pvPortMalloc
\r
116 #define IotMqtt_FreeMessage vPortFree
\r
117 #define IotMqtt_MallocOperation pvPortMalloc
\r
118 #define IotMqtt_FreeOperation vPortFree
\r
119 #define IotMqtt_MallocSubscription pvPortMalloc
\r
120 #define IotMqtt_FreeSubscription vPortFree
\r
122 #define IotSerializer_MallocCborEncoder pvPortMalloc
\r
123 #define IotSerializer_FreeCborEncoder vPortFree
\r
124 #define IotSerializer_MallocCborParser pvPortMalloc
\r
125 #define IotSerializer_FreeCborParser vPortFree
\r
126 #define IotSerializer_MallocCborValue pvPortMalloc
\r
127 #define IotSerializer_FreeCborValue vPortFree
\r
128 #define IotSerializer_MallocDecoderObject pvPortMalloc
\r
129 #define IotSerializer_FreeDecoderObject vPortFree
\r
131 #define AwsIotShadow_MallocOperation pvPortMalloc
\r
132 #define AwsIotShadow_FreeOperation vPortFree
\r
133 #define AwsIotShadow_MallocString pvPortMalloc
\r
134 #define AwsIotShadow_FreeString vPortFree
\r
135 #define AwsIotShadow_MallocSubscription pvPortMalloc
\r
136 #define AwsIotShadow_FreeSubscription vPortFree
\r
138 #define AwsIotDefender_MallocReport pvPortMalloc
\r
139 #define AwsIotDefender_FreeReport vPortFree
\r
140 #define AwsIotDefender_MallocTopic pvPortMalloc
\r
141 #define AwsIotDefender_FreeTopic vPortFree
\r
142 #endif /* if IOT_STATIC_MEMORY_ONLY == 0 */
\r
144 /* Default platform thread stack size and priority. */
\r
145 #ifndef IOT_THREAD_DEFAULT_STACK_SIZE
\r
146 #define IOT_THREAD_DEFAULT_STACK_SIZE 2048
\r
148 #ifndef IOT_THREAD_DEFAULT_PRIORITY
\r
149 #define IOT_THREAD_DEFAULT_PRIORITY tskIDLE_PRIORITY
\r
152 /* Platform network configuration. */
\r
153 #ifndef IOT_NETWORK_RECEIVE_TASK_PRIORITY
\r
154 #define IOT_NETWORK_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
\r
156 #ifndef IOT_NETWORK_RECEIVE_TASK_STACK_SIZE
\r
157 #define IOT_NETWORK_RECEIVE_TASK_STACK_SIZE IOT_THREAD_DEFAULT_STACK_SIZE
\r
160 /* Platform and SDK name for AWS IoT MQTT metrics. Only used when
\r
161 * AWS_IOT_MQTT_ENABLE_METRICS is 1. */
\r
162 #define IOT_SDK_NAME "AmazonFreeRTOS"
\r
163 #ifdef configPLATFORM_NAME
\r
164 #define IOT_PLATFORM_NAME configPLATFORM_NAME
\r
166 #define IOT_PLATFORM_NAME "Unknown"
\r
169 /* Cloud endpoint to which the device connects to. */
\r
170 #define IOT_CLOUD_ENDPOINT clientcredentialMQTT_BROKER_ENDPOINT
\r
173 * @brief Unique identifier used to recognize a device by the cloud.
\r
174 * This could be SHA-256 of the device certificate.
\r
176 extern const char *getDeviceIdentifier( void );
\r
177 #define IOT_DEVICE_IDENTIFIER getDeviceIdentifier()
\r
180 * @brief Metrics emitted by the device.
\r
182 extern const char *getDeviceMetrics( void );
\r
183 #define AWS_IOT_METRICS_USERNAME getDeviceMetrics()
\r
186 * @brief Length of the metrics emitted by device.
\r
188 extern uint16_t getDeviceMetricsLength( void );
\r
189 #define AWS_IOT_METRICS_USERNAME_LENGTH getDeviceMetricsLength()
\r
191 /* Define the data type of metrics connection id as same as Socket_t in aws_secure_socket.h */
\r
192 #define IotMetricsConnectionId_t void *
\r
194 /* Configuration for defender demo: set format to CBOR. */
\r
195 #define AWS_IOT_DEFENDER_FORMAT AWS_IOT_DEFENDER_FORMAT_CBOR
\r
197 /* Configuration for defender demo: use long tag for readable output. Please use short tag for the real application. */
\r
198 #define AWS_IOT_DEFENDER_USE_LONG_TAG ( 1 )
\r
200 /* Demo runner configuration. */
\r
201 //_RB_#include "aws_demo_config.h"
\r
203 #endif /* ifndef IOT_CONFIG_COMMON_H_ */
\r