8000
File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,9 @@ CONFIG_LWIP_PPP_CHAP_SUPPORT=y
46
46
# SSL
47
47
# Use 4kiB output buffer instead of default 16kiB (because IDF heap is fragmented in 4.0)
48
48
CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y
49
+ # Use uPy heap allocator as custom allocator
50
+ CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=n
51
+ CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC=y
49
52
50
53
# ULP coprocessor support
51
54
CONFIG_ESP32_ULP_COPROC_ENABLED=y
Original file line number Diff line number Diff line change 67
67
#include "extmod/modbluetooth.h"
68
68
#endif
69
69
70
+ #if MICROPY_PY_USSL && MICROPY_SSL_MBEDTLS && MICROPY_TRACKED_ALLOC && CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC
71
+ #include "py/misc.h"
72
+ #include "mbedtls/platform.h"
73
+ #endif
74
+
70
75
// MicroPython runs as a task under FreeRTOS
71
76
#define MP_TASK_PRIORITY (ESP_TASK_PRIO_MIN + 1)
72
77
#define MP_TASK_STACK_SIZE (16 * 1024)
@@ -143,6 +148,11 @@ void mp_task(void *pvParameter) {
143
148
mp_task_heap = malloc (mp_task_heap_size );
144
149
}
145
150
151
+ #if MICROPY_PY_USSL && MICROPY_SSL_MBEDTLS && MICROPY_TRACKED_ALLOC && CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC
152
+ // Configure mbedtls to allocate from the heap
153
+ mbedtls_platform_set_calloc_free (& m_tracked_calloc , & m_tracked_free );
154
+ #endif
155
+
146
156
soft_reset :
147
157
// initialise the stack pointer for the main thread
148
158
mp_stack_set_top ((void * )sp );
You can’t perform that action at this time.
0 commit comments