From 0889aae80c5e020bfcc04f6667d0488a54795f55 Mon Sep 17 00:00:00 2001 From: DakshitBabbar Date: Mon, 17 Mar 2025 10:59:31 +0530 Subject: [PATCH 01/11] Update code to remove the incompatible-pointer-types warning for the latest ESP-IDF v5.4 --- source/MQTTFileDownloader_cbor.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/source/MQTTFileDownloader_cbor.c b/source/MQTTFileDownloader_cbor.c index 758a6a7..f4cadac 100644 --- a/source/MQTTFileDownloader_cbor.c +++ b/source/MQTTFileDownloader_cbor.c @@ -71,6 +71,7 @@ bool CBOR_Decode_GetStreamResponseMessage( const uint8_t * messageBuffer, CborParser parser; CborValue value, cborMap; size_t payloadSizeReceived = 0; + int variableBuffer = 0; if( ( fileId == NULL ) || ( blockId == NULL ) || ( blockSize == NULL ) || ( payload == NULL ) || ( payloadSize == NULL ) || @@ -114,7 +115,9 @@ bool CBOR_Decode_GetStreamResponseMessage( const uint8_t * messageBuffer, if( CborNoError == cborResult ) { - cborResult = cbor_value_get_int( &value, ( int32_t * ) fileId ); + variableBuffer = ( int ) *fileId; + cborResult = cbor_value_get_int( &value, &variableBuffer ); + *fileId = ( int32_t ) variableBuffer; } /* Find the block ID. */ @@ -132,7 +135,9 @@ bool CBOR_Decode_GetStreamResponseMessage( const uint8_t * messageBuffer, if( CborNoError == cborResult ) { - cborResult = cbor_value_get_int( &value, ( int32_t * ) blockId ); + variableBuffer = ( int ) *blockId; + cborResult = cbor_value_get_int( &value, &variableBuffer ); + *blockId = ( int32_t ) variableBuffer; } /* Find the block size. */ @@ -150,7 +155,9 @@ bool CBOR_Decode_GetStreamResponseMessage( const uint8_t * messageBuffer, if( CborNoError == cborResult ) { - cborResult = cbor_value_get_int( &value, ( int32_t * ) blockSize ); + variableBuffer = ( int ) *blockSize; + cborResult = cbor_value_get_int( &value, &variableBuffer ); + *blockSize = ( int32_t ) variableBuffer; } /* Find the payload bytes. */ From 4781fc07bd31428772c5a7b38a8dc4730ffd1920 Mon Sep 17 00:00:00 2001 From: DakshitBabbar Date: Mon, 24 Mar 2025 11:49:54 +0530 Subject: [PATCH 02/11] [Debug] Update the locv command with branch_info flag --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 70b41cf..b8d4c05 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,8 +29,8 @@ jobs: run: | make -C build/ coverage declare -a EXCLUDE=("\*test\*" "\*CMakeCCompilerId\*" "\*mocks\*" "\*vendor/unity\*" "\*_deps\*") - echo ${EXCLUDE[@]} | xargs lcov --rc lcov_branch_coverage=1 -r build/coverage.info -o build/coverage.info - lcov --rc lcov_branch_coverage=1 --list build/coverage.info + echo ${EXCLUDE[@]} | xargs lcov --rc branch_coverage=1 -r build/coverage.info -o build/coverage.info + lcov --rc branch_coverage=1 --list build/coverage.info - name: Check Coverage uses: FreeRTOS/CI-CD-Github-Actions/coverage-cop@main with: From 6a667e7be4f7288d9f5684dde42eb464073747a6 Mon Sep 17 00:00:00 2001 From: DakshitBabbar Date: Mon, 24 Mar 2025 14:13:02 +0530 Subject: [PATCH 03/11] Update the CI checks workflow and cmake to fix lcov errors --- .github/workflows/ci.yml | 8 +++---- tools/cmock/coverage.cmake | 49 ++++++++++++++++++++++++-------------- 2 files changed, 35 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b8d4c05..392b59d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,9 +28,9 @@ jobs: - name: Run Coverage run: | make -C build/ coverage - declare -a EXCLUDE=("\*test\*" "\*CMakeCCompilerId\*" "\*mocks\*" "\*vendor/unity\*" "\*_deps\*") - echo ${EXCLUDE[@]} | xargs lcov --rc branch_coverage=1 -r build/coverage.info -o build/coverage.info - lcov --rc branch_coverage=1 --list build/coverage.info + declare -a EXCLUDE=("\*_deps\*") + echo ${EXCLUDE[@]} | xargs lcov --rc lcov_branch_coverage=1 -r build/coverage.info -o build/coverage.info + lcov --rc lcov_branch_coverage=1 --summary build/coverage.info - name: Check Coverage uses: FreeRTOS/CI-CD-Github-Actions/coverage-cop@main with: @@ -93,7 +93,7 @@ jobs: - name: Clone coreJSON run: git clone https://github.com/FreeRTOS/coreJSON.git --depth 1 --branch v3.2.0 - name: Clone tinycbor - run: git clone https://github.com/intel/tinycbor.git --depth 1 --branch main + run: git clone https://github.com/intel/tinycbor.git --depth 1 --branch main - name: Install Python3 uses: actions/setup-python@v3 with: diff --git a/tools/cmock/coverage.cmake b/tools/cmock/coverage.cmake index 3c03733..40dcee5 100644 --- a/tools/cmock/coverage.cmake +++ b/tools/cmock/coverage.cmake @@ -1,22 +1,29 @@ # Taken from amazon-freertos repository cmake_minimum_required(VERSION 3.13) set(BINARY_DIR ${CMAKE_BINARY_DIR}) + # reset coverage counters execute_process( - COMMAND lcov --directory ${CMAKE_BINARY_DIR} --base-directory - ${CMAKE_BINARY_DIR} --zerocounters + COMMAND lcov --directory ${CMAKE_BINARY_DIR} + --base-directory ${CMAKE_BINARY_DIR} + --zerocounters COMMAND mkdir -p ${CMAKE_BINARY_DIR}/coverage) -# make the initial/baseline capture a zeroed out files + + # make the initial/baseline capture a zeroed out files execute_process( - COMMAND - lcov --directory ${CMAKE_BINARY_DIR} --base-directory ${CMAKE_BINARY_DIR} - --initial --capture --rc lcov_branch_coverage=1 --rc - genhtml_branch_coverage=1 - --output-file=${CMAKE_BINARY_DIR}/base_coverage.info) -file(GLOB files "${CMAKE_BINARY_DIR}/bin/tests/*") + COMMAND lcov --directory ${CMAKE_BINARY_DIR} + --base-directory ${CMAKE_BINARY_DIR} + --initial + --capture + --rc lcov_branch_coverage=1 + --rc genhtml_branch_coverage=1 + --output-file=${CMAKE_BINARY_DIR}/base_coverage.info + --include "*source*") +file(GLOB files "${CMAKE_BINARY_DIR}/bin/tests/*") set(REPORT_FILE ${CMAKE_BINARY_DIR}/utest_report.txt) file(WRITE ${REPORT_FILE} "") + # execute all files in bin directory, gathering the output to show it in CI foreach(testname ${files}) get_filename_component(test ${testname} NAME_WLE) @@ -34,18 +41,24 @@ execute_process(COMMAND ruby ${CMOCK_DIR}/vendor/unity/auto/parse_output.rb -xml # capture data after running the tests execute_process( - COMMAND - lcov --capture --rc lcov_branch_coverage=1 --rc genhtml_branch_coverage=1 - --base-directory ${CMAKE_BINARY_DIR} --directory ${CMAKE_BINARY_DIR} - --output-file ${CMAKE_BINARY_DIR}/second_coverage.info) + COMMAND lcov --capture + --rc lcov_branch_coverage=1 + --rc genhtml_branch_coverage=1 + --base-directory ${CMAKE_BINARY_DIR} + --directory ${CMAKE_BINARY_DIR} + --output-file ${CMAKE_BINARY_DIR}/second_coverage.info + --include "*source*") # combile baseline results (zeros) with the one after running the tests execute_process( - COMMAND - lcov --base-directory ${CMAKE_BINARY_DIR} --directory ${CMAKE_BINARY_DIR} - --add-tracefile ${CMAKE_BINARY_DIR}/base_coverage.info --add-tracefile - ${CMAKE_BINARY_DIR}/second_coverage.info --output-file - ${CMAKE_BINARY_DIR}/coverage.info --no-external --rc lcov_branch_coverage=1) + COMMAND lcov --base-directory ${CMAKE_BINARY_DIR} + --directory ${CMAKE_BINARY_DIR} + --add-tracefile ${CMAKE_BINARY_DIR}/base_coverage.info + --add-tracefile ${CMAKE_BINARY_DIR}/second_coverage.info + --output-file ${CMAKE_BINARY_DIR}/coverage.info + --no-external + --rc lcov_branch_coverage=1) + execute_process( COMMAND genhtml --rc lcov_branch_coverage=1 --branch-coverage --output-directory From f300bc5f33cf2676b9ed4c4a9fba6d7f92fbd2da Mon Sep 17 00:00:00 2001 From: DakshitBabbar Date: Mon, 24 Mar 2025 14:40:31 +0530 Subject: [PATCH 04/11] Fix broken coverity link in readme file. --- tools/coverity/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/coverity/README.md b/tools/coverity/README.md index 29d4452..5e08c09 100644 --- a/tools/coverity/README.md +++ b/tools/coverity/README.md @@ -9,7 +9,7 @@ For generating the report as outlined below, we have used Coverity version 2023. ## Getting Started ### Prerequisites -You can run this on a platform supported by Coverity. The list and other details can be found [here](https://sig-docs.synopsys.com/polaris/topics/c_coverity-compatible-platforms.html). +You can run this on a platform supported by Coverity. The list and other details can be found [here](https://documentation.blackduck.com/bundle/coverity-docs-2024.9/page/deploy-install-guide/topics/supported_platforms_for_coverity_analysis.html). To compile and run the Coverity target successfully, you must have the following: 1. CMake version >= 3.16.0 (You can check whether you have this by typing `cmake --version`) From badb02aa8dcb54bbbbd0b2f3b68ab1ff6131594c Mon Sep 17 00:00:00 2001 From: DakshitBabbar Date: Wed, 25 Jun 2025 12:30:15 +0530 Subject: [PATCH 05/11] Update the location of tinycbor-export.h file --- .github/memory_statistics_config.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/memory_statistics_config.json b/.github/memory_statistics_config.json index c16e07d..16e3248 100644 --- a/.github/memory_statistics_config.json +++ b/.github/memory_statistics_config.json @@ -12,7 +12,8 @@ "include": [ "source/include", "coreJSON/source/include", - "tinycbor/src" + "tinycbor/src", + "build" ], "compiler_flags": [ "MQTT_STREAMS_DO_NOT_USE_CUSTOM_CONFIG" From d8b9862a4897a90d3c7de36a1f8334be73daecce Mon Sep 17 00:00:00 2001 From: DakshitBabbar Date: Wed, 25 Jun 2025 12:57:17 +0530 Subject: [PATCH 06/11] Update the memory statistics CI to create tinycbor-export.h file --- .github/workflows/ci.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 392b59d..e6c7168 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,7 +63,7 @@ jobs: with: path: ./ formatting: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Check formatting @@ -93,7 +93,11 @@ jobs: - name: Clone coreJSON run: git clone https://github.com/FreeRTOS/coreJSON.git --depth 1 --branch v3.2.0 - name: Clone tinycbor - run: git clone https://github.com/intel/tinycbor.git --depth 1 --branch main + run: | + git clone https://github.com/intel/tinycbor.git --depth 1 --branch main + cd tinycbor + cmake -B ./build -S . + cd ../ - name: Install Python3 uses: actions/setup-python@v3 with: From e09e47f62c4fe79df1740cf18f9925b60a6df2ff Mon Sep 17 00:00:00 2001 From: DakshitBabbar Date: Wed, 25 Jun 2025 13:00:25 +0530 Subject: [PATCH 07/11] Update memory_statistic_config.json for include paths --- .github/memory_statistics_config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/memory_statistics_config.json b/.github/memory_statistics_config.json index 16e3248..d944661 100644 --- a/.github/memory_statistics_config.json +++ b/.github/memory_statistics_config.json @@ -13,7 +13,7 @@ "source/include", "coreJSON/source/include", "tinycbor/src", - "build" + "tinycbor/build" ], "compiler_flags": [ "MQTT_STREAMS_DO_NOT_USE_CUSTOM_CONFIG" From 8bb0fdf81efac8544aa68207ce8598e0bc91f72a Mon Sep 17 00:00:00 2001 From: DakshitBabbar Date: Wed, 25 Jun 2025 14:16:50 +0530 Subject: [PATCH 08/11] Update file size metrics --- docs/doxygen/include/size_table.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/doxygen/include/size_table.md b/docs/doxygen/include/size_table.md index 412adbf..73e8f18 100644 --- a/docs/doxygen/include/size_table.md +++ b/docs/doxygen/include/size_table.md @@ -14,7 +14,7 @@ MQTTFileDownloader_cbor.c -
0.8K
+
0.7K
0.6K
@@ -34,7 +34,7 @@ cborencoder.c -
2.0K
+
2.1K
0.7K
From 313b710c3b36721e0a3c485e9aa06492b49c5647 Mon Sep 17 00:00:00 2001 From: DakshitBabbar Date: Wed, 25 Jun 2025 15:21:40 +0530 Subject: [PATCH 09/11] Update tiunycbor version used in CI --- .github/workflows/ci.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e6c7168..cb6503c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -94,10 +94,9 @@ jobs: run: git clone https://github.com/FreeRTOS/coreJSON.git --depth 1 --branch v3.2.0 - name: Clone tinycbor run: | - git clone https://github.com/intel/tinycbor.git --depth 1 --branch main + git clone https://github.com/intel/tinycbor.git cd tinycbor - cmake -B ./build -S . - cd ../ + git checkout 9924cfed3b95ad6de299ae675064430fdb886216 - name: Install Python3 uses: actions/setup-python@v3 with: From f02d4351e5bf8f51b050e050e820d2cc42ebd071 Mon Sep 17 00:00:00 2001 From: DakshitBabbar Date: Wed, 25 Jun 2025 15:26:22 +0530 Subject: [PATCH 10/11] Update file size stats --- docs/doxygen/include/size_table.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/doxygen/include/size_table.md b/docs/doxygen/include/size_table.md index 73e8f18..f8eaf88 100644 --- a/docs/doxygen/include/size_table.md +++ b/docs/doxygen/include/size_table.md @@ -29,12 +29,12 @@ cborparser.c -
2.8K
-
2.2K
+
1.9K
+
1.7K
cborencoder.c -
2.1K
+
1.7K
0.7K
@@ -44,7 +44,7 @@ Total estimates -
10.3K
-
7.6K
+
9.0K
+
7.1K
From 935c7343b417bf3690a593188dd4c04b314224cf Mon Sep 17 00:00:00 2001 From: DakshitBabbar Date: Wed, 25 Jun 2025 15:30:30 +0530 Subject: [PATCH 11/11] Update the include paths in memory_statistic_config.json --- .github/memory_statistics_config.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/memory_statistics_config.json b/.github/memory_statistics_config.json index d944661..c16e07d 100644 --- a/.github/memory_statistics_config.json +++ b/.github/memory_statistics_config.json @@ -12,8 +12,7 @@ "include": [ "source/include", "coreJSON/source/include", - "tinycbor/src", - "tinycbor/build" + "tinycbor/src" ], "compiler_flags": [ "MQTT_STREAMS_DO_NOT_USE_CUSTOM_CONFIG"