Skip to content

Commit b871850

Browse files
authored
Calculate the mbedtls memory usage into the IoT.js memory usage. (#233)
JSRemoteTest-DCO-1.0-Signed-off-by: Roland Takacs [email protected]
1 parent 6785ee1 commit b871850

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

jstest/resources/etc/iotjs-freya.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
iotjs %{iotjs-dirname}/src
88
jerry deps/jerry
99
libtuv deps/libtuv
10+
mbedtls deps/mbedtls
1011

1112
[Total] 1
1213
(jerry)
1314
(iotjs)
1415
(libtuv)
16+
(mbedtls)
1517
[other] 1 +

jstest/resources/memstat/jstest_memstat.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,9 @@ void print_mem_stat() {
122122
printf(" Malloc peak allocated: %u bytes\n", peak_allocated_bytes);
123123
}
124124

125+
126+
// Define custom allocator functions for mbedtls of TizenRT.
127+
void *(*mbedtls_calloc)(size_t n, size_t size) = jstest_calloc;
128+
void (*mbedtls_free)(void *ptr) = jstest_free;
129+
125130
#endif /* JSTEST_MEMSTAT_ENABLED */

jstest/resources/patches/tizenrt-mbedtls.diff

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
diff --git a/external/include/mbedtls/config.h b/external/include/mbedtls/config.h
2-
index 7d5cda4..0f1401f 100644
2+
index 7d5cda4..57e1501 100644
33
--- a/external/include/mbedtls/config.h
44
+++ b/external/include/mbedtls/config.h
5+
@@ -132,7 +132,7 @@
6+
*
7+
* Enable this layer to allow use of alternative memory allocators.
8+
*/
9+
-//#define MBEDTLS_PLATFORM_MEMORY
10+
+#define MBEDTLS_PLATFORM_MEMORY
11+
12+
/**
13+
* \def MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
514
@@ -678,7 +678,7 @@
615
* enabled as well):
716
* MBEDTLS_TLS_ECDH_ANON_WITH_AES_128_CBC_SHA256
@@ -11,6 +20,15 @@ index 7d5cda4..0f1401f 100644
1120

1221
/**
1322
* \def MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
23+
@@ -2178,7 +2178,7 @@
24+
*
25+
* This module enables abstraction of common (libc) functions.
26+
*/
27+
-//#define MBEDTLS_PLATFORM_C
28+
+#define MBEDTLS_PLATFORM_C
29+
30+
/**
31+
* \def MBEDTLS_RIPEMD160_C
1432
diff --git a/external/mbedtls/Makefile b/external/mbedtls/Makefile
1533
index 5e321e3..fb174a7 100644
1634
--- a/external/mbedtls/Makefile

0 commit comments

Comments
 (0)