]> git.sur5r.net Git - freertos/commitdiff
New MSVC task pool demo now building both the task pool and TCP libraries.
authorrtel <rtel@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sun, 14 Jul 2019 19:13:51 +0000 (19:13 +0000)
committerrtel <rtel@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sun, 14 Jul 2019 19:13:51 +0000 (19:13 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2679 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

FreeRTOS-Plus/Demo/FreeRTOS_Plus_IoT_SDK/task_pool/FreeRTOSConfig.h
FreeRTOS-Plus/Demo/FreeRTOS_Plus_IoT_SDK/task_pool/WIN32.vcxproj
FreeRTOS-Plus/Demo/FreeRTOS_Plus_IoT_SDK/task_pool/WIN32.vcxproj.filters
FreeRTOS-Plus/Demo/FreeRTOS_Plus_IoT_SDK/task_pool/iot_config.h [new file with mode: 0644]
FreeRTOS-Plus/Demo/FreeRTOS_Plus_IoT_SDK/task_pool/iot_config_common.h [new file with mode: 0644]
FreeRTOS-Plus/Demo/FreeRTOS_Plus_IoT_SDK/task_pool/main.c
FreeRTOS-Plus/Source/FreeRTOS-Plus-IoT-SDK/c_sdk/standard/common/taskpool/iot_taskpool.c

index e68bd81c51e54e182a9f90ae55e8ffa9e75b295f..01737d5f7064aed3439a76b4b7d5b4b0aa777377 100644 (file)
@@ -61,6 +61,7 @@
 #define configUSE_ALTERNATIVE_API                              0\r
 #define configNUM_THREAD_LOCAL_STORAGE_POINTERS        0\r
 #define configENABLE_BACKWARD_COMPATIBILITY            1\r
+#define configSUPPORT_STATIC_ALLOCATION                        1\r
 \r
 /* Hook function related definitions. */\r
 #define configUSE_TICK_HOOK                            0\r
index 44615e22db07467caef6de8d0252de2fb6643459..ae147ddd71e4c1c04c97a9482724308f528e3180 100644 (file)
@@ -58,7 +58,7 @@
     </Midl>\r
     <ClCompile>\r
       <Optimization>Disabled</Optimization>\r
-      <AdditionalIncludeDirectories>..\..\..\Source\FreeRTOS-Plus-FAT\include;..\..\..\Source\FreeRTOS-Plus-FAT\portable\common;..\..\..\Source\FreeRTOS-Plus-TCP\protocols\include;..\..\..\Source\FreeRTOS-Plus-TCP\portable\BufferManagement;.\DemoTasks\include;..\..\..\Source\FreeRTOS-Plus-TCP\portable\Compiler\MSVC;.\WinPCap;..\..\..\..\FreeRTOS\Source\include;..\..\..\..\FreeRTOS\Source\portable\MSVC-MingW;..\..\..\Source\FreeRTOS-Plus-CLI;.\TraceMacros\Example1;..\..\..\Source\FreeRTOS-Plus-TCP\include;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+      <AdditionalIncludeDirectories>..\..\..\Source\FreeRTOS-Plus-TCP\include;..\..\..\Source\FreeRTOS-Plus-TCP\portable\BufferManagement;..\..\..\Source\FreeRTOS-Plus-TCP\portable\Compiler\MSVC;.\DemoTasks\include;.\WinPCap;..\..\..\..\FreeRTOS\Source\include;..\..\..\..\FreeRTOS\Source\portable\MSVC-MingW;..\..\..\Source\FreeRTOS-Plus-IoT-SDK\c_sdk\standard\common\include;..\..\..\Source\FreeRTOS-Plus-IoT-SDK\abstractions\platform\include;..\..\..\Source\FreeRTOS-Plus-IoT-SDK\abstractions\platform\freertos\include;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
       <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
       <MinimalRebuild>true</MinimalRebuild>\r
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\r
     <ClCompile Include="..\..\..\..\FreeRTOS\Source\queue.c" />\r
     <ClCompile Include="..\..\..\..\FreeRTOS\Source\tasks.c" />\r
     <ClCompile Include="..\..\..\..\FreeRTOS\Source\timers.c" />\r
+    <ClCompile Include="..\..\..\Source\FreeRTOS-Plus-IoT-SDK\c_sdk\standard\common\taskpool\iot_taskpool.c" />\r
     <ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\FreeRTOS_ARP.c" />\r
     <ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\FreeRTOS_DHCP.c" />\r
     <ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\FreeRTOS_DNS.c" />\r
     <ClInclude Include="..\..\..\..\FreeRTOS\Source\include\task.h" />\r
     <ClInclude Include="..\..\..\..\FreeRTOS\Source\include\timers.h" />\r
     <ClInclude Include="..\..\..\..\FreeRTOS\Source\portable\MSVC-MingW\portmacro.h" />\r
+    <ClInclude Include="..\..\..\Source\FreeRTOS-Plus-IoT-SDK\abstractions\platform\freertos\include\platform\iot_platform_types_afr.h" />\r
+    <ClInclude Include="..\..\..\Source\FreeRTOS-Plus-IoT-SDK\abstractions\platform\include\types\iot_platform_types.h" />\r
+    <ClInclude Include="..\..\..\Source\FreeRTOS-Plus-IoT-SDK\c_sdk\standard\common\include\iot_taskpool.h" />\r
+    <ClInclude Include="..\..\..\Source\FreeRTOS-Plus-IoT-SDK\c_sdk\standard\common\include\private\iot_error.h" />\r
+    <ClInclude Include="..\..\..\Source\FreeRTOS-Plus-IoT-SDK\c_sdk\standard\common\include\private\iot_logging.h" />\r
+    <ClInclude Include="..\..\..\Source\FreeRTOS-Plus-IoT-SDK\c_sdk\standard\common\include\private\iot_static_memory.h" />\r
+    <ClInclude Include="..\..\..\Source\FreeRTOS-Plus-IoT-SDK\c_sdk\standard\common\include\private\iot_taskpool_internal.h" />\r
+    <ClInclude Include="..\..\..\Source\FreeRTOS-Plus-IoT-SDK\c_sdk\standard\common\include\types\iot_taskpool_types.h" />\r
     <ClInclude Include="..\..\..\Source\FreeRTOS-Plus-TCP\include\FreeRTOSIPConfigDefaults.h" />\r
     <ClInclude Include="..\..\..\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_ARP.h" />\r
     <ClInclude Include="..\..\..\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_DHCP.h" />\r
     <ClInclude Include="..\..\..\Source\FreeRTOS-Plus-TCP\include\NetworkInterface.h" />\r
     <ClInclude Include="FreeRTOSConfig.h" />\r
     <ClInclude Include="FreeRTOSIPConfig.h" />\r
+    <ClInclude Include="iot_config.h" />\r
+    <ClInclude Include="iot_config_common.h" />\r
   </ItemGroup>\r
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
   <ImportGroup Label="ExtensionTargets">\r
index 4dee640c55fd3fc6d7bfbc146f2af5e12d48bfef..f1df7966ae5b54fcc2618f5ff968ad3723c3c38a 100644 (file)
     <Filter Include="DemoTasks">\r
       <UniqueIdentifier>{b71e974a-9f28-4815-972b-d930ba8a34d0}</UniqueIdentifier>\r
     </Filter>\r
+    <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries">\r
+      <UniqueIdentifier>{60717407-397f-4ea5-8492-3314acdd25f0}</UniqueIdentifier>\r
+    </Filter>\r
+    <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\standard">\r
+      <UniqueIdentifier>{8a90222f-d723-4b4e-8e6e-c57afaf7fa92}</UniqueIdentifier>\r
+    </Filter>\r
+    <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\standard\common">\r
+      <UniqueIdentifier>{7c995f05-2a10-4771-ad77-18a755876e46}</UniqueIdentifier>\r
+    </Filter>\r
+    <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\standard\common\task_pool">\r
+      <UniqueIdentifier>{e07288b6-a8e7-416a-947d-7f0260673dcc}</UniqueIdentifier>\r
+    </Filter>\r
+    <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\standard\common\include">\r
+      <UniqueIdentifier>{9a636cc3-ebc6-48c5-8c18-c72494686e81}</UniqueIdentifier>\r
+    </Filter>\r
+    <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\standard\common\include\private">\r
+      <UniqueIdentifier>{fe53a296-12ec-4819-bf2b-fd9dca2c6e96}</UniqueIdentifier>\r
+    </Filter>\r
+    <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\standard\common\include\types">\r
+      <UniqueIdentifier>{29376c48-bc8b-4624-ad59-16807874c9f2}</UniqueIdentifier>\r
+    </Filter>\r
+    <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\abstractions">\r
+      <UniqueIdentifier>{91ef4008-de51-4b41-ba5e-bf24d8cda378}</UniqueIdentifier>\r
+    </Filter>\r
+    <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\abstractions\platform">\r
+      <UniqueIdentifier>{ade43c6c-04c5-4897-abdb-91af2df04e5d}</UniqueIdentifier>\r
+    </Filter>\r
+    <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\abstractions\platform\freertos">\r
+      <UniqueIdentifier>{08a4e35c-19ca-4b1e-af24-bac368c2bf7b}</UniqueIdentifier>\r
+    </Filter>\r
+    <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\abstractions\platform\include">\r
+      <UniqueIdentifier>{1fc5fc25-c18b-45a2-bad3-0c07795db1e9}</UniqueIdentifier>\r
+    </Filter>\r
+    <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\abstractions\platform\include\platform">\r
+      <UniqueIdentifier>{f3a69e5b-1462-4e19-8651-274e86c252b0}</UniqueIdentifier>\r
+    </Filter>\r
+    <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\abstractions\platform\include\types">\r
+      <UniqueIdentifier>{9a849d9e-91e5-4035-ab4c-70a986c6aed1}</UniqueIdentifier>\r
+    </Filter>\r
+    <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\abstractions\platform\freertos\include">\r
+      <UniqueIdentifier>{1e324500-91b4-4c76-b699-59ba75691760}</UniqueIdentifier>\r
+    </Filter>\r
+    <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\abstractions\platform\freertos\include\platform">\r
+      <UniqueIdentifier>{bdcbc1ec-99b8-4c72-9075-49035c115488}</UniqueIdentifier>\r
+    </Filter>\r
+    <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\abstractions\platform\freertos\include\platform\types">\r
+      <UniqueIdentifier>{35ce7745-52a2-4220-be31-50dfaa35c0ab}</UniqueIdentifier>\r
+    </Filter>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClCompile Include="..\..\..\..\FreeRTOS\Source\portable\MSVC-MingW\port.c">\r
       <Filter>FreeRTOS+\FreeRTOS+TCP</Filter>\r
     </ClCompile>\r
     <ClCompile Include="demo_logging.c" />\r
+    <ClCompile Include="..\..\..\Source\FreeRTOS-Plus-IoT-SDK\c_sdk\standard\common\taskpool\iot_taskpool.c">\r
+      <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\common\task_pool</Filter>\r
+    </ClCompile>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClInclude Include="..\..\..\Source\FreeRTOS-Plus-TCP\include\NetworkInterface.h">\r
     <ClInclude Include="..\..\..\..\FreeRTOS\Source\include\projdefs.h">\r
       <Filter>FreeRTOS\Source\include</Filter>\r
     </ClInclude>\r
+    <ClInclude Include="..\..\..\Source\FreeRTOS-Plus-IoT-SDK\c_sdk\standard\common\include\iot_taskpool.h">\r
+      <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\common\include</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\..\..\Source\FreeRTOS-Plus-IoT-SDK\c_sdk\standard\common\include\types\iot_taskpool_types.h">\r
+      <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\common\include\types</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\..\..\Source\FreeRTOS-Plus-IoT-SDK\c_sdk\standard\common\include\private\iot_error.h">\r
+      <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\common\include\private</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\..\..\Source\FreeRTOS-Plus-IoT-SDK\c_sdk\standard\common\include\private\iot_logging.h">\r
+      <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\common\include\private</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\..\..\Source\FreeRTOS-Plus-IoT-SDK\c_sdk\standard\common\include\private\iot_static_memory.h">\r
+      <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\common\include\private</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\..\..\Source\FreeRTOS-Plus-IoT-SDK\c_sdk\standard\common\include\private\iot_taskpool_internal.h">\r
+      <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\common\include\private</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="iot_config.h" />\r
+    <ClInclude Include="iot_config_common.h" />\r
+    <ClInclude Include="..\..\..\Source\FreeRTOS-Plus-IoT-SDK\abstractions\platform\freertos\include\platform\iot_platform_types_afr.h">\r
+      <Filter>FreeRTOS+\FreeRTOS IoT Libraries\abstractions\platform\freertos\include\platform</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\..\..\Source\FreeRTOS-Plus-IoT-SDK\abstractions\platform\include\types\iot_platform_types.h">\r
+      <Filter>FreeRTOS+\FreeRTOS IoT Libraries\abstractions\platform\include\types</Filter>\r
+    </ClInclude>\r
   </ItemGroup>\r
 </Project>
\ No newline at end of file
diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_IoT_SDK/task_pool/iot_config.h b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_IoT_SDK/task_pool/iot_config.h
new file mode 100644 (file)
index 0000000..3038f0b
--- /dev/null
@@ -0,0 +1,59 @@
+/*\r
+ * Copyright (C) 2018 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\r
+ *\r
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+ * this software and associated documentation files (the "Software"), to deal in\r
+ * the Software without restriction, including without limitation the rights to\r
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+ * the Software, and to permit persons to whom the Software is furnished to do so,\r
+ * subject to the following conditions:\r
+ *\r
+ * The above copyright notice and this permission notice shall be included in all\r
+ * copies or substantial portions of the Software.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+ */\r
+\r
+/* This file contains configuration settings for the demos. */\r
+\r
+#ifndef IOT_CONFIG_H_\r
+#define IOT_CONFIG_H_\r
+\r
+/* How long the MQTT library will wait for PINGRESPs or PUBACKs. */\r
+#define IOT_MQTT_RESPONSE_WAIT_MS            ( 10000 )\r
+\r
+/* MQTT demo configuration. */\r
+#define IOT_DEMO_MQTT_PUBLISH_BURST_COUNT    ( 10 )\r
+#define IOT_DEMO_MQTT_PUBLISH_BURST_SIZE     ( 2 )\r
+\r
+/* Shadow demo configuration. The demo publishes periodic Shadow updates and responds\r
+ * to changing Shadows. */\r
+#define AWS_IOT_DEMO_SHADOW_UPDATE_COUNT        ( 20 )   /* Number of updates to publish. */\r
+#define AWS_IOT_DEMO_SHADOW_UPDATE_PERIOD_MS    ( 3000 ) /* Period of Shadow updates. */\r
+\r
+/* Library logging configuration. IOT_LOG_LEVEL_GLOBAL provides a global log\r
+ * level for all libraries; the library-specific settings override the global\r
+ * setting. If both the library-specific and global settings are undefined,\r
+ * no logs will be printed. */\r
+#define IOT_LOG_LEVEL_GLOBAL                    IOT_LOG_INFO\r
+#define IOT_LOG_LEVEL_DEMO                      IOT_LOG_INFO\r
+#define IOT_LOG_LEVEL_PLATFORM                  IOT_LOG_NONE\r
+#define IOT_LOG_LEVEL_NETWORK                   IOT_LOG_INFO\r
+#define IOT_LOG_LEVEL_TASKPOOL                  IOT_LOG_NONE\r
+#define IOT_LOG_LEVEL_MQTT                      IOT_LOG_INFO\r
+#define AWS_IOT_LOG_LEVEL_SHADOW                IOT_LOG_INFO\r
+#define AWS_IOT_LOG_LEVEL_DEFENDER              IOT_LOG_INFO\r
+\r
+/* Platform thread stack size and priority. */\r
+#define IOT_THREAD_DEFAULT_STACK_SIZE    2048\r
+#define IOT_THREAD_DEFAULT_PRIORITY      5\r
+\r
+/* Include the common configuration file for FreeRTOS. */\r
+#include "iot_config_common.h"\r
+\r
+#endif /* ifndef IOT_CONFIG_H_ */\r
diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_IoT_SDK/task_pool/iot_config_common.h b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_IoT_SDK/task_pool/iot_config_common.h
new file mode 100644 (file)
index 0000000..ab85d95
--- /dev/null
@@ -0,0 +1,203 @@
+/*\r
+ * Amazon FreeRTOS V201906.00 Major\r
+ * Copyright (C) 2019 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\r
+ *\r
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+ * this software and associated documentation files (the "Software"), to deal in\r
+ * the Software without restriction, including without limitation the rights to\r
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+ * the Software, and to permit persons to whom the Software is furnished to do so,\r
+ * subject to the following conditions:\r
+ *\r
+ * The above copyright notice and this permission notice shall be included in all\r
+ * copies or substantial portions of the Software.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+ *\r
+ * http://aws.amazon.com/freertos\r
+ * http://www.FreeRTOS.org\r
+ */\r
+\r
+/* This file contains default configuration settings for the demos on FreeRTOS. */\r
+\r
+#ifndef IOT_CONFIG_COMMON_H_\r
+#define IOT_CONFIG_COMMON_H_\r
+\r
+/* FreeRTOS include. */\r
+#include "FreeRTOS.h"\r
+\r
+/* Use platform types on FreeRTOS. */\r
+#include "platform/iot_platform_types_afr.h"\r
+\r
+/* Used to get the cloud broker endpoint for FreeRTOS. */\r
+//_RB_#include "aws_clientcredential.h"\r
+\r
+/* SDK version. */\r
+#define IOT_SDK_VERSION    "4.0.0"\r
+\r
+/* This config file is for the demos; disable any test code. */\r
+#define IOT_BUILD_TESTS    ( 0 )\r
+\r
+/* Logging puts function. */\r
+#define IotLogging_Puts( str )                 configPRINTF( ( "%s\r\n", str ) )\r
+\r
+/* Enable asserts in libraries by default. */\r
+#ifndef IOT_METRICS_ENABLE_ASSERTS\r
+    #define IOT_METRICS_ENABLE_ASSERTS         ( 1 )\r
+#endif\r
+#ifndef IOT_CONTAINERS_ENABLE_ASSERTS\r
+    #define IOT_CONTAINERS_ENABLE_ASSERTS      ( 1 )\r
+#endif\r
+#ifndef IOT_TASKPOOL_ENABLE_ASSERTS\r
+    #define IOT_TASKPOOL_ENABLE_ASSERTS        ( 1 )\r
+#endif\r
+#ifndef IOT_MQTT_ENABLE_ASSERTS\r
+    #define IOT_MQTT_ENABLE_ASSERTS            ( 1 )\r
+#endif\r
+#ifndef AWS_IOT_SHADOW_ENABLE_ASSERTS\r
+    #define AWS_IOT_SHADOW_ENABLE_ASSERTS      ( 1 )\r
+#endif\r
+#ifndef AWS_IOT_DEFENDER_ENABLE_ASSERTS\r
+    #define AWS_IOT_DEFENDER_ENABLE_ASSERTS    ( 1 )\r
+#endif\r
+#ifndef IOT_BLE_ENABLE_ASSERTS\r
+    #define IOT_BLE_ENABLE_ASSERTS             ( 1 )\r
+#endif\r
+\r
+/* Assert functions. */\r
+#define IotMetrics_Assert( expression )        configASSERT( expression )\r
+#define IotContainers_Assert( expression )     configASSERT( expression )\r
+#define IotTaskPool_Assert( expression )       configASSERT( expression )\r
+#define IotMqtt_Assert( expression )           configASSERT( expression )\r
+#define AwsIotShadow_Assert( expression )      configASSERT( expression )\r
+#define AwsIotDefender_Assert( expression )    configASSERT( expression )\r
+#define IotBle_Assert( expression )            configASSERT( expression )\r
+\r
+/* Control the usage of dynamic memory allocation. */\r
+#ifndef IOT_STATIC_MEMORY_ONLY\r
+    #define IOT_STATIC_MEMORY_ONLY    ( 0 )\r
+#endif\r
+\r
+/* Memory allocation configuration. Note that these functions will not be affected\r
+ * by IOT_STATIC_MEMORY_ONLY. */\r
+#define IotNetwork_Malloc    pvPortMalloc\r
+#define IotNetwork_Free      vPortFree\r
+#define IotThreads_Malloc    pvPortMalloc\r
+#define IotThreads_Free      vPortFree\r
+#define IotLogging_Malloc    pvPortMalloc\r
+#define IotLogging_Free      vPortFree\r
+#define IotBle_Malloc        pvPortMalloc\r
+#define IotBle_Free          vPortFree\r
+/* #define IotLogging_StaticBufferSize */\r
+\r
+/* Memory allocation function configuration for the MQTT and Defender library.\r
+ * These libraries will be affected by IOT_STATIC_MEMORY_ONLY. */\r
+#if IOT_STATIC_MEMORY_ONLY == 0\r
+    #define IotMetrics_MallocTcpConnection       pvPortMalloc\r
+    #define IotMetrics_FreeTcpConnection         vPortFree\r
+    #define IotMetrics_MallocIpAddress           pvPortMalloc\r
+    #define IotMetrics_FreeIpAddress             vPortFree\r
+\r
+    #define IotTaskPool_MallocTaskPool           pvPortMalloc\r
+    #define IotTaskPool_FreeTaskPool             vPortFree\r
+    #define IotTaskPool_MallocJob                pvPortMalloc\r
+    #define IotTaskPool_FreeJob                  vPortFree\r
+    #define IotTaskPool_MallocTimerEvent         pvPortMalloc\r
+    #define IotTaskPool_FreeTimerEvent           vPortFree\r
+\r
+    #define IotMqtt_MallocConnection             pvPortMalloc\r
+    #define IotMqtt_FreeConnection               vPortFree\r
+    #define IotMqtt_MallocMessage                pvPortMalloc\r
+    #define IotMqtt_FreeMessage                  vPortFree\r
+    #define IotMqtt_MallocOperation              pvPortMalloc\r
+    #define IotMqtt_FreeOperation                vPortFree\r
+    #define IotMqtt_MallocSubscription           pvPortMalloc\r
+    #define IotMqtt_FreeSubscription             vPortFree\r
+\r
+    #define IotSerializer_MallocCborEncoder      pvPortMalloc\r
+    #define IotSerializer_FreeCborEncoder        vPortFree\r
+    #define IotSerializer_MallocCborParser       pvPortMalloc\r
+    #define IotSerializer_FreeCborParser         vPortFree\r
+    #define IotSerializer_MallocCborValue        pvPortMalloc\r
+    #define IotSerializer_FreeCborValue          vPortFree\r
+    #define IotSerializer_MallocDecoderObject    pvPortMalloc\r
+    #define IotSerializer_FreeDecoderObject      vPortFree\r
+\r
+    #define AwsIotShadow_MallocOperation         pvPortMalloc\r
+    #define AwsIotShadow_FreeOperation           vPortFree\r
+    #define AwsIotShadow_MallocString            pvPortMalloc\r
+    #define AwsIotShadow_FreeString              vPortFree\r
+    #define AwsIotShadow_MallocSubscription      pvPortMalloc\r
+    #define AwsIotShadow_FreeSubscription        vPortFree\r
+\r
+    #define AwsIotDefender_MallocReport          pvPortMalloc\r
+    #define AwsIotDefender_FreeReport            vPortFree\r
+    #define AwsIotDefender_MallocTopic           pvPortMalloc\r
+    #define AwsIotDefender_FreeTopic             vPortFree\r
+#endif /* if IOT_STATIC_MEMORY_ONLY == 0 */\r
+\r
+/* Default platform thread stack size and priority. */\r
+#ifndef IOT_THREAD_DEFAULT_STACK_SIZE\r
+    #define IOT_THREAD_DEFAULT_STACK_SIZE    2048\r
+#endif\r
+#ifndef IOT_THREAD_DEFAULT_PRIORITY\r
+    #define IOT_THREAD_DEFAULT_PRIORITY      tskIDLE_PRIORITY\r
+#endif\r
+\r
+/* Platform network configuration. */\r
+#ifndef IOT_NETWORK_RECEIVE_TASK_PRIORITY\r
+    #define IOT_NETWORK_RECEIVE_TASK_PRIORITY      ( tskIDLE_PRIORITY + 1 )\r
+#endif\r
+#ifndef IOT_NETWORK_RECEIVE_TASK_STACK_SIZE\r
+    #define IOT_NETWORK_RECEIVE_TASK_STACK_SIZE    IOT_THREAD_DEFAULT_STACK_SIZE\r
+#endif\r
+\r
+/* Platform and SDK name for AWS IoT MQTT metrics. Only used when\r
+ * AWS_IOT_MQTT_ENABLE_METRICS is 1. */\r
+#define IOT_SDK_NAME             "AmazonFreeRTOS"\r
+#ifdef configPLATFORM_NAME\r
+    #define IOT_PLATFORM_NAME    configPLATFORM_NAME\r
+#else\r
+    #define IOT_PLATFORM_NAME    "Unknown"\r
+#endif\r
+\r
+/* Cloud endpoint to which the device connects to. */\r
+#define IOT_CLOUD_ENDPOINT                    clientcredentialMQTT_BROKER_ENDPOINT\r
+\r
+/**\r
+ * @brief Unique identifier used to recognize a device by the cloud.\r
+ * This could be SHA-256 of the device certificate.\r
+ */\r
+extern const char *getDeviceIdentifier( void );\r
+#define IOT_DEVICE_IDENTIFIER                getDeviceIdentifier()\r
+\r
+/**\r
+ * @brief Metrics emitted by the device.\r
+ */\r
+extern const char *getDeviceMetrics( void );\r
+#define AWS_IOT_METRICS_USERNAME     getDeviceMetrics()\r
+\r
+/**\r
+ * @brief Length of the metrics emitted by device.\r
+ */\r
+extern uint16_t getDeviceMetricsLength( void );\r
+#define AWS_IOT_METRICS_USERNAME_LENGTH getDeviceMetricsLength()\r
+\r
+/* Define the data type of metrics connection id as same as Socket_t in aws_secure_socket.h */\r
+#define IotMetricsConnectionId_t            void *\r
+\r
+/* Configuration for defender demo: set format to CBOR. */\r
+#define AWS_IOT_DEFENDER_FORMAT             AWS_IOT_DEFENDER_FORMAT_CBOR\r
+\r
+/* Configuration for defender demo: use long tag for readable output. Please use short tag for the real application. */\r
+#define AWS_IOT_DEFENDER_USE_LONG_TAG       ( 1 )\r
+\r
+/* Demo runner configuration. */\r
+//_RB_#include "aws_demo_config.h"\r
+\r
+#endif /* ifndef IOT_CONFIG_COMMON_H_ */\r
index fa52947a58a61ecdbe96bc551e5fb913e32549d6..9a93fcd3d7c4b3b9a2995f3f3306751a1dd5c92a 100644 (file)
@@ -339,6 +339,7 @@ uint32_t ulLoggingIPAddress;
        }\r
 \r
 #endif\r
+/*-----------------------------------------------------------*/\r
 \r
 /*\r
  * Callback that provides the inputs necessary to generate a randomized TCP\r
@@ -358,4 +359,55 @@ extern uint32_t ulApplicationGetNextSequenceNumber( uint32_t ulSourceAddress,
 \r
        return uxRand();\r
 }\r
+/*-----------------------------------------------------------*/\r
+\r
+/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an\r
+implementation of vApplicationGetIdleTaskMemory() to provide the memory that is\r
+used by the Idle task. */\r
+void vApplicationGetIdleTaskMemory( StaticTask_t** ppxIdleTaskTCBBuffer, StackType_t** ppxIdleTaskStackBuffer, uint32_t* pulIdleTaskStackSize )\r
+{\r
+       /* If the buffers to be provided to the Idle task are declared inside this\r
+       function then they must be declared static - otherwise they will be allocated on\r
+       the stack and so not exists after this function exits. */\r
+       static StaticTask_t xIdleTaskTCB;\r
+       static StackType_t uxIdleTaskStack[configMINIMAL_STACK_SIZE];\r
+\r
+       /* Pass out a pointer to the StaticTask_t structure in which the Idle task's\r
+       state will be stored. */\r
+       *ppxIdleTaskTCBBuffer = &xIdleTaskTCB;\r
+\r
+       /* Pass out the array that will be used as the Idle task's stack. */\r
+       *ppxIdleTaskStackBuffer = uxIdleTaskStack;\r
+\r
+       /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer.\r
+       Note that, as the array is necessarily of type StackType_t,\r
+       configMINIMAL_STACK_SIZE is specified in words, not bytes. */\r
+       *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+/* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the\r
+application must provide an implementation of vApplicationGetTimerTaskMemory()\r
+to provide the memory that is used by the Timer service task. */\r
+void vApplicationGetTimerTaskMemory( StaticTask_t** ppxTimerTaskTCBBuffer, StackType_t** ppxTimerTaskStackBuffer, uint32_t* pulTimerTaskStackSize )\r
+{\r
+       /* If the buffers to be provided to the Timer task are declared inside this\r
+       function then they must be declared static - otherwise they will be allocated on\r
+       the stack and so not exists after this function exits. */\r
+       static StaticTask_t xTimerTaskTCB;\r
+       static StackType_t uxTimerTaskStack[configTIMER_TASK_STACK_DEPTH];\r
+\r
+       /* Pass out a pointer to the StaticTask_t structure in which the Timer\r
+       task's state will be stored. */\r
+       *ppxTimerTaskTCBBuffer = &xTimerTaskTCB;\r
+\r
+       /* Pass out the array that will be used as the Timer task's stack. */\r
+       *ppxTimerTaskStackBuffer = uxTimerTaskStack;\r
+\r
+       /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer.\r
+       Note that, as the array is necessarily of type StackType_t,\r
+       configMINIMAL_STACK_SIZE is specified in words, not bytes. */\r
+       *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;\r
+}\r
+\r
 \r
index a01e6423c2c760561183909c540025839e6c55d5..460117d63868a4829ab5b64c26b851e9a283cfd9 100644 (file)
  * @brief Implements the task pool functions in iot_taskpool.h\r
  */\r
 \r
-/* The config header is always included first. */\r
+/* Kernel includes. */\r
+#include "FreeRTOS.h"\r
+#include "semphr.h"\r
+\r
+/* IoT libraries includes. */\r
 #include "iot_config.h"\r
 \r
 /* Standard includes. */\r
 #include <stdint.h>\r
 #include <string.h>\r
 \r
+#if !defined( configSUPPORT_STATIC_ALLOCATION ) || ( configSUPPORT_STATIC_ALLOCATION != 1 )\r
+       #error configSUPPORT_STATIC_ALLOCATION must be set to 1 in FreeRTOSConfig.h to build this file.\r
+#endif\r
+\r
 /* Platform layer includes. */\r
-#include "platform/iot_threads.h"\r
-#include "platform/iot_clock.h"\r
+//_RB_#include "platform/iot_threads.h"\r
+//_RB_#include "platform/iot_clock.h"\r
 \r
 /* Task pool internal include. */\r
 #include "private/iot_taskpool_internal.h"\r
@@ -551,7 +559,7 @@ IotTaskPoolError_t IotTaskPool_DestroyRecyclableJob( IotTaskPool_t taskPoolHandl
     pool - no other values are allowed.  Use the full implementation of this\r
     library if you want multiple task pools (there is more than one task in\r
     each pool. */\r
-#warning could use a TASKPOOL macro to check value and return error.\r
+//_RB_could use a TASKPOOL macro to check value and return error.\r
     configASSERT( ( taskPoolHandle == NULL ) || ( taskPoolHandle == &_IotSystemTaskPool ) );\r
 \r
     /* Avoid compiler warnings about unused parameters if configASSERT() is not\r
@@ -891,7 +899,7 @@ static IotTaskPoolError_t _createTaskPool( const IotTaskPoolInfo_t * const pInfo
     TASKPOOL_FUNCTION_ENTRY( IOT_TASKPOOL_SUCCESS );\r
 \r
     uint32_t count;\r
-    uint32_t threadsCreated;\r
+    uint32_t threadsCreated = 0; /* Although initialised before use removing the initialiser here results in compiler warnings. */\r
     char cTaskName[ 10 ];\r
 \r
     /* Check input values for consistency. */\r