Skip to content

Commit 355eae8

Browse files
components: Add patch for MQTT File Streams library
The aws-iot-core-mqtt-file-streams-embedded-c library uses the `strnlen` function, which is not supported by the Arm Compiler for Embedded (v6.21). Therefore, add a patch which replaces the call to `strnlen` with a call to our custom implementation `app_strnlen`. Signed-off-by: Chuyue Luo <[email protected]>
1 parent c7d30e8 commit 355eae8

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

components/aws_iot/aws_iot_core_mqtt_file_streams_embedded_c/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,13 @@ else()
1111
"Path to MQTT File Streams source code"
1212
)
1313

14+
include(ApplyPatches)
15+
16+
set(PATCH_FILES_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/integration/patches")
17+
set(PATCH_FILES
18+
"${PATCH_FILES_DIRECTORY}/0001-Use-custom-strnlen-implementation.patch"
19+
)
20+
iot_reference_arm_corstone3xx_apply_patches("${aws-iot-core-mqtt-file-streams-embedded-c_SOURCE_DIR}" "${PATCH_FILES}")
21+
1422
add_subdirectory(integration)
1523
endif()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
From e760c27b177175214a7e71c93e7d9940e7044c23 Mon Sep 17 00:00:00 2001
2+
From: Chuyue Luo <[email protected]>
3+
Date: Wed, 4 Dec 2024 15:08:01 +0000
4+
Subject: [PATCH] Use custom `strnlen` implementation
5+
6+
The Arm Compiler for Embedded (v6.21) does not support the `strnlen`
7+
function. Therefore, use our own implementation (`app_strnlen`) instead.
8+
9+
Signed-off-by: Chuyue Luo <[email protected]>
10+
---
11+
source/MQTTFileDownloader.c | 7 ++++++-
12+
1 file changed, 6 insertions(+), 1 deletion(-)
13+
14+
diff --git a/source/MQTTFileDownloader.c b/source/MQTTFileDownloader.c
15+
index 93a4894..48edce3 100644
16+
--- a/source/MQTTFileDownloader.c
17+
+++ b/source/MQTTFileDownloader.c
18+
@@ -1,6 +1,9 @@
19+
/*
20+
* AWS IoT Core MQTT File Streams Embedded C v1.1.0
21+
* Copyright (C) 2023 Amazon.com, Inc. and its affiliates. All Rights Reserved.
22+
+ * Copyright 2024 Arm Limited and/or its affiliates
23+
24+
+ *
25+
* SPDX-License-Identifier: MIT
26+
*
27+
* Licensed under the MIT License. See the LICENSE accompanying this file
28+
@@ -27,6 +30,8 @@
29+
#include "MQTTFileDownloader_cbor.h"
30+
#include "core_json.h"
31+
32+
+#include "app_strnlen.h"
33+
+
34+
/**
35+
* @brief Macro to check whether a character is an ASCII digit or not.
36+
*/
37+
@@ -320,7 +325,7 @@ size_t mqttDownloader_createGetDataBlockRequest( DataType_t dataType,
38+
blockOffset,
39+
numberOfBlocksRequested );
40+
41+
- requestLength = strnlen( getStreamRequest,
42+
+ requestLength = app_strnlen( getStreamRequest,
43+
GET_STREAM_REQUEST_BUFFER_SIZE );
44+
}
45+
else
46+
--
47+
2.47.0
48+

0 commit comments

Comments
 (0)