OTA Demos (#573)
This change adds the OTA demos and required dependencies and helper components . * Add demos , configs and project files * Add subscription manager * Add HTTP utils * Submodules the OTA LTS 3.0 Library. * Add OTA palpull/585/head
parent
43bd42db27
commit
04f0f68f61
@ -0,0 +1,248 @@
|
||||
/*
|
||||
* FreeRTOS V202012.00
|
||||
* Copyright (C) 2020 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.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
/* Standard includes. */
|
||||
#include <assert.h>
|
||||
|
||||
#include "http_demo_utils.h"
|
||||
|
||||
/* Exponential backoff retry include. */
|
||||
#include "backoff_algorithm.h"
|
||||
|
||||
/* Parser utilities. */
|
||||
#include "http_parser.h"
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @brief The maximum number of retries for network operation with server.
|
||||
*/
|
||||
#define RETRY_MAX_ATTEMPTS ( 5U )
|
||||
|
||||
/**
|
||||
* @brief The maximum back-off delay (in milliseconds) for retrying failed
|
||||
* operation with server.
|
||||
*/
|
||||
#define RETRY_MAX_BACKOFF_DELAY_MS ( 5000U )
|
||||
|
||||
/**
|
||||
* @brief The base back-off delay (in milliseconds) to use for network operation
|
||||
* retry attempts.
|
||||
*/
|
||||
#define RETRY_BACKOFF_BASE_MS ( 500U )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @brief Each compilation unit that consumes the NetworkContext must define it.
|
||||
* It should contain a single pointer to the type of your desired transport.
|
||||
* This utility is used by both TLS and plaintext HTTP demos, so define this pointer as void *.
|
||||
*
|
||||
* @note Transport stacks are defined in FreeRTOS-Plus/Source/Application-Protocols/network_transport.
|
||||
*/
|
||||
struct NetworkContext
|
||||
{
|
||||
void * pParams;
|
||||
};
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
extern UBaseType_t uxRand();
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
BaseType_t connectToServerWithBackoffRetries( TransportConnect_t connectFunction,
|
||||
NetworkContext_t * pxNetworkContext )
|
||||
{
|
||||
BaseType_t xReturn = pdFAIL;
|
||||
/* Status returned by the retry utilities. */
|
||||
BackoffAlgorithmStatus_t xBackoffAlgStatus = BackoffAlgorithmSuccess;
|
||||
/* Struct containing the next backoff time. */
|
||||
BackoffAlgorithmContext_t xReconnectParams;
|
||||
uint16_t usNextBackoff = 0U;
|
||||
|
||||
assert( connectFunction != NULL );
|
||||
|
||||
/* Initialize reconnect attempts and interval */
|
||||
BackoffAlgorithm_InitializeParams( &xReconnectParams,
|
||||
RETRY_BACKOFF_BASE_MS,
|
||||
RETRY_MAX_BACKOFF_DELAY_MS,
|
||||
RETRY_MAX_ATTEMPTS );
|
||||
|
||||
/* Attempt to connect to the HTTP server. If connection fails, retry after a
|
||||
* timeout. The timeout value will exponentially increase until either the
|
||||
* maximum timeout value is reached or the set number of attempts are
|
||||
* exhausted.*/
|
||||
do
|
||||
{
|
||||
xReturn = connectFunction( pxNetworkContext );
|
||||
|
||||
if( xReturn != pdPASS )
|
||||
{
|
||||
/* Generate a random number and calculate backoff value (in milliseconds) for
|
||||
* the next connection retry.
|
||||
* Note: It is recommended to seed the random number generator with a device-specific
|
||||
* entropy source so that possibility of multiple devices retrying failed network operations
|
||||
* at similar intervals can be avoided. */
|
||||
xBackoffAlgStatus = BackoffAlgorithm_GetNextBackoff( &xReconnectParams, uxRand(), &usNextBackoff );
|
||||
|
||||
if( xBackoffAlgStatus == BackoffAlgorithmSuccess )
|
||||
{
|
||||
LogWarn( ( "Connection to the HTTP server failed. "
|
||||
"Retrying connection with backoff and jitter." ) );
|
||||
LogInfo( ( "Retry attempt %lu out of maximum retry attempts %lu.",
|
||||
xReconnectParams.attemptsDone,
|
||||
RETRY_MAX_ATTEMPTS ) );
|
||||
}
|
||||
}
|
||||
} while( ( xReturn == pdFAIL ) && ( xBackoffAlgStatus == BackoffAlgorithmSuccess ) );
|
||||
|
||||
if( xReturn == pdFAIL )
|
||||
{
|
||||
LogError( ( "Connection to the server failed, all attempts exhausted." ) );
|
||||
}
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
HTTPStatus_t getUrlPath( const char * pcUrl,
|
||||
size_t xUrlLen,
|
||||
const char ** pcPath,
|
||||
size_t * pxPathLen )
|
||||
{
|
||||
/* http-parser status. Initialized to 1 to signify failure. */
|
||||
int lParserStatus = 1;
|
||||
struct http_parser_url xUrlParser;
|
||||
HTTPStatus_t xHTTPStatus = HTTPSuccess;
|
||||
|
||||
/* Sets all members in xUrlParser to 0. */
|
||||
http_parser_url_init( &xUrlParser );
|
||||
|
||||
if( ( pcUrl == NULL ) || ( pcPath == NULL ) || ( pxPathLen == NULL ) )
|
||||
{
|
||||
LogError( ( "NULL parameter passed to getUrlPath()." ) );
|
||||
xHTTPStatus = HTTPInvalidParameter;
|
||||
}
|
||||
|
||||
if( xHTTPStatus == HTTPSuccess )
|
||||
{
|
||||
lParserStatus = http_parser_parse_url( pcUrl, xUrlLen, 0, &xUrlParser );
|
||||
|
||||
if( lParserStatus != 0 )
|
||||
{
|
||||
LogError( ( "Error parsing the input URL %.*s. Error code: %d.",
|
||||
( int32_t ) xUrlLen,
|
||||
pcUrl,
|
||||
lParserStatus ) );
|
||||
xHTTPStatus = HTTPParserInternalError;
|
||||
}
|
||||
}
|
||||
|
||||
if( xHTTPStatus == HTTPSuccess )
|
||||
{
|
||||
*pxPathLen = ( size_t ) ( xUrlParser.field_data[ UF_PATH ].len );
|
||||
|
||||
if( *pxPathLen == 0 )
|
||||
{
|
||||
xHTTPStatus = HTTPNoResponse;
|
||||
*pcPath = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
*pcPath = &pcUrl[ xUrlParser.field_data[ UF_PATH ].off ];
|
||||
}
|
||||
}
|
||||
|
||||
if( xHTTPStatus != HTTPSuccess )
|
||||
{
|
||||
LogError( ( "Error parsing the path from URL %s. Error code: %d",
|
||||
pcUrl,
|
||||
xHTTPStatus ) );
|
||||
}
|
||||
|
||||
return xHTTPStatus;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
HTTPStatus_t getUrlAddress( const char * pcUrl,
|
||||
size_t xUrlLen,
|
||||
const char ** pcAddress,
|
||||
size_t * pxAddressLen )
|
||||
{
|
||||
/* http-parser status. Initialized to 1 to signify failure. */
|
||||
int lParserStatus = 1;
|
||||
struct http_parser_url xUrlParser;
|
||||
HTTPStatus_t xHTTPStatus = HTTPSuccess;
|
||||
|
||||
/* Sets all members in xUrlParser to 0. */
|
||||
http_parser_url_init( &xUrlParser );
|
||||
|
||||
if( ( pcUrl == NULL ) || ( pcAddress == NULL ) || ( pxAddressLen == NULL ) )
|
||||
{
|
||||
LogError( ( "NULL parameter passed to getUrlAddress()." ) );
|
||||
xHTTPStatus = HTTPInvalidParameter;
|
||||
}
|
||||
|
||||
if( xHTTPStatus == HTTPSuccess )
|
||||
{
|
||||
lParserStatus = http_parser_parse_url( pcUrl, xUrlLen, 0, &xUrlParser );
|
||||
|
||||
if( lParserStatus != 0 )
|
||||
{
|
||||
LogError( ( "Error parsing the input URL %.*s. Error code: %d.",
|
||||
( int32_t ) xUrlLen,
|
||||
pcUrl,
|
||||
lParserStatus ) );
|
||||
xHTTPStatus = HTTPParserInternalError;
|
||||
}
|
||||
}
|
||||
|
||||
if( xHTTPStatus == HTTPSuccess )
|
||||
{
|
||||
*pxAddressLen = ( size_t ) ( xUrlParser.field_data[ UF_HOST ].len );
|
||||
|
||||
if( *pxAddressLen == 0 )
|
||||
{
|
||||
xHTTPStatus = HTTPNoResponse;
|
||||
*pcAddress = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
*pcAddress = &pcUrl[ xUrlParser.field_data[ UF_HOST ].off ];
|
||||
}
|
||||
}
|
||||
|
||||
if( xHTTPStatus != HTTPSuccess )
|
||||
{
|
||||
LogError( ( "Error parsing the address from URL %s. Error code %d",
|
||||
pcUrl,
|
||||
xHTTPStatus ) );
|
||||
}
|
||||
|
||||
return xHTTPStatus;
|
||||
}
|
@ -0,0 +1,127 @@
|
||||
/*
|
||||
* FreeRTOS V202012.00
|
||||
* Copyright (C) 2020 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.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HTTP_DEMO_UTILS_H
|
||||
#define HTTP_DEMO_UTILS_H
|
||||
|
||||
/* Standard includes. */
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
/* Kernel includes. */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
/* HTTP API header. */
|
||||
#include "core_http_client.h"
|
||||
|
||||
/**
|
||||
* @brief Function pointer for establishing connection to a server.
|
||||
*
|
||||
* @param[out] pxNetworkContext Implementation-defined network context.
|
||||
*
|
||||
* @return pdFAIL on failure; pdPASS on successful connection.
|
||||
*/
|
||||
typedef BaseType_t ( * TransportConnect_t )( NetworkContext_t * pxNetworkContext );
|
||||
|
||||
/**
|
||||
* @brief Connect to a server with reconnection retries.
|
||||
*
|
||||
* If connection fails, retry is attempted after a timeout. The timeout value
|
||||
* will exponentially increase until either the maximum timeout value is reached
|
||||
* or the set number of attempts are exhausted.
|
||||
*
|
||||
* @param[in] connectFunction Function pointer for establishing connection to a
|
||||
* server.
|
||||
* @param[out] pxNetworkContext Implementation-defined network context.
|
||||
*
|
||||
* @return pdFAIL on failure; pdPASS on successful connection.
|
||||
*/
|
||||
BaseType_t connectToServerWithBackoffRetries( TransportConnect_t connectFunction,
|
||||
NetworkContext_t * pxNetworkContext );
|
||||
|
||||
/**
|
||||
* @brief Retrieve the path from the input URL.
|
||||
*
|
||||
* This function retrieves the location and length of the path from within the
|
||||
* input the URL. The query is not included in the length returned.
|
||||
*
|
||||
* The URL MUST start with "http://" or "https://" to find the path.
|
||||
*
|
||||
* For example, if pcUrl is:
|
||||
* "https://www.somewebsite.com/path/to/item.txt?optionalquery=stuff"
|
||||
*
|
||||
* Then pcPath and pxPathLen will be the following:
|
||||
* *pcPath = "/path/to/item.txt?optionalquery=stuff"
|
||||
* *pxPathLen = 17
|
||||
*
|
||||
* @param[in] pcUrl URL string to parse.
|
||||
* @param[in] xUrlLen The length of the URL string input.
|
||||
* @param[out] pcPath pointer within input url that the path starts at.
|
||||
* @param[out] pxPathLen Length of the path.
|
||||
*
|
||||
* @return The status of the parsing attempt:
|
||||
* HTTPSuccess if the path was successfully parsed,
|
||||
* HTTPParserInternalError if there was an error parsing the URL,
|
||||
* or HTTPNoResponse if the path was not found.
|
||||
*/
|
||||
HTTPStatus_t getUrlPath( const char * pcUrl,
|
||||
size_t xUrlLen,
|
||||
const char ** pcPath,
|
||||
size_t * pxPathLen );
|
||||
|
||||
/**
|
||||
* @brief Retrieve the Address from the input URL.
|
||||
*
|
||||
* This function retrieves the location and length of the address from within
|
||||
* the input URL. The path and query are not included in the length returned.
|
||||
*
|
||||
* The URL MUST start with "http://" or "https://" to find the address.
|
||||
*
|
||||
* For example, if pcUrl is:
|
||||
* "https://www.somewebsite.com/path/to/item.txt?optionalquery=stuff"
|
||||
*
|
||||
* Then pcAddress and pxAddressLen will be the following:
|
||||
* *pcAddress = "www.somewebsite.com/path/to/item.txt?optionalquery=stuff"
|
||||
* *pxAddressLen = 19
|
||||
*
|
||||
* @param[in] pcUrl URL string to parse.
|
||||
* @param[in] xUrlLen The length of the URL string input.
|
||||
* @param[out] pcAddress pointer within input url that the address starts at.
|
||||
* @param[out] pxAddressLen Length of the address.
|
||||
*
|
||||
* @return The status of the parsing attempt:
|
||||
* HTTPSuccess if the path was successfully parsed,
|
||||
* HTTPParserInternalError if there was an error parsing the URL,
|
||||
* or HTTPNoResponse if the path was not found.
|
||||
*/
|
||||
HTTPStatus_t getUrlAddress( const char * pcUrl,
|
||||
size_t xUrlLen,
|
||||
const char ** pcAddress,
|
||||
size_t * pxAddressLen );
|
||||
|
||||
#endif /* ifndef HTTP_DEMO_UTILS_H */
|
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* FreeRTOS V202012.00
|
||||
* Copyright (C) 2020 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.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file aws_ota_codesigner_certificate.h
|
||||
* @brief Code signer certifciate as char array.
|
||||
*
|
||||
* Define this char array containing the PEM encode signing certificate.
|
||||
* Note - It is highly recommended to use this for demo pupose and store
|
||||
* certificates in secure location in production devices.
|
||||
*/
|
||||
|
||||
#ifndef __CODESIGNER_CERTIFICATE__H__
|
||||
#define __CODESIGNER_CERTIFICATE__H__
|
||||
|
||||
/*
|
||||
* PEM-encoded code signer certificate
|
||||
*
|
||||
* Must include the PEM header and footer:
|
||||
* "-----BEGIN CERTIFICATE-----\n"
|
||||
* "...base64 data...\n"
|
||||
* "-----END CERTIFICATE-----\n";
|
||||
*/
|
||||
static const char signingcredentialSIGNING_CERTIFICATE_PEM[] = "...Insert here...";
|
||||
|
||||
#endif
|
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* FreeRTOS V202012.00
|
||||
* Copyright (C) 2020 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.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file code_signature_verification.h
|
||||
* @brief Interface for code siganture verfication funtions.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CODE_SIGNATURE_VERIFICATION_H
|
||||
#define CODE_SIGNATURE_VERIFICATION_H
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
|
||||
/**
|
||||
* @brief Validate the integrity of the new image to be activated.
|
||||
* @param[in] pFileContext pointer to File context
|
||||
* @return OtaPalMainStatus_t , OtaPalSuccess if the signature of the image is valid.
|
||||
*/
|
||||
OtaPalMainStatus_t xValidateImageSignature( OtaFileContext_t* const pFileContext );
|
||||
|
||||
#endif
|
@ -0,0 +1,465 @@
|
||||
/*
|
||||
* FreeRTOS V202012.00
|
||||
* Copyright (C) 2020 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.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file code_signature_verfication_mbedtls.c
|
||||
* @brief Code signature verification using mbedtls crypto.
|
||||
*
|
||||
* The file demonstrates implements the code signature verfication functionality on
|
||||
* the specified file using mbedtls for SHA256 ECDSA.
|
||||
*/
|
||||
|
||||
/* C runtime includes. */
|
||||
#include <string.h>
|
||||
|
||||
/* FreeRTOS includes. */
|
||||
#include "FreeRTOS.h"
|
||||
|
||||
/* mbedTLS includes. */
|
||||
#if !defined( MBEDTLS_CONFIG_FILE )
|
||||
#include "mbedtls/config.h"
|
||||
#else
|
||||
#include MBEDTLS_CONFIG_FILE
|
||||
#endif
|
||||
#include "mbedtls/platform.h"
|
||||
#include "mbedtls/sha256.h"
|
||||
#include "mbedtls/sha1.h"
|
||||
#include "mbedtls/pk.h"
|
||||
#include "mbedtls/x509_crt.h"
|
||||
|
||||
/* OTA includes. */
|
||||
#include "ota.h"
|
||||
|
||||
/* Signature verification includes. */
|
||||
#include "code_signature_verification.h"
|
||||
#include "aws_ota_codesigner_certificate.h"
|
||||
|
||||
/**
|
||||
* @brief SHA256 buffer size for storing cryptographic hash computation results.
|
||||
*/
|
||||
#define SHA256_DIGEST_BYTES 32
|
||||
|
||||
/* Size of buffer used in file operations on this platform (Windows). */
|
||||
#define OTA_PAL_WIN_BUF_SIZE ( ( size_t ) 4096UL )
|
||||
|
||||
/**
|
||||
* @brief Library-independent cryptographic algorithm identifiers.
|
||||
*/
|
||||
#define HASH_ALGORITHM_SHA1 1
|
||||
#define HASH_ALGORITHM_SHA256 2
|
||||
#define ASYMMETRIC_ALGORITHM_RSA 1
|
||||
#define ASYMMETRIC_ALGORITHM_ECDSA 2
|
||||
|
||||
/**
|
||||
* @brief Internal signature verification context structure.
|
||||
*/
|
||||
typedef struct SignatureVerificationState
|
||||
{
|
||||
BaseType_t xAsymmetricAlgorithm;
|
||||
BaseType_t xHashAlgorithm;
|
||||
mbedtls_sha256_context xSHA256Context;
|
||||
} SignatureVerificationState_t, * SignatureVerificationStatePtr_t;
|
||||
|
||||
/**
|
||||
* @brief Initializes digital signature verification.
|
||||
*
|
||||
* @param[out] ppvContext Opaque context structure.
|
||||
* @param[in] xAsymmetricAlgorithm Cryptographic public key cryptosystem.
|
||||
* @param[in] xHashAlgorithm Cryptographic hash algorithm that was used for signing.
|
||||
*
|
||||
* @return pdTRUE if initialization succeeds, or pdFALSE otherwise.
|
||||
*/
|
||||
static BaseType_t prvSignatureVerificationStart(void** ppvContext,
|
||||
BaseType_t xAsymmetricAlgorithm,
|
||||
BaseType_t xHashAlgorithm);
|
||||
|
||||
/**
|
||||
* @brief Updates a cryptographic hash computation with the specified byte array.
|
||||
*
|
||||
* @param[in] pvContext Opaque context structure.
|
||||
* @param[in] pucData Byte array that was signed.
|
||||
* @param[in] xDataLength Length in bytes of data that was signed.
|
||||
*/
|
||||
static void prvSignatureVerificationUpdate(void* pvContext,
|
||||
const uint8_t* pucData,
|
||||
size_t xDataLength);
|
||||
|
||||
/**
|
||||
* @brief Verifies a digital signature computation using the public key from the
|
||||
* specified certificate.
|
||||
*
|
||||
* @param[in] pvContext Opaque context structure.
|
||||
* @param[in] pucSignerCertificate Base64 and DER encoded X.509 certificate of the
|
||||
* signer.
|
||||
* @param[in] xSignerCertificateLength Length in bytes of the certificate.
|
||||
* @param[in] pucSignature Digital signature result to verify.
|
||||
* @param[in] xSignatureLength in bytes of digital signature result.
|
||||
*
|
||||
* @return pdTRUE if the signature is correct or pdFALSE if the signature is invalid.
|
||||
*/
|
||||
static BaseType_t prvSignatureVerificationFinal(void* pvContext,
|
||||
char* pcSignerCertificate,
|
||||
size_t xSignerCertificateLength,
|
||||
uint8_t* pucSignature,
|
||||
size_t xSignatureLength);
|
||||
|
||||
/* Read the specified signer certificate from the filesystem into a local buffer. The allocated
|
||||
* memory becomes the property of the caller who is responsible for freeing it.
|
||||
*/
|
||||
|
||||
static uint8_t* otaPal_ReadAndAssumeCertificate(const uint8_t* const pucCertName,
|
||||
uint32_t* const ulSignerCertSize)
|
||||
{
|
||||
FILE* pFile;
|
||||
uint8_t* pucSignerCert = NULL;
|
||||
uint8_t* pucCertData = NULL;
|
||||
int32_t lSize = 0; /* For MISRA mandatory. */
|
||||
int32_t lWindowsError;
|
||||
|
||||
pFile = fopen((const char*)pucCertName, "rb"); /*lint !e586
|
||||
* C standard library call is being used for portability. */
|
||||
|
||||
if (pFile != NULL)
|
||||
{
|
||||
lWindowsError = fseek(pFile, 0, SEEK_END); /*lint !e586
|
||||
* C standard library call is being used for portability. */
|
||||
|
||||
if (lWindowsError == 0) /* fseek returns a non-zero value on error. */
|
||||
{
|
||||
lSize = (int32_t)ftell(pFile); /*lint !e586 Allow call in this context. */
|
||||
|
||||
if (lSize != -1L) /* ftell returns -1 on error. */
|
||||
{
|
||||
lWindowsError = fseek(pFile, 0, SEEK_SET); /*lint !e586
|
||||
* C standard library call is being used for portability. */
|
||||
}
|
||||
else /* ftell returned an error, pucSignerCert remains NULL. */
|
||||
{
|
||||
lWindowsError = -1L;
|
||||
}
|
||||
} /* else fseek returned an error, pucSignerCert remains NULL. */
|
||||
|
||||
if (lWindowsError == 0)
|
||||
{
|
||||
/* Allocate memory for the signer certificate plus a terminating zero so we can load and return it to the caller. */
|
||||
pucSignerCert = pvPortMalloc(lSize + 1); /*lint !e732 !e9034 !e9079 Allow conversion. */
|
||||
}
|
||||
|
||||
if (pucSignerCert != NULL)
|
||||
{
|
||||
if (fread(pucSignerCert, 1, lSize, pFile) == (size_t)lSize) /*lint !e586 !e732 !e9034
|
||||
* C standard library call is being used for portability. */
|
||||
{
|
||||
/* The crypto code requires the terminating zero to be part of the length so add 1 to the size. */
|
||||
*ulSignerCertSize = lSize + 1;
|
||||
pucSignerCert[lSize] = 0;
|
||||
}
|
||||
else
|
||||
{ /* There was a problem reading the certificate file so free the memory and abort. */
|
||||
vPortFree(pucSignerCert);
|
||||
pucSignerCert = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LogError(("Failed to allocate memory for signer cert contents.\r\n"));
|
||||
/* Nothing special to do. */
|
||||
}
|
||||
|
||||
lWindowsError = fclose(pFile); /*lint !e586
|
||||
* C standard library call is being used for portability. */
|
||||
|
||||
if (lWindowsError != 0)
|
||||
{
|
||||
LogError(("File pointer operation failed.\r\n"));
|
||||
pucSignerCert = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LogError(("No such certificate file: %s. Using aws_ota_codesigner_certificate.h.\r\n",
|
||||
(const char*)pucCertName));
|
||||
|
||||
/* Allocate memory for the signer certificate plus a terminating zero so we can copy it and return to the caller. */
|
||||
lSize = sizeof(signingcredentialSIGNING_CERTIFICATE_PEM);
|
||||
pucSignerCert = pvPortMalloc(lSize); /*lint !e9029 !e9079 !e838 malloc proto requires void*. */
|
||||
pucCertData = (uint8_t*)signingcredentialSIGNING_CERTIFICATE_PEM; /*lint !e9005 we don't modify the cert but it could be set by PKCS11 so it's not const. */
|
||||
|
||||
if (pucSignerCert != NULL)
|
||||
{
|
||||
memcpy(pucSignerCert, pucCertData, lSize);
|
||||
*ulSignerCertSize = lSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
LogError(("No memory for certificate of size %d!\r\n", lSize));
|
||||
}
|
||||
}
|
||||
|
||||
return pucSignerCert; /*lint !e480 !e481 fopen and fclose are being used by-design. */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Verifies a cryptographic signature based on the signer
|
||||
* certificate, hash algorithm, and the data that was signed.
|
||||
*/
|
||||
static BaseType_t prvVerifySignature(char* pcSignerCertificate,
|
||||
size_t xSignerCertificateLength,
|
||||
BaseType_t xHashAlgorithm,
|
||||
uint8_t* pucHash,
|
||||
size_t xHashLength,
|
||||
uint8_t* pucSignature,
|
||||
size_t xSignatureLength)
|
||||
{
|
||||
BaseType_t xResult = pdTRUE;
|
||||
mbedtls_x509_crt xCertCtx;
|
||||
mbedtls_md_type_t xMbedHashAlg = MBEDTLS_MD_SHA256;
|
||||
|
||||
(void)xHashAlgorithm;
|
||||
|
||||
memset(&xCertCtx, 0, sizeof(mbedtls_x509_crt));
|
||||
|
||||
/*
|
||||
* Decode and create a certificate context
|
||||
*/
|
||||
mbedtls_x509_crt_init(&xCertCtx);
|
||||
|
||||
if (0 != mbedtls_x509_crt_parse(
|
||||
&xCertCtx, (const unsigned char*)pcSignerCertificate, xSignerCertificateLength))
|
||||
{
|
||||
xResult = pdFALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Verify the signature using the public key from the decoded certificate
|
||||
*/
|
||||
if (pdTRUE == xResult)
|
||||
{
|
||||
if (0 != mbedtls_pk_verify(
|
||||
&xCertCtx.pk,
|
||||
xMbedHashAlg,
|
||||
pucHash,
|
||||
xHashLength,
|
||||
pucSignature,
|
||||
xSignatureLength))
|
||||
{
|
||||
xResult = pdFALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Clean-up
|
||||
*/
|
||||
mbedtls_x509_crt_free(&xCertCtx);
|
||||
|
||||
return xResult;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Creates signature verification context.
|
||||
*/
|
||||
static BaseType_t prvSignatureVerificationStart(void** ppvContext,
|
||||
BaseType_t xAsymmetricAlgorithm,
|
||||
BaseType_t xHashAlgorithm)
|
||||
{
|
||||
BaseType_t xResult = pdTRUE;
|
||||
SignatureVerificationState_t* pxCtx = NULL;
|
||||
|
||||
/*
|
||||
* Allocate the context
|
||||
*/
|
||||
if (NULL == (pxCtx = (SignatureVerificationStatePtr_t)pvPortMalloc(
|
||||
sizeof(*pxCtx)))) /*lint !e9087 Allow casting void* to other types. */
|
||||
{
|
||||
xResult = pdFALSE;
|
||||
}
|
||||
|
||||
if (pdTRUE == xResult)
|
||||
{
|
||||
*ppvContext = pxCtx;
|
||||
|
||||
/*
|
||||
* Store the algorithm identifiers
|
||||
*/
|
||||
pxCtx->xAsymmetricAlgorithm = xAsymmetricAlgorithm;
|
||||
pxCtx->xHashAlgorithm = xHashAlgorithm;
|
||||
|
||||
/*
|
||||
* Initialize the requested hash type
|
||||
*/
|
||||
mbedtls_sha256_init(&pxCtx->xSHA256Context);
|
||||
(void)mbedtls_sha256_starts_ret(&pxCtx->xSHA256Context, 0);
|
||||
}
|
||||
|
||||
return xResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Adds bytes to an in-progress hash for subsequent signature verification.
|
||||
*/
|
||||
static void prvSignatureVerificationUpdate(void* pvContext,
|
||||
const uint8_t* pucData,
|
||||
size_t xDataLength)
|
||||
{
|
||||
SignatureVerificationState_t* pxCtx = (SignatureVerificationStatePtr_t)pvContext; /*lint !e9087 Allow casting void* to other types. */
|
||||
|
||||
/*
|
||||
* Add the data to the hash of the requested type
|
||||
*/
|
||||
(void)mbedtls_sha256_update_ret(&pxCtx->xSHA256Context, pucData, xDataLength);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Performs signature verification on a cryptographic hash.
|
||||
*/
|
||||
static BaseType_t prvSignatureVerificationFinal(void* pvContext,
|
||||
char* pcSignerCertificate,
|
||||
size_t xSignerCertificateLength,
|
||||
uint8_t* pucSignature,
|
||||
size_t xSignatureLength)
|
||||
{
|
||||
BaseType_t xResult = pdFALSE;
|
||||
|
||||
if (pvContext != NULL)
|
||||
{
|
||||
SignatureVerificationStatePtr_t pxCtx = (SignatureVerificationStatePtr_t)pvContext; /*lint !e9087 Allow casting void* to other types. */
|
||||
uint8_t ucSHA256[SHA256_DIGEST_BYTES]; /* Reserve enough space for the larger for SHA256 results. */
|
||||
uint8_t* pucHash = NULL;
|
||||
size_t xHashLength = 0;
|
||||
|
||||
if ((pcSignerCertificate != NULL) &&
|
||||
(pucSignature != NULL) &&
|
||||
(xSignerCertificateLength > 0UL) &&
|
||||
(xSignatureLength > 0UL))
|
||||
{
|
||||
/*
|
||||
* Finish the hash.
|
||||
*/
|
||||
(void)mbedtls_sha256_finish_ret(&pxCtx->xSHA256Context, ucSHA256);
|
||||
pucHash = ucSHA256;
|
||||
xHashLength = SHA256_DIGEST_BYTES;
|
||||
|
||||
/*
|
||||
* Verify the signature.
|
||||
*/
|
||||
xResult = prvVerifySignature(pcSignerCertificate,
|
||||
xSignerCertificateLength,
|
||||
pxCtx->xHashAlgorithm,
|
||||
pucHash,
|
||||
xHashLength,
|
||||
pucSignature,
|
||||
xSignatureLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Allow function to be called with only the context pointer for cleanup after a failure. */
|
||||
}
|
||||
|
||||
/*
|
||||
* Clean-up
|
||||
*/
|
||||
vPortFree(pxCtx);
|
||||
}
|
||||
|
||||
return xResult;
|
||||
}
|
||||
|
||||
/* Verify the signature of the specified file. */
|
||||
OtaPalMainStatus_t xValidateImageSignature(OtaFileContext_t* const C)
|
||||
{
|
||||
OtaPalMainStatus_t eResult = OtaPalSuccess;
|
||||
uint32_t ulBytesRead;
|
||||
uint32_t ulSignerCertSize;
|
||||
uint8_t* pucBuf, * pucSignerCert;
|
||||
void* pvSigVerifyContext;
|
||||
|
||||
/* Verify an ECDSA-SHA256 signature. */
|
||||
if (pdFALSE == prvSignatureVerificationStart(&pvSigVerifyContext, ASYMMETRIC_ALGORITHM_ECDSA, HASH_ALGORITHM_SHA256))
|
||||
{
|
||||
eResult = OtaPalSignatureCheckFailed;
|
||||
}
|
||||
else
|
||||
{
|
||||
LogInfo(("Started %s signature verification, file: %s\r\n",
|
||||
OTA_JsonFileSignatureKey, (const char*)C->pCertFilepath));
|
||||
pucSignerCert = otaPal_ReadAndAssumeCertificate((const uint8_t* const)C->pCertFilepath, &ulSignerCertSize);
|
||||
|
||||
if (pucSignerCert != NULL)
|
||||
{
|
||||
pucBuf = pvPortMalloc( OTA_PAL_WIN_BUF_SIZE ); /*lint !e9079 Allow conversion. */
|
||||
|
||||
if (pucBuf != NULL)
|
||||
{
|
||||
/* Rewind the received file to the beginning. */
|
||||
if (fseek(C->pFile, 0L, SEEK_SET) == 0) /*lint !e586
|
||||
* C standard library call is being used for portability. */
|
||||
{
|
||||
do
|
||||
{
|
||||
ulBytesRead = fread(pucBuf, 1, OTA_PAL_WIN_BUF_SIZE, C->pFile); /*lint !e586
|
||||
* C standard library call is being used for portability. */
|
||||
/* Include the file chunk in the signature validation. Zero size is OK. */
|
||||
prvSignatureVerificationUpdate(pvSigVerifyContext, pucBuf, ulBytesRead);
|
||||
} while (ulBytesRead > 0UL);
|
||||
|
||||
if (pdFALSE == prvSignatureVerificationFinal(pvSigVerifyContext,
|
||||
(char*)pucSignerCert,
|
||||
(size_t)ulSignerCertSize,
|
||||
C->pSignature->data,
|
||||
C->pSignature->size)) /*lint !e732 !e9034 Allow comparison in this context. */
|
||||
{
|
||||
eResult = OtaPalSignatureCheckFailed;
|
||||
}
|
||||
pvSigVerifyContext = NULL; /* The context has been freed by prvSignatureVerificationFinal(). */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Nothing special to do. */
|
||||
}
|
||||
|
||||
/* Free the temporary file page buffer. */
|
||||
vPortFree(pucBuf);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogError(("Failed to allocate buffer memory.\r\n"));
|
||||
eResult = OtaPalOutOfMemory;
|
||||
}
|
||||
|
||||
/* Free the signer certificate that we now own after prvReadAndAssumeCertificate(). */
|
||||
vPortFree(pucSignerCert);
|
||||
}
|
||||
else
|
||||
{
|
||||
eResult = OtaPalBadSignerCert;
|
||||
}
|
||||
}
|
||||
|
||||
return eResult;
|
||||
}
|
@ -0,0 +1,419 @@
|
||||
/*
|
||||
* FreeRTOS V202012.00
|
||||
* Copyright (C) 2020 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.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file ota_pal.c
|
||||
* @brief OTA PAL implementation for Windows platform.
|
||||
*/
|
||||
|
||||
/* Standard includes. */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* Kernel includes. */
|
||||
#include "FreeRTOS.h"
|
||||
|
||||
/* Library config includes. */
|
||||
#include "ota_config.h"
|
||||
|
||||
/* OTA Library include. */
|
||||
#include "ota.h"
|
||||
#include "ota_pal.h"
|
||||
|
||||
#include "code_signature_verification.h"
|
||||
|
||||
/* Specify the OTA signature algorithm we support on this platform. */
|
||||
const char OTA_JsonFileSignatureKey[ OTA_FILE_SIG_KEY_STR_MAX_LENGTH ] = "sig-sha256-ecdsa";
|
||||
|
||||
static OtaPalMainStatus_t otaPal_CheckFileSignature( OtaFileContext_t * const C );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static inline BaseType_t prvContextValidate( OtaFileContext_t* pFileContext )
|
||||
{
|
||||
return( ( pFileContext != NULL ) &&
|
||||
( pFileContext->pFile != NULL ) ); /*lint !e9034 Comparison is correct for file pointer type. */
|
||||
}
|
||||
|
||||
/* Used to set the high bit of Windows error codes for a negative return value. */
|
||||
#define OTA_PAL_INT16_NEGATIVE_MASK ( 1 << 15 )
|
||||
|
||||
/* Attempt to create a new receive file for the file chunks as they come in. */
|
||||
|
||||
OtaPalStatus_t otaPal_CreateFileForRx( OtaFileContext_t* const C )
|
||||
{
|
||||
OtaPalMainStatus_t mainErr = OtaPalUninitialized;
|
||||
OtaPalSubStatus_t subErr = 0;
|
||||
|
||||
if( C != NULL )
|
||||
{
|
||||
if ( C->pFilePath != NULL )
|
||||
{
|
||||
C->pFile = fopen( ( const char * )C->pFilePath, "w+b" ); /*lint !e586
|
||||
* C standard library call is being used for portability. */
|
||||
|
||||
if ( C->pFile != NULL )
|
||||
{
|
||||
mainErr = OtaPalSuccess;
|
||||
LogInfo( ( "Receive file created.\r\n" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
mainErr = OtaPalRxFileCreateFailed;
|
||||
subErr = errno;
|
||||
LogError( ( "ERROR - Failed to start operation: already active!\r\n" ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mainErr = OtaPalRxFileCreateFailed;
|
||||
LogError( ( "ERROR - Invalid filepath in filecontext.\r\n" ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mainErr = OtaPalRxFileCreateFailed;
|
||||
LogError( ( "ERROR - Invalid file context provided.\r\n" ) );
|
||||
}
|
||||
|
||||
return OTA_PAL_COMBINE_ERR(mainErr,subErr);
|
||||
}
|
||||
|
||||
|
||||
/* Abort receiving the specified OTA update by closing the file. */
|
||||
|
||||
OtaPalStatus_t otaPal_Abort( OtaFileContext_t * const C )
|
||||
{
|
||||
/* Set default return status to uninitialized. */
|
||||
OtaPalMainStatus_t mainErr = OtaPalUninitialized;
|
||||
OtaPalSubStatus_t subErr = 0;
|
||||
int32_t lFileCloseResult;
|
||||
|
||||
if( NULL != C )
|
||||
{
|
||||
/* Close the OTA update file if it's open. */
|
||||
if( NULL != C->pFile )
|
||||
{
|
||||
lFileCloseResult = fclose( C->pFile ); /*lint !e482 !e586
|
||||
* Context file handle state is managed by this API. */
|
||||
C->pFile = NULL;
|
||||
|
||||
if( 0 == lFileCloseResult )
|
||||
{
|
||||
LogInfo( ( "File closed.\r\n" ) );
|
||||
mainErr = OtaPalSuccess;
|
||||
}
|
||||
else /* Failed to close file. */
|
||||
{
|
||||
LogError( ( "ERROR - Closing file failed.\r\n" ) );
|
||||
mainErr = OtaPalFileAbort;
|
||||
subErr = errno;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Nothing to do. No open file associated with this context. */
|
||||
mainErr = OtaPalSuccess;
|
||||
}
|
||||
}
|
||||
else /* Context was not valid. */
|
||||
{
|
||||
LogError( ( "ERROR - Invalid context.\r\n" ) );
|
||||
mainErr = OtaPalFileAbort;
|
||||
}
|
||||
|
||||
return OTA_PAL_COMBINE_ERR(mainErr,subErr);
|
||||
}
|
||||
|
||||
/* Write a block of data to the specified file. */
|
||||
int16_t otaPal_WriteBlock( OtaFileContext_t * const C,
|
||||
uint32_t ulOffset,
|
||||
uint8_t * const pacData,
|
||||
uint32_t ulBlockSize )
|
||||
{
|
||||
int32_t lResult = 0;
|
||||
|
||||
if( prvContextValidate( C ) == pdTRUE )
|
||||
{
|
||||
lResult = fseek( C->pFile, ulOffset, SEEK_SET ); /*lint !e586 !e713 !e9034
|
||||
* C standard library call is being used for portability. */
|
||||
|
||||
if( 0 == lResult )
|
||||
{
|
||||
lResult = fwrite( pacData, 1, ulBlockSize, C->pFile ); /*lint !e586 !e713 !e9034
|
||||
* C standard library call is being used for portability. */
|
||||
|
||||
if( lResult < 0 )
|
||||
{
|
||||
LogError( ( "ERROR - fwrite failed\r\n" ) );
|
||||
/* Mask to return a negative value. */
|
||||
lResult = OTA_PAL_INT16_NEGATIVE_MASK | errno; /*lint !e40 !e9027
|
||||
* Errno is being used in accordance with host API documentation.
|
||||
* Bitmasking is being used to preserve host API error with library status code. */
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LogError( ( "ERROR - fseek failed\r\n" ) );
|
||||
/* Mask to return a negative value. */
|
||||
lResult = OTA_PAL_INT16_NEGATIVE_MASK | errno; /*lint !e40 !e9027
|
||||
* Errno is being used in accordance with host API documentation.
|
||||
* Bitmasking is being used to preserve host API error with library status code. */
|
||||
}
|
||||
}
|
||||
else /* Invalid context or file pointer provided. */
|
||||
{
|
||||
LogError( ( "ERROR - Invalid context.\r\n" ) );
|
||||
lResult = -1; /*TODO: Need a negative error code from the PAL here. */
|
||||
}
|
||||
|
||||
return ( int16_t ) lResult;
|
||||
}
|
||||
|
||||
/* Close the specified file. This shall authenticate the file if it is marked as secure. */
|
||||
|
||||
OtaPalStatus_t otaPal_CloseFile( OtaFileContext_t * const C )
|
||||
{
|
||||
OtaPalMainStatus_t mainErr = OtaPalUninitialized;
|
||||
OtaPalSubStatus_t subErr = 0;
|
||||
int32_t lWindowsError = 0;
|
||||
|
||||
if( prvContextValidate( C ) == pdTRUE )
|
||||
{
|
||||
if( C->pSignature != NULL )
|
||||
{
|
||||
/* Verify the file signature, close the file and return the signature verification result. */
|
||||
mainErr = otaPal_CheckFileSignature( C );
|
||||
}
|
||||
else
|
||||
{
|
||||
LogError( ( "NULL OTA Signature structure.\r\n" ) );
|
||||
mainErr = OtaPalSignatureCheckFailed;
|
||||
}
|
||||
|
||||
/* Close the file. */
|
||||
lWindowsError = fclose( C->pFile ); /*lint !e482 !e586
|
||||
* C standard library call is being used for portability. */
|
||||
C->pFile = NULL;
|
||||
|
||||
if( lWindowsError != 0 )
|
||||
{
|
||||
LogError( ( "Failed to close OTA update file.\r\n" ) );
|
||||
mainErr = OtaPalFileClose;
|
||||
subErr = errno;
|
||||
}
|
||||
|
||||
if( mainErr == OtaPalSuccess )
|
||||
{
|
||||
LogInfo( ( "%s signature verification passed.\r\n", OTA_JsonFileSignatureKey ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
LogError( ( "Failed to pass %s signature verification: %d.\r\n",
|
||||
OTA_JsonFileSignatureKey, OTA_PAL_COMBINE_ERR(mainErr,subErr) ) );
|
||||
|
||||
/* If we fail to verify the file signature that means the image is not valid. We need to set the image state to aborted. */
|
||||
otaPal_SetPlatformImageState( C, OtaImageStateAborted );
|
||||
|
||||
}
|
||||
}
|
||||
else /* Invalid OTA Context. */
|
||||
{
|
||||
/* FIXME: Invalid error code for a null file context and file handle. */
|
||||
LogError( ( "Invalid file context.\r\n" ) );
|
||||
mainErr = OtaPalFileClose;
|
||||
}
|
||||
|
||||
return OTA_PAL_COMBINE_ERR(mainErr,subErr);
|
||||
}
|
||||
|
||||
|
||||
/* Verify the signature of the specified file. */
|
||||
|
||||
static OtaPalMainStatus_t otaPal_CheckFileSignature( OtaFileContext_t* const C )
|
||||
{
|
||||
OtaPalMainStatus_t eResult = OtaPalSignatureCheckFailed;
|
||||
|
||||
if ( prvContextValidate( C ) == pdTRUE )
|
||||
{
|
||||
eResult = xValidateImageSignature( C );
|
||||
}
|
||||
else
|
||||
{
|
||||
LogError( ( "OTA image signature is invalid.\r\n" ) );
|
||||
}
|
||||
|
||||
return eResult;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
OtaPalStatus_t otaPal_ResetDevice( OtaFileContext_t* const pFileContext )
|
||||
{
|
||||
(void)pFileContext;
|
||||
|
||||
/* Return no error. Windows implementation does not reset device. */
|
||||
return OTA_PAL_COMBINE_ERR(OtaPalSuccess,0);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
OtaPalStatus_t otaPal_ActivateNewImage( OtaFileContext_t* const pFileContext )
|
||||
{
|
||||
(void)pFileContext;
|
||||
|
||||
/* Return no error. Windows implementation simply does nothing on activate.
|
||||
* To run the new firmware image, double click the newly downloaded exe */
|
||||
return OTA_PAL_COMBINE_ERR(OtaPalSuccess,0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set the final state of the last transferred (final) OTA file (or bundle).
|
||||
* On Windows, the state of the OTA image is stored in PlaformImageState.txt.
|
||||
*/
|
||||
|
||||
OtaPalStatus_t otaPal_SetPlatformImageState( OtaFileContext_t * const pFileContext, OtaImageState_t eState )
|
||||
{
|
||||
(void)pFileContext;
|
||||
|
||||
OtaPalMainStatus_t mainErr = OtaPalSuccess;
|
||||
OtaPalSubStatus_t subErr = 0;
|
||||
FILE * pstPlatformImageState;
|
||||
|
||||
if( eState != OtaImageStateUnknown && eState <= OtaLastImageState )
|
||||
{
|
||||
pstPlatformImageState = fopen( "PlatformImageState.txt", "w+b" ); /*lint !e586
|
||||
* C standard library call is being used for portability. */
|
||||
|
||||
if( pstPlatformImageState != NULL )
|
||||
{
|
||||
/* Write the image state to PlatformImageState.txt. */
|
||||
if( 1 != fwrite( &eState, sizeof( OtaImageState_t ), 1, pstPlatformImageState ) ) /*lint !e586 !e9029
|
||||
* C standard library call is being used for portability. */
|
||||
{
|
||||
LogError( ( "Unable to write to image state file.\r\n" ) );
|
||||
mainErr = OtaPalBadImageState;
|
||||
subErr = errno;
|
||||
}
|
||||
|
||||
/* Close PlatformImageState.txt. */
|
||||
if( 0 != fclose( pstPlatformImageState ) ) /*lint !e586 Allow call in this context. */
|
||||
{
|
||||
LogError( ( "Unable to close image state file.\r\n" ) );
|
||||
mainErr = OtaPalBadImageState;
|
||||
subErr = errno;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LogError( ( "Unable to open image state file.\r\n" ) );
|
||||
mainErr = OtaPalBadImageState;
|
||||
subErr = errno;
|
||||
}
|
||||
} /*lint !e481 Allow fopen and fclose calls in this context. */
|
||||
else /* Image state invalid. */
|
||||
{
|
||||
LogError( ( "ERROR - Invalid image state provided.\r\n" ) );
|
||||
mainErr = OtaPalBadImageState;
|
||||
}
|
||||
|
||||
return OTA_PAL_COMBINE_ERR(mainErr,subErr);
|
||||
}
|
||||
|
||||
/* Get the state of the currently running image.
|
||||
*
|
||||
* On Windows, this is simulated by looking for and reading the state from
|
||||
* the PlatformImageState.txt file in the current working directory.
|
||||
*
|
||||
* We read this at OTA_Init time so we can tell if the MCU image is in self
|
||||
* test mode. If it is, we expect a successful connection to the OTA services
|
||||
* within a reasonable amount of time. If we don't satisfy that requirement,
|
||||
* we assume there is something wrong with the firmware and reset the device,
|
||||
* causing it to rollback to the previous code. On Windows, this is not
|
||||
* fully simulated as there is no easy way to reset the simulated device.
|
||||
*/
|
||||
OtaPalImageState_t otaPal_GetPlatformImageState( OtaFileContext_t * const pFileContext )
|
||||
{
|
||||
(void)pFileContext;
|
||||
|
||||
FILE * pstPlatformImageState;
|
||||
OtaImageState_t eSavedAgentState = OtaImageStateUnknown;
|
||||
OtaPalImageState_t ePalState = OtaPalImageStateUnknown;
|
||||
|
||||
pstPlatformImageState = fopen( "PlatformImageState.txt", "r+b" ); /*lint !e586
|
||||
* C standard library call is being used for portability. */
|
||||
|
||||
if( pstPlatformImageState != NULL )
|
||||
{
|
||||
if( 1 != fread( &eSavedAgentState, sizeof(OtaImageState_t), 1, pstPlatformImageState ) ) /*lint !e586 !e9029
|
||||
* C standard library call is being used for portability. */
|
||||
{
|
||||
/* If an error occured reading the file, mark the state as aborted. */
|
||||
LogError( ( "Unable to read image state file.\r\n" ) );
|
||||
ePalState = ( OtaPalImageStateInvalid | (errno & OTA_PAL_ERR_MASK) );
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (eSavedAgentState)
|
||||
{
|
||||
case OtaImageStateTesting:
|
||||
ePalState = OtaPalImageStatePendingCommit;
|
||||
break;
|
||||
case OtaImageStateAccepted:
|
||||
ePalState = OtaPalImageStateValid;
|
||||
break;
|
||||
case OtaImageStateRejected:
|
||||
case OtaImageStateAborted:
|
||||
default:
|
||||
ePalState = OtaPalImageStateInvalid;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if( 0 != fclose( pstPlatformImageState ) ) /*lint !e586
|
||||
* C standard library call is being used for portability. */
|
||||
{
|
||||
LogError( ( "Unable to close image state file.\r\n" ) );
|
||||
ePalState = (OtaPalImageStateInvalid | ( errno & OTA_PAL_ERR_MASK ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If no image state file exists, assume a factory image. */
|
||||
ePalState = OtaPalImageStateValid; /*lint !e64 Allow assignment. */
|
||||
}
|
||||
|
||||
return ePalState; /*lint !e64 !e480 !e481 I/O calls and return type are used per design. */
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Provide access to private members for testing. */
|
||||
#ifdef FREERTOS_ENABLE_UNIT_TESTS
|
||||
#include "aws_ota_pal_test_access_define.h"
|
||||
#endif
|
@ -0,0 +1,207 @@
|
||||
/*
|
||||
* FreeRTOS V202012.00
|
||||
* Copyright (C) 2020 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.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file ota_pal.h
|
||||
* @brief Function declarations for ota_ptal.c.
|
||||
*/
|
||||
|
||||
#ifndef _OTA_PAL_H_
|
||||
#define _OTA_PAL_H_
|
||||
|
||||
#include "ota.h"
|
||||
|
||||
//static const char signingcredentialSIGNING_CERTIFICATE_PEM[] = "Paste code signing certificate here.";
|
||||
|
||||
/**
|
||||
* @brief Abort an OTA transfer.
|
||||
*
|
||||
* Aborts access to an existing open file represented by the OTA file context C. This is only valid
|
||||
* for jobs that started successfully.
|
||||
*
|
||||
* @note The input OtaFileContext_t C is checked for NULL by the OTA agent before this
|
||||
* function is called.
|
||||
* This function may be called before the file is opened, so the file pointer C->fileHandle may be NULL
|
||||
* when this function is called.
|
||||
*
|
||||
* @param[in] C OTA file context information.
|
||||
*
|
||||
* @return The OTA PAL layer error code combined with the MCU specific error code. See OTA Agent
|
||||
* error codes information in ota.h.
|
||||
*
|
||||
* The file pointer will be set to NULL after this function returns.
|
||||
* OTA_ERR_NONE is returned when aborting access to the open file was successful.
|
||||
* OTA_ERR_FILE_ABORT is returned when aborting access to the open file context was unsuccessful.
|
||||
*/
|
||||
OtaPalStatus_t otaPal_Abort( OtaFileContext_t * const C );
|
||||
|
||||
/**
|
||||
* @brief Create a new receive file for the data chunks as they come in.
|
||||
*
|
||||
* @note Opens the file indicated in the OTA file context in the MCU file system.
|
||||
*
|
||||
* @note The previous image may be present in the designated image download partition or file, so the partition or file
|
||||
* must be completely erased or overwritten in this routine.
|
||||
*
|
||||
* @note The input OtaFileContext_t C is checked for NULL by the OTA agent before this
|
||||
* function is called.
|
||||
* The device file path is a required field in the OTA job document, so C->pFilePath is
|
||||
* checked for NULL by the OTA agent before this function is called.
|
||||
*
|
||||
* @param[in] C OTA file context information.
|
||||
*
|
||||
* @return The OTA PAL layer error code combined with the MCU specific error code. See OTA Agent
|
||||
* error codes information in ota.h.
|
||||
*
|
||||
* OTA_ERR_NONE is returned when file creation is successful.
|
||||
* OTA_ERR_RX_FILE_TOO_LARGE is returned if the file to be created exceeds the device's non-volatile memory size constraints.
|
||||
* OTA_ERR_BOOT_INFO_CREATE_FAILED is returned if the bootloader information file creation fails.
|
||||
* OTA_ERR_RX_FILE_CREATE_FAILED is returned for other errors creating the file in the device's non-volatile memory.
|
||||
*/
|
||||
OtaPalStatus_t otaPal_CreateFileForRx( OtaFileContext_t * const C );
|
||||
|
||||
/* @brief Authenticate and close the underlying receive file in the specified OTA context.
|
||||
*
|
||||
* @note The input OtaFileContext_t C is checked for NULL by the OTA agent before this
|
||||
* function is called. This function is called only at the end of block ingestion.
|
||||
* prvPAL_CreateFileForRx() must succeed before this function is reached, so
|
||||
* C->fileHandle(or C->pFile) is never NULL.
|
||||
* The certificate path on the device is a required job document field in the OTA Agent,
|
||||
* so C->pCertFilepath is never NULL.
|
||||
* The file signature key is required job document field in the OTA Agent, so C->pSignature will
|
||||
* never be NULL.
|
||||
*
|
||||
* If the signature verification fails, file close should still be attempted.
|
||||
*
|
||||
* @param[in] C OTA file context information.
|
||||
*
|
||||
* @return The OTA PAL layer error code combined with the MCU specific error code. See OTA Agent
|
||||
* error codes information in ota.h.
|
||||
*
|
||||
* OTA_ERR_NONE is returned on success.
|
||||
* OTA_ERR_SIGNATURE_CHECK_FAILED is returned when cryptographic signature verification fails.
|
||||
* OTA_ERR_BAD_SIGNER_CERT is returned for errors in the certificate itself.
|
||||
* OTA_ERR_FILE_CLOSE is returned when closing the file fails.
|
||||
*/
|
||||
OtaPalStatus_t otaPal_CloseFile( OtaFileContext_t * const C );
|
||||
|
||||
/**
|
||||
* @brief Write a block of data to the specified file at the given offset.
|
||||
*
|
||||
* @note The input OtaFileContext_t C is checked for NULL by the OTA agent before this
|
||||
* function is called.
|
||||
* The file pointer/handle C->pFile, is checked for NULL by the OTA agent before this
|
||||
* function is called.
|
||||
* pacData is checked for NULL by the OTA agent before this function is called.
|
||||
* ulBlockSize is validated for range by the OTA agent before this function is called.
|
||||
* ulBlockIndex is validated by the OTA agent before this function is called.
|
||||
*
|
||||
* @param[in] C OTA file context information.
|
||||
* @param[in] ulOffset Byte offset to write to from the beginning of the file.
|
||||
* @param[in] pacData Pointer to the byte array of data to write.
|
||||
* @param[in] ulBlockSize The number of bytes to write.
|
||||
*
|
||||
* @return The number of bytes written on a success, or a negative error code from the platform abstraction layer.
|
||||
*/
|
||||
int16_t otaPal_WriteBlock( OtaFileContext_t * const C,
|
||||
uint32_t ulOffset,
|
||||
uint8_t * const pcData,
|
||||
uint32_t ulBlockSize );
|
||||
|
||||
/**
|
||||
* @brief Activate the newest MCU image received via OTA.
|
||||
*
|
||||
* This function shall do whatever is necessary to activate the newest MCU
|
||||
* firmware received via OTA. It is typically just a reset of the device.
|
||||
*
|
||||
* @note This function SHOULD not return. If it does, the platform does not support
|
||||
* an automatic reset or an error occurred.
|
||||
*
|
||||
* @return The OTA PAL layer error code combined with the MCU specific error code. See OTA Agent
|
||||
* error codes information in ota.h.
|
||||
*/
|
||||
OtaPalStatus_t otaPal_ActivateNewImage( OtaFileContext_t * const C );
|
||||
|
||||
/**
|
||||
* @brief Reset the device.
|
||||
*
|
||||
* This function shall reset the MCU and cause a reboot of the system.
|
||||
*
|
||||
* @note This function SHOULD not return. If it does, the platform does not support
|
||||
* an automatic reset or an error occurred.
|
||||
*
|
||||
* @return The OTA PAL layer error code combined with the MCU specific error code. See OTA Agent
|
||||
* error codes information in ota.h.
|
||||
*/
|
||||
|
||||
OtaPalStatus_t otaPal_ResetDevice( OtaFileContext_t * const C );
|
||||
|
||||
/**
|
||||
* @brief Attempt to set the state of the OTA update image.
|
||||
*
|
||||
* Do whatever is required by the platform to Accept/Reject the OTA update image (or bundle).
|
||||
* Refer to the PAL implementation to determine what happens on your platform.
|
||||
*
|
||||
* @param[in] eState The desired state of the OTA update image.
|
||||
*
|
||||
* @return The OtaErr_t error code combined with the MCU specific error code. See ota.h for
|
||||
* OTA major error codes and your specific PAL implementation for the sub error code.
|
||||
*
|
||||
* Major error codes returned are:
|
||||
*
|
||||
* OTA_ERR_NONE on success.
|
||||
* OTA_ERR_BAD_IMAGE_STATE: if you specify an invalid OtaImageState_t. No sub error code.
|
||||
* OTA_ERR_ABORT_FAILED: failed to roll back the update image as requested by OtaImageStateAborted.
|
||||
* OTA_ERR_REJECT_FAILED: failed to roll back the update image as requested by OtaImageStateRejected.
|
||||
* OTA_ERR_COMMIT_FAILED: failed to make the update image permanent as requested by OtaImageStateAccepted.
|
||||
*/
|
||||
OtaPalStatus_t otaPal_SetPlatformImageState( OtaFileContext_t * const C,
|
||||
OtaImageState_t eState );
|
||||
|
||||
/**
|
||||
* @brief Get the state of the OTA update image.
|
||||
*
|
||||
* We read this at OTA_Init time and when the latest OTA job reports itself in self
|
||||
* test. If the update image is in the "pending commit" state, we start a self test
|
||||
* timer to assure that we can successfully connect to the OTA services and accept
|
||||
* the OTA update image within a reasonable amount of time (user configurable). If
|
||||
* we don't satisfy that requirement, we assume there is something wrong with the
|
||||
* firmware and automatically reset the device, causing it to roll back to the
|
||||
* previously known working code.
|
||||
*
|
||||
* If the update image state is not in "pending commit," the self test timer is
|
||||
* not started.
|
||||
*
|
||||
* @return An OtaPalImageState_t. One of the following:
|
||||
* OtaPalImageStatePendingCommit (the new firmware image is in the self test phase)
|
||||
* OtaPalImageStateValid (the new firmware image is already committed)
|
||||
* OtaPalImageStateInvalid (the new firmware image is invalid or non-existent)
|
||||
*
|
||||
* NOTE: OtaPalImageStateUnknown should NEVER be returned and indicates an implementation error.
|
||||
*/
|
||||
OtaPalImageState_t otaPal_GetPlatformImageState( OtaFileContext_t * const C );
|
||||
|
||||
#endif /* ifndef _OTA_PAL_H_ */
|
@ -0,0 +1,170 @@
|
||||
/*
|
||||
* FreeRTOS V202012.00
|
||||
* Copyright (C) 2020 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.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file subscription_manager.c
|
||||
* @brief Functions for managing MQTT subscriptions.
|
||||
*/
|
||||
|
||||
/* Standard includes. */
|
||||
#include <string.h>
|
||||
|
||||
/* Subscription manager header include. */
|
||||
#include "subscription_manager.h"
|
||||
|
||||
|
||||
bool addSubscription( SubscriptionElement_t * pxSubscriptionList,
|
||||
const char * pcTopicFilterString,
|
||||
uint16_t usTopicFilterLength,
|
||||
IncomingPubCallback_t pxIncomingPublishCallback,
|
||||
void * pvIncomingPublishCallbackContext )
|
||||
{
|
||||
int32_t lIndex = 0;
|
||||
size_t xAvailableIndex = SUBSCRIPTION_MANAGER_MAX_SUBSCRIPTIONS;
|
||||
bool xReturnStatus = false;
|
||||
|
||||
if( ( pxSubscriptionList == NULL ) ||
|
||||
( pcTopicFilterString == NULL ) ||
|
||||
( usTopicFilterLength == 0U ) ||
|
||||
( pxIncomingPublishCallback == NULL ) )
|
||||
{
|
||||
LogError( ( "Invalid parameter. pxSubscriptionList=%p, pcTopicFilterString=%p,"
|
||||
" usTopicFilterLength=%u, pxIncomingPublishCallback=%p.",
|
||||
pxSubscriptionList,
|
||||
pcTopicFilterString,
|
||||
( unsigned int ) usTopicFilterLength,
|
||||
pxIncomingPublishCallback ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Start at end of array, so that we will insert at the first available index.
|
||||
* Scans backwards to find duplicates. */
|
||||
for( lIndex = ( int32_t ) SUBSCRIPTION_MANAGER_MAX_SUBSCRIPTIONS - 1; lIndex >= 0; lIndex-- )
|
||||
{
|
||||
if( pxSubscriptionList[ lIndex ].usFilterStringLength == 0 )
|
||||
{
|
||||
xAvailableIndex = lIndex;
|
||||
}
|
||||
else if( ( pxSubscriptionList[ lIndex ].usFilterStringLength == usTopicFilterLength ) &&
|
||||
( strncmp( pcTopicFilterString, pxSubscriptionList[ lIndex ].pcSubscriptionFilterString, ( size_t ) usTopicFilterLength ) == 0 ) )
|
||||
{
|
||||
/* If a subscription already exists, don't do anything. */
|
||||
if( ( pxSubscriptionList[ lIndex ].pxIncomingPublishCallback == pxIncomingPublishCallback ) &&
|
||||
( pxSubscriptionList[ lIndex ].pvIncomingPublishCallbackContext == pvIncomingPublishCallbackContext ) )
|
||||
{
|
||||
LogWarn( ( "Subscription already exists.\n" ) );
|
||||
xAvailableIndex = SUBSCRIPTION_MANAGER_MAX_SUBSCRIPTIONS;
|
||||
xReturnStatus = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( xAvailableIndex < SUBSCRIPTION_MANAGER_MAX_SUBSCRIPTIONS )
|
||||
{
|
||||
pxSubscriptionList[ xAvailableIndex ].pcSubscriptionFilterString = pcTopicFilterString;
|
||||
pxSubscriptionList[ xAvailableIndex ].usFilterStringLength = usTopicFilterLength;
|
||||
pxSubscriptionList[ xAvailableIndex ].pxIncomingPublishCallback = pxIncomingPublishCallback;
|
||||
pxSubscriptionList[ xAvailableIndex ].pvIncomingPublishCallbackContext = pvIncomingPublishCallbackContext;
|
||||
xReturnStatus = true;
|
||||
}
|
||||
}
|
||||
|
||||
return xReturnStatus;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void removeSubscription( SubscriptionElement_t * pxSubscriptionList,
|
||||
const char * pcTopicFilterString,
|
||||
uint16_t usTopicFilterLength )
|
||||
{
|
||||
int32_t lIndex = 0;
|
||||
|
||||
if( ( pxSubscriptionList == NULL ) ||
|
||||
( pcTopicFilterString == NULL ) ||
|
||||
( usTopicFilterLength == 0U ) )
|
||||
{
|
||||
LogError( ( "Invalid parameter. pxSubscriptionList=%p, pcTopicFilterString=%p,"
|
||||
" usTopicFilterLength=%u.",
|
||||
pxSubscriptionList,
|
||||
pcTopicFilterString,
|
||||
( unsigned int ) usTopicFilterLength ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
for( lIndex = 0; lIndex < SUBSCRIPTION_MANAGER_MAX_SUBSCRIPTIONS; lIndex++ )
|
||||
{
|
||||
if( pxSubscriptionList[ lIndex ].usFilterStringLength == usTopicFilterLength )
|
||||
{
|
||||
if( strncmp( pxSubscriptionList[ lIndex ].pcSubscriptionFilterString, pcTopicFilterString, usTopicFilterLength ) == 0 )
|
||||
{
|
||||
memset( &( pxSubscriptionList[ lIndex ] ), 0x00, sizeof( SubscriptionElement_t ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
bool handleIncomingPublishes( SubscriptionElement_t * pxSubscriptionList,
|
||||
MQTTPublishInfo_t * pxPublishInfo )
|
||||
{
|
||||
int32_t lIndex = 0;
|
||||
bool isMatched = false, publishHandled = false;
|
||||
|
||||
if( ( pxSubscriptionList == NULL ) ||
|
||||
( pxPublishInfo == NULL ) )
|
||||
{
|
||||
LogError( ( "Invalid parameter. pxSubscriptionList=%p, pxPublishInfo=%p,",
|
||||
pxSubscriptionList,
|
||||
pxPublishInfo ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
for( lIndex = 0; lIndex < SUBSCRIPTION_MANAGER_MAX_SUBSCRIPTIONS; lIndex++ )
|
||||
{
|
||||
if( pxSubscriptionList[ lIndex ].usFilterStringLength > 0 )
|
||||
{
|
||||
MQTT_MatchTopic( pxPublishInfo->pTopicName,
|
||||
pxPublishInfo->topicNameLength,
|
||||
pxSubscriptionList[ lIndex ].pcSubscriptionFilterString,
|
||||
pxSubscriptionList[ lIndex ].usFilterStringLength,
|
||||
&isMatched );
|
||||
|
||||
if( isMatched == true )
|
||||
{
|
||||
pxSubscriptionList[ lIndex ].pxIncomingPublishCallback( pxSubscriptionList[ lIndex ].pvIncomingPublishCallbackContext,
|
||||
pxPublishInfo );
|
||||
publishHandled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return publishHandled;
|
||||
}
|
@ -0,0 +1,150 @@
|
||||
/*
|
||||
* FreeRTOS V202012.00
|
||||
* Copyright (C) 2020 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.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file subscription_manager.h
|
||||
* @brief Functions for managing MQTT subscriptions.
|
||||
*/
|
||||
#ifndef SUBSCRIPTION_MANAGER_H
|
||||
#define SUBSCRIPTION_MANAGER_H
|
||||
|
||||
/**************************************************/
|
||||
/******* DO NOT CHANGE the following order ********/
|
||||
/**************************************************/
|
||||
|
||||
/* Logging related header files are required to be included in the following order:
|
||||
* 1. Include the header file "logging_levels.h".
|
||||
* 2. Define LIBRARY_LOG_NAME and LIBRARY_LOG_LEVEL.
|
||||
* 3. Include the header file "logging_stack.h".
|
||||
*/
|
||||
|
||||
/* Include header that defines log levels. */
|
||||
#include "logging_levels.h"
|
||||
|
||||
/* Logging configuration for the Subscription Manager module. */
|
||||
#ifndef LIBRARY_LOG_NAME
|
||||
#define LIBRARY_LOG_NAME "Subscription Manager"
|
||||
#endif
|
||||
#ifndef LIBRARY_LOG_LEVEL
|
||||
#define LIBRARY_LOG_LEVEL LOG_ERROR
|
||||
#endif
|
||||
|
||||
#include "logging_stack.h"
|
||||
|
||||
|
||||
/* Demo config include. */
|
||||
#include "demo_config.h"
|
||||
|
||||
/* core MQTT include. */
|
||||
#include "core_mqtt.h"
|
||||
|
||||
|
||||
/**
|
||||
* @brief Maximum number of subscriptions maintained by the subscription manager
|
||||
* simultaneously in a list.
|
||||
*/
|
||||
#ifndef SUBSCRIPTION_MANAGER_MAX_SUBSCRIPTIONS
|
||||
#define SUBSCRIPTION_MANAGER_MAX_SUBSCRIPTIONS 10U
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Callback function called when receiving a publish.
|
||||
*
|
||||
* @param[in] pvIncomingPublishCallbackContext The incoming publish callback context.
|
||||
* @param[in] pxPublishInfo Deserialized publish information.
|
||||
*/
|
||||
typedef void (* IncomingPubCallback_t )( void * pvIncomingPublishCallbackContext,
|
||||
MQTTPublishInfo_t * pxPublishInfo );
|
||||
|
||||
/**
|
||||
* @brief An element in the list of subscriptions.
|
||||
*
|
||||
* This subscription manager implementation expects that the array of the
|
||||
* subscription elements used for storing subscriptions to be initialized to 0.
|
||||
*
|
||||
* @note This implementation allows multiple tasks to subscribe to the same topic.
|
||||
* In this case, another element is added to the subscription list, differing
|
||||
* in the intended publish callback. Also note that the topic filters are not
|
||||
* copied in the subscription manager and hence the topic filter strings need to
|
||||
* stay in scope until unsubscribed.
|
||||
*/
|
||||
typedef struct subscriptionElement
|
||||
{
|
||||
IncomingPubCallback_t pxIncomingPublishCallback;
|
||||
void * pvIncomingPublishCallbackContext;
|
||||
uint16_t usFilterStringLength;
|
||||
const char * pcSubscriptionFilterString;
|
||||
} SubscriptionElement_t;
|
||||
|
||||
/**
|
||||
* @brief Add a subscription to the subscription list.
|
||||
*
|
||||
* @note Multiple tasks can be subscribed to the same topic with different
|
||||
* context-callback pairs. However, a single context-callback pair may only be
|
||||
* associated to the same topic filter once.
|
||||
*
|
||||
* @param[in] pxSubscriptionList The pointer to the subscription list array.
|
||||
* @param[in] pcTopicFilterString Topic filter string of subscription.
|
||||
* @param[in] usTopicFilterLength Length of topic filter string.
|
||||
* @param[in] pxIncomingPublishCallback Callback function for the subscription.
|
||||
* @param[in] pvIncomingPublishCallbackContext Context for the subscription callback.
|
||||
*
|
||||
* @return `true` if subscription added or exists, `false` if insufficient memory.
|
||||
*/
|
||||
bool addSubscription( SubscriptionElement_t * pxSubscriptionList,
|
||||
const char * pcTopicFilterString,
|
||||
uint16_t usTopicFilterLength,
|
||||
IncomingPubCallback_t pxIncomingPublishCallback,
|
||||
void * pvIncomingPublishCallbackContext );
|
||||
|
||||
/**
|
||||
* @brief Remove a subscription from the subscription list.
|
||||
*
|
||||
* @note If the topic filter exists multiple times in the subscription list,
|
||||
* then every instance of the subscription will be removed.
|
||||
*
|
||||
* @param[in] pxSubscriptionList The pointer to the subscription list array.
|
||||
* @param[in] pcTopicFilterString Topic filter of subscription.
|
||||
* @param[in] usTopicFilterLength Length of topic filter.
|
||||
*/
|
||||
void removeSubscription( SubscriptionElement_t * pxSubscriptionList,
|
||||
const char * pcTopicFilterString,
|
||||
uint16_t usTopicFilterLength );
|
||||
|
||||
/**
|
||||
* @brief Handle incoming publishes by invoking the callbacks registered
|
||||
* for the incoming publish's topic filter.
|
||||
*
|
||||
* @param[in] pxSubscriptionList The pointer to the subscription list array.
|
||||
* @param[in] pxPublishInfo Info of incoming publish.
|
||||
*
|
||||
* @return `true` if an application callback could be invoked;
|
||||
* `false` otherwise.
|
||||
*/
|
||||
bool handleIncomingPublishes( SubscriptionElement_t * pxSubscriptionList,
|
||||
MQTTPublishInfo_t * pxPublishInfo );
|
||||
|
||||
#endif /* SUBSCRIPTION_MANAGER_H */
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,210 @@
|
||||
/*
|
||||
* FreeRTOS V202012.00
|
||||
* Copyright (C) 2020 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.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
#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.
|
||||
* http://www.freertos.org/a00110.html
|
||||
*
|
||||
* The bottom of this file contains some constants specific to running the UDP
|
||||
* stack in this demo. Constants specific to FreeRTOS+TCP itself (rather than
|
||||
* the demo) are contained in FreeRTOSIPConfig.h.
|
||||
*----------------------------------------------------------*/
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
|
||||
#define configMAX_PRIORITIES ( 7 )
|
||||
#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 ) 60 ) /* 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 ) ( 2048U * 1024U ) )
|
||||
#define configMAX_TASK_NAME_LEN ( 15 )
|
||||
#define configUSE_TRACE_FACILITY 0
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configIDLE_SHOULD_YIELD 1
|
||||
#define configUSE_CO_ROUTINES 0
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configUSE_RECURSIVE_MUTEXES 1
|
||||
#define configQUEUE_REGISTRY_SIZE 0
|
||||
#define configUSE_APPLICATION_TASK_TAG 0
|
||||
#define configUSE_COUNTING_SEMAPHORES 1
|
||||
#define configUSE_ALTERNATIVE_API 0
|
||||
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 0
|
||||
#define configENABLE_BACKWARD_COMPATIBILITY 1
|
||||
#define configSUPPORT_STATIC_ALLOCATION 1
|
||||
|
||||
/* Hook function related definitions. */
|
||||
#define configUSE_TICK_HOOK 0
|
||||
#define configUSE_IDLE_HOOK 0
|
||||
#define configUSE_MALLOC_FAILED_HOOK 0
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 0 /* Not applicable to the Win32 port. */
|
||||
|
||||
/* Software timer related definitions. */
|
||||
#define configUSE_TIMERS 1
|
||||
#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
|
||||
#define configTIMER_QUEUE_LENGTH 5
|
||||
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE * 2 )
|
||||
|
||||
/* Event group related definitions. */
|
||||
#define configUSE_EVENT_GROUPS 1
|
||||
|
||||
/* Run time stats gathering configuration options. */
|
||||
#define configGENERATE_RUN_TIME_STATS 0
|
||||
|
||||
/* Co-routine definitions. */
|
||||
#define configUSE_CO_ROUTINES 0
|
||||
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
|
||||
|
||||
/* Set the following definitions to 1 to include the API function, or zero
|
||||
* to exclude the API function. */
|
||||
#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_xTaskGetSchedulerState 1
|
||||
#define INCLUDE_xTimerGetTimerTaskHandle 0
|
||||
#define INCLUDE_xTaskGetIdleTaskHandle 0
|
||||
#define INCLUDE_xQueueGetMutexHolder 1
|
||||
#define INCLUDE_eTaskGetState 1
|
||||
#define INCLUDE_xEventGroupSetBitsFromISR 1
|
||||
#define INCLUDE_xTimerPendFunctionCall 1
|
||||
#define INCLUDE_pcTaskGetTaskName 1
|
||||
|
||||
/* This demo makes 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. configUSE_STATS_FORMATTING_FUNCTIONS
|
||||
* is set to 2 so the formatting functions are included without the stdio.h being
|
||||
* included in tasks.c. That is because this project defines its own sprintf()
|
||||
* functions. */
|
||||
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
|
||||
|
||||
/* Assert call defined for debug builds. */
|
||||
#ifdef _DEBUG
|
||||
extern void vAssertCalled( const char * pcFile,
|
||||
uint32_t ulLine );
|
||||
#define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled( __FILE__, __LINE__ )
|
||||
#endif /* _DEBUG */
|
||||
|
||||
|
||||
|
||||
/* Application specific definitions follow. **********************************/
|
||||
|
||||
/* Only used when running in the FreeRTOS Windows simulator. Defines the
|
||||
* priority of the task used to simulate Ethernet interrupts. */
|
||||
#define configMAC_ISR_SIMULATOR_PRIORITY ( configMAX_PRIORITIES - 1 )
|
||||
|
||||
/* This demo creates a virtual network connection by accessing the raw Ethernet
|
||||
* or WiFi data to and from a real network connection. Many computers have more
|
||||
* than one real network port, and configNETWORK_INTERFACE_TO_USE is used to tell
|
||||
* the demo which real port should be used to create the virtual port. The ports
|
||||
* available are displayed on the console when the application is executed. For
|
||||
* example, on my development laptop setting configNETWORK_INTERFACE_TO_USE to 4
|
||||
* results in the wired network being used, while setting
|
||||
* configNETWORK_INTERFACE_TO_USE to 2 results in the wireless network being
|
||||
* used. */
|
||||
#define configNETWORK_INTERFACE_TO_USE ( 5L )
|
||||
|
||||
/* The address to which logging is sent should UDP logging be enabled. */
|
||||
#define configUDP_LOGGING_ADDR0 192
|
||||
#define configUDP_LOGGING_ADDR1 168
|
||||
#define configUDP_LOGGING_ADDR2 0
|
||||
#define configUDP_LOGGING_ADDR3 11
|
||||
|
||||
/* Default MAC address configuration. The demo creates a virtual network
|
||||
* connection that uses this MAC address by accessing the raw Ethernet/WiFi data
|
||||
* to and from a real network connection on the host PC. See the
|
||||
* configNETWORK_INTERFACE_TO_USE definition above for information on how to
|
||||
* configure the real network connection to use. */
|
||||
#define configMAC_ADDR0 0x00
|
||||
#define configMAC_ADDR1 0x11
|
||||
#define configMAC_ADDR2 0x11
|
||||
#define configMAC_ADDR3 0x11
|
||||
#define configMAC_ADDR4 0x11
|
||||
#define configMAC_ADDR5 0x41
|
||||
|
||||
/* Default IP address configuration. Used in ipconfigUSE_DNS is set to 0, or
|
||||
* ipconfigUSE_DNS is set to 1 but a DNS server cannot be contacted. */
|
||||
#define configIP_ADDR0 10
|
||||
#define configIP_ADDR1 10
|
||||
#define configIP_ADDR2 10
|
||||
#define configIP_ADDR3 200
|
||||
|
||||
/* Default gateway IP address configuration. Used in ipconfigUSE_DNS is set to
|
||||
* 0, or ipconfigUSE_DNS is set to 1 but a DNS server cannot be contacted. */
|
||||
#define configGATEWAY_ADDR0 10
|
||||
#define configGATEWAY_ADDR1 10
|
||||
#define configGATEWAY_ADDR2 10
|
||||
#define configGATEWAY_ADDR3 1
|
||||
|
||||
/* Default DNS server configuration. OpenDNS addresses are 208.67.222.222 and
|
||||
* 208.67.220.220. Used in ipconfigUSE_DNS is set to 0, or ipconfigUSE_DNS is set
|
||||
* to 1 but a DNS server cannot be contacted.*/
|
||||
#define configDNS_SERVER_ADDR0 208
|
||||
#define configDNS_SERVER_ADDR1 67
|
||||
#define configDNS_SERVER_ADDR2 222
|
||||
#define configDNS_SERVER_ADDR3 222
|
||||
|
||||
/* Default netmask configuration. Used in ipconfigUSE_DNS is set to 0, or
|
||||
* ipconfigUSE_DNS is set to 1 but a DNS server cannot be contacted. */
|
||||
#define configNET_MASK0 255
|
||||
#define configNET_MASK1 0
|
||||
#define configNET_MASK2 0
|
||||
#define configNET_MASK3 0
|
||||
|
||||
/* The UDP port to which print messages are sent. */
|
||||
#define configPRINT_PORT ( 15000 )
|
||||
|
||||
|
||||
#if ( defined( _MSC_VER ) && ( _MSC_VER <= 1600 ) && !defined( snprintf ) )
|
||||
/* Map to Windows names. */
|
||||
#define snprintf _snprintf
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
|
||||
/* Visual studio does not have an implementation of strcasecmp(). */
|
||||
#define strcasecmp _stricmp
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcmpi _strcmpi
|
||||
|
||||
/* Prototype for the function used to print out. In this case it prints to the
|
||||
* console before the network is connected then a UDP port after the network has
|
||||
* connected. */
|
||||
extern void vLoggingPrintf( const char * pcFormatString,
|
||||
... );
|
||||
#define configPRINTF( X ) vLoggingPrintf X
|
||||
|
||||
#endif /* FREERTOS_CONFIG_H */
|
@ -0,0 +1,310 @@
|
||||
/*
|
||||
* FreeRTOS V202012.00
|
||||
* Copyright (C) 2020 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.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* See the following URL for configuration information.
|
||||
* http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef FREERTOS_IP_CONFIG_H
|
||||
#define FREERTOS_IP_CONFIG_H
|
||||
|
||||
/* Prototype for the function used to print out. In this case it prints to the
|
||||
* console before the network is connected then a UDP port after the network has
|
||||
* connected. */
|
||||
extern void vLoggingPrintf( const char * pcFormatString,
|
||||
... );
|
||||
|
||||
/* Set to 1 to print out debug messages. If ipconfigHAS_DEBUG_PRINTF is set to
|
||||
* 1 then FreeRTOS_debug_printf should be defined to the function used to print
|
||||
* out the debugging messages. */
|
||||
#define ipconfigHAS_DEBUG_PRINTF 0
|
||||
#if ( ipconfigHAS_DEBUG_PRINTF == 1 )
|
||||
#define FreeRTOS_debug_printf( X ) vLoggingPrintf X
|
||||
#endif
|
||||
|
||||
/* Set to 1 to print out non debugging messages, for example the output of the
|
||||
* FreeRTOS_netstat() command, and ping replies. If ipconfigHAS_PRINTF is set to 1
|
||||
* then FreeRTOS_printf should be set to the function used to print out the
|
||||
* messages. */
|
||||
#define ipconfigHAS_PRINTF 1
|
||||
#if ( ipconfigHAS_PRINTF == 1 )
|
||||
#define FreeRTOS_printf( X ) vLoggingPrintf X
|
||||
#endif
|
||||
|
||||
/* Define the byte order of the target MCU (the MCU FreeRTOS+TCP is executing
|
||||
* on). Valid options are pdFREERTOS_BIG_ENDIAN and pdFREERTOS_LITTLE_ENDIAN. */
|
||||
#define ipconfigBYTE_ORDER pdFREERTOS_LITTLE_ENDIAN
|
||||
|
||||
/* If the network card/driver includes checksum offloading (IP/TCP/UDP checksums)
|
||||
* then set ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM to 1 to prevent the software
|
||||
* stack repeating the checksum calculations. */
|
||||
#define ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM 1
|
||||
|
||||
/* Several API's will block until the result is known, or the action has been
|
||||
* performed, for example FreeRTOS_send() and FreeRTOS_recv(). The timeouts can be
|
||||
* set per socket, using setsockopt(). If not set, the times below will be
|
||||
* used as defaults. */
|
||||
#define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME ( 2000 )
|
||||
#define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME ( 5000 )
|
||||
|
||||
/* Include support for LLMNR: Link-local Multicast Name Resolution
|
||||
* (non-Microsoft) */
|
||||
#define ipconfigUSE_LLMNR ( 0 )
|
||||
|
||||
/* Include support for NBNS: NetBIOS Name Service (Microsoft) */
|
||||
#define ipconfigUSE_NBNS ( 0 )
|
||||
|
||||
/* Include support for DNS caching. For TCP, having a small DNS cache is very
|
||||
* useful. When a cache is present, ipconfigDNS_REQUEST_ATTEMPTS can be kept low
|
||||
* and also DNS may use small timeouts. If a DNS reply comes in after the DNS
|
||||
* socket has been destroyed, the result will be stored into the cache. The next
|
||||
* call to FreeRTOS_gethostbyname() will return immediately, without even creating
|
||||
* a socket. */
|
||||
#define ipconfigUSE_DNS_CACHE ( 1 )
|
||||
#define ipconfigDNS_CACHE_NAME_LENGTH ( 64 )
|
||||
#define ipconfigDNS_CACHE_ENTRIES ( 4 )
|
||||
#define ipconfigDNS_REQUEST_ATTEMPTS ( 2 )
|
||||
|
||||
/* The IP stack executes it its own task (although any application task can make
|
||||
* use of its services through the published sockets API). ipconfigUDP_TASK_PRIORITY
|
||||
* sets the priority of the task that executes the IP stack. The priority is a
|
||||
* standard FreeRTOS task priority so can take any value from 0 (the lowest
|
||||
* priority) to (configMAX_PRIORITIES - 1) (the highest priority).
|
||||
* configMAX_PRIORITIES is a standard FreeRTOS configuration parameter defined in
|
||||
* FreeRTOSConfig.h, not FreeRTOSIPConfig.h. Consideration needs to be given as to
|
||||
* the priority assigned to the task executing the IP stack relative to the
|
||||
* priority assigned to tasks that use the IP stack. */
|
||||
#define ipconfigIP_TASK_PRIORITY ( configMAX_PRIORITIES - 2 )
|
||||
|
||||
/* The size, in words (not bytes), of the stack allocated to the FreeRTOS+TCP
|
||||
* task. This setting is less important when the FreeRTOS Win32 simulator is used
|
||||
* as the Win32 simulator only stores a fixed amount of information on the task
|
||||
* stack. FreeRTOS includes optional stack overflow detection, see:
|
||||
* http://www.freertos.org/Stacks-and-stack-overflow-checking.html */
|
||||
#define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 )
|
||||
|
||||
/* ipconfigRAND32() is called by the IP stack to generate random numbers for
|
||||
* things such as a DHCP transaction number or initial sequence number. Random
|
||||
* number generation is performed via this macro to allow applications to use their
|
||||
* own random number generation method. For example, it might be possible to
|
||||
* generate a random number by sampling noise on an analogue input. */
|
||||
extern UBaseType_t uxRand();
|
||||
#define ipconfigRAND32() uxRand()
|
||||
|
||||
/* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the
|
||||
* network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK
|
||||
* is not set to 1 then the network event hook will never be called. See
|
||||
* http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml
|
||||
*/
|
||||
#define ipconfigUSE_NETWORK_EVENT_HOOK 1
|
||||
|
||||
/* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but
|
||||
* a network buffer cannot be obtained then the calling task is held in the Blocked
|
||||
* state (so other tasks can continue to executed) until either a network buffer
|
||||
* becomes available or the send block time expires. If the send block time expires
|
||||
* then the send operation is aborted. The maximum allowable send block time is
|
||||
* capped to the value set by ipconfigMAX_SEND_BLOCK_TIME_TICKS. Capping the
|
||||
* maximum allowable send block time prevents a deadlock occurring when
|
||||
* all the network buffers are in use and the tasks that process (and subsequently
|
||||
* free) the network buffers are themselves blocked waiting for a network buffer.
|
||||
* ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in
|
||||
* milliseconds can be converted to a time in ticks by dividing the time in
|
||||
* milliseconds by portTICK_PERIOD_MS. */
|
||||
#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000 / portTICK_PERIOD_MS )
|
||||
|
||||
/* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP
|
||||
* address, netmask, DNS server address and gateway address from a DHCP server. If
|
||||
* ipconfigUSE_DHCP is 0 then FreeRTOS+TCP will use a static IP address. The
|
||||
* stack will revert to using the static IP address even when ipconfigUSE_DHCP is
|
||||
* set to 1 if a valid configuration cannot be obtained from a DHCP server for any
|
||||
* reason. The static configuration used is that passed into the stack by the
|
||||
* FreeRTOS_IPInit() function call. */
|
||||
#define ipconfigUSE_DHCP 1
|
||||
|
||||
/* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at
|
||||
* increasing time intervals until either a reply is received from a DHCP server
|
||||
* and accepted, or the interval between transmissions reaches
|
||||
* ipconfigMAXIMUM_DISCOVER_TX_PERIOD. The IP stack will revert to using the
|
||||
* static IP address passed as a parameter to FreeRTOS_IPInit() if the
|
||||
* re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without
|
||||
* a DHCP reply being received. */
|
||||
#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD ( 120000 / portTICK_PERIOD_MS )
|
||||
|
||||
/* The ARP cache is a table that maps IP addresses to MAC addresses. The IP
|
||||
* stack can only send a UDP message to a remove IP address if it knowns the MAC
|
||||
* address associated with the IP address, or the MAC address of the router used to
|
||||
* contact the remote IP address. When a UDP message is received from a remote IP
|
||||
* address the MAC address and IP address are added to the ARP cache. When a UDP
|
||||
* message is sent to a remote IP address that does not already appear in the ARP
|
||||
* cache then the UDP message is replaced by a ARP message that solicits the
|
||||
* required MAC address information. ipconfigARP_CACHE_ENTRIES defines the maximum
|
||||
* number of entries that can exist in the ARP table at any one time. */
|
||||
#define ipconfigARP_CACHE_ENTRIES 6
|
||||
|
||||
/* ARP requests that do not result in an ARP response will be re-transmitted a
|
||||
* maximum of ipconfigMAX_ARP_RETRANSMISSIONS times before the ARP request is
|
||||
* aborted. */
|
||||
#define ipconfigMAX_ARP_RETRANSMISSIONS ( 5 )
|
||||
|
||||
/* ipconfigMAX_ARP_AGE defines the maximum time between an entry in the ARP
|
||||
* table being created or refreshed and the entry being removed because it is stale.
|
||||
* New ARP requests are sent for ARP cache entries that are nearing their maximum
|
||||
* age. ipconfigMAX_ARP_AGE is specified in tens of seconds, so a value of 150 is
|
||||
* equal to 1500 seconds (or 25 minutes). */
|
||||
#define ipconfigMAX_ARP_AGE 150
|
||||
|
||||
/* Implementing FreeRTOS_inet_addr() necessitates the use of string handling
|
||||
* routines, which are relatively large. To save code space the full
|
||||
* FreeRTOS_inet_addr() implementation is made optional, and a smaller and faster
|
||||
* alternative called FreeRTOS_inet_addr_quick() is provided. FreeRTOS_inet_addr()
|
||||
* takes an IP in decimal dot format (for example, "192.168.0.1") as its parameter.
|
||||
* FreeRTOS_inet_addr_quick() takes an IP address as four separate numerical octets
|
||||
* (for example, 192, 168, 0, 1) as its parameters. If
|
||||
* ipconfigINCLUDE_FULL_INET_ADDR is set to 1 then both FreeRTOS_inet_addr() and
|
||||
* FreeRTOS_indet_addr_quick() are available. If ipconfigINCLUDE_FULL_INET_ADDR is
|
||||
* not set to 1 then only FreeRTOS_indet_addr_quick() is available. */
|
||||
#define ipconfigINCLUDE_FULL_INET_ADDR 1
|
||||
|
||||
/* ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS defines the total number of network buffer that
|
||||
* are available to the IP stack. The total number of network buffers is limited
|
||||
* to ensure the total amount of RAM that can be consumed by the IP stack is capped
|
||||
* to a pre-determinable value. */
|
||||
#define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS 60
|
||||
|
||||
/* A FreeRTOS queue is used to send events from application tasks to the IP
|
||||
* stack. ipconfigEVENT_QUEUE_LENGTH sets the maximum number of events that can
|
||||
* be queued for processing at any one time. The event queue must be a minimum of
|
||||
* 5 greater than the total number of network buffers. */
|
||||
#define ipconfigEVENT_QUEUE_LENGTH ( ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS + 5 )
|
||||
|
||||
/* The address of a socket is the combination of its IP address and its port
|
||||
* number. FreeRTOS_bind() is used to manually allocate a port number to a socket
|
||||
* (to 'bind' the socket to a port), but manual binding is not normally necessary
|
||||
* for client sockets (those sockets that initiate outgoing connections rather than
|
||||
* wait for incoming connections on a known port number). If
|
||||
* ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND is set to 1 then calling
|
||||
* FreeRTOS_sendto() on a socket that has not yet been bound will result in the IP
|
||||
* stack automatically binding the socket to a port number from the range
|
||||
* socketAUTO_PORT_ALLOCATION_START_NUMBER to 0xffff. If
|
||||
* ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND is set to 0 then calling FreeRTOS_sendto()
|
||||
* on a socket that has not yet been bound will result in the send operation being
|
||||
* aborted. */
|
||||
#define ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND 1
|
||||
|
||||
/* Defines the Time To Live (TTL) values used in outgoing UDP packets. */
|
||||
#define ipconfigUDP_TIME_TO_LIVE 128
|
||||
#define ipconfigTCP_TIME_TO_LIVE 128 /* also defined in FreeRTOSIPConfigDefaults.h */
|
||||
|
||||
/* USE_TCP: Use TCP and all its features */
|
||||
#define ipconfigUSE_TCP ( 1 )
|
||||
|
||||
/* Use the TCP socket wake context with a callback. */
|
||||
#define ipconfigSOCKET_HAS_USER_WAKE_CALLBACK_WITH_CONTEXT ( 1 )
|
||||
|
||||
/* USE_WIN: Let TCP use windowing mechanism. */
|
||||
#define ipconfigUSE_TCP_WIN ( 1 )
|
||||
|
||||
/* The MTU is the maximum number of bytes the payload of a network frame can
|
||||
* contain. For normal Ethernet V2 frames the maximum MTU is 1500. Setting a
|
||||
* lower value can save RAM, depending on the buffer management scheme used. If
|
||||
* ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must
|
||||
* be divisible by 8. */
|
||||
#define ipconfigNETWORK_MTU 1200
|
||||
|
||||
/* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used
|
||||
* through the FreeRTOS_gethostbyname() API function. */
|
||||
#define ipconfigUSE_DNS 1
|
||||
|
||||
/* If ipconfigREPLY_TO_INCOMING_PINGS is set to 1 then the IP stack will
|
||||
* generate replies to incoming ICMP echo (ping) requests. */
|
||||
#define ipconfigREPLY_TO_INCOMING_PINGS 1
|
||||
|
||||
/* If ipconfigSUPPORT_OUTGOING_PINGS is set to 1 then the
|
||||
* FreeRTOS_SendPingRequest() API function is available. */
|
||||
#define ipconfigSUPPORT_OUTGOING_PINGS 0
|
||||
|
||||
/* If ipconfigSUPPORT_SELECT_FUNCTION is set to 1 then the FreeRTOS_select()
|
||||
* (and associated) API function is available. */
|
||||
#define ipconfigSUPPORT_SELECT_FUNCTION 1
|
||||
|
||||
/* If ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES is set to 1 then Ethernet frames
|
||||
* that are not in Ethernet II format will be dropped. This option is included for
|
||||
* potential future IP stack developments. */
|
||||
#define ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES 1
|
||||
|
||||
/* If ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES is set to 1 then it is the
|
||||
* responsibility of the Ethernet interface to filter out packets that are of no
|
||||
* interest. If the Ethernet interface does not implement this functionality, then
|
||||
* set ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES to 0 to have the IP stack
|
||||
* perform the filtering instead (it is much less efficient for the stack to do it
|
||||
* because the packet will already have been passed into the stack). If the
|
||||
* Ethernet driver does all the necessary filtering in hardware then software
|
||||
* filtering can be removed by using a value other than 1 or 0. */
|
||||
#define ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES 1
|
||||
|
||||
/* The windows simulator cannot really simulate MAC interrupts, and needs to
|
||||
* block occasionally to allow other tasks to run. */
|
||||
#define configWINDOWS_MAC_INTERRUPT_SIMULATOR_DELAY ( 20 / portTICK_PERIOD_MS )
|
||||
|
||||
/* Advanced only: in order to access 32-bit fields in the IP packets with
|
||||
* 32-bit memory instructions, all packets will be stored 32-bit-aligned, plus 16-bits.
|
||||
* This has to do with the contents of the IP-packets: all 32-bit fields are
|
||||
* 32-bit-aligned, plus 16-bit(!) */
|
||||
#define ipconfigPACKET_FILLER_SIZE 2
|
||||
|
||||
/* Define the size of the pool of TCP window descriptors. On the average, each
|
||||
* TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6
|
||||
* outstanding packets (for Rx and Tx). When using up to 10 TP sockets
|
||||
* simultaneously, one could define TCP_WIN_SEG_COUNT as 120. */
|
||||
#define ipconfigTCP_WIN_SEG_COUNT 240
|
||||
|
||||
/* Each TCP socket has a circular buffers for Rx and Tx, which have a fixed
|
||||
* maximum size. Define the size of Rx buffer for TCP sockets. */
|
||||
#define ipconfigTCP_RX_BUFFER_LENGTH ( 5000 )
|
||||
|
||||
/* Define the size of Tx buffer for TCP sockets. */
|
||||
#define ipconfigTCP_TX_BUFFER_LENGTH ( 1000 )
|
||||
|
||||
/* When using call-back handlers, the driver may check if the handler points to
|
||||
* real program memory (RAM or flash) or just has a random non-zero value. */
|
||||
#define ipconfigIS_VALID_PROG_ADDRESS( x ) ( ( x ) != NULL )
|
||||
|
||||
/* Include support for TCP hang protection. All sockets in a connecting or
|
||||
* disconnecting stage will timeout after a period of non-activity. */
|
||||
#define ipconfigTCP_HANG_PROTECTION ( 1 )
|
||||
#define ipconfigTCP_HANG_PROTECTION_TIME ( 30 )
|
||||
|
||||
/* Include support for TCP keep-alive messages. */
|
||||
#define ipconfigTCP_KEEP_ALIVE ( 1 )
|
||||
#define ipconfigTCP_KEEP_ALIVE_INTERVAL ( 20 ) /* in seconds */
|
||||
|
||||
#define portINLINE __inline
|
||||
|
||||
#endif /* FREERTOS_IP_CONFIG_H */
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* FreeRTOS V202012.00
|
||||
* Copyright (C) 2020 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.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CORE_HTTP_CONFIG_H_
|
||||
#define CORE_HTTP_CONFIG_H_
|
||||
|
||||
/**************************************************/
|
||||
/******* DO NOT CHANGE the following order ********/
|
||||
/**************************************************/
|
||||
|
||||
/* Logging config definition and header files inclusion are required in the following order:
|
||||
* 1. Include the header file "logging_levels.h".
|
||||
* 2. Define the LIBRARY_LOG_NAME and LIBRARY_LOG_LEVEL macros depending on
|
||||
* the logging configuration for HTTP.
|
||||
* 3. Include the header file "logging_stack.h", if logging is enabled for HTTP.
|
||||
*/
|
||||
|
||||
#include "logging_levels.h"
|
||||
|
||||
/* Logging configuration for the HTTP library. */
|
||||
#ifndef LIBRARY_LOG_NAME
|
||||
#define LIBRARY_LOG_NAME "HTTP"
|
||||
#endif
|
||||
|
||||
#ifndef LIBRARY_LOG_LEVEL
|
||||
#define LIBRARY_LOG_LEVEL LOG_INFO
|
||||
#endif
|
||||
|
||||
#include "logging_stack.h"
|
||||
|
||||
|
||||
/************ End of logging configuration ****************/
|
||||
|
||||
#endif /* ifndef CORE_HTTP_CONFIG_H_ */
|
@ -0,0 +1,109 @@
|
||||
/*
|
||||
* FreeRTOS V202012.00
|
||||
* Copyright (C) 2020 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.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CORE_MQTT_CONFIG_H
|
||||
#define CORE_MQTT_CONFIG_H
|
||||
|
||||
/**************************************************/
|
||||
/******* DO NOT CHANGE the following order ********/
|
||||
/**************************************************/
|
||||
|
||||
/* Include logging header files and define logging macros in the following order:
|
||||
* 1. Include the header file "logging_levels.h".
|
||||
* 2. Define the LIBRARY_LOG_NAME and LIBRARY_LOG_LEVEL macros depending on
|
||||
* the logging configuration for MQTT.
|
||||
* 3. Include the header file "logging_stack.h", if logging is enabled for MQTT.
|
||||
*/
|
||||
|
||||
#include "logging_levels.h"
|
||||
|
||||
/* Logging configuration for the MQTT library. */
|
||||
#ifndef LIBRARY_LOG_NAME
|
||||
#define LIBRARY_LOG_NAME "MQTT"
|
||||
#endif
|
||||
|
||||
#ifndef LIBRARY_LOG_LEVEL
|
||||
#define LIBRARY_LOG_LEVEL LOG_ERROR
|
||||
#endif
|
||||
|
||||
/* Prototype for the function used to print to console on Windows simulator
|
||||
* of FreeRTOS.
|
||||
* The function prints to the console before the network is connected;
|
||||
* then a UDP port after the network has connected. */
|
||||
extern void vLoggingPrintf( const char * pcFormatString,
|
||||
... );
|
||||
|
||||
/* Map the SdkLog macro to the logging function to enable logging
|
||||
* on Windows simulator. */
|
||||
#ifndef SdkLog
|
||||
#define SdkLog( message ) vLoggingPrintf message
|
||||
#endif
|
||||
#include "logging_stack.h"
|
||||
/************ End of logging configuration ****************/
|
||||
|
||||
/**
|
||||
* @brief The maximum number of MQTT PUBLISH messages that may be pending
|
||||
* acknowledgement at any time.
|
||||
*
|
||||
* QoS 1 and 2 MQTT PUBLISHes require acknowledgment from the server before
|
||||
* they can be completed. While they are awaiting the acknowledgment, the
|
||||
* client must maintain information about their state. The value of this
|
||||
* macro sets the limit on how many simultaneous PUBLISH states an MQTT
|
||||
* context maintains.
|
||||
*/
|
||||
#define MQTT_STATE_ARRAY_MAX_COUNT 10U
|
||||
|
||||
/*********************** coreMQTT Agent Configurations **********************/
|
||||
/**
|
||||
* @brief The maximum number of pending acknowledgments to track for a single
|
||||
* connection.
|
||||
*
|
||||
* @note The MQTT agent tracks MQTT commands (such as PUBLISH and SUBSCRIBE) th
|
||||
* at are still waiting to be acknowledged. MQTT_AGENT_MAX_OUTSTANDING_ACKS set
|
||||
* the maximum number of acknowledgments that can be outstanding at any one time.
|
||||
* The higher this number is the greater the agent's RAM consumption will be.
|
||||
*/
|
||||
#define MQTT_AGENT_MAX_OUTSTANDING_ACKS ( 20U )
|
||||
|
||||
/**
|
||||
* @brief Time in MS that the MQTT agent task will wait in the Blocked state (so
|
||||
* not using any CPU time) for a command to arrive in its command queue before
|
||||
* exiting the blocked state so it can call MQTT_ProcessLoop().
|
||||
*
|
||||
* @note It is important MQTT_ProcessLoop() is called often if there is known
|
||||
* MQTT traffic, but calling it too often can take processing time away from
|
||||
* lower priority tasks and waste CPU time and power.
|
||||
*/
|
||||
#define MQTT_AGENT_MAX_EVENT_QUEUE_WAIT_TIME ( 1000 )
|
||||
|
||||
/**
|
||||
* @brief The number of command structures to allocate in the pool
|
||||
* for the agent.
|
||||
*/
|
||||
#define MQTT_COMMAND_CONTEXTS_POOL_SIZE 10
|
||||
|
||||
|
||||
#endif /* ifndef CORE_MQTT_CONFIG_H */
|
@ -0,0 +1,187 @@
|
||||
/*
|
||||
* FreeRTOS V202012.00
|
||||
* Copyright (C) 2020 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.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file core_pkcs11_config.h
|
||||
* @brief PCKS#11 config options.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _CORE_PKCS11_CONFIG_H_
|
||||
#define _CORE_PKCS11_CONFIG_H_
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
|
||||
/**************************************************/
|
||||
/******* DO NOT CHANGE the following order ********/
|
||||
/**************************************************/
|
||||
|
||||
/* Include logging header files and define logging macros in the following order:
|
||||
* 1. Include the header file "logging_levels.h".
|
||||
* 2. Define the LIBRARY_LOG_NAME and LIBRARY_LOG_LEVEL macros depending on
|
||||
* the logging configuration for PKCS #11.
|
||||
* 3. Include the header file "logging_stack.h", if logging is enabled for PKCS #11.
|
||||
*/
|
||||
|
||||
#include "logging_levels.h"
|
||||
|
||||
/* Logging configuration for the PKCS #11 library. */
|
||||
#ifndef LIBRARY_LOG_NAME
|
||||
#define LIBRARY_LOG_NAME "PKCS11"
|
||||
#endif
|
||||
|
||||
#ifndef LIBRARY_LOG_LEVEL
|
||||
#define LIBRARY_LOG_LEVEL LOG_ERROR
|
||||
#endif
|
||||
|
||||
/* Prototype for the function used to print to console on Windows simulator
|
||||
* of FreeRTOS.
|
||||
* The function prints to the console before the network is connected;
|
||||
* then a UDP port after the network has connected. */
|
||||
extern void vLoggingPrintf( const char * pcFormatString,
|
||||
... );
|
||||
|
||||
/* Map the SdkLog macro to the logging function to enable logging
|
||||
* on Windows simulator. */
|
||||
#ifndef SdkLog
|
||||
#define SdkLog( message ) vLoggingPrintf message
|
||||
#endif
|
||||
|
||||
#include "logging_stack.h"
|
||||
|
||||
/**
|
||||
* @brief Malloc API used by core_pkcs11.h
|
||||
*/
|
||||
#define PKCS11_MALLOC pvPortMalloc
|
||||
|
||||
/**
|
||||
* @brief Free API used by core_pkcs11.h
|
||||
*/
|
||||
#define PKCS11_FREE vPortFree
|
||||
|
||||
/**
|
||||
* @brief PKCS #11 default user PIN.
|
||||
*
|
||||
* The PKCS #11 standard specifies the presence of a user PIN. That feature is
|
||||
* sensible for applications that have an interactive user interface and memory
|
||||
* protections. However, since typical microcontroller applications lack one or
|
||||
* both of those, the user PIN is assumed to be used herein for interoperability
|
||||
* purposes only, and not as a security feature.
|
||||
*
|
||||
* Note: Do not cast this to a pointer! The library calls sizeof to get the length
|
||||
* of this string.
|
||||
*/
|
||||
#define configPKCS11_DEFAULT_USER_PIN "0000"
|
||||
|
||||
/**
|
||||
* @brief Maximum length (in characters) for a PKCS #11 CKA_LABEL
|
||||
* attribute.
|
||||
*/
|
||||
#define pkcs11configMAX_LABEL_LENGTH 32
|
||||
|
||||
/**
|
||||
* @brief Maximum number of token objects that can be stored
|
||||
* by the PKCS #11 module.
|
||||
*/
|
||||
#define pkcs11configMAX_NUM_OBJECTS 6
|
||||
|
||||
/**
|
||||
* @brief Maximum number of sessions that can be stored
|
||||
* by the PKCS #11 module.
|
||||
*/
|
||||
#define pkcs11configMAX_SESSIONS 10
|
||||
|
||||
/**
|
||||
* @brief Set to 1 if a PAL destroy object is implemented.
|
||||
*
|
||||
* If set to 0, no PAL destroy object is implemented, and this functionality
|
||||
* is implemented in the common PKCS #11 layer.
|
||||
*/
|
||||
#define pkcs11configPAL_DESTROY_SUPPORTED 0
|
||||
|
||||
/**
|
||||
* @brief Set to 1 if OTA image verification via PKCS #11 module is supported.
|
||||
*
|
||||
* If set to 0, OTA code signing certificate is built in via
|
||||
* aws_ota_codesigner_certificate.h.
|
||||
*/
|
||||
#define pkcs11configOTA_SUPPORTED 0
|
||||
|
||||
/**
|
||||
* @brief Set to 1 if PAL supports storage for JITP certificate,
|
||||
* code verify certificate, and trusted server root certificate.
|
||||
*
|
||||
* If set to 0, PAL does not support storage mechanism for these, and
|
||||
* they are accessed via headers compiled into the code.
|
||||
*/
|
||||
#define pkcs11configJITP_CODEVERIFY_ROOT_CERT_SUPPORTED 0
|
||||
|
||||
/**
|
||||
* @brief The PKCS #11 label for device private key.
|
||||
*
|
||||
* Private key for connection to AWS IoT endpoint. The corresponding
|
||||
* public key should be registered with the AWS IoT endpoint.
|
||||
*/
|
||||
#define pkcs11configLABEL_DEVICE_PRIVATE_KEY_FOR_TLS "Device Priv TLS Key"
|
||||
|
||||
/**
|
||||
* @brief The PKCS #11 label for device public key.
|
||||
*
|
||||
* The public key corresponding to pkcs11configLABEL_DEVICE_PRIVATE_KEY_FOR_TLS.
|
||||
*/
|
||||
#define pkcs11configLABEL_DEVICE_PUBLIC_KEY_FOR_TLS "Device Pub TLS Key"
|
||||
|
||||
/**
|
||||
* @brief The PKCS #11 label for the device certificate.
|
||||
*
|
||||
* Device certificate corresponding to pkcs11configLABEL_DEVICE_PRIVATE_KEY_FOR_TLS.
|
||||
*/
|
||||
#define pkcs11configLABEL_DEVICE_CERTIFICATE_FOR_TLS "Device Cert"
|
||||
|
||||
/**
|
||||
* @brief The PKCS #11 label for the object to be used for code verification.
|
||||
*
|
||||
* Used by over-the-air update code to verify an incoming signed image.
|
||||
*/
|
||||
#define pkcs11configLABEL_CODE_VERIFICATION_KEY "Code Verify Key"
|
||||
|
||||
/**
|
||||
* @brief The PKCS #11 label for Just-In-Time-Provisioning.
|
||||
*
|
||||
* The certificate corresponding to the issuer of the device certificate
|
||||
* (pkcs11configLABEL_DEVICE_CERTIFICATE_FOR_TLS) when using the JITR or
|
||||
* JITP flow.
|
||||
*/
|
||||
#define pkcs11configLABEL_JITP_CERTIFICATE "JITP Cert"
|
||||
|
||||
/**
|
||||
* @brief The PKCS #11 label for the AWS Trusted Root Certificate.
|
||||
*
|
||||
* @see aws_default_root_certificates.h
|
||||
*/
|
||||
#define pkcs11configLABEL_ROOT_CERTIFICATE "Root Cert"
|
||||
|
||||
#endif /* _CORE_PKCS11_CONFIG_H_ */
|
@ -0,0 +1,462 @@
|
||||
/*
|
||||
* FreeRTOS V202012.00
|
||||
* Copyright (C) 2020 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.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DEMO_CONFIG_H
|
||||
#define DEMO_CONFIG_H
|
||||
|
||||
/**************************************************/
|
||||
/******* DO NOT CHANGE the following order ********/
|
||||
/**************************************************/
|
||||
|
||||
/* Include logging header files and define logging macros in the following order:
|
||||
* 1. Include the header file "logging_levels.h".
|
||||
* 2. Define the LIBRARY_LOG_NAME and LIBRARY_LOG_LEVEL macros depending on
|
||||
* the logging configuration for DEMO.
|
||||
* 3. Include the header file "logging_stack.h", if logging is enabled for DEMO.
|
||||
*/
|
||||
|
||||
#include "logging_levels.h"
|
||||
|
||||
/* Logging configuration for the Demo. */
|
||||
#ifndef LIBRARY_LOG_NAME
|
||||
#define LIBRARY_LOG_NAME "OTADemo"
|
||||
#endif
|
||||
|
||||
#ifndef LIBRARY_LOG_LEVEL
|
||||
#define LIBRARY_LOG_LEVEL LOG_DEBUG
|
||||
#endif
|
||||
|
||||
/* Prototype for the function used to print to console on Windows simulator
|
||||
* of FreeRTOS.
|
||||
* The function prints to the console before the network is connected;
|
||||
* then a UDP port after the network has connected. */
|
||||
extern void vLoggingPrintf( const char * pcFormatString,
|
||||
... );
|
||||
|
||||
/* Map the SdkLog macro to the logging function to enable logging
|
||||
* on Windows simulator. */
|
||||
#ifndef SdkLog
|
||||
#define SdkLog( message ) vLoggingPrintf message
|
||||
#endif
|
||||
|
||||
#include "logging_stack.h"
|
||||
|
||||
/************ End of logging configuration ****************/
|
||||
|
||||
/**
|
||||
* @brief The version for the firmware which is running. OTA agent uses this
|
||||
* version number to perform anti-rollback validation. The firmware version for the
|
||||
* download image should be higher than the current version, otherwise the new image is
|
||||
* rejected in self test phase.
|
||||
*/
|
||||
#define APP_VERSION_MAJOR 0
|
||||
#define APP_VERSION_MINOR 9
|
||||
#define APP_VERSION_BUILD 2
|
||||
|
||||
/**
|
||||
* @brief The MQTT client identifier used in this example. Each client identifier
|
||||
* must be unique so edit as required to ensure no two clients connecting to the
|
||||
* same broker use the same client identifier.
|
||||
*
|
||||
*!!! Please note a #defined constant is used for convenience of demonstration
|
||||
*!!! only. Production devices can use something unique to the device that can
|
||||
*!!! be read by software, such as a production serial number, instead of a
|
||||
*!!! hard coded constant.
|
||||
*
|
||||
*/
|
||||
#define democonfigCLIENT_IDENTIFIER "...insert here..."
|
||||
|
||||
/**
|
||||
* @brief Endpoint of the MQTT broker to connect to.
|
||||
*
|
||||
* This demo application can be run with any MQTT broker, although it is
|
||||
* recommended to use one that supports mutual authentication. If mutual
|
||||
* authentication is not used, then #democonfigUSE_TLS should be set to 0.
|
||||
*
|
||||
* For AWS IoT MQTT broker, this is the Thing's REST API Endpoint.
|
||||
*
|
||||
* @note Your AWS IoT Core endpoint can be found in the AWS IoT console under
|
||||
* Settings/Custom Endpoint, or using the describe-endpoint REST API (with
|
||||
* AWS CLI command line tool).
|
||||
*
|
||||
*/
|
||||
#define democonfigMQTT_BROKER_ENDPOINT "...insert here..."
|
||||
|
||||
/**
|
||||
* @brief The port to use for the demo.
|
||||
*
|
||||
* In general, port 8883 is for secured MQTT connections, and port 1883 if not
|
||||
* using TLS.
|
||||
*
|
||||
* @note Port 443 requires use of the ALPN TLS extension with the ALPN protocol
|
||||
* name. Using ALPN with this demo would require additional changes, including
|
||||
* setting the `pAlpnProtos` member of the `NetworkCredentials_t` struct before
|
||||
* forming the TLS connection. When using port 8883, ALPN is not required.
|
||||
*
|
||||
* #define democonfigMQTT_BROKER_PORT ( insert here. )
|
||||
*/
|
||||
#define democonfigMQTT_BROKER_PORT ( 8883 )
|
||||
|
||||
/**
|
||||
* @brief Server's root CA certificate.
|
||||
*
|
||||
* For AWS IoT MQTT broker, this certificate is used to identify the AWS IoT
|
||||
* server and is publicly available. Refer to the AWS documentation available
|
||||
* in the link below.
|
||||
* https://docs.aws.amazon.com/iot/latest/developerguide/server-authentication.html#server-authentication-certs
|
||||
*
|
||||
* @note This certificate should be PEM-encoded.
|
||||
*
|
||||
* @note If you would like to setup an MQTT broker for running this demo,
|
||||
* please see `mqtt_broker_setup.txt`.
|
||||
*
|
||||
* Must include the PEM header and footer:
|
||||
* "-----BEGIN CERTIFICATE-----\n"\
|
||||
* "...base64 data...\n"\
|
||||
* "-----END CERTIFICATE-----\n"
|
||||
*
|
||||
* #define democonfigROOT_CA_PEM "...insert here..."
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief Client certificate.
|
||||
*
|
||||
* For AWS IoT MQTT broker, refer to the AWS documentation below for details
|
||||
* regarding client authentication.
|
||||
* https://docs.aws.amazon.com/iot/latest/developerguide/client-authentication.html
|
||||
*
|
||||
* @note This certificate should be PEM-encoded.
|
||||
*
|
||||
* Must include the PEM header and footer:
|
||||
* "-----BEGIN CERTIFICATE-----\n"\
|
||||
* "...base64 data...\n"\
|
||||
* "-----END CERTIFICATE-----\n"
|
||||
*
|
||||
* #define democonfigCLIENT_CERTIFICATE_PEM "...insert here..."
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief Client's private key.
|
||||
*
|
||||
*!!! Please note pasting a key into the header file in this manner is for
|
||||
*!!! convenience of demonstration only and should not be done in production.
|
||||
*!!! Never paste a production private key here!. Production devices should
|
||||
*!!! store keys securely, such as within a secure element. Additionally,
|
||||
*!!! we provide the corePKCS library that further enhances security by
|
||||
*!!! enabling securely stored keys to be used without exposing them to
|
||||
*!!! software.
|
||||
*
|
||||
* For AWS IoT MQTT broker, refer to the AWS documentation below for details
|
||||
* regarding clientauthentication.
|
||||
* https://docs.aws.amazon.com/iot/latest/developerguide/client-authentication.html
|
||||
*
|
||||
* @note This private key should be PEM-encoded.
|
||||
*
|
||||
* Must include the PEM header and footer:
|
||||
* "-----BEGIN RSA PRIVATE KEY-----\n"\
|
||||
* "...base64 data...\n"\
|
||||
* "-----END RSA PRIVATE KEY-----\n"
|
||||
*
|
||||
* #define democonfigCLIENT_PRIVATE_KEY_PEM "...insert here..."
|
||||
*/
|
||||
|
||||
/*
|
||||
* @brief Server's root CA certificate for TLS authentication with S3.
|
||||
*
|
||||
* The Baltimore Cybertrust Root CA Certificate is defined below.
|
||||
*
|
||||
* @note This certificate should be PEM-encoded.
|
||||
*
|
||||
* Must include the PEM header and footer:
|
||||
* "-----BEGIN CERTIFICATE-----\n"\
|
||||
* "...base64 data...\n"\
|
||||
* "-----END CERTIFICATE-----\n"
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef democonfigHTTPS_ROOT_CA_PEM
|
||||
#define democonfigHTTPS_ROOT_CA_PEM \
|
||||
"-----BEGIN CERTIFICATE-----\n" \
|
||||
"MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJ\n" \
|
||||
"RTESMBAGA1UEChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYD\n" \
|
||||
"VQQDExlCYWx0aW1vcmUgQ3liZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoX\n" \
|
||||
"DTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMCSUUxEjAQBgNVBAoTCUJhbHRpbW9y\n" \
|
||||
"ZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFsdGltb3JlIEN5YmVy\n" \
|
||||
"VHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKMEuyKr\n" \
|
||||
"mD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjr\n" \
|
||||
"IZ3AQSsBUnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeK\n" \
|
||||
"mpYcqWe4PwzV9/lSEy/CG9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSu\n" \
|
||||
"XmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9XbIGevOF6uvUA65ehD5f/xXtabz5OTZy\n" \
|
||||
"dc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjprl3RjM71oGDHweI12v/ye\n" \
|
||||
"jl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoIVDaGezq1\n" \
|
||||
"BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3\n" \
|
||||
"DQEBBQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT92\n" \
|
||||
"9hkTI7gQCvlYpNRhcL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3Wgx\n" \
|
||||
"jkzSswF07r51XgdIGn9w/xZchMB5hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0\n" \
|
||||
"Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsaY71k5h+3zvDyny67G7fyUIhz\n" \
|
||||
"ksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9HRCwBXbsdtTLS\n" \
|
||||
"R9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp\n" \
|
||||
"-----END CERTIFICATE-----\n"
|
||||
#endif /* ifndef democonfigHTTPS_ROOT_CA_PEM */
|
||||
|
||||
/**
|
||||
* @brief AWS IoT Core server port number for HTTPS connections.
|
||||
*
|
||||
* For this demo, an X.509 certificate is used to verify the client.
|
||||
*
|
||||
* @note Port 443 requires use of the ALPN TLS extension with the ALPN protocol
|
||||
* name being x-amzn-http-ca. When using port 8443, ALPN is not required.
|
||||
*/
|
||||
#define democonfigHTTPS_PORT 443
|
||||
|
||||
/**
|
||||
* @brief An option to disable Server Name Indication.
|
||||
*
|
||||
* @note When using a local Mosquitto server setup, SNI needs to be disabled
|
||||
* for an MQTT broker that only has an IP address but no hostname. However,
|
||||
* SNI should be enabled whenever possible.
|
||||
*/
|
||||
#define democonfigDISABLE_SNI ( pdFALSE )
|
||||
|
||||
/**
|
||||
* @brief Configuration that indicates if the demo connection is made to the AWS IoT Core MQTT broker.
|
||||
*
|
||||
* If username/password based authentication is used, the demo will use appropriate TLS ALPN and
|
||||
* SNI configurations as required for the Custom Authentication feature of AWS IoT.
|
||||
* For more information, refer to the following documentation:
|
||||
* https://docs.aws.amazon.com/iot/latest/developerguide/custom-auth.html#custom-auth-mqtt
|
||||
*
|
||||
* #define democonfigUSE_AWS_IOT_CORE_BROKER ( 1 )
|
||||
*/
|
||||
#define democonfigUSE_AWS_IOT_CORE_BROKER ( 1 )
|
||||
|
||||
/**
|
||||
* @brief The username value for authenticating client to the MQTT broker when
|
||||
* username/password based client authentication is used.
|
||||
*
|
||||
* For AWS IoT MQTT broker, refer to the AWS IoT documentation below for
|
||||
* details regarding client authentication with a username and password.
|
||||
* https://docs.aws.amazon.com/iot/latest/developerguide/custom-authentication.html
|
||||
* An authorizer setup needs to be done, as mentioned in the above link, to use
|
||||
* username/password based client authentication.
|
||||
*
|
||||
* #define democonfigCLIENT_USERNAME "...insert here..."
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief The password value for authenticating client to the MQTT broker when
|
||||
* username/password based client authentication is used.
|
||||
*
|
||||
* For AWS IoT MQTT broker, refer to the AWS IoT documentation below for
|
||||
* details regarding client authentication with a username and password.
|
||||
* https://docs.aws.amazon.com/iot/latest/developerguide/custom-authentication.html
|
||||
* An authorizer setup needs to be done, as mentioned in the above link, to use
|
||||
* username/password based client authentication.
|
||||
*
|
||||
* #define democonfigCLIENT_PASSWORD "...insert here..."
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief The name of the operating system that the application is running on.
|
||||
* The current value is given as an example. Please update for your specific
|
||||
* operating system.
|
||||
*/
|
||||
#define democonfigOS_NAME "FreeRTOS"
|
||||
|
||||
/**
|
||||
* @brief The version of the operating system that the application is running
|
||||
* on. The current value is given as an example. Please update for your specific
|
||||
* operating system version.
|
||||
*/
|
||||
#define democonfigOS_VERSION tskKERNEL_VERSION_NUMBER
|
||||
|
||||
/**
|
||||
* @brief The name of the hardware platform the application is running on. The
|
||||
* current value is given as an example. Please update for your specific
|
||||
* hardware platform.
|
||||
*/
|
||||
#define democonfigHARDWARE_PLATFORM_NAME "WinSim"
|
||||
|
||||
/**
|
||||
* @brief The name of the MQTT library used and its version, following an "@"
|
||||
* symbol.
|
||||
*/
|
||||
#define democonfigMQTT_LIB "core-mqtt@1.0.0"
|
||||
|
||||
/**
|
||||
* @brief Whether to use mutual authentication. If this macro is not set to 1
|
||||
* or not defined, then plaintext TCP will be used instead of TLS over TCP.
|
||||
*/
|
||||
#define democonfigUSE_TLS 1
|
||||
|
||||
/**
|
||||
* @brief Set the stack size of the main demo task.
|
||||
*
|
||||
* In the Windows port, this stack only holds a structure. The actual
|
||||
* stack is created by an operating system thread.
|
||||
*/
|
||||
#define democonfigDEMO_STACKSIZE configMINIMAL_STACK_SIZE
|
||||
|
||||
/**********************************************************************************
|
||||
* Error checks and derived values only below here - do not edit below here. -----*
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
/* Compile time error for some undefined configs, and provide default values
|
||||
* for others. */
|
||||
#ifndef democonfigMQTT_BROKER_ENDPOINT
|
||||
#error "Please define democonfigMQTT_BROKER_ENDPOINT in demo_config.h."
|
||||
#endif
|
||||
|
||||
#ifndef democonfigCLIENT_IDENTIFIER
|
||||
|
||||
/**
|
||||
* @brief The MQTT client identifier used in this example. Each client identifier
|
||||
* must be unique so edit as required to ensure no two clients connecting to the
|
||||
* same broker use the same client identifier. Using a #define is for convenience
|
||||
* of demonstration only - production devices should use something unique to the
|
||||
* device that can be read from software - such as a production serial number.
|
||||
*/
|
||||
#error "Please define democonfigCLIENT_IDENTIFIER in demo_config.h to something unique for this device."
|
||||
#endif
|
||||
|
||||
|
||||
#if defined( democonfigUSE_TLS ) && ( democonfigUSE_TLS == 1 )
|
||||
#ifndef democonfigROOT_CA_PEM
|
||||
#error "Please define Root CA certificate of the MQTT broker(democonfigROOT_CA_PEM) in demo_config.h."
|
||||
#endif
|
||||
|
||||
/* If no username is defined, then a client certificate/key is required. */
|
||||
#ifndef democonfigCLIENT_USERNAME
|
||||
|
||||
/*
|
||||
*!!! Please note democonfigCLIENT_PRIVATE_KEY_PEM in used for
|
||||
*!!! convenience of demonstration only. Production devices should
|
||||
*!!! store keys securely, such as within a secure element.
|
||||
*/
|
||||
|
||||
#ifndef democonfigCLIENT_CERTIFICATE_PEM
|
||||
#error "Please define client certificate(democonfigCLIENT_CERTIFICATE_PEM) in demo_config.h."
|
||||
#endif
|
||||
#ifndef democonfigCLIENT_PRIVATE_KEY_PEM
|
||||
#error "Please define client private key(democonfigCLIENT_PRIVATE_KEY_PEM) in demo_config.h."
|
||||
#endif
|
||||
#else
|
||||
|
||||
/* If a username is defined, a client password also would need to be defined for
|
||||
* client authentication. */
|
||||
#ifndef democonfigCLIENT_PASSWORD
|
||||
#error "Please define client password(democonfigCLIENT_PASSWORD) in demo_config.h for client authentication based on username/password."
|
||||
#endif
|
||||
|
||||
/* AWS IoT MQTT broker port needs to be 443 for client authentication based on
|
||||
* username/password. */
|
||||
#if defined( democonfigUSE_AWS_IOT_CORE_BROKER ) && democonfigMQTT_BROKER_PORT != 443
|
||||
#error "Broker port(democonfigMQTT_BROKER_PORT) should be defined as 443 in demo_config.h for client authentication based on username/password in AWS IoT Core."
|
||||
#endif
|
||||
#endif /* ifndef democonfigCLIENT_USERNAME */
|
||||
|
||||
#ifndef democonfigMQTT_BROKER_PORT
|
||||
#define democonfigMQTT_BROKER_PORT ( 8883 )
|
||||
#endif
|
||||
#else /* if defined( democonfigUSE_TLS ) && ( democonfigUSE_TLS == 1 ) */
|
||||
#ifndef democonfigMQTT_BROKER_PORT
|
||||
#define democonfigMQTT_BROKER_PORT ( 1883 )
|
||||
#endif
|
||||
#endif /* if defined( democonfigUSE_TLS ) && ( democonfigUSE_TLS == 1 ) */
|
||||
|
||||
/**
|
||||
* @brief ALPN (Application-Layer Protocol Negotiation) protocol name for AWS IoT MQTT.
|
||||
*
|
||||
* This will be used if democonfigMQTT_BROKER_PORT is configured as 443 for the AWS IoT MQTT broker.
|
||||
* Please see more details about the ALPN protocol for AWS IoT MQTT endpoint
|
||||
* in the link below.
|
||||
* https://aws.amazon.com/blogs/iot/mqtt-with-tls-client-authentication-on-port-443-why-it-is-useful-and-how-it-works/
|
||||
*/
|
||||
#define AWS_IOT_MQTT_ALPN "\x0ex-amzn-mqtt-ca"
|
||||
|
||||
/**
|
||||
* @brief This is the ALPN (Application-Layer Protocol Negotiation) string
|
||||
* required by AWS IoT for password-based authentication using TCP port 443.
|
||||
*/
|
||||
#define AWS_IOT_CUSTOM_AUTH_ALPN "\x04mqtt"
|
||||
|
||||
/**
|
||||
* Provide default values for undefined configuration settings.
|
||||
*/
|
||||
#ifndef democonfigOS_NAME
|
||||
#define democonfigOS_NAME "FreeRTOS"
|
||||
#endif
|
||||
|
||||
#ifndef democonfigOS_VERSION
|
||||
#define democonfigOS_VERSION tskKERNEL_VERSION_NUMBER
|
||||
#endif
|
||||
|
||||
#ifndef democonfigHARDWARE_PLATFORM_NAME
|
||||
#define democonfigHARDWARE_PLATFORM_NAME "WinSim"
|
||||
#endif
|
||||
|
||||
#ifndef democonfigMQTT_LIB
|
||||
#define democonfigMQTT_LIB "core-mqtt@1.0.0"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief The MQTT metrics string expected by AWS IoT.
|
||||
*/
|
||||
#define AWS_IOT_METRICS_STRING \
|
||||
"?SDK=" democonfigOS_NAME "&Version=" democonfigOS_VERSION \
|
||||
"&Platform=" democonfigHARDWARE_PLATFORM_NAME "&MQTTLib=" democonfigMQTT_LIB
|
||||
|
||||
/**
|
||||
* @brief The length of the MQTT metrics string expected by AWS IoT.
|
||||
*/
|
||||
#define AWS_IOT_METRICS_STRING_LENGTH ( ( uint16_t ) ( sizeof( AWS_IOT_METRICS_STRING ) - 1 ) )
|
||||
|
||||
#ifdef democonfigCLIENT_USERNAME
|
||||
|
||||
/**
|
||||
* @brief Append the username with the metrics string if #democonfigCLIENT_USERNAME is defined.
|
||||
*
|
||||
* This is to support both metrics reporting and username/password based client
|
||||
* authentication by AWS IoT.
|
||||
*/
|
||||
#define CLIENT_USERNAME_WITH_METRICS democonfigCLIENT_USERNAME AWS_IOT_METRICS_STRING
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Length of client identifier.
|
||||
*/
|
||||
#define democonfigCLIENT_IDENTIFIER_LENGTH ( ( uint16_t ) ( sizeof( democonfigCLIENT_IDENTIFIER ) - 1 ) )
|
||||
|
||||
/**
|
||||
* @brief Length of MQTT server host name.
|
||||
*/
|
||||
#define democonfigBROKER_ENDPOINT_LENGTH ( ( uint16_t ) ( sizeof( democonfigMQTT_BROKER_ENDPOINT ) - 1 ) )
|
||||
|
||||
|
||||
#endif /* DEMO_CONFIG_H */
|
@ -0,0 +1,375 @@
|
||||
/*
|
||||
* FreeRTOS V202012.00
|
||||
* Copyright (C) 2020 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.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
/***
|
||||
* See https://www.FreeRTOS.org/coremqtt for configuration and usage instructions.
|
||||
***/
|
||||
|
||||
/* Standard includes. */
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
/* Visual studio intrinsics used so the __debugbreak() function is available
|
||||
* should an assert get hit. */
|
||||
#include <intrin.h>
|
||||
|
||||
/* FreeRTOS includes. */
|
||||
#include <FreeRTOS.h>
|
||||
#include "task.h"
|
||||
|
||||
/* TCP/IP stack includes. */
|
||||
#include "FreeRTOS_IP.h"
|
||||
#include "FreeRTOS_Sockets.h"
|
||||
|
||||
/* Demo logging includes. */
|
||||
#include "logging.h"
|
||||
|
||||
/* Demo Specific configs. */
|
||||
#include "demo_config.h"
|
||||
|
||||
|
||||
/*
|
||||
* Prototypes for the demos that can be started from this project. Note the
|
||||
* Ota demo is not actually started until the network is already, which is
|
||||
* indicated by vApplicationIPNetworkEventHook() executing - hence
|
||||
* vStartOtaDemo() is called from inside vApplicationIPNetworkEventHook().
|
||||
*/
|
||||
extern void vStartOtaDemo( void );
|
||||
|
||||
/*
|
||||
* Just seeds the simple pseudo random number generator.
|
||||
*
|
||||
* !!! NOTE !!!
|
||||
* This is not a secure method of generating random numbers and production
|
||||
* devices should use a true random number generator (TRNG).
|
||||
*/
|
||||
static void prvSRand( UBaseType_t ulSeed );
|
||||
|
||||
/*
|
||||
* Miscellaneous initialization including preparing the logging and seeding the
|
||||
* random number generator.
|
||||
*/
|
||||
static void prvMiscInitialisation( void );
|
||||
|
||||
/* The default IP and MAC address used by the demo. The address configuration
|
||||
* defined here will be used if ipconfigUSE_DHCP is 0, or if ipconfigUSE_DHCP is
|
||||
* 1 but a DHCP server could not be contacted. See the online documentation for
|
||||
* more information. */
|
||||
static const uint8_t ucIPAddress[ 4 ] = { configIP_ADDR0, configIP_ADDR1, configIP_ADDR2, configIP_ADDR3 };
|
||||
static const uint8_t ucNetMask[ 4 ] = { configNET_MASK0, configNET_MASK1, configNET_MASK2, configNET_MASK3 };
|
||||
static const uint8_t ucGatewayAddress[ 4 ] = { configGATEWAY_ADDR0, configGATEWAY_ADDR1, configGATEWAY_ADDR2, configGATEWAY_ADDR3 };
|
||||
static const uint8_t ucDNSServerAddress[ 4 ] = { configDNS_SERVER_ADDR0, configDNS_SERVER_ADDR1, configDNS_SERVER_ADDR2, configDNS_SERVER_ADDR3 };
|
||||
|
||||
/* Set the following constant to pdTRUE to log using the method indicated by the
|
||||
* name of the constant, or pdFALSE to not log using the method indicated by the
|
||||
* name of the constant. Options include to standard out (xLogToStdout), to a disk
|
||||
* file (xLogToFile), and to a UDP port (xLogToUDP). If xLogToUDP is set to pdTRUE
|
||||
* then UDP messages are sent to the IP address configured as the UDP logging server
|
||||
* address (see the configUDP_LOGGING_ADDR0 definitions in FreeRTOSConfig.h) and
|
||||
* the port number set by configPRINT_PORT in FreeRTOSConfig.h. */
|
||||
const BaseType_t xLogToStdout = pdTRUE, xLogToFile = pdFALSE, xLogToUDP = pdFALSE;
|
||||
|
||||
/* Default MAC address configuration. The demo creates a virtual network
|
||||
* connection that uses this MAC address by accessing the raw Ethernet data
|
||||
* to and from a real network connection on the host PC. See the
|
||||
* configNETWORK_INTERFACE_TO_USE definition for information on how to configure
|
||||
* the real network connection to use. */
|
||||
const uint8_t ucMACAddress[ 6 ] = { configMAC_ADDR0, configMAC_ADDR1, configMAC_ADDR2, configMAC_ADDR3, configMAC_ADDR4, configMAC_ADDR5 };
|
||||
|
||||
/* Used by the pseudo random number generator. */
|
||||
static UBaseType_t ulNextRand;
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
int main( void )
|
||||
{
|
||||
/* Miscellaneous initialization including preparing the logging and seeding
|
||||
* the random number generator. */
|
||||
prvMiscInitialisation();
|
||||
|
||||
/* Initialize the network interface.
|
||||
*
|
||||
***NOTE*** Tasks that use the network are created in the network event hook
|
||||
* when the network is connected and ready for use (see the implementation of
|
||||
* vApplicationIPNetworkEventHook() below). The address values passed in here
|
||||
* are used if ipconfigUSE_DHCP is set to 0, or if ipconfigUSE_DHCP is set to 1
|
||||
* but a DHCP server cannot be contacted. */
|
||||
FreeRTOS_IPInit( ucIPAddress, ucNetMask, ucGatewayAddress, ucDNSServerAddress, ucMACAddress );
|
||||
|
||||
/* Start the RTOS scheduler. */
|
||||
vTaskStartScheduler();
|
||||
|
||||
/* If all is well, the scheduler will now be running, and the following
|
||||
* line will never be reached. If the following line does execute, then
|
||||
* there was insufficient FreeRTOS heap memory available for the idle and/or
|
||||
* timer tasks to be created. See the memory management section on the
|
||||
* FreeRTOS web site for more details (this is standard text that is not
|
||||
* really applicable to the Win32 simulator port). */
|
||||
for( ; ; )
|
||||
{
|
||||
__debugbreak();
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Called by FreeRTOS+TCP when the network connects or disconnects. Disconnect
|
||||
* events are only received if implemented in the MAC driver. */
|
||||
void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent )
|
||||
{
|
||||
uint32_t ulIPAddress, ulNetMask, ulGatewayAddress, ulDNSServerAddress;
|
||||
char cBuffer[ 16 ];
|
||||
static BaseType_t xTasksAlreadyCreated = pdFALSE;
|
||||
|
||||
/* If the network has just come up...*/
|
||||
if( eNetworkEvent == eNetworkUp )
|
||||
{
|
||||
/* Create the tasks that use the IP stack if they have not already been
|
||||
* created. */
|
||||
if( xTasksAlreadyCreated == pdFALSE )
|
||||
{
|
||||
/* Demos that use the network are created after the network is
|
||||
* up. */
|
||||
LogInfo( ( "---------STARTING DEMO---------\r\n" ) );
|
||||
vStartOtaDemo();
|
||||
xTasksAlreadyCreated = pdTRUE;
|
||||
}
|
||||
|
||||
/* Print out the network configuration, which may have come from a DHCP
|
||||
* server. */
|
||||
FreeRTOS_GetAddressConfiguration( &ulIPAddress, &ulNetMask, &ulGatewayAddress, &ulDNSServerAddress );
|
||||
FreeRTOS_inet_ntoa( ulIPAddress, cBuffer );
|
||||
LogInfo( ( "\r\n\r\nIP Address: %s\r\n", cBuffer ) );
|
||||
|
||||
FreeRTOS_inet_ntoa( ulNetMask, cBuffer );
|
||||
LogInfo( ( "Subnet Mask: %s\r\n", cBuffer ) );
|
||||
|
||||
FreeRTOS_inet_ntoa( ulGatewayAddress, cBuffer );
|
||||
LogInfo( ( "Gateway Address: %s\r\n", cBuffer ) );
|
||||
|
||||
FreeRTOS_inet_ntoa( ulDNSServerAddress, cBuffer );
|
||||
LogInfo( ( "DNS Server Address: %s\r\n\r\n\r\n", cBuffer ) );
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vAssertCalled( const char * pcFile,
|
||||
uint32_t ulLine )
|
||||
{
|
||||
volatile uint32_t ulBlockVariable = 0UL;
|
||||
volatile char * pcFileName = ( volatile char * ) pcFile;
|
||||
volatile uint32_t ulLineNumber = ulLine;
|
||||
|
||||
( void ) pcFileName;
|
||||
( void ) ulLineNumber;
|
||||
|
||||
printf( "vAssertCalled( %s, %u\n", pcFile, ulLine );
|
||||
|
||||
/* Setting ulBlockVariable to a non-zero value in the debugger will allow
|
||||
* this function to be exited. */
|
||||
taskDISABLE_INTERRUPTS();
|
||||
{
|
||||
while( ulBlockVariable == 0UL )
|
||||
{
|
||||
__debugbreak();
|
||||
}
|
||||
}
|
||||
taskENABLE_INTERRUPTS();
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
UBaseType_t uxRand( void )
|
||||
{
|
||||
const uint32_t ulMultiplier = 0x015a4e35UL, ulIncrement = 1UL;
|
||||
|
||||
/*
|
||||
* Utility function to generate a pseudo random number.
|
||||
*
|
||||
* !!!NOTE!!!
|
||||
* This is not a secure method of generating a random number. Production
|
||||
* devices should use a True Random Number Generator (TRNG).
|
||||
*/
|
||||
ulNextRand = ( ulMultiplier * ulNextRand ) + ulIncrement;
|
||||
return( ( int ) ( ulNextRand >> 16UL ) & 0x7fffUL );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvSRand( UBaseType_t ulSeed )
|
||||
{
|
||||
/* Utility function to seed the pseudo random number generator. */
|
||||
ulNextRand = ulSeed;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvMiscInitialisation( void )
|
||||
{
|
||||
time_t xTimeNow;
|
||||
uint32_t ulLoggingIPAddress;
|
||||
|
||||
ulLoggingIPAddress = FreeRTOS_inet_addr_quick( configUDP_LOGGING_ADDR0, configUDP_LOGGING_ADDR1, configUDP_LOGGING_ADDR2, configUDP_LOGGING_ADDR3 );
|
||||
vLoggingInit( xLogToStdout, xLogToFile, xLogToUDP, ulLoggingIPAddress, configPRINT_PORT );
|
||||
|
||||
/*
|
||||
* Seed random number generator.
|
||||
*
|
||||
* !!!NOTE!!!
|
||||
* This is not a secure method of generating a random number. Production
|
||||
* devices should use a True Random Number Generator (TRNG).
|
||||
*/
|
||||
time( &xTimeNow );
|
||||
LogDebug( ( "Seed for randomizer: %lu\n", xTimeNow ) );
|
||||
prvSRand( ( uint32_t ) xTimeNow );
|
||||
LogDebug( ( "Random numbers: %08X %08X %08X %08X\n", ipconfigRAND32(), ipconfigRAND32(), ipconfigRAND32(), ipconfigRAND32() ) );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( ipconfigUSE_LLMNR != 0 ) || ( ipconfigUSE_NBNS != 0 ) || ( ipconfigDHCP_REGISTER_HOSTNAME == 1 )
|
||||
|
||||
const char * pcApplicationHostnameHook( void )
|
||||
{
|
||||
/* Assign the name "FreeRTOS" to this network node. This function will
|
||||
* be called during the DHCP: the machine will be registered with an IP
|
||||
* address plus this name. */
|
||||
return mainHOST_NAME;
|
||||
}
|
||||
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( ipconfigUSE_LLMNR != 0 ) || ( ipconfigUSE_NBNS != 0 )
|
||||
|
||||
BaseType_t xApplicationDNSQueryHook( const char * pcName )
|
||||
{
|
||||
BaseType_t xReturn;
|
||||
|
||||
/* Determine if a name lookup is for this node. Two names are given
|
||||
* to this node: that returned by pcApplicationHostnameHook() and that set
|
||||
* by mainDEVICE_NICK_NAME. */
|
||||
if( _stricmp( pcName, pcApplicationHostnameHook() ) == 0 )
|
||||
{
|
||||
xReturn = pdPASS;
|
||||
}
|
||||
else if( _stricmp( pcName, mainDEVICE_NICK_NAME ) == 0 )
|
||||
{
|
||||
xReturn = pdPASS;
|
||||
}
|
||||
else
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
|
||||
#endif /* if ( ipconfigUSE_LLMNR != 0 ) || ( ipconfigUSE_NBNS != 0 ) */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Callback that provides the inputs necessary to generate a randomized TCP
|
||||
* Initial Sequence Number per RFC 6528. THIS IS ONLY A DUMMY IMPLEMENTATION
|
||||
* THAT RETURNS A PSEUDO RANDOM NUMBER SO IS NOT INTENDED FOR USE IN PRODUCTION
|
||||
* SYSTEMS.
|
||||
*/
|
||||
extern uint32_t ulApplicationGetNextSequenceNumber( uint32_t ulSourceAddress,
|
||||
uint16_t usSourcePort,
|
||||
uint32_t ulDestinationAddress,
|
||||
uint16_t usDestinationPort )
|
||||
{
|
||||
( void ) ulSourceAddress;
|
||||
( void ) usSourcePort;
|
||||
( void ) ulDestinationAddress;
|
||||
( void ) usDestinationPort;
|
||||
|
||||
return uxRand();
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Set *pulNumber to a random number, and return pdTRUE. When the random number
|
||||
* generator is broken, it shall return pdFALSE.
|
||||
* The macros ipconfigRAND32() and configRAND32() are not in use
|
||||
* anymore in FreeRTOS+TCP.
|
||||
*
|
||||
* THIS IS ONLY A DUMMY IMPLEMENTATION THAT RETURNS A PSEUDO RANDOM NUMBER SO IS
|
||||
* NOT INTENDED FOR USE IN PRODUCTION SYSTEMS.
|
||||
*/
|
||||
BaseType_t xApplicationGetRandomNumber( uint32_t * pulNumber )
|
||||
{
|
||||
*pulNumber = uxRand();
|
||||
return pdTRUE;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* 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;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
@ -0,0 +1,134 @@
|
||||
/*
|
||||
* FreeRTOS V202012.00
|
||||
* Copyright (C) 2020 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.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
/* This file configures mbed TLS for FreeRTOS. */
|
||||
|
||||
#ifndef MBEDTLS_CONFIG_H_
|
||||
#define MBEDTLS_CONFIG_H_
|
||||
|
||||
/* FreeRTOS include. */
|
||||
#include "FreeRTOS.h"
|
||||
|
||||
/* Generate errors if deprecated functions are used. */
|
||||
#define MBEDTLS_DEPRECATED_REMOVED
|
||||
|
||||
/* Place AES tables in ROM. */
|
||||
#define MBEDTLS_AES_ROM_TABLES
|
||||
|
||||
/* Enable the following cipher modes. */
|
||||
#define MBEDTLS_CIPHER_MODE_CBC
|
||||
#define MBEDTLS_CIPHER_MODE_CFB
|
||||
#define MBEDTLS_CIPHER_MODE_CTR
|
||||
|
||||
/* Enable the following cipher padding modes. */
|
||||
#define MBEDTLS_CIPHER_PADDING_PKCS7
|
||||
#define MBEDTLS_CIPHER_PADDING_ONE_AND_ZEROS
|
||||
#define MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN
|
||||
#define MBEDTLS_CIPHER_PADDING_ZEROS
|
||||
|
||||
/* Cipher suite configuration. */
|
||||
#define MBEDTLS_REMOVE_ARC4_CIPHERSUITES
|
||||
#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
|
||||
#define MBEDTLS_ECP_NIST_OPTIM
|
||||
#define MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED
|
||||
#define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
|
||||
/* Enable all SSL alert messages. */
|
||||
#define MBEDTLS_SSL_ALL_ALERT_MESSAGES
|
||||
|
||||
/* Enable the following SSL features. */
|
||||
#define MBEDTLS_SSL_ENCRYPT_THEN_MAC
|
||||
#define MBEDTLS_SSL_EXTENDED_MASTER_SECRET
|
||||
#define MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
|
||||
#define MBEDTLS_SSL_PROTO_TLS1_2
|
||||
#define MBEDTLS_SSL_ALPN
|
||||
#define MBEDTLS_SSL_SERVER_NAME_INDICATION
|
||||
|
||||
/* Check certificate key usage. */
|
||||
#define MBEDTLS_X509_CHECK_KEY_USAGE
|
||||
#define MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE
|
||||
#define MBEDTLS_X509_CREATE_C
|
||||
#define MBEDTLS_PK_WRITE_C
|
||||
#define MBEDTLS_X509_CSR_WRITE_C
|
||||
|
||||
/* Disable platform entropy functions. */
|
||||
#define MBEDTLS_NO_PLATFORM_ENTROPY
|
||||
|
||||
/* Enable the following mbed TLS features. */
|
||||
#define MBEDTLS_AES_C
|
||||
#define MBEDTLS_ASN1_PARSE_C
|
||||
#define MBEDTLS_ASN1_WRITE_C
|
||||
#define MBEDTLS_BASE64_C
|
||||
#define MBEDTLS_BIGNUM_C
|
||||
#define MBEDTLS_CIPHER_C
|
||||
#define MBEDTLS_CTR_DRBG_C
|
||||
#define MBEDTLS_ECDH_C
|
||||
#define MBEDTLS_ECDSA_C
|
||||
#define MBEDTLS_ECP_C
|
||||
#define MBEDTLS_ENTROPY_C
|
||||
#define MBEDTLS_GCM_C
|
||||
#define MBEDTLS_MD_C
|
||||
#define MBEDTLS_OID_C
|
||||
#define MBEDTLS_PEM_PARSE_C
|
||||
#define MBEDTLS_PK_C
|
||||
#define MBEDTLS_PK_PARSE_C
|
||||
#define MBEDTLS_PKCS1_V15
|
||||
#define MBEDTLS_PLATFORM_C
|
||||
#define MBEDTLS_RSA_C
|
||||
#define MBEDTLS_SHA1_C
|
||||
#define MBEDTLS_SHA256_C
|
||||
#define MBEDTLS_SSL_CLI_C
|
||||
#define MBEDTLS_SSL_TLS_C
|
||||
#define MBEDTLS_THREADING_ALT
|
||||
#define MBEDTLS_THREADING_C
|
||||
#define MBEDTLS_X509_USE_C
|
||||
#define MBEDTLS_X509_CRT_PARSE_C
|
||||
|
||||
/* Set the memory allocation functions on FreeRTOS. */
|
||||
void * mbedtls_platform_calloc( size_t nmemb,
|
||||
size_t size );
|
||||
void mbedtls_platform_free( void * ptr );
|
||||
#define MBEDTLS_PLATFORM_MEMORY
|
||||
#define MBEDTLS_PLATFORM_CALLOC_MACRO mbedtls_platform_calloc
|
||||
#define MBEDTLS_PLATFORM_FREE_MACRO mbedtls_platform_free
|
||||
|
||||
/* The network send and receive functions on FreeRTOS. */
|
||||
int mbedtls_platform_send( void * ctx,
|
||||
const unsigned char * buf,
|
||||
size_t len );
|
||||
int mbedtls_platform_recv( void * ctx,
|
||||
unsigned char * buf,
|
||||
size_t len );
|
||||
|
||||
/* The entropy poll function. */
|
||||
int mbedtls_platform_entropy_poll( void * data,
|
||||
unsigned char * output,
|
||||
size_t len,
|
||||
size_t * olen );
|
||||
|
||||
#include "mbedtls/check_config.h"
|
||||
|
||||
#endif /* ifndef MBEDTLS_CONFIG_H_ */
|
@ -0,0 +1,200 @@
|
||||
/*
|
||||
* FreeRTOS V202012.00
|
||||
* Copyright (C) 2020 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.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file ota_config.h
|
||||
* @brief OTA user configurable settings.
|
||||
*/
|
||||
|
||||
#ifndef OTA_CONFIG_H_
|
||||
#define OTA_CONFIG_H_
|
||||
|
||||
/**************************************************/
|
||||
/******* DO NOT CHANGE the following order ********/
|
||||
/**************************************************/
|
||||
|
||||
/* Logging related header files are required to be included in the following order:
|
||||
* 1. Include the header file "logging_levels.h".
|
||||
* 2. Define LIBRARY_LOG_NAME and LIBRARY_LOG_LEVEL.
|
||||
* 3. Include the header file "logging_stack.h".
|
||||
*/
|
||||
|
||||
/* Include header that defines log levels. */
|
||||
#include "logging_levels.h"
|
||||
|
||||
/* Configure name and log level for the OTA library. */
|
||||
#ifndef LIBRARY_LOG_NAME
|
||||
#define LIBRARY_LOG_NAME "OTA"
|
||||
#endif
|
||||
#ifndef LIBRARY_LOG_LEVEL
|
||||
#define LIBRARY_LOG_LEVEL LOG_INFO
|
||||
#endif
|
||||
|
||||
|
||||
/* Prototype for the function used to print to console on Windows simulator
|
||||
* of FreeRTOS.
|
||||
* The function prints to the console before the network is connected;
|
||||
* then a UDP port after the network has connected. */
|
||||
extern void vLoggingPrintf( const char * pcFormatString,
|
||||
... );
|
||||
|
||||
/* Map the SdkLog macro to the logging function to enable logging
|
||||
* on Windows simulator. */
|
||||
#ifndef SdkLog
|
||||
#define SdkLog( message ) vLoggingPrintf message
|
||||
#endif
|
||||
|
||||
#include "logging_stack.h"
|
||||
|
||||
/************ End of logging configuration ****************/
|
||||
|
||||
/**
|
||||
* @brief Log base 2 of the size of the file data block message (excluding the header).
|
||||
*
|
||||
* 10 bits yields a data block size of 1KB.
|
||||
*/
|
||||
#define otaconfigLOG2_FILE_BLOCK_SIZE 11UL
|
||||
|
||||
/**
|
||||
* @brief Size of the file data block message (excluding the header).
|
||||
*
|
||||
*/
|
||||
#define otaconfigFILE_BLOCK_SIZE ( 1UL << otaconfigLOG2_FILE_BLOCK_SIZE )
|
||||
|
||||
/**
|
||||
* @brief Milliseconds to wait for the self test phase to succeed before we force reset.
|
||||
*/
|
||||
#define otaconfigSELF_TEST_RESPONSE_WAIT_MS 16000U
|
||||
|
||||
/**
|
||||
* @brief Milliseconds to wait before requesting data blocks from the OTA service if nothing is happening.
|
||||
*
|
||||
* The wait timer is reset whenever a data block is received from the OTA service so we will only send
|
||||
* the request message after being idle for this amount of time.
|
||||
*/
|
||||
#define otaconfigFILE_REQUEST_WAIT_MS 10000U
|
||||
|
||||
/**
|
||||
* @brief The maximum allowed length of the thing name used by the OTA agent.
|
||||
*
|
||||
* AWS IoT requires Thing names to be unique for each device that connects to the broker.
|
||||
* Likewise, the OTA agent requires the developer to construct and pass in the Thing name when
|
||||
* initializing the OTA agent. The agent uses this size to allocate static storage for the
|
||||
* Thing name used in all OTA base topics. Namely $aws/things/<thingName>
|
||||
*/
|
||||
#define otaconfigMAX_THINGNAME_LEN 128U
|
||||
|
||||
/**
|
||||
* @brief The maximum number of data blocks requested from OTA streaming service.
|
||||
*
|
||||
* This configuration parameter is sent with data requests and represents the maximum number of
|
||||
* data blocks the service will send in response. The maximum limit for this must be calculated
|
||||
* from the maximum data response limit (128 KB from service) divided by the block size.
|
||||
* For example if block size is set as 1 KB then the maximum number of data blocks that we can
|
||||
* request is 128/1 = 128 blocks. Configure this parameter to this maximum limit or lower based on
|
||||
* how many data blocks response is expected for each data requests.
|
||||
* Please note that this must be set larger than zero.
|
||||
*
|
||||
*/
|
||||
#define otaconfigMAX_NUM_BLOCKS_REQUEST 4U
|
||||
|
||||
/**
|
||||
* @brief The maximum number of requests allowed to send without a response before we abort.
|
||||
*
|
||||
* This configuration parameter sets the maximum number of times the requests are made over
|
||||
* the selected communication channel before aborting and returning error.
|
||||
*
|
||||
*/
|
||||
#define otaconfigMAX_NUM_REQUEST_MOMENTUM 32U
|
||||
|
||||
/**
|
||||
* @brief The number of data buffers reserved by the OTA agent.
|
||||
*
|
||||
* This configurations parameter sets the maximum number of static data buffers used by
|
||||
* the OTA agent for job and file data blocks received.
|
||||
*/
|
||||
#define otaconfigMAX_NUM_OTA_DATA_BUFFERS 5U
|
||||
|
||||
/**
|
||||
* @brief How frequently the device will report its OTA progress to the cloud.
|
||||
*
|
||||
* Device will update the job status with the number of blocks it has received every certain
|
||||
* number of blocks it receives. For example, 25 means device will update job status every 25 blocks
|
||||
* it receives.
|
||||
*/
|
||||
#define otaconfigOTA_UPDATE_STATUS_FREQUENCY 25U
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Allow update to same or lower version.
|
||||
*
|
||||
* Set this to 1 to allow downgrade or same version update.This configurations parameter
|
||||
* disables version check and allows update to a same or lower version.This is provided for
|
||||
* testing purpose and it is recommended to always update to higher version and keep this
|
||||
* configuration disabled.
|
||||
*/
|
||||
#define otaconfigAllowDowngrade 0U
|
||||
|
||||
/**
|
||||
* @brief The protocol selected for OTA control operations.
|
||||
*
|
||||
* This configurations parameter sets the default protocol for all the OTA control
|
||||
* operations like requesting OTA job, updating the job status etc.
|
||||
*
|
||||
* Note - Only MQTT is supported at this time for control operations.
|
||||
*/
|
||||
#define configENABLED_CONTROL_PROTOCOL ( OTA_CONTROL_OVER_MQTT )
|
||||
|
||||
/**
|
||||
* @brief The protocol selected for OTA data operations.
|
||||
*
|
||||
* This configurations parameter sets the protocols selected for the data operations
|
||||
* like requesting file blocks from the service.
|
||||
*
|
||||
* Note - Both MQTT and HTTP is supported for data transfer from service. This configuration parameter
|
||||
* can be set to following -
|
||||
* Enable data over MQTT - ( OTA_DATA_OVER_MQTT )
|
||||
* Enable data over HTTP - ( OTA_DATA_OVER_HTTP)
|
||||
*
|
||||
* Note - Please check the OTA over MQTT demo which has the MQTT data trasnfer functionality and
|
||||
* and this configuration is set to OTA_DATA_OVER_MQTT.
|
||||
*/
|
||||
#define configENABLED_DATA_PROTOCOLS ( OTA_DATA_OVER_HTTP )
|
||||
|
||||
/**
|
||||
* @brief The preferred protocol selected for OTA data operations.
|
||||
*
|
||||
* Primary data protocol will be the protocol used for downloading file if more than
|
||||
* one protocol is selected while creating OTA job. Default primary data protocol is MQTT
|
||||
* and following update here to switch to HTTP as primary.
|
||||
*
|
||||
* Note - use OTA_DATA_OVER_HTTP for HTTP as primary data protocol.
|
||||
*/
|
||||
|
||||
#define configOTA_PRIMARY_DATA_PROTOCOL ( OTA_DATA_OVER_HTTP )
|
||||
|
||||
#endif /* OTA_CONFIG_H_ */
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,210 @@
|
||||
/*
|
||||
* FreeRTOS V202012.00
|
||||
* Copyright (C) 2020 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.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
#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.
|
||||
* http://www.freertos.org/a00110.html
|
||||
*
|
||||
* The bottom of this file contains some constants specific to running the UDP
|
||||
* stack in this demo. Constants specific to FreeRTOS+TCP itself (rather than
|
||||
* the demo) are contained in FreeRTOSIPConfig.h.
|
||||
*----------------------------------------------------------*/
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
|
||||
#define configMAX_PRIORITIES ( 7 )
|
||||
#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 ) 60 ) /* 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 ) ( 2048U * 1024U ) )
|
||||
#define configMAX_TASK_NAME_LEN ( 15 )
|
||||
#define configUSE_TRACE_FACILITY 0
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configIDLE_SHOULD_YIELD 1
|
||||
#define configUSE_CO_ROUTINES 0
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configUSE_RECURSIVE_MUTEXES 1
|
||||
#define configQUEUE_REGISTRY_SIZE 0
|
||||
#define configUSE_APPLICATION_TASK_TAG 0
|
||||
#define configUSE_COUNTING_SEMAPHORES 1
|
||||
#define configUSE_ALTERNATIVE_API 0
|
||||
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 0
|
||||
#define configENABLE_BACKWARD_COMPATIBILITY 1
|
||||
#define configSUPPORT_STATIC_ALLOCATION 1
|
||||
|
||||
/* Hook function related definitions. */
|
||||
#define configUSE_TICK_HOOK 0
|
||||
#define configUSE_IDLE_HOOK 0
|
||||
#define configUSE_MALLOC_FAILED_HOOK 0
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 0 /* Not applicable to the Win32 port. */
|
||||
|
||||
/* Software timer related definitions. */
|
||||
#define configUSE_TIMERS 1
|
||||
#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
|
||||
#define configTIMER_QUEUE_LENGTH 5
|
||||
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE * 2 )
|
||||
|
||||
/* Event group related definitions. */
|
||||
#define configUSE_EVENT_GROUPS 1
|
||||
|
||||
/* Run time stats gathering configuration options. */
|
||||
#define configGENERATE_RUN_TIME_STATS 0
|
||||
|
||||
/* Co-routine definitions. */
|
||||
#define configUSE_CO_ROUTINES 0
|
||||
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
|
||||
|
||||
/* Set the following definitions to 1 to include the API function, or zero
|
||||
* to exclude the API function. */
|
||||
#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_xTaskGetSchedulerState 1
|
||||
#define INCLUDE_xTimerGetTimerTaskHandle 0
|
||||
#define INCLUDE_xTaskGetIdleTaskHandle 0
|
||||
#define INCLUDE_xQueueGetMutexHolder 1
|
||||
#define INCLUDE_eTaskGetState 1
|
||||
#define INCLUDE_xEventGroupSetBitsFromISR 1
|
||||
#define INCLUDE_xTimerPendFunctionCall 1
|
||||
#define INCLUDE_pcTaskGetTaskName 1
|
||||
|
||||
/* This demo makes 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. configUSE_STATS_FORMATTING_FUNCTIONS
|
||||
* is set to 2 so the formatting functions are included without the stdio.h being
|
||||
* included in tasks.c. That is because this project defines its own sprintf()
|
||||
* functions. */
|
||||
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
|
||||
|
||||
/* Assert call defined for debug builds. */
|
||||
#ifdef _DEBUG
|
||||
extern void vAssertCalled( const char * pcFile,
|
||||
uint32_t ulLine );
|
||||
#define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled( __FILE__, __LINE__ )
|
||||
#endif /* _DEBUG */
|
||||
|
||||
|
||||
|
||||
/* Application specific definitions follow. **********************************/
|
||||
|
||||
/* Only used when running in the FreeRTOS Windows simulator. Defines the
|
||||
* priority of the task used to simulate Ethernet interrupts. */
|
||||
#define configMAC_ISR_SIMULATOR_PRIORITY ( configMAX_PRIORITIES - 1 )
|
||||
|
||||
/* This demo creates a virtual network connection by accessing the raw Ethernet
|
||||
* or WiFi data to and from a real network connection. Many computers have more
|
||||
* than one real network port, and configNETWORK_INTERFACE_TO_USE is used to tell
|
||||
* the demo which real port should be used to create the virtual port. The ports
|
||||
* available are displayed on the console when the application is executed. For
|
||||
* example, on my development laptop setting configNETWORK_INTERFACE_TO_USE to 4
|
||||
* results in the wired network being used, while setting
|
||||
* configNETWORK_INTERFACE_TO_USE to 2 results in the wireless network being
|
||||
* used. */
|
||||
#define configNETWORK_INTERFACE_TO_USE ( 0L )
|
||||
|
||||
/* The address to which logging is sent should UDP logging be enabled. */
|
||||
#define configUDP_LOGGING_ADDR0 192
|
||||
#define configUDP_LOGGING_ADDR1 168
|
||||
#define configUDP_LOGGING_ADDR2 0
|
||||
#define configUDP_LOGGING_ADDR3 11
|
||||
|
||||
/* Default MAC address configuration. The demo creates a virtual network
|
||||
* connection that uses this MAC address by accessing the raw Ethernet/WiFi data
|
||||
* to and from a real network connection on the host PC. See the
|
||||
* configNETWORK_INTERFACE_TO_USE definition above for information on how to
|
||||
* configure the real network connection to use. */
|
||||
#define configMAC_ADDR0 0x00
|
||||
#define configMAC_ADDR1 0x11
|
||||
#define configMAC_ADDR2 0x11
|
||||
#define configMAC_ADDR3 0x11
|
||||
#define configMAC_ADDR4 0x11
|
||||
#define configMAC_ADDR5 0x41
|
||||
|
||||
/* Default IP address configuration. Used in ipconfigUSE_DNS is set to 0, or
|
||||
* ipconfigUSE_DNS is set to 1 but a DNS server cannot be contacted. */
|
||||
#define configIP_ADDR0 10
|
||||
#define configIP_ADDR1 10
|
||||
#define configIP_ADDR2 10
|
||||
#define configIP_ADDR3 200
|
||||
|
||||
/* Default gateway IP address configuration. Used in ipconfigUSE_DNS is set to
|
||||
* 0, or ipconfigUSE_DNS is set to 1 but a DNS server cannot be contacted. */
|
||||
#define configGATEWAY_ADDR0 10
|
||||
#define configGATEWAY_ADDR1 10
|
||||
#define configGATEWAY_ADDR2 10
|
||||
#define configGATEWAY_ADDR3 1
|
||||
|
||||
/* Default DNS server configuration. OpenDNS addresses are 208.67.222.222 and
|
||||
* 208.67.220.220. Used in ipconfigUSE_DNS is set to 0, or ipconfigUSE_DNS is set
|
||||
* to 1 but a DNS server cannot be contacted.*/
|
||||
#define configDNS_SERVER_ADDR0 208
|
||||
#define configDNS_SERVER_ADDR1 67
|
||||
#define configDNS_SERVER_ADDR2 222
|
||||
#define configDNS_SERVER_ADDR3 222
|
||||
|
||||
/* Default netmask configuration. Used in ipconfigUSE_DNS is set to 0, or
|
||||
* ipconfigUSE_DNS is set to 1 but a DNS server cannot be contacted. */
|
||||
#define configNET_MASK0 255
|
||||
#define configNET_MASK1 0
|
||||
#define configNET_MASK2 0
|
||||
#define configNET_MASK3 0
|
||||
|
||||
/* The UDP port to which print messages are sent. */
|
||||
#define configPRINT_PORT ( 15000 )
|
||||
|
||||
|
||||
#if ( defined( _MSC_VER ) && ( _MSC_VER <= 1600 ) && !defined( snprintf ) )
|
||||
/* Map to Windows names. */
|
||||
#define snprintf _snprintf
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
|
||||
/* Visual studio does not have an implementation of strcasecmp(). */
|
||||
#define strcasecmp _stricmp
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcmpi _strcmpi
|
||||
|
||||
/* Prototype for the function used to print out. In this case it prints to the
|
||||
* console before the network is connected then a UDP port after the network has
|
||||
* connected. */
|
||||
extern void vLoggingPrintf( const char * pcFormatString,
|
||||
... );
|
||||
#define configPRINTF( X ) vLoggingPrintf X
|
||||
|
||||
#endif /* FREERTOS_CONFIG_H */
|
@ -0,0 +1,310 @@
|
||||
/*
|
||||
* FreeRTOS V202012.00
|
||||
* Copyright (C) 2020 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.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* See the following URL for configuration information.
|
||||
* http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef FREERTOS_IP_CONFIG_H
|
||||
#define FREERTOS_IP_CONFIG_H
|
||||
|
||||
/* Prototype for the function used to print out. In this case it prints to the
|
||||
* console before the network is connected then a UDP port after the network has
|
||||
* connected. */
|
||||
extern void vLoggingPrintf( const char * pcFormatString,
|
||||
... );
|
||||
|
||||
/* Set to 1 to print out debug messages. If ipconfigHAS_DEBUG_PRINTF is set to
|
||||
* 1 then FreeRTOS_debug_printf should be defined to the function used to print
|
||||
* out the debugging messages. */
|
||||
#define ipconfigHAS_DEBUG_PRINTF 0
|
||||
#if ( ipconfigHAS_DEBUG_PRINTF == 1 )
|
||||
#define FreeRTOS_debug_printf( X ) vLoggingPrintf X
|
||||
#endif
|
||||
|
||||
/* Set to 1 to print out non debugging messages, for example the output of the
|
||||
* FreeRTOS_netstat() command, and ping replies. If ipconfigHAS_PRINTF is set to 1
|
||||
* then FreeRTOS_printf should be set to the function used to print out the
|
||||
* messages. */
|
||||
#define ipconfigHAS_PRINTF 1
|
||||
#if ( ipconfigHAS_PRINTF == 1 )
|
||||
#define FreeRTOS_printf( X ) vLoggingPrintf X
|
||||
#endif
|
||||
|
||||
/* Define the byte order of the target MCU (the MCU FreeRTOS+TCP is executing
|
||||
* on). Valid options are pdFREERTOS_BIG_ENDIAN and pdFREERTOS_LITTLE_ENDIAN. */
|
||||
#define ipconfigBYTE_ORDER pdFREERTOS_LITTLE_ENDIAN
|
||||
|
||||
/* If the network card/driver includes checksum offloading (IP/TCP/UDP checksums)
|
||||
* then set ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM to 1 to prevent the software
|
||||
* stack repeating the checksum calculations. */
|
||||
#define ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM 1
|
||||
|
||||
/* Several API's will block until the result is known, or the action has been
|
||||
* performed, for example FreeRTOS_send() and FreeRTOS_recv(). The timeouts can be
|
||||
* set per socket, using setsockopt(). If not set, the times below will be
|
||||
* used as defaults. */
|
||||
#define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME ( 2000 )
|
||||
#define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME ( 5000 )
|
||||
|
||||
/* Include support for LLMNR: Link-local Multicast Name Resolution
|
||||
* (non-Microsoft) */
|
||||
#define ipconfigUSE_LLMNR ( 0 )
|
||||
|
||||
/* Include support for NBNS: NetBIOS Name Service (Microsoft) */
|
||||
#define ipconfigUSE_NBNS ( 0 )
|
||||
|
||||
/* Include support for DNS caching. For TCP, having a small DNS cache is very
|
||||
* useful. When a cache is present, ipconfigDNS_REQUEST_ATTEMPTS can be kept low
|
||||
* and also DNS may use small timeouts. If a DNS reply comes in after the DNS
|
||||
* socket has been destroyed, the result will be stored into the cache. The next
|
||||
* call to FreeRTOS_gethostbyname() will return immediately, without even creating
|
||||
* a socket. */
|
||||
#define ipconfigUSE_DNS_CACHE ( 1 )
|
||||
#define ipconfigDNS_CACHE_NAME_LENGTH ( 64 )
|
||||
#define ipconfigDNS_CACHE_ENTRIES ( 4 )
|
||||
#define ipconfigDNS_REQUEST_ATTEMPTS ( 2 )
|
||||
|
||||
/* The IP stack executes it its own task (although any application task can make
|
||||
* use of its services through the published sockets API). ipconfigUDP_TASK_PRIORITY
|
||||
* sets the priority of the task that executes the IP stack. The priority is a
|
||||
* standard FreeRTOS task priority so can take any value from 0 (the lowest
|
||||
* priority) to (configMAX_PRIORITIES - 1) (the highest priority).
|
||||
* configMAX_PRIORITIES is a standard FreeRTOS configuration parameter defined in
|
||||
* FreeRTOSConfig.h, not FreeRTOSIPConfig.h. Consideration needs to be given as to
|
||||
* the priority assigned to the task executing the IP stack relative to the
|
||||
* priority assigned to tasks that use the IP stack. */
|
||||
#define ipconfigIP_TASK_PRIORITY ( configMAX_PRIORITIES - 2 )
|
||||
|
||||
/* The size, in words (not bytes), of the stack allocated to the FreeRTOS+TCP
|
||||
* task. This setting is less important when the FreeRTOS Win32 simulator is used
|
||||
* as the Win32 simulator only stores a fixed amount of information on the task
|
||||
* stack. FreeRTOS includes optional stack overflow detection, see:
|
||||
* http://www.freertos.org/Stacks-and-stack-overflow-checking.html */
|
||||
#define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 )
|
||||
|
||||
/* ipconfigRAND32() is called by the IP stack to generate random numbers for
|
||||
* things such as a DHCP transaction number or initial sequence number. Random
|
||||
* number generation is performed via this macro to allow applications to use their
|
||||
* own random number generation method. For example, it might be possible to
|
||||
* generate a random number by sampling noise on an analogue input. */
|
||||
extern UBaseType_t uxRand();
|
||||
#define ipconfigRAND32() uxRand()
|
||||
|
||||
/* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the
|
||||
* network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK
|
||||
* is not set to 1 then the network event hook will never be called. See
|
||||
* http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml
|
||||
*/
|
||||
#define ipconfigUSE_NETWORK_EVENT_HOOK 1
|
||||
|
||||
/* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but
|
||||
* a network buffer cannot be obtained then the calling task is held in the Blocked
|
||||
* state (so other tasks can continue to executed) until either a network buffer
|
||||
* becomes available or the send block time expires. If the send block time expires
|
||||
* then the send operation is aborted. The maximum allowable send block time is
|
||||
* capped to the value set by ipconfigMAX_SEND_BLOCK_TIME_TICKS. Capping the
|
||||
* maximum allowable send block time prevents a deadlock occurring when
|
||||
* all the network buffers are in use and the tasks that process (and subsequently
|
||||
* free) the network buffers are themselves blocked waiting for a network buffer.
|
||||
* ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in
|
||||
* milliseconds can be converted to a time in ticks by dividing the time in
|
||||
* milliseconds by portTICK_PERIOD_MS. */
|
||||
#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000 / portTICK_PERIOD_MS )
|
||||
|
||||
/* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP
|
||||
* address, netmask, DNS server address and gateway address from a DHCP server. If
|
||||
* ipconfigUSE_DHCP is 0 then FreeRTOS+TCP will use a static IP address. The
|
||||
* stack will revert to using the static IP address even when ipconfigUSE_DHCP is
|
||||
* set to 1 if a valid configuration cannot be obtained from a DHCP server for any
|
||||
* reason. The static configuration used is that passed into the stack by the
|
||||
* FreeRTOS_IPInit() function call. */
|
||||
#define ipconfigUSE_DHCP 1
|
||||
|
||||
/* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at
|
||||
* increasing time intervals until either a reply is received from a DHCP server
|
||||
* and accepted, or the interval between transmissions reaches
|
||||
* ipconfigMAXIMUM_DISCOVER_TX_PERIOD. The IP stack will revert to using the
|
||||
* static IP address passed as a parameter to FreeRTOS_IPInit() if the
|
||||
* re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without
|
||||
* a DHCP reply being received. */
|
||||
#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD ( 120000 / portTICK_PERIOD_MS )
|
||||
|
||||
/* The ARP cache is a table that maps IP addresses to MAC addresses. The IP
|
||||
* stack can only send a UDP message to a remove IP address if it knowns the MAC
|
||||
* address associated with the IP address, or the MAC address of the router used to
|
||||
* contact the remote IP address. When a UDP message is received from a remote IP
|
||||
* address the MAC address and IP address are added to the ARP cache. When a UDP
|
||||
* message is sent to a remote IP address that does not already appear in the ARP
|
||||
* cache then the UDP message is replaced by a ARP message that solicits the
|
||||
* required MAC address information. ipconfigARP_CACHE_ENTRIES defines the maximum
|
||||
* number of entries that can exist in the ARP table at any one time. */
|
||||
#define ipconfigARP_CACHE_ENTRIES 6
|
||||
|
||||
/* ARP requests that do not result in an ARP response will be re-transmitted a
|
||||
* maximum of ipconfigMAX_ARP_RETRANSMISSIONS times before the ARP request is
|
||||
* aborted. */
|
||||
#define ipconfigMAX_ARP_RETRANSMISSIONS ( 5 )
|
||||
|
||||
/* ipconfigMAX_ARP_AGE defines the maximum time between an entry in the ARP
|
||||
* table being created or refreshed and the entry being removed because it is stale.
|
||||
* New ARP requests are sent for ARP cache entries that are nearing their maximum
|
||||
* age. ipconfigMAX_ARP_AGE is specified in tens of seconds, so a value of 150 is
|
||||
* equal to 1500 seconds (or 25 minutes). */
|
||||
#define ipconfigMAX_ARP_AGE 150
|
||||
|
||||
/* Implementing FreeRTOS_inet_addr() necessitates the use of string handling
|
||||
* routines, which are relatively large. To save code space the full
|
||||
* FreeRTOS_inet_addr() implementation is made optional, and a smaller and faster
|
||||
* alternative called FreeRTOS_inet_addr_quick() is provided. FreeRTOS_inet_addr()
|
||||
* takes an IP in decimal dot format (for example, "192.168.0.1") as its parameter.
|
||||
* FreeRTOS_inet_addr_quick() takes an IP address as four separate numerical octets
|
||||
* (for example, 192, 168, 0, 1) as its parameters. If
|
||||
* ipconfigINCLUDE_FULL_INET_ADDR is set to 1 then both FreeRTOS_inet_addr() and
|
||||
* FreeRTOS_indet_addr_quick() are available. If ipconfigINCLUDE_FULL_INET_ADDR is
|
||||
* not set to 1 then only FreeRTOS_indet_addr_quick() is available. */
|
||||
#define ipconfigINCLUDE_FULL_INET_ADDR 1
|
||||
|
||||
/* ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS defines the total number of network buffer that
|
||||
* are available to the IP stack. The total number of network buffers is limited
|
||||
* to ensure the total amount of RAM that can be consumed by the IP stack is capped
|
||||
* to a pre-determinable value. */
|
||||
#define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS 60
|
||||
|
||||
/* A FreeRTOS queue is used to send events from application tasks to the IP
|
||||
* stack. ipconfigEVENT_QUEUE_LENGTH sets the maximum number of events that can
|
||||
* be queued for processing at any one time. The event queue must be a minimum of
|
||||
* 5 greater than the total number of network buffers. */
|
||||
#define ipconfigEVENT_QUEUE_LENGTH ( ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS + 5 )
|
||||
|
||||
/* The address of a socket is the combination of its IP address and its port
|
||||
* number. FreeRTOS_bind() is used to manually allocate a port number to a socket
|
||||
* (to 'bind' the socket to a port), but manual binding is not normally necessary
|
||||
* for client sockets (those sockets that initiate outgoing connections rather than
|
||||
* wait for incoming connections on a known port number). If
|
||||
* ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND is set to 1 then calling
|
||||
* FreeRTOS_sendto() on a socket that has not yet been bound will result in the IP
|
||||
* stack automatically binding the socket to a port number from the range
|
||||
* socketAUTO_PORT_ALLOCATION_START_NUMBER to 0xffff. If
|
||||
* ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND is set to 0 then calling FreeRTOS_sendto()
|
||||
* on a socket that has not yet been bound will result in the send operation being
|
||||
* aborted. */
|
||||
#define ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND 1
|
||||
|
||||
/* Defines the Time To Live (TTL) values used in outgoing UDP packets. */
|
||||
#define ipconfigUDP_TIME_TO_LIVE 128
|
||||
#define ipconfigTCP_TIME_TO_LIVE 128 /* also defined in FreeRTOSIPConfigDefaults.h */
|
||||
|
||||
/* USE_TCP: Use TCP and all its features */
|
||||
#define ipconfigUSE_TCP ( 1 )
|
||||
|
||||
/* Use the TCP socket wake context with a callback. */
|
||||
#define ipconfigSOCKET_HAS_USER_WAKE_CALLBACK_WITH_CONTEXT ( 1 )
|
||||
|
||||
/* USE_WIN: Let TCP use windowing mechanism. */
|
||||
#define ipconfigUSE_TCP_WIN ( 1 )
|
||||
|
||||
/* The MTU is the maximum number of bytes the payload of a network frame can
|
||||
* contain. For normal Ethernet V2 frames the maximum MTU is 1500. Setting a
|
||||
* lower value can save RAM, depending on the buffer management scheme used. If
|
||||
* ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must
|
||||
* be divisible by 8. */
|
||||
#define ipconfigNETWORK_MTU 1200
|
||||
|
||||
/* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used
|
||||
* through the FreeRTOS_gethostbyname() API function. */
|
||||
#define ipconfigUSE_DNS 1
|
||||
|
||||
/* If ipconfigREPLY_TO_INCOMING_PINGS is set to 1 then the IP stack will
|
||||
* generate replies to incoming ICMP echo (ping) requests. */
|
||||
#define ipconfigREPLY_TO_INCOMING_PINGS 1
|
||||
|
||||
/* If ipconfigSUPPORT_OUTGOING_PINGS is set to 1 then the
|
||||
* FreeRTOS_SendPingRequest() API function is available. */
|
||||
#define ipconfigSUPPORT_OUTGOING_PINGS 0
|
||||
|
||||
/* If ipconfigSUPPORT_SELECT_FUNCTION is set to 1 then the FreeRTOS_select()
|
||||
* (and associated) API function is available. */
|
||||
#define ipconfigSUPPORT_SELECT_FUNCTION 1
|
||||
|
||||
/* If ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES is set to 1 then Ethernet frames
|
||||
* that are not in Ethernet II format will be dropped. This option is included for
|
||||
* potential future IP stack developments. */
|
||||
#define ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES 1
|
||||
|
||||
/* If ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES is set to 1 then it is the
|
||||
* responsibility of the Ethernet interface to filter out packets that are of no
|
||||
* interest. If the Ethernet interface does not implement this functionality, then
|
||||
* set ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES to 0 to have the IP stack
|
||||
* perform the filtering instead (it is much less efficient for the stack to do it
|
||||
* because the packet will already have been passed into the stack). If the
|
||||
* Ethernet driver does all the necessary filtering in hardware then software
|
||||
* filtering can be removed by using a value other than 1 or 0. */
|
||||
#define ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES 1
|
||||
|
||||
/* The windows simulator cannot really simulate MAC interrupts, and needs to
|
||||
* block occasionally to allow other tasks to run. */
|
||||
#define configWINDOWS_MAC_INTERRUPT_SIMULATOR_DELAY ( 20 / portTICK_PERIOD_MS )
|
||||
|
||||
/* Advanced only: in order to access 32-bit fields in the IP packets with
|
||||
* 32-bit memory instructions, all packets will be stored 32-bit-aligned, plus 16-bits.
|
||||
* This has to do with the contents of the IP-packets: all 32-bit fields are
|
||||
* 32-bit-aligned, plus 16-bit(!) */
|
||||
#define ipconfigPACKET_FILLER_SIZE 2
|
||||
|
||||
/* Define the size of the pool of TCP window descriptors. On the average, each
|
||||
* TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6
|
||||
* outstanding packets (for Rx and Tx). When using up to 10 TP sockets
|
||||
* simultaneously, one could define TCP_WIN_SEG_COUNT as 120. */
|
||||
#define ipconfigTCP_WIN_SEG_COUNT 240
|
||||
|
||||
/* Each TCP socket has a circular buffers for Rx and Tx, which have a fixed
|
||||
* maximum size. Define the size of Rx buffer for TCP sockets. */
|
||||
#define ipconfigTCP_RX_BUFFER_LENGTH ( 5000 )
|
||||
|
||||
/* Define the size of Tx buffer for TCP sockets. */
|
||||
#define ipconfigTCP_TX_BUFFER_LENGTH ( 1000 )
|
||||
|
||||
/* When using call-back handlers, the driver may check if the handler points to
|
||||
* real program memory (RAM or flash) or just has a random non-zero value. */
|
||||
#define ipconfigIS_VALID_PROG_ADDRESS( x ) ( ( x ) != NULL )
|
||||
|
||||
/* Include support for TCP hang protection. All sockets in a connecting or
|
||||
* disconnecting stage will timeout after a period of non-activity. */
|
||||
#define ipconfigTCP_HANG_PROTECTION ( 1 )
|
||||
#define ipconfigTCP_HANG_PROTECTION_TIME ( 30 )
|
||||
|
||||
/* Include support for TCP keep-alive messages. */
|
||||
#define ipconfigTCP_KEEP_ALIVE ( 1 )
|
||||
#define ipconfigTCP_KEEP_ALIVE_INTERVAL ( 20 ) /* in seconds */
|
||||
|
||||
#define portINLINE __inline
|
||||
|
||||
#endif /* FREERTOS_IP_CONFIG_H */
|
@ -0,0 +1,986 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="FreeRTOS">
|
||||
<UniqueIdentifier>{af3445a1-4908-4170-89ed-39345d90d30c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS\Source">
|
||||
<UniqueIdentifier>{f32be356-4763-4cae-9020-974a2638cb08}</UniqueIdentifier>
|
||||
<Extensions>*.c</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS\Source\Portable">
|
||||
<UniqueIdentifier>{88f409e6-d396-4ac5-94bd-7a99c914be46}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS+">
|
||||
<UniqueIdentifier>{e5ad4ec7-23dc-4295-8add-2acaee488f5a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS\Source\include">
|
||||
<UniqueIdentifier>{d2dcd641-8d91-492b-852f-5563ffadaec6}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS+\FreeRTOS+TCP">
|
||||
<UniqueIdentifier>{8672fa26-b119-481f-8b8d-086419c01a3e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS+\FreeRTOS+TCP\portable">
|
||||
<UniqueIdentifier>{4570be11-ec96-4b55-ac58-24b50ada980a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS+\FreeRTOS+TCP\include">
|
||||
<UniqueIdentifier>{5d93ed51-023a-41ad-9243-8d230165d34b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="DemoTasks">
|
||||
<UniqueIdentifier>{b71e974a-9f28-4815-972b-d930ba8a34d0}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS+\FreeRTOS IoT Libraries">
|
||||
<UniqueIdentifier>{60717407-397f-4ea5-8492-3314acdd25f0}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\standard">
|
||||
<UniqueIdentifier>{8a90222f-d723-4b4e-8e6e-c57afaf7fa92}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT">
|
||||
<UniqueIdentifier>{2d17d5e6-ed70-4e42-9693-f7a63baf4948}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include">
|
||||
<UniqueIdentifier>{6ad56e6d-c330-4830-8f4b-c75b05dfa866}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\platform">
|
||||
<UniqueIdentifier>{84613aa2-91dc-4e1a-a3b3-823b6d7bf0e0}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS+\mbedtls">
|
||||
<UniqueIdentifier>{7bedd2e3-adbb-4c95-9632-445132b459ce}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS+\mbedtls\include">
|
||||
<UniqueIdentifier>{07a14673-4d02-4780-a099-6b8c654dff91}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS+\mbedtls\library">
|
||||
<UniqueIdentifier>{e875c5e3-40a2-4408-941e-5e1a951cc663}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls">
|
||||
<UniqueIdentifier>{8a0aa896-6b3a-49b3-997e-681f0d1949ae}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\platform\transport">
|
||||
<UniqueIdentifier>{c5a01679-3e7a-4320-97ac-ee5b872c1650}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include">
|
||||
<UniqueIdentifier>{c992824d-4198-46b2-8d59-5f99ab9946ab}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\platform\transport">
|
||||
<UniqueIdentifier>{6a35782c-bc09-42d5-a850-98bcb668a4dc}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\standard\coreJSON">
|
||||
<UniqueIdentifier>{20aee693-d2dc-480e-ae21-0db2156e54ac}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\AWS">
|
||||
<UniqueIdentifier>{0dacb84e-5cc3-4eed-8fb1-68b6e4741f77}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Config">
|
||||
<UniqueIdentifier>{d286fe5f-3c24-4a2f-881c-4b458623648d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Logging">
|
||||
<UniqueIdentifier>{c8b7bd64-7a0e-458b-bcaa-8081806e4508}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\standard\coreJSON\include">
|
||||
<UniqueIdentifier>{6c6bc472-3f73-42c1-83e0-ffe6cae93393}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm">
|
||||
<UniqueIdentifier>{fcf93295-15e2-4a84-a5e9-b3c162e9f061}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm\include">
|
||||
<UniqueIdentifier>{7de8717e-b494-4eba-ba10-bc8252d9876a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota">
|
||||
<UniqueIdentifier>{3cce55b5-995f-476c-a3a5-9c659a977c89}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include">
|
||||
<UniqueIdentifier>{d6ca6595-6585-4fd8-b0dd-224128fbd230}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent">
|
||||
<UniqueIdentifier>{044f1490-9d76-41d8-9887-94f5e89cab11}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent\include">
|
||||
<UniqueIdentifier>{28ef5930-f7c7-44f3-9189-749dcdf13cdd}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="subscription-manager">
|
||||
<UniqueIdentifier>{0025af31-a87a-438e-86fd-8048c9f98025}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\portable">
|
||||
<UniqueIdentifier>{e7b017ae-316c-4d8b-b427-5df150109d0f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="otapal">
|
||||
<UniqueIdentifier>{0d8ed7df-8ac2-4ac0-ba27-ca59624bf363}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS+\tinycbor">
|
||||
<UniqueIdentifier>{b43eb5ed-8c56-41eb-a67a-4ce41403629e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS+\tinycbor\include">
|
||||
<UniqueIdentifier>{4650e6af-01d5-46c3-9674-8554dab982ac}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface">
|
||||
<UniqueIdentifier>{e3a23704-31ed-4869-b74e-6d09f842b336}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface\include">
|
||||
<UniqueIdentifier>{b5277e13-3a7f-46ab-a73d-7a8aa2831f98}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="otapal\code_signature_verification">
|
||||
<UniqueIdentifier>{920f406b-9c90-4ea6-8a0b-6e328d6ff095}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="otapal\code_signature_verification\include">
|
||||
<UniqueIdentifier>{9d7ce275-011a-4bdc-bba5-ad569f629872}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\..\..\FreeRTOS\Source\portable\MSVC-MingW\port.c">
|
||||
<Filter>FreeRTOS\Source\Portable</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\FreeRTOS\Source\timers.c">
|
||||
<Filter>FreeRTOS\Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\FreeRTOS\Source\list.c">
|
||||
<Filter>FreeRTOS\Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\FreeRTOS\Source\queue.c">
|
||||
<Filter>FreeRTOS\Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\FreeRTOS\Source\tasks.c">
|
||||
<Filter>FreeRTOS\Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_UDP_IP.c">
|
||||
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_DHCP.c">
|
||||
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_DNS.c">
|
||||
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_Sockets.c">
|
||||
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\portable\BufferManagement\BufferAllocation_2.c">
|
||||
<Filter>FreeRTOS+\FreeRTOS+TCP\portable</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\portable\NetworkInterface\WinPCap\NetworkInterface.c">
|
||||
<Filter>FreeRTOS+\FreeRTOS+TCP\portable</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_ARP.c">
|
||||
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_IP.c">
|
||||
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_TCP_IP.c">
|
||||
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_TCP_WIN.c">
|
||||
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\FreeRTOS\Source\event_groups.c">
|
||||
<Filter>FreeRTOS\Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\FreeRTOS\Source\portable\MemMang\heap_4.c">
|
||||
<Filter>FreeRTOS\Source\Portable</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_Stream_Buffer.c">
|
||||
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\FreeRTOS\Source\stream_buffer.c">
|
||||
<Filter>FreeRTOS\Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\Utilities\mbedtls_freertos\mbedtls_freertos_port.c">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\Utilities\mbedtls_freertos\mbedtls_error.c">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\Utilities\backoff_algorithm\source\backoff_algorithm.c">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\network_transport\freertos_plus_tcp\using_mbedtls\using_mbedtls.c">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\transport</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\network_transport\freertos_plus_tcp\sockets_wrapper.c">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\transport</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\aes.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\aesni.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\arc4.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\aria.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\asn1parse.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\asn1write.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\base64.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\bignum.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\blowfish.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\camellia.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ccm.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\certs.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\chacha20.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\chachapoly.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\cipher.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\cipher_wrap.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\cmac.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ctr_drbg.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\debug.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\des.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\dhm.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ecdh.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ecdsa.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ecjpake.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ecp.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ecp_curves.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\entropy.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\entropy_poll.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\error.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\gcm.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\havege.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\hkdf.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\hmac_drbg.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\md.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\md2.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\md4.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\md5.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\memory_buffer_alloc.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\net_sockets.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\nist_kw.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\oid.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\padlock.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pem.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pk.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pkcs11.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pkcs12.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pkcs5.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pkparse.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pkwrite.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pk_wrap.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\platform.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\platform_util.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\poly1305.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ripemd160.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\rsa.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\rsa_internal.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\sha1.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\sha256.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\sha512.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_cache.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_ciphersuites.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_cli.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_cookie.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_msg.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_srv.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_ticket.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_tls.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\threading.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\timing.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\version.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\version_features.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\x509.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\x509write_crt.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\x509write_csr.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\x509_create.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\x509_crl.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\x509_crt.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\x509_csr.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\xtea.c">
|
||||
<Filter>FreeRTOS+\mbedtls\library</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\coreJSON\source\core_json.c">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreJSON</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="main.c" />
|
||||
<ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Demo\Common\Logging\windows\Logging_WinSim.c">
|
||||
<Filter>Logging</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt.c">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt_state.c">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt_serializer.c">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DemoTasks\OtaOverMqttDemoExample.c">
|
||||
<Filter>DemoTasks</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\AWS\ota\source\ota.c">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\AWS\ota\source\ota_base64.c">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\AWS\ota\source\ota_cbor.c">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\AWS\ota\source\ota_http.c">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\AWS\ota\source\ota_interface.c">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\AWS\ota\source\ota_mqtt.c">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\AWS\ota\source\portable\os\ota_os_freertos.c">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\portable</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Common\Ota_PAL\Win32\ota_pal.c">
|
||||
<Filter>otapal</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborencoder.c">
|
||||
<Filter>FreeRTOS+\tinycbor</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborencoder_close_container_checked.c">
|
||||
<Filter>FreeRTOS+\tinycbor</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborerrorstrings.c">
|
||||
<Filter>FreeRTOS+\tinycbor</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborparser.c">
|
||||
<Filter>FreeRTOS+\tinycbor</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborparser_dup_string.c">
|
||||
<Filter>FreeRTOS+\tinycbor</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborpretty.c">
|
||||
<Filter>FreeRTOS+\tinycbor</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborpretty_stdio.c">
|
||||
<Filter>FreeRTOS+\tinycbor</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborvalidation.c">
|
||||
<Filter>FreeRTOS+\tinycbor</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\Common\coreMQTT_Agent_Interface\freertos_agent_message.c">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface\include</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\Common\coreMQTT_Agent_Interface\freertos_command_pool.c">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface\include</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Common\subscription-manager\subscription_manager.c">
|
||||
<Filter>subscription-manager</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT-Agent\source\core_mqtt_agent.c">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT-Agent\source\core_mqtt_agent_command_functions.c">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Common\Ota_PAL\Win32\Code_Signature_Verification\code_signature_verification_mbedtls.c">
|
||||
<Filter>otapal\code_signature_verification</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\NetworkInterface.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_DNS.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_Sockets.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_UDP_IP.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\timers.h">
|
||||
<Filter>FreeRTOS\Source\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\event_groups.h">
|
||||
<Filter>FreeRTOS\Source\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\FreeRTOS.h">
|
||||
<Filter>FreeRTOS\Source\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\queue.h">
|
||||
<Filter>FreeRTOS\Source\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\semphr.h">
|
||||
<Filter>FreeRTOS\Source\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\task.h">
|
||||
<Filter>FreeRTOS\Source\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\..\FreeRTOS\Source\portable\MSVC-MingW\portmacro.h">
|
||||
<Filter>FreeRTOS\Source\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_IP_Private.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\NetworkBufferManagement.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_ARP.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_DHCP.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_IP.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_TCP_IP.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_TCP_WIN.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOSIPConfigDefaults.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\IPTraceMacroDefaults.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_Stream_Buffer.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\portable.h">
|
||||
<Filter>FreeRTOS\Source\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\projdefs.h">
|
||||
<Filter>FreeRTOS\Source\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_serializer.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_state.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\interface\transport_interface.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Utilities\mbedtls_freertos\mbedtls_error.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Utilities\mbedtls_freertos\threading_alt.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\network_transport\freertos_plus_tcp\sockets_wrapper.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\network_transport\freertos_plus_tcp\using_mbedtls\using_mbedtls.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\aes.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\aesni.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\arc4.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\aria.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\asn1.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\asn1write.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\base64.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\bignum.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\blowfish.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\bn_mul.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\camellia.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ccm.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\certs.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\chacha20.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\chachapoly.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\check_config.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\cipher.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\cipher_internal.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\cmac.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\compat-1.3.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\config.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ctr_drbg.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\debug.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\des.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\dhm.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ecdh.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ecdsa.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ecjpake.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ecp.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ecp_internal.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\entropy.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\entropy_poll.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\error.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\gcm.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\havege.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\hkdf.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\hmac_drbg.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\md.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\md2.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\md4.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\md5.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\md_internal.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\memory_buffer_alloc.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\net.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\net_sockets.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\nist_kw.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\oid.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\padlock.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\pem.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\pk.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\pkcs11.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\pkcs12.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\pkcs5.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\pk_internal.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\platform.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\platform_time.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\platform_util.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\poly1305.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\psa_util.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ripemd160.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\rsa.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\rsa_internal.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\sha1.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\sha256.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\sha512.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ssl.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ssl_cache.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ssl_ciphersuites.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ssl_cookie.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ssl_internal.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ssl_ticket.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\threading.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\timing.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\version.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\x509.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\x509_crl.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\x509_crt.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\x509_csr.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\xtea.h">
|
||||
<Filter>FreeRTOS+\mbedtls\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="core_mqtt_config.h">
|
||||
<Filter>Config</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="FreeRTOSConfig.h">
|
||||
<Filter>Config</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="demo_config.h">
|
||||
<Filter>Config</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="FreeRTOSIPConfig.h">
|
||||
<Filter>Config</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\Utilities\logging\logging.h">
|
||||
<Filter>Logging</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\Utilities\logging\logging_levels.h">
|
||||
<Filter>Logging</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\Utilities\logging\logging_stack.h">
|
||||
<Filter>Logging</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="mbedtls_config.h">
|
||||
<Filter>Config</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_errno_TCP.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_config_defaults.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\coreJSON\source\include\core_json.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreJSON\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Utilities\backoff_algorithm\source\include\backoff_algorithm.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_appversion32.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_base64_private.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_cbor_private.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_config_defaults.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_http_interface.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_http_private.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_interface_private.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_mqtt_interface.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_mqtt_private.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_os_interface.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_platform_interface.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_private.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ota_config.h">
|
||||
<Filter>Config</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\AWS\ota\source\portable\os\ota_os_freertos.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\portable</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Common\Ota_PAL\Win32\ota_pal.h">
|
||||
<Filter>otapal</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cbor.h">
|
||||
<Filter>FreeRTOS+\tinycbor\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborinternal_p.h">
|
||||
<Filter>FreeRTOS+\tinycbor\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborjson.h">
|
||||
<Filter>FreeRTOS+\tinycbor\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\compilersupport_p.h">
|
||||
<Filter>FreeRTOS+\tinycbor\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\tinycbor-version.h">
|
||||
<Filter>FreeRTOS+\tinycbor\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\utf8_p.h">
|
||||
<Filter>FreeRTOS+\tinycbor\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\Common\coreMQTT_Agent_Interface\include\freertos_agent_message.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\Common\coreMQTT_Agent_Interface\include\freertos_command_pool.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Common\subscription-manager\subscription_manager.h">
|
||||
<Filter>subscription-manager</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Common\Ota_PAL\Win32\Code_Signature_Verification\code_signature_verification.h">
|
||||
<Filter>otapal\code_signature_verification\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="core_pkcs11_config.h">
|
||||
<Filter>Config</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT-Agent\source\include\core_mqtt_agent.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT-Agent\source\include\core_mqtt_agent_command_functions.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT-Agent\source\include\core_mqtt_agent_message_interface.h">
|
||||
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Common\Ota_PAL\Win32\Code_Signature_Verification\aws_ota_codesigner_certificate.h">
|
||||
<Filter>otapal\code_signature_verification\include</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -0,0 +1,109 @@
|
||||
/*
|
||||
* FreeRTOS V202012.00
|
||||
* Copyright (C) 2020 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.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CORE_MQTT_CONFIG_H
|
||||
#define CORE_MQTT_CONFIG_H
|
||||
|
||||
/**************************************************/
|
||||
/******* DO NOT CHANGE the following order ********/
|
||||
/**************************************************/
|
||||
|
||||
/* Include logging header files and define logging macros in the following order:
|
||||
* 1. Include the header file "logging_levels.h".
|
||||
* 2. Define the LIBRARY_LOG_NAME and LIBRARY_LOG_LEVEL macros depending on
|
||||
* the logging configuration for MQTT.
|
||||
* 3. Include the header file "logging_stack.h", if logging is enabled for MQTT.
|
||||
*/
|
||||
|
||||
#include "logging_levels.h"
|
||||
|
||||
/* Logging configuration for the MQTT library. */
|
||||
#ifndef LIBRARY_LOG_NAME
|
||||
#define LIBRARY_LOG_NAME "MQTT"
|
||||
#endif
|
||||
|
||||
#ifndef LIBRARY_LOG_LEVEL
|
||||
#define LIBRARY_LOG_LEVEL LOG_ERROR
|
||||
#endif
|
||||
|
||||
/* Prototype for the function used to print to console on Windows simulator
|
||||
* of FreeRTOS.
|
||||
* The function prints to the console before the network is connected;
|
||||
* then a UDP port after the network has connected. */
|
||||
extern void vLoggingPrintf( const char * pcFormatString,
|
||||
... );
|
||||
|
||||
/* Map the SdkLog macro to the logging function to enable logging
|
||||
* on Windows simulator. */
|
||||
#ifndef SdkLog
|
||||
#define SdkLog( message ) vLoggingPrintf message
|
||||
#endif
|
||||
#include "logging_stack.h"
|
||||
/************ End of logging configuration ****************/
|
||||
|
||||
/**
|
||||
* @brief The maximum number of MQTT PUBLISH messages that may be pending
|
||||
* acknowledgement at any time.
|
||||
*
|
||||
* QoS 1 and 2 MQTT PUBLISHes require acknowledgment from the server before
|
||||
* they can be completed. While they are awaiting the acknowledgment, the
|
||||
* client must maintain information about their state. The value of this
|
||||
* macro sets the limit on how many simultaneous PUBLISH states an MQTT
|
||||
* context maintains.
|
||||
*/
|
||||
#define MQTT_STATE_ARRAY_MAX_COUNT 10U
|
||||
|
||||
/*********************** coreMQTT Agent Configurations **********************/
|
||||
/**
|
||||
* @brief The maximum number of pending acknowledgments to track for a single
|
||||
* connection.
|
||||
*
|
||||
* @note The MQTT agent tracks MQTT commands (such as PUBLISH and SUBSCRIBE) th
|
||||
* at are still waiting to be acknowledged. MQTT_AGENT_MAX_OUTSTANDING_ACKS set
|
||||
* the maximum number of acknowledgments that can be outstanding at any one time.
|
||||
* The higher this number is the greater the agent's RAM consumption will be.
|
||||
*/
|
||||
#define MQTT_AGENT_MAX_OUTSTANDING_ACKS ( 20U )
|
||||
|
||||
/**
|
||||
* @brief Time in MS that the MQTT agent task will wait in the Blocked state (so
|
||||
* not using any CPU time) for a command to arrive in its command queue before
|
||||
* exiting the blocked state so it can call MQTT_ProcessLoop().
|
||||
*
|
||||
* @note It is important MQTT_ProcessLoop() is called often if there is known
|
||||
* MQTT traffic, but calling it too often can take processing time away from
|
||||
* lower priority tasks and waste CPU time and power.
|
||||
*/
|
||||
#define MQTT_AGENT_MAX_EVENT_QUEUE_WAIT_TIME ( 1000 )
|
||||
|
||||
/**
|
||||
* @brief The number of command structures to allocate in the pool
|
||||
* for the agent.
|
||||
*/
|
||||
#define MQTT_COMMAND_CONTEXTS_POOL_SIZE 10
|
||||
|
||||
|
||||
#endif /* ifndef CORE_MQTT_CONFIG_H */
|
@ -0,0 +1,187 @@
|
||||
/*
|
||||
* FreeRTOS V202012.00
|
||||
* Copyright (C) 2020 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.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file core_pkcs11_config.h
|
||||
* @brief PCKS#11 config options.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _CORE_PKCS11_CONFIG_H_
|
||||
#define _CORE_PKCS11_CONFIG_H_
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
|
||||
/**************************************************/
|
||||
/******* DO NOT CHANGE the following order ********/
|
||||
/**************************************************/
|
||||
|
||||
/* Include logging header files and define logging macros in the following order:
|
||||
* 1. Include the header file "logging_levels.h".
|
||||
* 2. Define the LIBRARY_LOG_NAME and LIBRARY_LOG_LEVEL macros depending on
|
||||
* the logging configuration for PKCS #11.
|
||||
* 3. Include the header file "logging_stack.h", if logging is enabled for PKCS #11.
|
||||
*/
|
||||
|
||||
#include "logging_levels.h"
|
||||
|
||||
/* Logging configuration for the PKCS #11 library. */
|
||||
#ifndef LIBRARY_LOG_NAME
|
||||
#define LIBRARY_LOG_NAME "PKCS11"
|
||||
#endif
|
||||
|
||||
#ifndef LIBRARY_LOG_LEVEL
|
||||
#define LIBRARY_LOG_LEVEL LOG_ERROR
|
||||
#endif
|
||||
|
||||
/* Prototype for the function used to print to console on Windows simulator
|
||||
* of FreeRTOS.
|
||||
* The function prints to the console before the network is connected;
|
||||
* then a UDP port after the network has connected. */
|
||||
extern void vLoggingPrintf( const char * pcFormatString,
|
||||
... );
|
||||
|
||||
/* Map the SdkLog macro to the logging function to enable logging
|
||||
* on Windows simulator. */
|
||||
#ifndef SdkLog
|
||||
#define SdkLog( message ) vLoggingPrintf message
|
||||
#endif
|
||||
|
||||
#include "logging_stack.h"
|
||||
|
||||
/**
|
||||
* @brief Malloc API used by core_pkcs11.h
|
||||
*/
|
||||
#define PKCS11_MALLOC pvPortMalloc
|
||||
|
||||
/**
|
||||
* @brief Free API used by core_pkcs11.h
|
||||
*/
|
||||
#define PKCS11_FREE vPortFree
|
||||
|
||||
/**
|
||||
* @brief PKCS #11 default user PIN.
|
||||
*
|
||||
* The PKCS #11 standard specifies the presence of a user PIN. That feature is
|
||||
* sensible for applications that have an interactive user interface and memory
|
||||
* protections. However, since typical microcontroller applications lack one or
|
||||
* both of those, the user PIN is assumed to be used herein for interoperability
|
||||
* purposes only, and not as a security feature.
|
||||
*
|
||||
* Note: Do not cast this to a pointer! The library calls sizeof to get the length
|
||||
* of this string.
|
||||
*/
|
||||
#define configPKCS11_DEFAULT_USER_PIN "0000"
|
||||
|
||||
/**
|
||||
* @brief Maximum length (in characters) for a PKCS #11 CKA_LABEL
|
||||
* attribute.
|
||||
*/
|
||||
#define pkcs11configMAX_LABEL_LENGTH 32
|
||||
|
||||
/**
|
||||
* @brief Maximum number of token objects that can be stored
|
||||
* by the PKCS #11 module.
|
||||
*/
|
||||
#define pkcs11configMAX_NUM_OBJECTS 6
|
||||
|
||||
/**
|
||||
* @brief Maximum number of sessions that can be stored
|
||||
* by the PKCS #11 module.
|
||||
*/
|
||||
#define pkcs11configMAX_SESSIONS 10
|
||||
|
||||
/**
|
||||
* @brief Set to 1 if a PAL destroy object is implemented.
|
||||
*
|
||||
* If set to 0, no PAL destroy object is implemented, and this functionality
|
||||
* is implemented in the common PKCS #11 layer.
|
||||
*/
|
||||
#define pkcs11configPAL_DESTROY_SUPPORTED 0
|
||||
|
||||
/**
|
||||
* @brief Set to 1 if OTA image verification via PKCS #11 module is supported.
|
||||
*
|
||||
* If set to 0, OTA code signing certificate is built in via
|
||||
* aws_ota_codesigner_certificate.h.
|
||||
*/
|
||||
#define pkcs11configOTA_SUPPORTED 0
|
||||
|
||||
/**
|
||||
* @brief Set to 1 if PAL supports storage for JITP certificate,
|
||||
* code verify certificate, and trusted server root certificate.
|
||||
*
|
||||
* If set to 0, PAL does not support storage mechanism for these, and
|
||||
* they are accessed via headers compiled into the code.
|
||||
*/
|
||||
#define pkcs11configJITP_CODEVERIFY_ROOT_CERT_SUPPORTED 0
|
||||
|
||||
/**
|
||||
* @brief The PKCS #11 label for device private key.
|
||||
*
|
||||
* Private key for connection to AWS IoT endpoint. The corresponding
|
||||
* public key should be registered with the AWS IoT endpoint.
|
||||
*/
|
||||
#define pkcs11configLABEL_DEVICE_PRIVATE_KEY_FOR_TLS "Device Priv TLS Key"
|
||||
|
||||
/**
|
||||
* @brief The PKCS #11 label for device public key.
|
||||
*
|
||||
* The public key corresponding to pkcs11configLABEL_DEVICE_PRIVATE_KEY_FOR_TLS.
|
||||
*/
|
||||
#define pkcs11configLABEL_DEVICE_PUBLIC_KEY_FOR_TLS "Device Pub TLS Key"
|
||||
|
||||
/**
|
||||
* @brief The PKCS #11 label for the device certificate.
|
||||
*
|
||||
* Device certificate corresponding to pkcs11configLABEL_DEVICE_PRIVATE_KEY_FOR_TLS.
|
||||
*/
|
||||
#define pkcs11configLABEL_DEVICE_CERTIFICATE_FOR_TLS "Device Cert"
|
||||
|
||||
/**
|
||||
* @brief The PKCS #11 label for the object to be used for code verification.
|
||||
*
|
||||
* Used by over-the-air update code to verify an incoming signed image.
|
||||
*/
|
||||
#define pkcs11configLABEL_CODE_VERIFICATION_KEY "Code Verify Key"
|
||||
|
||||
/**
|
||||
* @brief The PKCS #11 label for Just-In-Time-Provisioning.
|
||||
*
|
||||
* The certificate corresponding to the issuer of the device certificate
|
||||
* (pkcs11configLABEL_DEVICE_CERTIFICATE_FOR_TLS) when using the JITR or
|
||||
* JITP flow.
|
||||
*/
|
||||
#define pkcs11configLABEL_JITP_CERTIFICATE "JITP Cert"
|
||||
|
||||
/**
|
||||
* @brief The PKCS #11 label for the AWS Trusted Root Certificate.
|
||||
*
|
||||
* @see aws_default_root_certificates.h
|
||||
*/
|
||||
#define pkcs11configLABEL_ROOT_CERTIFICATE "Root Cert"
|
||||
|
||||
#endif /* _CORE_PKCS11_CONFIG_H_ */
|
@ -0,0 +1,409 @@
|
||||
/*
|
||||
* FreeRTOS V202012.00
|
||||
* Copyright (C) 2020 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.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DEMO_CONFIG_H
|
||||
#define DEMO_CONFIG_H
|
||||
|
||||
/**************************************************/
|
||||
/******* DO NOT CHANGE the following order ********/
|
||||
/**************************************************/
|
||||
|
||||
/* Include logging header files and define logging macros in the following order:
|
||||
* 1. Include the header file "logging_levels.h".
|
||||
* 2. Define the LIBRARY_LOG_NAME and LIBRARY_LOG_LEVEL macros depending on
|
||||
* the logging configuration for DEMO.
|
||||
* 3. Include the header file "logging_stack.h", if logging is enabled for DEMO.
|
||||
*/
|
||||
|
||||
#include "logging_levels.h"
|
||||
|
||||
/* Logging configuration for the Demo. */
|
||||
#ifndef LIBRARY_LOG_NAME
|
||||
#define LIBRARY_LOG_NAME "OTADemo"
|
||||
#endif
|
||||
|
||||
#ifndef LIBRARY_LOG_LEVEL
|
||||
#define LIBRARY_LOG_LEVEL LOG_DEBUG
|
||||
#endif
|
||||
|
||||
/* Prototype for the function used to print to console on Windows simulator
|
||||
* of FreeRTOS.
|
||||
* The function prints to the console before the network is connected;
|
||||
* then a UDP port after the network has connected. */
|
||||
extern void vLoggingPrintf( const char * pcFormatString,
|
||||
... );
|
||||
|
||||
/* Map the SdkLog macro to the logging function to enable logging
|
||||
* on Windows simulator. */
|
||||
#ifndef SdkLog
|
||||
#define SdkLog( message ) vLoggingPrintf message
|
||||
#endif
|
||||
|
||||
#include "logging_stack.h"
|
||||
|
||||
/************ End of logging configuration ****************/
|
||||
|
||||
/**
|
||||
* @brief The version for the firmware which is running. OTA agent uses this
|
||||
* version number to perform anti-rollback validation. The firmware version for the
|
||||
* download image should be higher than the current version, otherwise the new image is
|
||||
* rejected in self test phase.
|
||||
*/
|
||||
#define APP_VERSION_MAJOR 0
|
||||
#define APP_VERSION_MINOR 9
|
||||
#define APP_VERSION_BUILD 2
|
||||
|
||||
/**
|
||||
* @brief The MQTT client identifier used in this example. Each client identifier
|
||||
* must be unique so edit as required to ensure no two clients connecting to the
|
||||
* same broker use the same client identifier.
|
||||
*
|
||||
*!!! Please note a #defined constant is used for convenience of demonstration
|
||||
*!!! only. Production devices can use something unique to the device that can
|
||||
*!!! be read by software, such as a production serial number, instead of a
|
||||
*!!! hard coded constant.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Endpoint of the MQTT broker to connect to.
|
||||
*
|
||||
* This demo application can be run with any MQTT broker, although it is
|
||||
* recommended to use one that supports mutual authentication. If mutual
|
||||
* authentication is not used, then #democonfigUSE_TLS should be set to 0.
|
||||
*
|
||||
* For AWS IoT MQTT broker, this is the Thing's REST API Endpoint.
|
||||
*
|
||||
* @note Your AWS IoT Core endpoint can be found in the AWS IoT console under
|
||||
* Settings/Custom Endpoint, or using the describe-endpoint REST API (with
|
||||
* AWS CLI command line tool).
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief The port to use for the demo.
|
||||
*
|
||||
* In general, port 8883 is for secured MQTT connections, and port 1883 if not
|
||||
* using TLS.
|
||||
*
|
||||
* @note Port 443 requires use of the ALPN TLS extension with the ALPN protocol
|
||||
* name. Using ALPN with this demo would require additional changes, including
|
||||
* setting the `pAlpnProtos` member of the `NetworkCredentials_t` struct before
|
||||
* forming the TLS connection. When using port 8883, ALPN is not required.
|
||||
*
|
||||
* #define democonfigMQTT_BROKER_PORT ( insert here. )
|
||||
*/
|
||||
#define democonfigMQTT_BROKER_PORT ( 8883 )
|
||||
|
||||
/**
|
||||
* @brief Server's root CA certificate.
|
||||
*
|
||||
* For AWS IoT MQTT broker, this certificate is used to identify the AWS IoT
|
||||
* server and is publicly available. Refer to the AWS documentation available
|
||||
* in the link below.
|
||||
* https://docs.aws.amazon.com/iot/latest/developerguide/server-authentication.html#server-authentication-certs
|
||||
*
|
||||
* @note This certificate should be PEM-encoded.
|
||||
*
|
||||
* @note If you would like to setup an MQTT broker for running this demo,
|
||||
* please see `mqtt_broker_setup.txt`.
|
||||
*
|
||||
* Must include the PEM header and footer:
|
||||
* "-----BEGIN CERTIFICATE-----\n"\
|
||||
* "...base64 data...\n"\
|
||||
* "-----END CERTIFICATE-----\n"
|
||||
*
|
||||
* #define democonfigROOT_CA_PEM "...insert here..."
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Client certificate.
|
||||
*
|
||||
* For AWS IoT MQTT broker, refer to the AWS documentation below for details
|
||||
* regarding client authentication.
|
||||
* https://docs.aws.amazon.com/iot/latest/developerguide/client-authentication.html
|
||||
*
|
||||
* @note This certificate should be PEM-encoded.
|
||||
*
|
||||
* Must include the PEM header and footer:
|
||||
* "-----BEGIN CERTIFICATE-----\n"\
|
||||
* "...base64 data...\n"\
|
||||
* "-----END CERTIFICATE-----\n"
|
||||
*
|
||||
* #define democonfigCLIENT_CERTIFICATE_PEM "...insert here..."
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Client's private key.
|
||||
*
|
||||
*!!! Please note pasting a key into the header file in this manner is for
|
||||
*!!! convenience of demonstration only and should not be done in production.
|
||||
*!!! Never paste a production private key here!. Production devices should
|
||||
*!!! store keys securely, such as within a secure element. Additionally,
|
||||
*!!! we provide the corePKCS library that further enhances security by
|
||||
*!!! enabling securely stored keys to be used without exposing them to
|
||||
*!!! software.
|
||||
*
|
||||
* For AWS IoT MQTT broker, refer to the AWS documentation below for details
|
||||
* regarding clientauthentication.
|
||||
* https://docs.aws.amazon.com/iot/latest/developerguide/client-authentication.html
|
||||
*
|
||||
* @note This private key should be PEM-encoded.
|
||||
*
|
||||
* Must include the PEM header and footer:
|
||||
* "-----BEGIN RSA PRIVATE KEY-----\n"\
|
||||
* "...base64 data...\n"\
|
||||
* "-----END RSA PRIVATE KEY-----\n"
|
||||
*
|
||||
* #define democonfigCLIENT_PRIVATE_KEY_PEM "...insert here..."
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief An option to disable Server Name Indication.
|
||||
*
|
||||
* @note When using a local Mosquitto server setup, SNI needs to be disabled
|
||||
* for an MQTT broker that only has an IP address but no hostname. However,
|
||||
* SNI should be enabled whenever possible.
|
||||
*/
|
||||
#define democonfigDISABLE_SNI ( pdFALSE )
|
||||
|
||||
/**
|
||||
* @brief Configuration that indicates if the demo connection is made to the AWS IoT Core MQTT broker.
|
||||
*
|
||||
* If username/password based authentication is used, the demo will use appropriate TLS ALPN and
|
||||
* SNI configurations as required for the Custom Authentication feature of AWS IoT.
|
||||
* For more information, refer to the following documentation:
|
||||
* https://docs.aws.amazon.com/iot/latest/developerguide/custom-auth.html#custom-auth-mqtt
|
||||
*
|
||||
* #define democonfigUSE_AWS_IOT_CORE_BROKER ( 1 )
|
||||
*/
|
||||
#define democonfigUSE_AWS_IOT_CORE_BROKER ( 1 )
|
||||
|
||||
/**
|
||||
* @brief The username value for authenticating client to the MQTT broker when
|
||||
* username/password based client authentication is used.
|
||||
*
|
||||
* For AWS IoT MQTT broker, refer to the AWS IoT documentation below for
|
||||
* details regarding client authentication with a username and password.
|
||||
* https://docs.aws.amazon.com/iot/latest/developerguide/custom-authentication.html
|
||||
* An authorizer setup needs to be done, as mentioned in the above link, to use
|
||||
* username/password based client authentication.
|
||||
*
|
||||
* #define democonfigCLIENT_USERNAME "...insert here..."
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief The password value for authenticating client to the MQTT broker when
|
||||
* username/password based client authentication is used.
|
||||
*
|
||||
* For AWS IoT MQTT broker, refer to the AWS IoT documentation below for
|
||||
* details regarding client authentication with a username and password.
|
||||
* https://docs.aws.amazon.com/iot/latest/developerguide/custom-authentication.html
|
||||
* An authorizer setup needs to be done, as mentioned in the above link, to use
|
||||
* username/password based client authentication.
|
||||
*
|
||||
* #define democonfigCLIENT_PASSWORD "...insert here..."
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief The name of the operating system that the application is running on.
|
||||
* The current value is given as an example. Please update for your specific
|
||||
* operating system.
|
||||
*/
|
||||
#define democonfigOS_NAME "FreeRTOS"
|
||||
|
||||
/**
|
||||
* @brief The version of the operating system that the application is running
|
||||
* on. The current value is given as an example. Please update for your specific
|
||||
* operating system version.
|
||||
*/
|
||||
#define democonfigOS_VERSION tskKERNEL_VERSION_NUMBER
|
||||
|
||||
/**
|
||||
* @brief The name of the hardware platform the application is running on. The
|
||||
* current value is given as an example. Please update for your specific
|
||||
* hardware platform.
|
||||
*/
|
||||
#define democonfigHARDWARE_PLATFORM_NAME "WinSim"
|
||||
|
||||
/**
|
||||
* @brief The name of the MQTT library used and its version, following an "@"
|
||||
* symbol.
|
||||
*/
|
||||
#define democonfigMQTT_LIB "core-mqtt@1.0.0"
|
||||
|
||||
/**
|
||||
* @brief Whether to use mutual authentication. If this macro is not set to 1
|
||||
* or not defined, then plaintext TCP will be used instead of TLS over TCP.
|
||||
*/
|
||||
#define democonfigUSE_TLS 1
|
||||
|
||||
/**
|
||||
* @brief Set the stack size of the main demo task.
|
||||
*
|
||||
* In the Windows port, this stack only holds a structure. The actual
|
||||
* stack is created by an operating system thread.
|
||||
*/
|
||||
#define democonfigDEMO_STACKSIZE configMINIMAL_STACK_SIZE
|
||||
|
||||
/**********************************************************************************
|
||||
* Error checks and derived values only below here - do not edit below here. -----*
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
/* Compile time error for some undefined configs, and provide default values
|
||||
* for others. */
|
||||
#ifndef democonfigMQTT_BROKER_ENDPOINT
|
||||
#error "Please define democonfigMQTT_BROKER_ENDPOINT in demo_config.h."
|
||||
#endif
|
||||
|
||||
#ifndef democonfigCLIENT_IDENTIFIER
|
||||
|
||||
/**
|
||||
* @brief The MQTT client identifier used in this example. Each client identifier
|
||||
* must be unique so edit as required to ensure no two clients connecting to the
|
||||
* same broker use the same client identifier. Using a #define is for convenience
|
||||
* of demonstration only - production devices should use something unique to the
|
||||
* device that can be read from software - such as a production serial number.
|
||||
*/
|
||||
#error "Please define democonfigCLIENT_IDENTIFIER in demo_config.h to something unique for this device."
|
||||
#endif
|
||||
|
||||
|
||||
#if defined( democonfigUSE_TLS ) && ( democonfigUSE_TLS == 1 )
|
||||
#ifndef democonfigROOT_CA_PEM
|
||||
#error "Please define Root CA certificate of the MQTT broker(democonfigROOT_CA_PEM) in demo_config.h."
|
||||
#endif
|
||||
|
||||
/* If no username is defined, then a client certificate/key is required. */
|
||||
#ifndef democonfigCLIENT_USERNAME
|
||||
|
||||
/*
|
||||
*!!! Please note democonfigCLIENT_PRIVATE_KEY_PEM in used for
|
||||
*!!! convenience of demonstration only. Production devices should
|
||||
*!!! store keys securely, such as within a secure element.
|
||||
*/
|
||||
|
||||
#ifndef democonfigCLIENT_CERTIFICATE_PEM
|
||||
#error "Please define client certificate(democonfigCLIENT_CERTIFICATE_PEM) in demo_config.h."
|
||||
#endif
|
||||
#ifndef democonfigCLIENT_PRIVATE_KEY_PEM
|
||||
#error "Please define client private key(democonfigCLIENT_PRIVATE_KEY_PEM) in demo_config.h."
|
||||
#endif
|
||||
#else
|
||||
|
||||
/* If a username is defined, a client password also would need to be defined for
|
||||
* client authentication. */
|
||||
#ifndef democonfigCLIENT_PASSWORD
|
||||
#error "Please define client password(democonfigCLIENT_PASSWORD) in demo_config.h for client authentication based on username/password."
|
||||
#endif
|
||||
|
||||
/* AWS IoT MQTT broker port needs to be 443 for client authentication based on
|
||||
* username/password. */
|
||||
#if defined( democonfigUSE_AWS_IOT_CORE_BROKER ) && democonfigMQTT_BROKER_PORT != 443
|
||||
#error "Broker port(democonfigMQTT_BROKER_PORT) should be defined as 443 in demo_config.h for client authentication based on username/password in AWS IoT Core."
|
||||
#endif
|
||||
#endif /* ifndef democonfigCLIENT_USERNAME */
|
||||
|
||||
#ifndef democonfigMQTT_BROKER_PORT
|
||||
#define democonfigMQTT_BROKER_PORT ( 8883 )
|
||||
#endif
|
||||
#else /* if defined( democonfigUSE_TLS ) && ( democonfigUSE_TLS == 1 ) */
|
||||
#ifndef democonfigMQTT_BROKER_PORT
|
||||
#define democonfigMQTT_BROKER_PORT ( 1883 )
|
||||
#endif
|
||||
#endif /* if defined( democonfigUSE_TLS ) && ( democonfigUSE_TLS == 1 ) */
|
||||
|
||||
/**
|
||||
* @brief ALPN (Application-Layer Protocol Negotiation) protocol name for AWS IoT MQTT.
|
||||
*
|
||||
* This will be used if democonfigMQTT_BROKER_PORT is configured as 443 for the AWS IoT MQTT broker.
|
||||
* Please see more details about the ALPN protocol for AWS IoT MQTT endpoint
|
||||
* in the link below.
|
||||
* https://aws.amazon.com/blogs/iot/mqtt-with-tls-client-authentication-on-port-443-why-it-is-useful-and-how-it-works/
|
||||
*/
|
||||
#define AWS_IOT_MQTT_ALPN "\x0ex-amzn-mqtt-ca"
|
||||
|
||||
/**
|
||||
* @brief This is the ALPN (Application-Layer Protocol Negotiation) string
|
||||
* required by AWS IoT for password-based authentication using TCP port 443.
|
||||
*/
|
||||
#define AWS_IOT_CUSTOM_AUTH_ALPN "\x04mqtt"
|
||||
|
||||
/**
|
||||
* Provide default values for undefined configuration settings.
|
||||
*/
|
||||
#ifndef democonfigOS_NAME
|
||||
#define democonfigOS_NAME "FreeRTOS"
|
||||
#endif
|
||||
|
||||
#ifndef democonfigOS_VERSION
|
||||
#define democonfigOS_VERSION tskKERNEL_VERSION_NUMBER
|
||||
#endif
|
||||
|
||||
#ifndef democonfigHARDWARE_PLATFORM_NAME
|
||||
#define democonfigHARDWARE_PLATFORM_NAME "WinSim"
|
||||
#endif
|
||||
|
||||
#ifndef democonfigMQTT_LIB
|
||||
#define democonfigMQTT_LIB "core-mqtt@1.0.0"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief The MQTT metrics string expected by AWS IoT.
|
||||
*/
|
||||
#define AWS_IOT_METRICS_STRING \
|
||||
"?SDK=" democonfigOS_NAME "&Version=" democonfigOS_VERSION \
|
||||
"&Platform=" democonfigHARDWARE_PLATFORM_NAME "&MQTTLib=" democonfigMQTT_LIB
|
||||
|
||||
/**
|
||||
* @brief The length of the MQTT metrics string expected by AWS IoT.
|
||||
*/
|
||||
#define AWS_IOT_METRICS_STRING_LENGTH ( ( uint16_t ) ( sizeof( AWS_IOT_METRICS_STRING ) - 1 ) )
|
||||
|
||||
#ifdef democonfigCLIENT_USERNAME
|
||||
|
||||
/**
|
||||
* @brief Append the username with the metrics string if #democonfigCLIENT_USERNAME is defined.
|
||||
*
|
||||
* This is to support both metrics reporting and username/password based client
|
||||
* authentication by AWS IoT.
|
||||
*/
|
||||
#define CLIENT_USERNAME_WITH_METRICS democonfigCLIENT_USERNAME AWS_IOT_METRICS_STRING
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Length of client identifier.
|
||||
*/
|
||||
#define democonfigCLIENT_IDENTIFIER_LENGTH ( ( uint16_t ) ( sizeof( democonfigCLIENT_IDENTIFIER ) - 1 ) )
|
||||
|
||||
/**
|
||||
* @brief Length of MQTT server host name.
|
||||
*/
|
||||
#define democonfigBROKER_ENDPOINT_LENGTH ( ( uint16_t ) ( sizeof( democonfigMQTT_BROKER_ENDPOINT ) - 1 ) )
|
||||
|
||||
|
||||
#endif /* DEMO_CONFIG_H */
|
@ -0,0 +1,376 @@
|
||||
/*
|
||||
* FreeRTOS V202012.00
|
||||
* Copyright (C) 2020 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.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
/***
|
||||
* See https://www.FreeRTOS.org/coremqtt for configuration and usage instructions.
|
||||
***/
|
||||
|
||||
/* Standard includes. */
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
/* Visual studio intrinsics used so the __debugbreak() function is available
|
||||
* should an assert get hit. */
|
||||
#include <intrin.h>
|
||||
|
||||
/* FreeRTOS includes. */
|
||||
#include <FreeRTOS.h>
|
||||
#include "task.h"
|
||||
|
||||
/* TCP/IP stack includes. */
|
||||
#include "FreeRTOS_IP.h"
|
||||
#include "FreeRTOS_Sockets.h"
|
||||
|
||||
/* Demo logging includes. */
|
||||
#include "logging.h"
|
||||
|
||||
/* Demo Specific configs. */
|
||||
#include "demo_config.h"
|
||||
|
||||
|
||||
/*
|
||||
* Prototypes for the demos that can be started from this project. Note the
|
||||
* Ota demo is not actually started until the network is already, which is
|
||||
* indicated by vApplicationIPNetworkEventHook() executing - hence
|
||||
* vStartOtaDemo() is called from inside vApplicationIPNetworkEventHook().
|
||||
*/
|
||||
extern void vStartOtaDemo( void );
|
||||
|
||||
/*
|
||||
* Just seeds the simple pseudo random number generator.
|
||||
*
|
||||
* !!! NOTE !!!
|
||||
* This is not a secure method of generating random numbers and production
|
||||
* devices should use a true random number generator (TRNG).
|
||||
*/
|
||||
static void prvSRand( UBaseType_t ulSeed );
|
||||
|
||||
/*
|
||||
* Miscellaneous initialization including preparing the logging and seeding the
|
||||
* random number generator.
|
||||
*/
|
||||
static void prvMiscInitialisation( void );
|
||||
|
||||
/* The default IP and MAC address used by the demo. The address configuration
|
||||
* defined here will be used if ipconfigUSE_DHCP is 0, or if ipconfigUSE_DHCP is
|
||||
* 1 but a DHCP server could not be contacted. See the online documentation for
|
||||
* more information. */
|
||||
static const uint8_t ucIPAddress[ 4 ] = { configIP_ADDR0, configIP_ADDR1, configIP_ADDR2, configIP_ADDR3 };
|
||||
static const uint8_t ucNetMask[ 4 ] = { configNET_MASK0, configNET_MASK1, configNET_MASK2, configNET_MASK3 };
|
||||
static const uint8_t ucGatewayAddress[ 4 ] = { configGATEWAY_ADDR0, configGATEWAY_ADDR1, configGATEWAY_ADDR2, configGATEWAY_ADDR3 };
|
||||
static const uint8_t ucDNSServerAddress[ 4 ] = { configDNS_SERVER_ADDR0, configDNS_SERVER_ADDR1, configDNS_SERVER_ADDR2, configDNS_SERVER_ADDR3 };
|
||||
|
||||
/* Set the following constant to pdTRUE to log using the method indicated by the
|
||||
* name of the constant, or pdFALSE to not log using the method indicated by the
|
||||
* name of the constant. Options include to standard out (xLogToStdout), to a disk
|
||||
* file (xLogToFile), and to a UDP port (xLogToUDP). If xLogToUDP is set to pdTRUE
|
||||
* then UDP messages are sent to the IP address configured as the UDP logging server
|
||||
* address (see the configUDP_LOGGING_ADDR0 definitions in FreeRTOSConfig.h) and
|
||||
* the port number set by configPRINT_PORT in FreeRTOSConfig.h. */
|
||||
const BaseType_t xLogToStdout = pdTRUE, xLogToFile = pdFALSE, xLogToUDP = pdFALSE;
|
||||
|
||||
/* Default MAC address configuration. The demo creates a virtual network
|
||||
* connection that uses this MAC address by accessing the raw Ethernet data
|
||||
* to and from a real network connection on the host PC. See the
|
||||
* configNETWORK_INTERFACE_TO_USE definition for information on how to configure
|
||||
* the real network connection to use. */
|
||||
const uint8_t ucMACAddress[ 6 ] = { configMAC_ADDR0, configMAC_ADDR1, configMAC_ADDR2, configMAC_ADDR3, configMAC_ADDR4, configMAC_ADDR5 };
|
||||
|
||||
/* Used by the pseudo random number generator. */
|
||||
static UBaseType_t ulNextRand;
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
int main( void )
|
||||
{
|
||||
/* Miscellaneous initialization including preparing the logging and seeding
|
||||
* the random number generator. */
|
||||
prvMiscInitialisation();
|
||||
|
||||
/* Initialize the network interface.
|
||||
*
|
||||
***NOTE*** Tasks that use the network are created in the network event hook
|
||||
* when the network is connected and ready for use (see the implementation of
|
||||
* vApplicationIPNetworkEventHook() below). The address values passed in here
|
||||
* are used if ipconfigUSE_DHCP is set to 0, or if ipconfigUSE_DHCP is set to 1
|
||||
* but a DHCP server cannot be contacted. */
|
||||
FreeRTOS_IPInit( ucIPAddress, ucNetMask, ucGatewayAddress, ucDNSServerAddress, ucMACAddress );
|
||||
|
||||
/* Start the RTOS scheduler. */
|
||||
vTaskStartScheduler();
|
||||
|
||||
/* If all is well, the scheduler will now be running, and the following
|
||||
* line will never be reached. If the following line does execute, then
|
||||
* there was insufficient FreeRTOS heap memory available for the idle and/or
|
||||
* timer tasks to be created. See the memory management section on the
|
||||
* FreeRTOS web site for more details (this is standard text that is not
|
||||
* really applicable to the Win32 simulator port). */
|
||||
for( ; ; )
|
||||
{
|
||||
__debugbreak();
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Called by FreeRTOS+TCP when the network connects or disconnects. Disconnect
|
||||
* events are only received if implemented in the MAC driver. */
|
||||
void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent )
|
||||
{
|
||||
uint32_t ulIPAddress, ulNetMask, ulGatewayAddress, ulDNSServerAddress;
|
||||
char cBuffer[ 16 ];
|
||||
static BaseType_t xTasksAlreadyCreated = pdFALSE;
|
||||
|
||||
/* If the network has just come up...*/
|
||||
if( eNetworkEvent == eNetworkUp )
|
||||
{
|
||||
/* Create the tasks that use the IP stack if they have not already been
|
||||
* created. */
|
||||
if( xTasksAlreadyCreated == pdFALSE )
|
||||
{
|
||||
/* Demos that use the network are created after the network is
|
||||
* up. */
|
||||
LogInfo( ( "---------STARTING DEMO---------\r\n" ) );
|
||||
vStartOtaDemo();
|
||||
xTasksAlreadyCreated = pdTRUE;
|
||||
}
|
||||
|
||||
/* Print out the network configuration, which may have come from a DHCP
|
||||
* server. */
|
||||
FreeRTOS_GetAddressConfiguration( &ulIPAddress, &ulNetMask, &ulGatewayAddress, &ulDNSServerAddress );
|
||||
FreeRTOS_inet_ntoa( ulIPAddress, cBuffer );
|
||||
LogInfo( ( "\r\n\r\nIP Address: %s\r\n", cBuffer ) );
|
||||
|
||||
FreeRTOS_inet_ntoa( ulNetMask, cBuffer );
|
||||
LogInfo( ( "Subnet Mask: %s\r\n", cBuffer ) );
|
||||
|
||||
FreeRTOS_inet_ntoa( ulGatewayAddress, cBuffer );
|
||||
LogInfo( ( "Gateway Address: %s\r\n", cBuffer ) );
|
||||
|
||||
FreeRTOS_inet_ntoa( ulDNSServerAddress, cBuffer );
|
||||
LogInfo( ( "DNS Server Address: %s\r\n\r\n\r\n", cBuffer ) );
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vAssertCalled( const char * pcFile,
|
||||
uint32_t ulLine )
|
||||
{
|
||||
volatile uint32_t ulBlockVariable = 0UL;
|
||||
volatile char * pcFileName = ( volatile char * ) pcFile;
|
||||
volatile uint32_t ulLineNumber = ulLine;
|
||||
|
||||
( void ) pcFileName;
|
||||
( void ) ulLineNumber;
|
||||
|
||||
printf( "vAssertCalled( %s, %u\n", pcFile, ulLine );
|
||||
|
||||
/* Setting ulBlockVariable to a non-zero value in the debugger will allow
|
||||
* this function to be exited. */
|
||||
taskDISABLE_INTERRUPTS();
|
||||
{
|
||||
while( ulBlockVariable == 0UL )
|
||||
{
|
||||
__debugbreak();
|
||||
}
|
||||
}
|
||||
taskENABLE_INTERRUPTS();
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
UBaseType_t uxRand( void )
|
||||
{
|
||||
const uint32_t ulMultiplier = 0x015a4e35UL, ulIncrement = 1UL;
|
||||
|
||||
/*
|
||||
* Utility function to generate a pseudo random number.
|
||||
*
|
||||
* !!!NOTE!!!
|
||||
* This is not a secure method of generating a random number. Production
|
||||
* devices should use a True Random Number Generator (TRNG).
|
||||
*/
|
||||
ulNextRand = ( ulMultiplier * ulNextRand ) + ulIncrement;
|
||||
return( ( int ) ( ulNextRand >> 16UL ) & 0x7fffUL );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvSRand( UBaseType_t ulSeed )
|
||||
{
|
||||
/* Utility function to seed the pseudo random number generator. */
|
||||
ulNextRand = ulSeed;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvMiscInitialisation( void )
|
||||
{
|
||||
time_t xTimeNow;
|
||||
uint32_t ulLoggingIPAddress;
|
||||
|
||||
ulLoggingIPAddress = FreeRTOS_inet_addr_quick( configUDP_LOGGING_ADDR0, configUDP_LOGGING_ADDR1, configUDP_LOGGING_ADDR2, configUDP_LOGGING_ADDR3 );
|
||||
vLoggingInit( xLogToStdout, xLogToFile, xLogToUDP, ulLoggingIPAddress, configPRINT_PORT );
|
||||
|
||||
/*
|
||||
* Seed random number generator.
|
||||
*
|
||||
* !!!NOTE!!!
|
||||
* This is not a secure method of generating a random number. Production
|
||||
* devices should use a True Random Number Generator (TRNG).
|
||||
*/
|
||||
time( &xTimeNow );
|
||||
LogDebug( ( "Seed for randomizer: %lu\n", xTimeNow ) );
|
||||
prvSRand( ( uint32_t ) xTimeNow );
|
||||
LogDebug( ( "Random numbers: %08X %08X %08X %08X\n", ipconfigRAND32(), ipconfigRAND32(), ipconfigRAND32(), ipconfigRAND32() ) );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( ipconfigUSE_LLMNR != 0 ) || ( ipconfigUSE_NBNS != 0 ) || ( ipconfigDHCP_REGISTER_HOSTNAME == 1 )
|
||||
|
||||
const char * pcApplicationHostnameHook( void )
|
||||
{
|
||||
/* Assign the name "FreeRTOS" to this network node. This function will
|
||||
* be called during the DHCP: the machine will be registered with an IP
|
||||
* address plus this name. */
|
||||
return mainHOST_NAME;
|
||||
}
|
||||
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( ipconfigUSE_LLMNR != 0 ) || ( ipconfigUSE_NBNS != 0 )
|
||||
|
||||
BaseType_t xApplicationDNSQueryHook( const char * pcName )
|
||||
{
|
||||
BaseType_t xReturn;
|
||||
|
||||
/* Determine if a name lookup is for this node. Two names are given
|
||||
* to this node: that returned by pcApplicationHostnameHook() and that set
|
||||
* by mainDEVICE_NICK_NAME. */
|
||||
if( _stricmp( pcName, pcApplicationHostnameHook() ) == 0 )
|
||||
{
|
||||
xReturn = pdPASS;
|
||||
}
|
||||
else if( _stricmp( pcName, mainDEVICE_NICK_NAME ) == 0 )
|
||||
{
|
||||
xReturn = pdPASS;
|
||||
}
|
||||
else
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
|
||||
#endif /* if ( ipconfigUSE_LLMNR != 0 ) || ( ipconfigUSE_NBNS != 0 ) */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Callback that provides the inputs necessary to generate a randomized TCP
|
||||
* Initial Sequence Number per RFC 6528. THIS IS ONLY A DUMMY IMPLEMENTATION
|
||||
* THAT RETURNS A PSEUDO RANDOM NUMBER SO IS NOT INTENDED FOR USE IN PRODUCTION
|
||||
* SYSTEMS.
|
||||
*/
|
||||
extern uint32_t ulApplicationGetNextSequenceNumber( uint32_t ulSourceAddress,
|
||||
uint16_t usSourcePort,
|
||||
uint32_t ulDestinationAddress,
|
||||
uint16_t usDestinationPort )
|
||||
{
|
||||
( void ) ulSourceAddress;
|
||||
( void ) usSourcePort;
|
||||
( void ) ulDestinationAddress;
|
||||
( void ) usDestinationPort;
|
||||
|
||||
return uxRand();
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Set *pulNumber to a random number, and return pdTRUE. When the random number
|
||||
* generator is broken, it shall return pdFALSE.
|
||||
* The macros ipconfigRAND32() and configRAND32() are not in use
|
||||
* anymore in FreeRTOS+TCP.
|
||||
*
|
||||
* THIS IS ONLY A DUMMY IMPLEMENTATION THAT RETURNS A PSEUDO RANDOM NUMBER SO IS
|
||||
* NOT INTENDED FOR USE IN PRODUCTION SYSTEMS.
|
||||
*/
|
||||
BaseType_t xApplicationGetRandomNumber( uint32_t * pulNumber )
|
||||
{
|
||||
*pulNumber = uxRand();
|
||||
return pdTRUE;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* 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;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
@ -0,0 +1,134 @@
|
||||
/*
|
||||
* FreeRTOS V202012.00
|
||||
* Copyright (C) 2020 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.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
/* This file configures mbed TLS for FreeRTOS. */
|
||||
|
||||
#ifndef MBEDTLS_CONFIG_H_
|
||||
#define MBEDTLS_CONFIG_H_
|
||||
|
||||
/* FreeRTOS include. */
|
||||
#include "FreeRTOS.h"
|
||||
|
||||
/* Generate errors if deprecated functions are used. */
|
||||
#define MBEDTLS_DEPRECATED_REMOVED
|
||||
|
||||
/* Place AES tables in ROM. */
|
||||
#define MBEDTLS_AES_ROM_TABLES
|
||||
|
||||
/* Enable the following cipher modes. */
|
||||
#define MBEDTLS_CIPHER_MODE_CBC
|
||||
#define MBEDTLS_CIPHER_MODE_CFB
|
||||
#define MBEDTLS_CIPHER_MODE_CTR
|
||||
|
||||
/* Enable the following cipher padding modes. */
|
||||
#define MBEDTLS_CIPHER_PADDING_PKCS7
|
||||
#define MBEDTLS_CIPHER_PADDING_ONE_AND_ZEROS
|
||||
#define MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN
|
||||
#define MBEDTLS_CIPHER_PADDING_ZEROS
|
||||
|
||||
/* Cipher suite configuration. */
|
||||
#define MBEDTLS_REMOVE_ARC4_CIPHERSUITES
|
||||
#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
|
||||
#define MBEDTLS_ECP_NIST_OPTIM
|
||||
#define MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED
|
||||
#define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
|
||||
/* Enable all SSL alert messages. */
|
||||
#define MBEDTLS_SSL_ALL_ALERT_MESSAGES
|
||||
|
||||
/* Enable the following SSL features. */
|
||||
#define MBEDTLS_SSL_ENCRYPT_THEN_MAC
|
||||
#define MBEDTLS_SSL_EXTENDED_MASTER_SECRET
|
||||
#define MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
|
||||
#define MBEDTLS_SSL_PROTO_TLS1_2
|
||||
#define MBEDTLS_SSL_ALPN
|
||||
#define MBEDTLS_SSL_SERVER_NAME_INDICATION
|
||||
|
||||
/* Check certificate key usage. */
|
||||
#define MBEDTLS_X509_CHECK_KEY_USAGE
|
||||
#define MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE
|
||||
#define MBEDTLS_X509_CREATE_C
|
||||
#define MBEDTLS_PK_WRITE_C
|
||||
#define MBEDTLS_X509_CSR_WRITE_C
|
||||
|
||||
/* Disable platform entropy functions. */
|
||||
#define MBEDTLS_NO_PLATFORM_ENTROPY
|
||||
|
||||
/* Enable the following mbed TLS features. */
|
||||
#define MBEDTLS_AES_C
|
||||
#define MBEDTLS_ASN1_PARSE_C
|
||||
#define MBEDTLS_ASN1_WRITE_C
|
||||
#define MBEDTLS_BASE64_C
|
||||
#define MBEDTLS_BIGNUM_C
|
||||
#define MBEDTLS_CIPHER_C
|
||||
#define MBEDTLS_CTR_DRBG_C
|
||||
#define MBEDTLS_ECDH_C
|
||||
#define MBEDTLS_ECDSA_C
|
||||
#define MBEDTLS_ECP_C
|
||||
#define MBEDTLS_ENTROPY_C
|
||||
#define MBEDTLS_GCM_C
|
||||
#define MBEDTLS_MD_C
|
||||
#define MBEDTLS_OID_C
|
||||
#define MBEDTLS_PEM_PARSE_C
|
||||
#define MBEDTLS_PK_C
|
||||
#define MBEDTLS_PK_PARSE_C
|
||||
#define MBEDTLS_PKCS1_V15
|
||||
#define MBEDTLS_PLATFORM_C
|
||||
#define MBEDTLS_RSA_C
|
||||
#define MBEDTLS_SHA1_C
|
||||
#define MBEDTLS_SHA256_C
|
||||
#define MBEDTLS_SSL_CLI_C
|
||||
#define MBEDTLS_SSL_TLS_C
|
||||
#define MBEDTLS_THREADING_ALT
|
||||
#define MBEDTLS_THREADING_C
|
||||
#define MBEDTLS_X509_USE_C
|
||||
#define MBEDTLS_X509_CRT_PARSE_C
|
||||
|
||||
/* Set the memory allocation functions on FreeRTOS. */
|
||||
void * mbedtls_platform_calloc( size_t nmemb,
|
||||
size_t size );
|
||||
void mbedtls_platform_free( void * ptr );
|
||||
#define MBEDTLS_PLATFORM_MEMORY
|
||||
#define MBEDTLS_PLATFORM_CALLOC_MACRO mbedtls_platform_calloc
|
||||
#define MBEDTLS_PLATFORM_FREE_MACRO mbedtls_platform_free
|
||||
|
||||
/* The network send and receive functions on FreeRTOS. */
|
||||
int mbedtls_platform_send( void * ctx,
|
||||
const unsigned char * buf,
|
||||
size_t len );
|
||||
int mbedtls_platform_recv( void * ctx,
|
||||
unsigned char * buf,
|
||||
size_t len );
|
||||
|
||||
/* The entropy poll function. */
|
||||
int mbedtls_platform_entropy_poll( void * data,
|
||||
unsigned char * output,
|
||||
size_t len,
|
||||
size_t * olen );
|
||||
|
||||
#include "mbedtls/check_config.h"
|
||||
|
||||
#endif /* ifndef MBEDTLS_CONFIG_H_ */
|
@ -0,0 +1,200 @@
|
||||
/*
|
||||
* FreeRTOS V202012.00
|
||||
* Copyright (C) 2020 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.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file ota_config.h
|
||||
* @brief OTA user configurable settings.
|
||||
*/
|
||||
|
||||
#ifndef OTA_CONFIG_H_
|
||||
#define OTA_CONFIG_H_
|
||||
|
||||
/**************************************************/
|
||||
/******* DO NOT CHANGE the following order ********/
|
||||
/**************************************************/
|
||||
|
||||
/* Logging related header files are required to be included in the following order:
|
||||
* 1. Include the header file "logging_levels.h".
|
||||
* 2. Define LIBRARY_LOG_NAME and LIBRARY_LOG_LEVEL.
|
||||
* 3. Include the header file "logging_stack.h".
|
||||
*/
|
||||
|
||||
/* Include header that defines log levels. */
|
||||
#include "logging_levels.h"
|
||||
|
||||
/* Configure name and log level for the OTA library. */
|
||||
#ifndef LIBRARY_LOG_NAME
|
||||
#define LIBRARY_LOG_NAME "OTA"
|
||||
#endif
|
||||
#ifndef LIBRARY_LOG_LEVEL
|
||||
#define LIBRARY_LOG_LEVEL LOG_INFO
|
||||
#endif
|
||||
|
||||
|
||||
/* Prototype for the function used to print to console on Windows simulator
|
||||
* of FreeRTOS.
|
||||
* The function prints to the console before the network is connected;
|
||||
* then a UDP port after the network has connected. */
|
||||
extern void vLoggingPrintf( const char * pcFormatString,
|
||||
... );
|
||||
|
||||
/* Map the SdkLog macro to the logging function to enable logging
|
||||
* on Windows simulator. */
|
||||
#ifndef SdkLog
|
||||
#define SdkLog( message ) vLoggingPrintf message
|
||||
#endif
|
||||
|
||||
#include "logging_stack.h"
|
||||
|
||||
/************ End of logging configuration ****************/
|
||||
|
||||
/**
|
||||
* @brief Log base 2 of the size of the file data block message (excluding the header).
|
||||
*
|
||||
* 10 bits yields a data block size of 1KB.
|
||||
*/
|
||||
#define otaconfigLOG2_FILE_BLOCK_SIZE 11UL
|
||||
|
||||
/**
|
||||
* @brief Size of the file data block message (excluding the header).
|
||||
*
|
||||
*/
|
||||
#define otaconfigFILE_BLOCK_SIZE ( 1UL << otaconfigLOG2_FILE_BLOCK_SIZE )
|
||||
|
||||
/**
|
||||
* @brief Milliseconds to wait for the self test phase to succeed before we force reset.
|
||||
*/
|
||||
#define otaconfigSELF_TEST_RESPONSE_WAIT_MS 16000U
|
||||
|
||||
/**
|
||||
* @brief Milliseconds to wait before requesting data blocks from the OTA service if nothing is happening.
|
||||
*
|
||||
* The wait timer is reset whenever a data block is received from the OTA service so we will only send
|
||||
* the request message after being idle for this amount of time.
|
||||
*/
|
||||
#define otaconfigFILE_REQUEST_WAIT_MS 10000U
|
||||
|
||||
/**
|
||||
* @brief The maximum allowed length of the thing name used by the OTA agent.
|
||||
*
|
||||
* AWS IoT requires Thing names to be unique for each device that connects to the broker.
|
||||
* Likewise, the OTA agent requires the developer to construct and pass in the Thing name when
|
||||
* initializing the OTA agent. The agent uses this size to allocate static storage for the
|
||||
* Thing name used in all OTA base topics. Namely $aws/things/<thingName>
|
||||
*/
|
||||
#define otaconfigMAX_THINGNAME_LEN 128U
|
||||
|
||||
/**
|
||||
* @brief The maximum number of data blocks requested from OTA streaming service.
|
||||
*
|
||||
* This configuration parameter is sent with data requests and represents the maximum number of
|
||||
* data blocks the service will send in response. The maximum limit for this must be calculated
|
||||
* from the maximum data response limit (128 KB from service) divided by the block size.
|
||||
* For example if block size is set as 1 KB then the maximum number of data blocks that we can
|
||||
* request is 128/1 = 128 blocks. Configure this parameter to this maximum limit or lower based on
|
||||
* how many data blocks response is expected for each data requests.
|
||||
* Please note that this must be set larger than zero.
|
||||
*
|
||||
*/
|
||||
#define otaconfigMAX_NUM_BLOCKS_REQUEST 4U
|
||||
|
||||
/**
|
||||
* @brief The maximum number of requests allowed to send without a response before we abort.
|
||||
*
|
||||
* This configuration parameter sets the maximum number of times the requests are made over
|
||||
* the selected communication channel before aborting and returning error.
|
||||
*
|
||||
*/
|
||||
#define otaconfigMAX_NUM_REQUEST_MOMENTUM 32U
|
||||
|
||||
/**
|
||||
* @brief The number of data buffers reserved by the OTA agent.
|
||||
*
|
||||
* This configurations parameter sets the maximum number of static data buffers used by
|
||||
* the OTA agent for job and file data blocks received.
|
||||
*/
|
||||
#define otaconfigMAX_NUM_OTA_DATA_BUFFERS 5U
|
||||
|
||||
/**
|
||||
* @brief How frequently the device will report its OTA progress to the cloud.
|
||||
*
|
||||
* Device will update the job status with the number of blocks it has received every certain
|
||||
* number of blocks it receives. For example, 25 means device will update job status every 25 blocks
|
||||
* it receives.
|
||||
*/
|
||||
#define otaconfigOTA_UPDATE_STATUS_FREQUENCY 25U
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Allow update to same or lower version.
|
||||
*
|
||||
* Set this to 1 to allow downgrade or same version update.This configurations parameter
|
||||
* disables version check and allows update to a same or lower version.This is provided for
|
||||
* testing purpose and it is recommended to always update to higher version and keep this
|
||||
* configuration disabled.
|
||||
*/
|
||||
#define otaconfigAllowDowngrade 0U
|
||||
|
||||
/**
|
||||
* @brief The protocol selected for OTA control operations.
|
||||
*
|
||||
* This configurations parameter sets the default protocol for all the OTA control
|
||||
* operations like requesting OTA job, updating the job status etc.
|
||||
*
|
||||
* Note - Only MQTT is supported at this time for control operations.
|
||||
*/
|
||||
#define configENABLED_CONTROL_PROTOCOL ( OTA_CONTROL_OVER_MQTT )
|
||||
|
||||
/**
|
||||
* @brief The protocol selected for OTA data operations.
|
||||
*
|
||||
* This configurations parameter sets the protocols selected for the data operations
|
||||
* like requesting file blocks from the service.
|
||||
*
|
||||
* Note - Both MQTT and HTTP is supported for data transfer from service. This configuration parameter
|
||||
* can be set to following -
|
||||
* Enable data over MQTT - ( OTA_DATA_OVER_MQTT )
|
||||
* Enable data over HTTP - ( OTA_DATA_OVER_HTTP)
|
||||
*
|
||||
* Note - Please check the OTA over HTTP demo which has the HTTP data trasnfer functionality and
|
||||
* and this configuration is set to OTA_DATA_OVER_HTTP.
|
||||
*/
|
||||
#define configENABLED_DATA_PROTOCOLS ( OTA_DATA_OVER_MQTT )
|
||||
|
||||
/**
|
||||
* @brief The preferred protocol selected for OTA data operations.
|
||||
*
|
||||
* Primary data protocol will be the protocol used for downloading file if more than
|
||||
* one protocol is selected while creating OTA job. Default primary data protocol is MQTT
|
||||
* and following update here to switch to HTTP as primary.
|
||||
*
|
||||
* Note - use OTA_DATA_OVER_HTTP for HTTP as primary data protocol.
|
||||
*/
|
||||
|
||||
#define configOTA_PRIMARY_DATA_PROTOCOL ( OTA_DATA_OVER_MQTT )
|
||||
|
||||
#endif /* OTA_CONFIG_H_ */
|
@ -0,0 +1 @@
|
||||
Subproject commit 826b4b40fdbd5f7746df48a650c18d0556aae41d
|
Loading…
Reference in New Issue