summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArchit Aggarwal <architag@amazon.com>2020-07-13 11:01:11 -0700
committerGitHub <noreply@github.com>2020-07-13 11:01:11 -0700
commit28e0db8b3bcf9a0e5f95b1c7b31c7e814441be67 (patch)
treeda713c141d22d6018334df0654fbfe82188614d0
parent9db0f873587eadaefa190ddd0b3899062ad9d2bb (diff)
downloadfreertos-git-28e0db8b3bcf9a0e5f95b1c7b31c7e814441be67.tar.gz
Add support for new MQTT in memory estimator tool (#138)
* Add support for new MQTT in memory estimator tool * Fix issues in generating memory estimate report for MQTT Beta2 library * Update supported libraries' list in README for mqtt-beta1 and mqtt-beta libraries * Add beta1 suffix for light-mqtt library in README
-rw-r--r--tools/memory_estimator/README.md2
-rw-r--r--tools/memory_estimator/config_files/mqtt_config.h42
-rw-r--r--tools/memory_estimator/memory_estimator.py40
-rw-r--r--tools/memory_estimator/template/report_libs.json10
4 files changed, 72 insertions, 22 deletions
diff --git a/tools/memory_estimator/README.md b/tools/memory_estimator/README.md
index 333dfb25b..5849efb35 100644
--- a/tools/memory_estimator/README.md
+++ b/tools/memory_estimator/README.md
@@ -20,7 +20,7 @@ Where:
| ---------- | --------- | ------- | ---------- |
| -p | --lts-path | | Path to the directory containing FreeRTOS LTS code. |
| -o | --optimization | O0 | Compiler optimization level (O0, Os etc). |
-| -l | --lib | `mqtt` | The library to calculate the memory estimates for. Currently supported libraries are: `mqtt`, `light-mqtt`, `https`, `shadow`, `jobs`, `ota-mqtt`, `ota-http`, `kernel`|
+| -l | --lib | `mqtt-beta1` | The library to calculate the memory estimates for. Currently supported libraries are: `mqtt-beta1`, `light-mqtt-beta1`, `mqtt-beta2`, `https`, `shadow`, `jobs`, `ota-mqtt`, `ota-http`, `kernel`|
| -c | --compiler | arm-none-eabi-gcc | Compiler to use. |
| -s | --sizetool | arm-none-eabi-size | Size tool to use. |
| -d | --dontclean | | The generated artifacts, which include the generated Makefile and built object files, are deleted by default. Pass `-d` to ensure that the generated artifacts are not deleted. |
diff --git a/tools/memory_estimator/config_files/mqtt_config.h b/tools/memory_estimator/config_files/mqtt_config.h
new file mode 100644
index 000000000..d92c6fb3e
--- /dev/null
+++ b/tools/memory_estimator/config_files/mqtt_config.h
@@ -0,0 +1,42 @@
+/*
+ * FreeRTOS Kernel V10.3.0
+ * 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://www.FreeRTOS.org
+ * http://aws.amazon.com/freertos
+ *
+ * 1 tab == 4 spaces!
+ */
+#ifndef MQTT_CONFIG_H_
+#define MQTT_CONFIG_H_
+
+/**
+ * @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
+
+#endif /* ifndef MQTT_CONFIG_H_ */
diff --git a/tools/memory_estimator/memory_estimator.py b/tools/memory_estimator/memory_estimator.py
index 828820f4f..035be7992 100644
--- a/tools/memory_estimator/memory_estimator.py
+++ b/tools/memory_estimator/memory_estimator.py
@@ -20,36 +20,40 @@ __REPORT_LIBS_JSON__ = os.path.join(__THIS_FILE_PATH__, 'template', 'report_libs
__FREERTOS_SRC_DIR__ = os.path.join('FreeRTOS', 'Source')
__FREERTOS_PLUS_SRC_DIR__ = os.path.join('FreeRTOS-Plus', 'Source')
-__IOT_LIBS_DIR__ = os.path.join(__FREERTOS_PLUS_SRC_DIR__, 'FreeRTOS-IoT-Libraries-LTS-Beta1')
+__IOT_LIBS_BETA1_DIR__ = os.path.join(__FREERTOS_PLUS_SRC_DIR__, 'FreeRTOS-IoT-Libraries-LTS-Beta1')
+__IOT_LIBS_BETA2_DIR__ = os.path.join(__FREERTOS_PLUS_SRC_DIR__, 'FreeRTOS-IoT-Libraries-LTS-Beta2')
__LIB_NAME_TO_SRC_DIRS_MAPPING__ = {
- 'light-mqtt' : [
- os.path.join(__IOT_LIBS_DIR__, 'c_sdk', 'standard', 'mqtt', 'src', 'iot_mqtt_lightweight_api.c'),
- os.path.join(__IOT_LIBS_DIR__, 'c_sdk', 'standard', 'mqtt', 'src', 'iot_mqtt_helper.c')
+ 'light-mqtt-beta1' : [
+ os.path.join(__IOT_LIBS_BETA1_DIR__, 'c_sdk', 'standard', 'mqtt', 'src', 'iot_mqtt_lightweight_api.c'),
+ os.path.join(__IOT_LIBS_BETA1_DIR__, 'c_sdk', 'standard', 'mqtt', 'src', 'iot_mqtt_helper.c')
],
- 'mqtt' : [
- os.path.join(__IOT_LIBS_DIR__, 'c_sdk', 'standard', 'mqtt', 'src')
+ 'mqtt-beta1' : [
+ os.path.join(__IOT_LIBS_BETA1_DIR__, 'c_sdk', 'standard', 'mqtt', 'src')
+ ],
+ 'mqtt-beta2' : [
+ os.path.join(__IOT_LIBS_BETA2_DIR__, 'c_sdk', 'standard', 'mqtt', 'src')
],
'https' : [
- os.path.join(__IOT_LIBS_DIR__, 'c_sdk', 'standard', 'https', 'src'),
+ os.path.join(__IOT_LIBS_BETA1_DIR__, 'c_sdk', 'standard', 'https', 'src'),
os.path.join(__FREERTOS_PLUS_SRC_DIR__, 'http-parser')
],
'shadow' : [
- os.path.join(__IOT_LIBS_DIR__, 'c_sdk', 'aws', 'shadow', 'src'),
- os.path.join(__IOT_LIBS_DIR__, 'c_sdk', 'aws', 'common', 'src')
+ os.path.join(__IOT_LIBS_BETA1_DIR__, 'c_sdk', 'aws', 'shadow', 'src'),
+ os.path.join(__IOT_LIBS_BETA1_DIR__, 'c_sdk', 'aws', 'common', 'src')
],
'jobs' : [
- os.path.join(__IOT_LIBS_DIR__, 'c_sdk', 'aws', 'jobs', 'src'),
- os.path.join(__IOT_LIBS_DIR__, 'c_sdk', 'aws', 'common', 'src')
+ os.path.join(__IOT_LIBS_BETA1_DIR__, 'c_sdk', 'aws', 'jobs', 'src'),
+ os.path.join(__IOT_LIBS_BETA1_DIR__, 'c_sdk', 'aws', 'common', 'src')
],
'ota-mqtt' : [
- os.path.join(__IOT_LIBS_DIR__, 'c_sdk', 'aws', 'ota', 'src', 'aws_iot_ota_agent.c'),
- os.path.join(__IOT_LIBS_DIR__, 'c_sdk', 'aws', 'ota', 'src', 'aws_iot_ota_interface.c'),
- os.path.join(__IOT_LIBS_DIR__, 'c_sdk', 'aws', 'ota', 'src', 'mqtt', 'aws_iot_ota_mqtt.c'),
- os.path.join(__IOT_LIBS_DIR__, 'c_sdk', 'aws', 'ota', 'src', 'mqtt', 'aws_iot_ota_cbor.c')
+ os.path.join(__IOT_LIBS_BETA1_DIR__, 'c_sdk', 'aws', 'ota', 'src', 'aws_iot_ota_agent.c'),
+ os.path.join(__IOT_LIBS_BETA1_DIR__, 'c_sdk', 'aws', 'ota', 'src', 'aws_iot_ota_interface.c'),
+ os.path.join(__IOT_LIBS_BETA1_DIR__, 'c_sdk', 'aws', 'ota', 'src', 'mqtt', 'aws_iot_ota_mqtt.c'),
+ os.path.join(__IOT_LIBS_BETA1_DIR__, 'c_sdk', 'aws', 'ota', 'src', 'mqtt', 'aws_iot_ota_cbor.c')
],
'ota-http' : [
- os.path.join(__IOT_LIBS_DIR__, 'c_sdk', 'aws', 'ota', 'src')
+ os.path.join(__IOT_LIBS_BETA1_DIR__, 'c_sdk', 'aws', 'ota', 'src')
],
'kernel' : [
os.path.join(__FREERTOS_SRC_DIR__, 'event_groups.c'),
@@ -74,7 +78,7 @@ def apply_patches(freertos_lts, lib_name):
# level is moved to a config file, it will not be needed and we will turn
# off logging in the header file tools\memory_estimator\config_files\aws_ota_agent_config.h.
if 'ota' in lib_name:
- ota_agent_header_file = os.path.join(freertos_lts, __IOT_LIBS_DIR__, 'c_sdk', 'aws', 'ota', 'include', 'aws_iot_ota_agent.h')
+ ota_agent_header_file = os.path.join(freertos_lts, __IOT_LIBS_BETA1_DIR__, 'c_sdk', 'aws', 'ota', 'include', 'aws_iot_ota_agent.h')
with open(ota_agent_header_file) as ota_agent_header_file_handle:
original_content = ota_agent_header_file_handle.read()
@@ -238,7 +242,7 @@ def parse_arguments():
parser.add_argument('-p', '--lts-path', required=True, help='Path to FreeRTOS LTS directory.')
parser.add_argument('-o', '--optimization', default='O0', help='Compiler optimization (O0, Os etc.).')
- parser.add_argument('-l', '--lib', default='mqtt', help='Library name to generate the memory estimate for.')
+ parser.add_argument('-l', '--lib', default='mqtt-beta1', help='Library name to generate the memory estimate for.')
parser.add_argument('-c', '--compiler', default='arm-none-eabi-gcc', help='Compiler to use.')
parser.add_argument('-s', '--sizetool', default='arm-none-eabi-size', help='Size tool to use.')
parser.add_argument('-d', '--dontclean', action='store_true', help='Do not clean the generated artifacts.')
diff --git a/tools/memory_estimator/template/report_libs.json b/tools/memory_estimator/template/report_libs.json
index b970ab9b7..68ae7a151 100644
--- a/tools/memory_estimator/template/report_libs.json
+++ b/tools/memory_estimator/template/report_libs.json
@@ -9,12 +9,16 @@
"size_description":"Code Size of AWS IoT Jobs excluding dependencies (example generated with GCC for ARM Cortex-M)"
},
{
- "lib_name":"light-mqtt",
+ "lib_name":"light-mqtt-beta1",
"size_description":"Code Size of Lightweight MQTT API (example generated with GCC for ARM Cortex-M)"
},
{
- "lib_name":"mqtt",
- "size_description":"Code Size of MQTT (example generated with GCC for ARM Cortex-M)"
+ "lib_name":"mqtt-beta1",
+ "size_description":"Code Size of MQTT Beta1 (example generated with GCC for ARM Cortex-M)"
+ },
+ {
+ "lib_name":"mqtt-beta2",
+ "size_description":"Code Size of MQTT Beta2 (example generated with GCC for ARM Cortex-M)"
},
{
"lib_name":"ota-http",