Skip to content

Updates for clean build with latest ESP-IDF v5.4 #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jun 30, 2025
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/memory_statistics_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"include": [
"source/include",
"coreJSON/source/include",
"tinycbor/src"
"tinycbor/src",
"tinycbor/build"
],
"compiler_flags": [
"MQTT_STREAMS_DO_NOT_USE_CUSTOM_CONFIG"
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ jobs:
- name: Run Coverage
run: |
make -C build/ coverage
declare -a EXCLUDE=("\*test\*" "\*CMakeCCompilerId\*" "\*mocks\*" "\*vendor/unity\*" "\*_deps\*")
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 --list 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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than mainline, can we use a release version?

Copy link
Member Author

@DakshitBabbar DakshitBabbar Jun 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that makes more sense. Thanks. Done.

cd tinycbor
cmake -B ./build -S .
cd ../
- name: Install Python3
uses: actions/setup-python@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions docs/doxygen/include/size_table.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</tr>
<tr>
<td>MQTTFileDownloader_cbor.c</td>
<td><center>0.8K</center></td>
<td><center>0.7K</center></td>
<td><center>0.6K</center></td>
</tr>
<tr>
Expand All @@ -34,7 +34,7 @@
</tr>
<tr>
<td>cborencoder.c</td>
<td><center>2.0K</center></td>
<td><center>2.1K</center></td>
<td><center>0.7K</center></td>
</tr>
<tr>
Expand Down
13 changes: 10 additions & 3 deletions source/MQTTFileDownloader_cbor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) ||
Expand Down Expand Up @@ -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. */
Expand All @@ -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. */
Expand All @@ -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. */
Expand Down
49 changes: 31 additions & 18 deletions tools/cmock/coverage.cmake
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tools/coverity/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down