From: rtel Date: Wed, 19 Jun 2019 18:42:58 +0000 (+0000) Subject: Create a project that builds a subset of the dependencies of the IoT SDK that have... X-Git-Tag: V10.3.0~155 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=0ae52b9fd9d23de3846c6242fbde6270269f8243;p=freertos Create a project that builds a subset of the dependencies of the IoT SDK that have been brought into SVN thus far. The application does nothing other than build at this time. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2666 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_IoT_SDK/TaskPool/.cproject b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_IoT_SDK/TaskPool/.cproject new file mode 100644 index 000000000..30bb63e72 --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_IoT_SDK/TaskPool/.cproject @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_IoT_SDK/TaskPool/.project b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_IoT_SDK/TaskPool/.project new file mode 100644 index 000000000..f3fa6ed36 --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_IoT_SDK/TaskPool/.project @@ -0,0 +1,159 @@ + + + RTOSDemo + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + FreeRTOS-Plus-IoT-SDK + 2 + virtual:/virtual + + + FreeRTOS_Kernel_Source + 2 + virtual:/virtual + + + FreeRTOS-Plus-IoT-SDK/abstractions + 2 + virtual:/virtual + + + FreeRTOS-Plus-IoT-SDK/c_sdk + 2 + virtual:/virtual + + + FreeRTOS_Kernel_Source/event_groups.c + 1 + FREERTOS_ROOT/FreeRTOS/Source/event_groups.c + + + FreeRTOS_Kernel_Source/include + 2 + FREERTOS_ROOT/FreeRTOS/Source/include + + + FreeRTOS_Kernel_Source/list.c + 1 + FREERTOS_ROOT/FreeRTOS/Source/list.c + + + FreeRTOS_Kernel_Source/portable + 2 + virtual:/virtual + + + FreeRTOS_Kernel_Source/queue.c + 1 + FREERTOS_ROOT/FreeRTOS/Source/queue.c + + + FreeRTOS_Kernel_Source/readme.txt + 1 + FREERTOS_ROOT/FreeRTOS/Source/readme.txt + + + FreeRTOS_Kernel_Source/stream_buffer.c + 1 + FREERTOS_ROOT/FreeRTOS/Source/stream_buffer.c + + + FreeRTOS_Kernel_Source/tasks.c + 1 + FREERTOS_ROOT/FreeRTOS/Source/tasks.c + + + FreeRTOS_Kernel_Source/timers.c + 1 + FREERTOS_ROOT/FreeRTOS/Source/timers.c + + + FreeRTOS-Plus-IoT-SDK/abstractions/platform + 2 + virtual:/virtual + + + FreeRTOS-Plus-IoT-SDK/c_sdk/standard + 2 + virtual:/virtual + + + FreeRTOS_Kernel_Source/portable/MSVC-MingW + 2 + FREERTOS_ROOT/FreeRTOS/Source/portable/MSVC-MingW + + + FreeRTOS_Kernel_Source/portable/MemMang + 2 + virtual:/virtual + + + FreeRTOS-Plus-IoT-SDK/abstractions/platform/freertos + 2 + virtual:/virtual + + + FreeRTOS-Plus-IoT-SDK/abstractions/platform/include + 2 + FREERTOS_ROOT/FreeRTOS-Plus/Source/FreeRTOS-Plus-IoT-SDK/abstractions/platform/include + + + FreeRTOS-Plus-IoT-SDK/c_sdk/standard/common + 2 + virtual:/virtual + + + FreeRTOS_Kernel_Source/portable/MemMang/heap_4.c + 1 + FREERTOS_ROOT/FreeRTOS/Source/portable/MemMang/heap_4.c + + + FreeRTOS-Plus-IoT-SDK/abstractions/platform/freertos/include + 2 + FREERTOS_ROOT/FreeRTOS-Plus/Source/FreeRTOS-Plus-IoT-SDK/abstractions/platform/freertos/include + + + FreeRTOS-Plus-IoT-SDK/c_sdk/standard/common/include + 2 + FREERTOS_ROOT/FreeRTOS-Plus/Source/FreeRTOS-Plus-IoT-SDK/c_sdk/standard/common/include + + + FreeRTOS-Plus-IoT-SDK/c_sdk/standard/common/taskpool + 2 + virtual:/virtual + + + FreeRTOS-Plus-IoT-SDK/c_sdk/standard/common/taskpool/iot_taskpool.c + 1 + PARENT-5-FREERTOS_ROOT/T/amazon-freertos-master_fr_task_pool/libraries/c_sdk/standard/common/taskpool/iot_taskpool.c + + + + + FREERTOS_ROOT + $%7BPARENT-4-PROJECT_LOC%7D + + + diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_IoT_SDK/TaskPool/.settings/language.settings.xml b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_IoT_SDK/TaskPool/.settings/language.settings.xml new file mode 100644 index 000000000..a11d160d6 --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_IoT_SDK/TaskPool/.settings/language.settings.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_IoT_SDK/TaskPool/.settings/org.eclipse.cdt.managedbuilder.core.prefs b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_IoT_SDK/TaskPool/.settings/org.eclipse.cdt.managedbuilder.core.prefs new file mode 100644 index 000000000..b58567223 --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_IoT_SDK/TaskPool/.settings/org.eclipse.cdt.managedbuilder.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1831810452/CPATH/delimiter=; +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1831810452/CPATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1831810452/C_INCLUDE_PATH/delimiter=; +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1831810452/C_INCLUDE_PATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1831810452/append=true +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1831810452/appendContributed=true +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1831810452/LIBRARY_PATH/delimiter=; +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1831810452/LIBRARY_PATH/operation=remove +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1831810452/append=true +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1831810452/appendContributed=true diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_IoT_SDK/TaskPool/Configuration_Files/FreeRTOSConfig.h b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_IoT_SDK/TaskPool/Configuration_Files/FreeRTOSConfig.h new file mode 100644 index 000000000..0fc6b57e1 --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_IoT_SDK/TaskPool/Configuration_Files/FreeRTOSConfig.h @@ -0,0 +1,130 @@ +/* + * FreeRTOS Kernel V10.2.1 + * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * http://www.FreeRTOS.org + * http://aws.amazon.com/freertos + * + * 1 tab == 4 spaces! + */ +#ifndef FREERTOS_CONFIG_H +#define FREERTOS_CONFIG_H + +/*----------------------------------------------------------- + * Application specific definitions. + * + * These definitions should be adjusted for your particular hardware and + * application requirements. + * + * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE + * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. See + * http://www.freertos.org/a00110.html + *----------------------------------------------------------*/ + +#define configUSE_PREEMPTION 1 +#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1 +#define configUSE_IDLE_HOOK 1 +#define configUSE_TICK_HOOK 1 +#define configUSE_DAEMON_TASK_STARTUP_HOOK 1 +#define configTICK_RATE_HZ ( 1000 ) /* In this non-real time simulated environment the tick frequency has to be at least a multiple of the Win32 tick frequency, and therefore very slow. */ +#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 70 ) /* In this simulated case, the stack only has to hold one small structure as the real stack is part of the win32 thread. */ +#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 65 * 1024 ) ) +#define configMAX_TASK_NAME_LEN ( 12 ) +#define configUSE_TRACE_FACILITY 1 +#define configUSE_16_BIT_TICKS 0 +#define configIDLE_SHOULD_YIELD 1 +#define configUSE_MUTEXES 1 +#define configCHECK_FOR_STACK_OVERFLOW 0 +#define configUSE_RECURSIVE_MUTEXES 1 +#define configQUEUE_REGISTRY_SIZE 20 +#define configUSE_APPLICATION_TASK_TAG 1 +#define configUSE_COUNTING_SEMAPHORES 1 +#define configUSE_ALTERNATIVE_API 0 +#define configUSE_QUEUE_SETS 1 +#define configUSE_TASK_NOTIFICATIONS 1 +#define configSUPPORT_STATIC_ALLOCATION 1 + +/* Software timer related configuration options. The maximum possible task +priority is configMAX_PRIORITIES - 1. The priority of the timer task is +deliberately set higher to ensure it is correctly capped back to +configMAX_PRIORITIES - 1. */ +#define configUSE_TIMERS 1 +#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 ) +#define configTIMER_QUEUE_LENGTH 20 +#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE * 2 ) + +#define configMAX_PRIORITIES ( 7 ) + +/* Run time stats gathering configuration options. */ +#define configGENERATE_RUN_TIME_STATS 0 + +/* Co-routine related configuration options. */ +#define configUSE_CO_ROUTINES 0 +#define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) + +/* This demo can use of one or more example stats formatting functions. These +format the raw data provided by the uxTaskGetSystemState() function in to human +readable ASCII form. See the notes in the implementation of vTaskList() within +FreeRTOS/Source/tasks.c for limitations. */ +#define configUSE_STATS_FORMATTING_FUNCTIONS 0 + +/* Enables the test whereby a stack larger than the total heap size is +requested. */ +#define configSTACK_DEPTH_TYPE uint32_t + +/* Set the following definitions to 1 to include the API function, or zero +to exclude the API function. In most cases the linker will remove unused +functions anyway. */ +#define INCLUDE_vTaskPrioritySet 1 +#define INCLUDE_uxTaskPriorityGet 1 +#define INCLUDE_vTaskDelete 1 +#define INCLUDE_vTaskCleanUpResources 0 +#define INCLUDE_vTaskSuspend 1 +#define INCLUDE_vTaskDelayUntil 1 +#define INCLUDE_vTaskDelay 1 +#define INCLUDE_uxTaskGetStackHighWaterMark 1 +#define INCLUDE_uxTaskGetStackHighWaterMark2 1 +#define INCLUDE_xTaskGetSchedulerState 1 +#define INCLUDE_xTimerGetTimerDaemonTaskHandle 1 +#define INCLUDE_xTaskGetIdleTaskHandle 1 +#define INCLUDE_xTaskGetHandle 1 +#define INCLUDE_eTaskGetState 1 +#define INCLUDE_xSemaphoreGetMutexHolder 1 +#define INCLUDE_xTimerPendFunctionCall 1 +#define INCLUDE_xTaskAbortDelay 1 + +#define configINCLUDE_MESSAGE_BUFFER_AMP_DEMO 0 +#if ( configINCLUDE_MESSAGE_BUFFER_AMP_DEMO == 1 ) + extern void vGenerateCoreBInterrupt( void * xUpdatedMessageBuffer ); + #define sbSEND_COMPLETED( pxStreamBuffer ) vGenerateCoreBInterrupt( pxStreamBuffer ) +#endif /* configINCLUDE_MESSAGE_BUFFER_AMP_DEMO */ + +extern void vAssertCalled( unsigned long ulLine, const char * const pcFileName ); + +/* It is best practice to define configASSERT() while developing. configASSERT() +uses the same semantics as the standard C assert() macro. Don't define +configASSERT() when performing code coverage tests though, as it is not +intended to asserts() to fail, some some code is intended not to run if no +errors are present. */ +#define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled( __LINE__, __FILE__ ) + +#define configUSE_MALLOC_FAILED_HOOK 1 + +#endif /* FREERTOS_CONFIG_H */ diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_IoT_SDK/TaskPool/Configuration_Files/iot_config.h b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_IoT_SDK/TaskPool/Configuration_Files/iot_config.h new file mode 100644 index 000000000..3038f0b78 --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_IoT_SDK/TaskPool/Configuration_Files/iot_config.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/* This file contains configuration settings for the demos. */ + +#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 ) + +/* MQTT demo configuration. */ +#define IOT_DEMO_MQTT_PUBLISH_BURST_COUNT ( 10 ) +#define IOT_DEMO_MQTT_PUBLISH_BURST_SIZE ( 2 ) + +/* 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. */ + +/* 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 + +/* Platform thread stack size and priority. */ +#define IOT_THREAD_DEFAULT_STACK_SIZE 2048 +#define IOT_THREAD_DEFAULT_PRIORITY 5 + +/* Include the common configuration file for FreeRTOS. */ +#include "iot_config_common.h" + +#endif /* ifndef IOT_CONFIG_H_ */ diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_IoT_SDK/TaskPool/Configuration_Files/iot_config_common.h b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_IoT_SDK/TaskPool/Configuration_Files/iot_config_common.h new file mode 100644 index 000000000..ab85d95f3 --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_IoT_SDK/TaskPool/Configuration_Files/iot_config_common.h @@ -0,0 +1,203 @@ +/* + * Amazon FreeRTOS V201906.00 Major + * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * http://aws.amazon.com/freertos + * http://www.FreeRTOS.org + */ + +/* This file contains default configuration settings for the demos on FreeRTOS. */ + +#ifndef IOT_CONFIG_COMMON_H_ +#define IOT_CONFIG_COMMON_H_ + +/* FreeRTOS include. */ +#include "FreeRTOS.h" + +/* Use platform types on FreeRTOS. */ +#include "platform/iot_platform_types_afr.h" + +/* Used to get the cloud broker endpoint for FreeRTOS. */ +//_RB_#include "aws_clientcredential.h" + +/* SDK version. */ +#define IOT_SDK_VERSION "4.0.0" + +/* This config file is for the demos; disable any test code. */ +#define IOT_BUILD_TESTS ( 0 ) + +/* Logging puts function. */ +#define IotLogging_Puts( str ) configPRINTF( ( "%s\r\n", str ) ) + +/* Enable asserts in libraries by default. */ +#ifndef IOT_METRICS_ENABLE_ASSERTS + #define IOT_METRICS_ENABLE_ASSERTS ( 1 ) +#endif +#ifndef IOT_CONTAINERS_ENABLE_ASSERTS + #define IOT_CONTAINERS_ENABLE_ASSERTS ( 1 ) +#endif +#ifndef IOT_TASKPOOL_ENABLE_ASSERTS + #define IOT_TASKPOOL_ENABLE_ASSERTS ( 1 ) +#endif +#ifndef IOT_MQTT_ENABLE_ASSERTS + #define IOT_MQTT_ENABLE_ASSERTS ( 1 ) +#endif +#ifndef AWS_IOT_SHADOW_ENABLE_ASSERTS + #define AWS_IOT_SHADOW_ENABLE_ASSERTS ( 1 ) +#endif +#ifndef AWS_IOT_DEFENDER_ENABLE_ASSERTS + #define AWS_IOT_DEFENDER_ENABLE_ASSERTS ( 1 ) +#endif +#ifndef IOT_BLE_ENABLE_ASSERTS + #define IOT_BLE_ENABLE_ASSERTS ( 1 ) +#endif + +/* Assert functions. */ +#define IotMetrics_Assert( expression ) configASSERT( expression ) +#define IotContainers_Assert( expression ) configASSERT( expression ) +#define IotTaskPool_Assert( expression ) configASSERT( expression ) +#define IotMqtt_Assert( expression ) configASSERT( expression ) +#define AwsIotShadow_Assert( expression ) configASSERT( expression ) +#define AwsIotDefender_Assert( expression ) configASSERT( expression ) +#define IotBle_Assert( expression ) configASSERT( expression ) + +/* Control the usage of dynamic memory allocation. */ +#ifndef IOT_STATIC_MEMORY_ONLY + #define IOT_STATIC_MEMORY_ONLY ( 0 ) +#endif + +/* Memory allocation configuration. Note that these functions will not be affected + * by IOT_STATIC_MEMORY_ONLY. */ +#define IotNetwork_Malloc pvPortMalloc +#define IotNetwork_Free vPortFree +#define IotThreads_Malloc pvPortMalloc +#define IotThreads_Free vPortFree +#define IotLogging_Malloc pvPortMalloc +#define IotLogging_Free vPortFree +#define IotBle_Malloc pvPortMalloc +#define IotBle_Free vPortFree +/* #define IotLogging_StaticBufferSize */ + +/* Memory allocation function configuration for the MQTT and Defender library. + * These libraries will be affected by IOT_STATIC_MEMORY_ONLY. */ +#if IOT_STATIC_MEMORY_ONLY == 0 + #define IotMetrics_MallocTcpConnection pvPortMalloc + #define IotMetrics_FreeTcpConnection vPortFree + #define IotMetrics_MallocIpAddress pvPortMalloc + #define IotMetrics_FreeIpAddress vPortFree + + #define IotTaskPool_MallocTaskPool pvPortMalloc + #define IotTaskPool_FreeTaskPool vPortFree + #define IotTaskPool_MallocJob pvPortMalloc + #define IotTaskPool_FreeJob vPortFree + #define IotTaskPool_MallocTimerEvent pvPortMalloc + #define IotTaskPool_FreeTimerEvent vPortFree + + #define IotMqtt_MallocConnection pvPortMalloc + #define IotMqtt_FreeConnection vPortFree + #define IotMqtt_MallocMessage pvPortMalloc + #define IotMqtt_FreeMessage vPortFree + #define IotMqtt_MallocOperation pvPortMalloc + #define IotMqtt_FreeOperation vPortFree + #define IotMqtt_MallocSubscription pvPortMalloc + #define IotMqtt_FreeSubscription vPortFree + + #define IotSerializer_MallocCborEncoder pvPortMalloc + #define IotSerializer_FreeCborEncoder vPortFree + #define IotSerializer_MallocCborParser pvPortMalloc + #define IotSerializer_FreeCborParser vPortFree + #define IotSerializer_MallocCborValue pvPortMalloc + #define IotSerializer_FreeCborValue vPortFree + #define IotSerializer_MallocDecoderObject pvPortMalloc + #define IotSerializer_FreeDecoderObject vPortFree + + #define AwsIotShadow_MallocOperation pvPortMalloc + #define AwsIotShadow_FreeOperation vPortFree + #define AwsIotShadow_MallocString pvPortMalloc + #define AwsIotShadow_FreeString vPortFree + #define AwsIotShadow_MallocSubscription pvPortMalloc + #define AwsIotShadow_FreeSubscription vPortFree + + #define AwsIotDefender_MallocReport pvPortMalloc + #define AwsIotDefender_FreeReport vPortFree + #define AwsIotDefender_MallocTopic pvPortMalloc + #define AwsIotDefender_FreeTopic vPortFree +#endif /* if IOT_STATIC_MEMORY_ONLY == 0 */ + +/* Default platform thread stack size and priority. */ +#ifndef IOT_THREAD_DEFAULT_STACK_SIZE + #define IOT_THREAD_DEFAULT_STACK_SIZE 2048 +#endif +#ifndef IOT_THREAD_DEFAULT_PRIORITY + #define IOT_THREAD_DEFAULT_PRIORITY tskIDLE_PRIORITY +#endif + +/* Platform network configuration. */ +#ifndef IOT_NETWORK_RECEIVE_TASK_PRIORITY + #define IOT_NETWORK_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#endif +#ifndef IOT_NETWORK_RECEIVE_TASK_STACK_SIZE + #define IOT_NETWORK_RECEIVE_TASK_STACK_SIZE IOT_THREAD_DEFAULT_STACK_SIZE +#endif + +/* Platform and SDK name for AWS IoT MQTT metrics. Only used when + * AWS_IOT_MQTT_ENABLE_METRICS is 1. */ +#define IOT_SDK_NAME "AmazonFreeRTOS" +#ifdef configPLATFORM_NAME + #define IOT_PLATFORM_NAME configPLATFORM_NAME +#else + #define IOT_PLATFORM_NAME "Unknown" +#endif + +/* Cloud endpoint to which the device connects to. */ +#define IOT_CLOUD_ENDPOINT clientcredentialMQTT_BROKER_ENDPOINT + +/** + * @brief Unique identifier used to recognize a device by the cloud. + * This could be SHA-256 of the device certificate. + */ +extern const char *getDeviceIdentifier( void ); +#define IOT_DEVICE_IDENTIFIER getDeviceIdentifier() + +/** + * @brief Metrics emitted by the device. + */ +extern const char *getDeviceMetrics( void ); +#define AWS_IOT_METRICS_USERNAME getDeviceMetrics() + +/** + * @brief Length of the metrics emitted by device. + */ +extern uint16_t getDeviceMetricsLength( void ); +#define AWS_IOT_METRICS_USERNAME_LENGTH getDeviceMetricsLength() + +/* Define the data type of metrics connection id as same as Socket_t in aws_secure_socket.h */ +#define IotMetricsConnectionId_t void * + +/* Configuration for defender demo: set format to CBOR. */ +#define AWS_IOT_DEFENDER_FORMAT AWS_IOT_DEFENDER_FORMAT_CBOR + +/* 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_ */ diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_IoT_SDK/TaskPool/main.c b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_IoT_SDK/TaskPool/main.c new file mode 100644 index 000000000..bf6e538da --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_IoT_SDK/TaskPool/main.c @@ -0,0 +1,156 @@ +/* Kernel includes. */ +#include "FreeRTOS.h" +#include "task.h" + +void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize ); +void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize ); + + +int main( void ) +{ + return 0; +} + +/*-----------------------------------------------------------*/ + +void vApplicationMallocFailedHook( void ) +{ + /* vApplicationMallocFailedHook() will only be called if + configUSE_MALLOC_FAILED_HOOK is set to 1 in FreeRTOSConfig.h. It is a hook + function that will get called if a call to pvPortMalloc() fails. + pvPortMalloc() is called internally by the kernel whenever a task, queue, + timer or semaphore is created. It is also called by various parts of the + demo application. If heap_1.c, heap_2.c or heap_4.c is being used, then the + size of the heap available to pvPortMalloc() is defined by + configTOTAL_HEAP_SIZE in FreeRTOSConfig.h, and the xPortGetFreeHeapSize() + API function can be used to query the size of free heap space that remains + (although it does not provide information on how the remaining heap might be + fragmented). See http://www.freertos.org/a00111.html for more + information. */ + vAssertCalled( __LINE__, __FILE__ ); +} +/*-----------------------------------------------------------*/ + +void vApplicationIdleHook( void ) +{ + /* vApplicationIdleHook() will only be called if configUSE_IDLE_HOOK is set + to 1 in FreeRTOSConfig.h. It will be called on each iteration of the idle + task. It is essential that code added to this hook function never attempts + to block in any way (for example, call xQueueReceive() with a block time + specified, or call vTaskDelay()). If application tasks make use of the + vTaskDelete() API function to delete themselves then it is also important + that vApplicationIdleHook() is permitted to return to its calling function, + because it is the responsibility of the idle task to clean up memory + allocated by the kernel to any task that has since deleted itself. */ +} +/*-----------------------------------------------------------*/ + +void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +{ + ( void ) pcTaskName; + ( void ) pxTask; + + /* Run time stack overflow checking is performed if + configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook + function is called if a stack overflow is detected. This function is + provided as an example only as stack overflow checking does not function + when running the FreeRTOS Windows port. */ + vAssertCalled( __LINE__, __FILE__ ); +} +/*-----------------------------------------------------------*/ + +void vApplicationTickHook( void ) +{ + /* This function will be called by each tick interrupt if + configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be + added here, but the tick hook is called from an interrupt context, so + code must not attempt to block, and only the interrupt safe FreeRTOS API + functions can be used (those that end in FromISR()). */ +} +/*-----------------------------------------------------------*/ + +void vApplicationDaemonTaskStartupHook( void ) +{ + /* This function will be called once only, when the daemon task starts to + execute (sometimes called the timer task). This is useful if the + application includes initialisation code that would benefit from executing + after the scheduler has been started. */ +} +/*-----------------------------------------------------------*/ + +void vAssertCalled( unsigned long ulLine, const char * const pcFileName ) +{ +volatile uint32_t ulSetToNonZeroInDebuggerToContinue = 0; + + /* Called if an assertion passed to configASSERT() fails. See + http://www.freertos.org/a00110.html#configASSERT for more information. */ + + /* Parameters are not used. */ + ( void ) ulLine; + ( void ) pcFileName; + + + taskENTER_CRITICAL(); + { + /* You can step out of this function to debug the assertion by using + the debugger to set ulSetToNonZeroInDebuggerToContinue to a non-zero + value. */ + while( ulSetToNonZeroInDebuggerToContinue == 0 ) + { + __asm volatile( "NOP" ); + __asm volatile( "NOP" ); + } + } + taskEXIT_CRITICAL(); +} +/*-----------------------------------------------------------*/ + +/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an +implementation of vApplicationGetIdleTaskMemory() to provide the memory that is +used by the Idle task. */ +void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize ) +{ +/* If the buffers to be provided to the Idle task are declared inside this +function then they must be declared static - otherwise they will be allocated on +the stack and so not exists after this function exits. */ +static StaticTask_t xIdleTaskTCB; +static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ]; + + /* Pass out a pointer to the StaticTask_t structure in which the Idle task's + state will be stored. */ + *ppxIdleTaskTCBBuffer = &xIdleTaskTCB; + + /* Pass out the array that will be used as the Idle task's stack. */ + *ppxIdleTaskStackBuffer = uxIdleTaskStack; + + /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer. + Note that, as the array is necessarily of type StackType_t, + configMINIMAL_STACK_SIZE is specified in words, not bytes. */ + *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; +} +/*-----------------------------------------------------------*/ + +/* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the +application must provide an implementation of vApplicationGetTimerTaskMemory() +to provide the memory that is used by the Timer service task. */ +void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize ) +{ +/* If the buffers to be provided to the Timer task are declared inside this +function then they must be declared static - otherwise they will be allocated on +the stack and so not exists after this function exits. */ +static StaticTask_t xTimerTaskTCB; +static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ]; + + /* Pass out a pointer to the StaticTask_t structure in which the Timer + task's state will be stored. */ + *ppxTimerTaskTCBBuffer = &xTimerTaskTCB; + + /* Pass out the array that will be used as the Timer task's stack. */ + *ppxTimerTaskStackBuffer = uxTimerTaskStack; + + /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer. + Note that, as the array is necessarily of type StackType_t, + configMINIMAL_STACK_SIZE is specified in words, not bytes. */ + *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; +} +