Update task pool so tasks and timer are allocated statically.

This commit is contained in:
Richard Barry 2019-07-23 01:46:59 +00:00
parent 1840d38abf
commit 7af8756c97
17 changed files with 102 additions and 1465 deletions

View file

@ -169,7 +169,7 @@ uint32_t ulLoops = 0;
ulLoops++;
if( ( ulLoops % 10UL ) == 0 )
{
printf( "prvTaskPoolDemoTask() performed %u iterations without hitting an assert.\r\n", ulLoops );
configPRINTF( ( "prvTaskPoolDemoTask() performed %u iterations without hitting an assert.\r\n", ulLoops ) );
fflush( stdout );
}
}

View file

@ -202,5 +202,7 @@ ipconfigUSE_DNS is set to 1 but a DNS server cannot be contacted. */
#define strncasecmp _strnicmp
#define strcmpi _strcmpi
#define configPRINTF( X ) printf X
#endif /* FREERTOS_CONFIG_H */

View file

@ -60,7 +60,6 @@
<Optimization>Disabled</Optimization>
<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>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeaderOutputFile>.\Debug/WIN32.pch</PrecompiledHeaderOutputFile>
@ -145,6 +144,8 @@
<ClCompile Include="..\..\..\..\FreeRTOS\Source\queue.c" />
<ClCompile Include="..\..\..\..\FreeRTOS\Source\tasks.c" />
<ClCompile Include="..\..\..\..\FreeRTOS\Source\timers.c" />
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-IoT-SDK\abstractions\platform\freertos\iot_clock_freertos.c" />
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-IoT-SDK\c_sdk\standard\common\logging\iot_logging.c" />
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-IoT-SDK\c_sdk\standard\common\taskpool\iot_taskpool.c" />
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\FreeRTOS_ARP.c" />
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\FreeRTOS_DHCP.c" />

View file

@ -81,6 +81,9 @@
<Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\abstractions\platform\freertos\include\platform\types">
<UniqueIdentifier>{35ce7745-52a2-4220-be31-50dfaa35c0ab}</UniqueIdentifier>
</Filter>
<Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\standard\common\logging">
<UniqueIdentifier>{6c8bc003-a388-4666-99f4-a31faa932a36}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\..\FreeRTOS\Source\portable\MSVC-MingW\port.c">
@ -148,6 +151,12 @@
<ClCompile Include="DemoTasks\SimpleTaskPoolExamples.c">
<Filter>DemoTasks</Filter>
</ClCompile>
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-IoT-SDK\c_sdk\standard\common\logging\iot_logging.c">
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\common\logging</Filter>
</ClCompile>
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-IoT-SDK\abstractions\platform\freertos\iot_clock_freertos.c">
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\abstractions\platform\freertos</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\Source\FreeRTOS-Plus-TCP\include\NetworkInterface.h">

View file

@ -24,34 +24,62 @@
#ifndef IOT_CONFIG_H_
#define IOT_CONFIG_H_
/* How long the MQTT library will wait for PINGRESPs or PUBACKs. */
#define IOT_MQTT_RESPONSE_WAIT_MS ( 10000 )
/* Use platform types on FreeRTOS. */
#include "FreeRTOS.h"
#include "platform/iot_platform_types_freertos.h" //_RB_Makes common config file FreeRTOS specific
/* MQTT demo configuration. */
#define IOT_DEMO_MQTT_PUBLISH_BURST_COUNT ( 10 )
#define IOT_DEMO_MQTT_PUBLISH_BURST_SIZE ( 2 )
/*
* Set this to the number of recyclable tasks for the task pool to cache.
*
* Caching dynamically allocated tasks (recyclable tasks) helps the application
* to limit the number of allocations at runtime. Caching recyclable tasks may
* help making the application more responsive and predictable, by removing a
* potential for memory allocation failures, but it may also have negative
* repercussions on the amount of memory available at any given time. It is up
* to the application developer to strike the correct balance these competing
* needs. The task pool will cache when the application calling
* IotTaskPool_RecycleJob. Any recycled tasks in excess of
* IOT_TASKPOOL_JOBS_RECYCLE_LIMIT will be destroyed and its memory will be
* release.
*
* Default value (if undefined): 8
*/
#define IOT_TASKPOOL_JOBS_RECYCLE_LIMIT 8
/* Shadow demo configuration. The demo publishes periodic Shadow updates and responds
* to changing Shadows. */
#define AWS_IOT_DEMO_SHADOW_UPDATE_COUNT ( 20 ) /* Number of updates to publish. */
#define AWS_IOT_DEMO_SHADOW_UPDATE_PERIOD_MS ( 3000 ) /* Period of Shadow updates. */
/*
* Set this to 1 to perform sanity checks when using the task pool library.
*
* Asserts are useful for debugging, but should be disabled in production code.
* If this is set to 1, IotTaskPool_Assert can be defined to set the assertion
* function; otherwise, the standard library's assert function will be used.
*
* Possible values: 0 (asserts disabled) or 1 (asserts enabled)
* Recommended values: 1 when debugging; 0 in production code.
* Default value (if undefined): 0
*/
#define IOT_TASKPOOL_ENABLE_ASSERTS 1
/* Library logging configuration. IOT_LOG_LEVEL_GLOBAL provides a global log
* level for all libraries; the library-specific settings override the global
* setting. If both the library-specific and global settings are undefined,
* no logs will be printed. */
#define IOT_LOG_LEVEL_GLOBAL IOT_LOG_INFO
#define IOT_LOG_LEVEL_DEMO IOT_LOG_INFO
#define IOT_LOG_LEVEL_PLATFORM IOT_LOG_NONE
#define IOT_LOG_LEVEL_NETWORK IOT_LOG_INFO
#define IOT_LOG_LEVEL_TASKPOOL IOT_LOG_NONE
#define IOT_LOG_LEVEL_MQTT IOT_LOG_INFO
#define AWS_IOT_LOG_LEVEL_SHADOW IOT_LOG_INFO
#define AWS_IOT_LOG_LEVEL_DEFENDER IOT_LOG_INFO
/*
* Set the log level of the task pool library.
*
* Log messages from the task pool library at or below this setting will be
* printed.
*
* Possible values: One of the Log levels.
* Default value (if undefined): IOT_LOG_LEVEL_GLOBAL; if that is undefined,
* then IOT_LOG_NONE.
*/
#define IOT_LOG_LEVEL_TASKPOOL IOT_LOG_INFO
/* Platform thread stack size and priority. */
#define IOT_THREAD_DEFAULT_STACK_SIZE 2048
#define IOT_THREAD_DEFAULT_PRIORITY 5
/*
*
*/
#define IOT_TASKPOOL_NUMBER_OF_WORKERS 3
/*
*
*/
#define IOT_TASKPOOL_WORKER_STACK_SIZE_BYTES 2048
/* Include the common configuration file for FreeRTOS. */
#include "iot_config_common.h"

View file

@ -28,15 +28,6 @@
#ifndef IOT_CONFIG_COMMON_H_
#define IOT_CONFIG_COMMON_H_
/* FreeRTOS include. */
#include "FreeRTOS.h" //_RB_Makes common config file FreeRTOS specific
/* Use platform types on FreeRTOS. */
#include "platform/iot_platform_types_freertos.h" //_RB_Makes common config file FreeRTOS specific
/* Used to get the cloud broker endpoint for FreeRTOS. */
//_RB_#include "aws_clientcredential.h"
/* SDK version. */
#define IOT_SDK_VERSION "4.0.0"
@ -197,7 +188,4 @@ extern uint16_t getDeviceMetricsLength( void );
/* Configuration for defender demo: use long tag for readable output. Please use short tag for the real application. */
#define AWS_IOT_DEFENDER_USE_LONG_TAG ( 1 )
/* Demo runner configuration. */
//_RB_#include "aws_demo_config.h"
#endif /* ifndef IOT_CONFIG_COMMON_H_ */