forked from aws/aws-iot-device-sdk-embedded-C
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request aws#36 from divekarshubham/dev
Changing OTA demo project structure
- Loading branch information
Showing
10 changed files
with
1,317 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
set( DEMO_NAME "ota_demo_core_mqtt" ) | ||
|
||
# Include required library's source and header path variables. | ||
include( ${CMAKE_SOURCE_DIR}/libraries/aws/ota/otaFilePaths.cmake ) | ||
include( ${CMAKE_SOURCE_DIR}/libraries/standard/coreMQTT/mqttFilePaths.cmake ) | ||
|
||
# Demo target. | ||
add_executable(${DEMO_NAME}) | ||
|
||
# librt is required to use OTA OS POSIX port. | ||
find_library(LIB_RT rt REQUIRED) | ||
|
||
target_sources( | ||
${DEMO_NAME} | ||
PRIVATE | ||
"ota_demo_core_mqtt.c" | ||
${OTA_SOURCES} | ||
${OTA_OS_POSIX_SOURCES} | ||
${OTA_MQTT_SOURCES} | ||
${MQTT_SOURCES} | ||
${MQTT_SERIALIZER_SOURCES} | ||
) | ||
target_link_libraries( | ||
${DEMO_NAME} | ||
PRIVATE | ||
${LIB_RT} | ||
ota_pal | ||
clock_posix | ||
openssl_posix | ||
retry_utils_posix | ||
mqtt_subscription_manager | ||
) | ||
|
||
target_include_directories( | ||
${DEMO_NAME} | ||
PUBLIC | ||
"${CMAKE_CURRENT_LIST_DIR}" | ||
"${LOGGING_INCLUDE_DIRS}" | ||
${OTA_INCLUDE_PUBLIC_DIRS} | ||
${OTA_INCLUDE_PRIVATE_DIRS} | ||
${OTA_INCLUDE_OS_POSIX_DIRS} | ||
${MQTT_INCLUDE_PUBLIC_DIRS} | ||
) | ||
|
||
if(ROOT_CA_CERT_PATH) | ||
target_compile_definitions( | ||
${DEMO_NAME} PRIVATE | ||
ROOT_CA_CERT_PATH="${ROOT_CA_CERT_PATH}" | ||
) | ||
endif() | ||
if(BROKER_ENDPOINT) | ||
target_compile_definitions( | ||
${DEMO_NAME} PRIVATE | ||
BROKER_ENDPOINT="${BROKER_ENDPOINT}" | ||
) | ||
endif() | ||
if(CLIENT_IDENTIFIER) | ||
target_compile_definitions( | ||
${DEMO_NAME} PRIVATE | ||
CLIENT_IDENTIFIER="${CLIENT_IDENTIFIER}" | ||
) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,175 @@ | ||
/* | ||
* FreeRTOS V1.4.7 | ||
* 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. | ||
* | ||
* http://aws.amazon.com/freertos | ||
* http://www.FreeRTOS.org | ||
*/ | ||
|
||
/** | ||
* @file aws_ota_agent_config.h | ||
* @brief OTA user configurable settings. | ||
*/ | ||
|
||
#ifndef _AWS_OTA_AGENT_CONFIG_H_ | ||
#define _AWS_OTA_AGENT_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 MQTT library. */ | ||
#ifndef LIBRARY_LOG_NAME | ||
#define LIBRARY_LOG_NAME "MQTT" | ||
#endif | ||
#ifndef LIBRARY_LOG_LEVEL | ||
#define LIBRARY_LOG_LEVEL LOG_INFO | ||
#endif | ||
|
||
#include "logging_stack.h" | ||
|
||
/************ End of logging configuration ****************/ | ||
|
||
/** | ||
* @brief The number of words allocated to the stack for the OTA agent. | ||
*/ | ||
#define otaconfigSTACK_SIZE 10000U | ||
|
||
/** | ||
* @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 14UL | ||
|
||
/** | ||
* @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 OTA agent task priority. Normally it runs at a low priority. | ||
*/ | ||
#define otaconfigAGENT_PRIORITY tskIDLE_PRIORITY + 5U | ||
|
||
/** | ||
* @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 64U | ||
/** | ||
* @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 1U | ||
|
||
/** | ||
* @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 1U | ||
|
||
/** | ||
* @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. This configuration parameter | ||
* can be set to following - | ||
* Enable data over MQTT - ( OTA_DATA_OVER_MQTT ) | ||
* Enable data over HTTP - ( OTA_DATA_OVER_HTTP) | ||
* Enable data over both MQTT & HTTP ( OTA_DATA_OVER_MQTT | 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 /* _AWS_OTA_AGENT_CONFIG_H_ */ |
39 changes: 39 additions & 0 deletions
39
demos/ota/ota_demo_core_mqtt/aws_ota_codesigner_certificate.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* FreeRTOS V202007.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. | ||
* | ||
* http://aws.amazon.com/freertos | ||
* http://www.FreeRTOS.org | ||
*/ | ||
|
||
#ifndef __AWS_CODESIGN_KEYS__H__ | ||
#define __AWS_CODESIGN_KEYS__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[] = "Paste code signing certificate here."; | ||
|
||
#endif |
Oops, something went wrong.