6060#include " common/timer.hpp"
6161#include " common/type_traits.hpp"
6262#include " common/uptime.hpp"
63+ #include " crypto/mbedtls.hpp"
6364#include " diags/factory_diags.hpp"
6465#include " instance/extension.hpp"
6566#include " mac/link_raw.hpp"
6667#include " radio/radio.hpp"
68+ #include " utils/heap.hpp"
6769#include " utils/otns.hpp"
6870#include " utils/power_calibration.hpp"
6971#include " utils/static_counter.hpp"
7880#include " common/code_utils.hpp"
7981#include " common/notifier.hpp"
8082#include " common/settings.hpp"
81- #include " crypto/mbedtls.hpp"
8283#include " crypto/storage.hpp"
8384#include " mac/mac.hpp"
8485#include " mac/wakeup_tx_scheduler.hpp"
136137#include " thread/tmf.hpp"
137138#include " utils/channel_manager.hpp"
138139#include " utils/channel_monitor.hpp"
139- #include " utils/heap.hpp"
140140#include " utils/history_tracker.hpp"
141141#include " utils/jam_detector.hpp"
142142#include " utils/link_metrics_manager.hpp"
@@ -329,6 +329,15 @@ class Instance : public otInstance, private NonCopyable
329329 */
330330 void Finalize (void );
331331
332+ #if OPENTHREAD_CONFIG_HEAP_INTERNAL_ENABLE
333+ /* *
334+ * Returns a reference to the Heap object.
335+ *
336+ * @returns A reference to the Heap object.
337+ */
338+ static Utils::Heap &GetHeap (void );
339+ #endif
340+
332341#if OPENTHREAD_MTD || OPENTHREAD_FTD
333342 /* *
334343 * Deletes all the settings stored in non-volatile memory, and then triggers a platform reset.
@@ -345,15 +354,6 @@ class Instance : public otInstance, private NonCopyable
345354 */
346355 Error ErasePersistentInfo (void );
347356
348- #if !OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE
349- /* *
350- * Returns a reference to the Heap object.
351- *
352- * @returns A reference to the Heap object.
353- */
354- static Utils::Heap &GetHeap (void );
355- #endif
356-
357357#if OPENTHREAD_CONFIG_COAP_API_ENABLE
358358 /* *
359359 * Returns a reference to application COAP object.
@@ -449,7 +449,7 @@ class Instance : public otInstance, private NonCopyable
449449 static LogLevel sLogLevel ;
450450#endif
451451
452- #if (OPENTHREAD_MTD || OPENTHREAD_FTD) && !OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE
452+ #if OPENTHREAD_CONFIG_HEAP_INTERNAL_ENABLE
453453 static Utils::Heap *sHeap ;
454454#endif
455455
@@ -471,7 +471,7 @@ class Instance : public otInstance, private NonCopyable
471471 TimerMicro::Scheduler mTimerMicroScheduler ;
472472#endif
473473
474- #if OPENTHREAD_MTD || OPENTHREAD_FTD
474+ #if OPENTHREAD_MTD || OPENTHREAD_FTD || (OPENTHREAD_CONFIG_CRYPTO_LIB == OPENTHREAD_CONFIG_CRYPTO_LIB_PSA)
475475 // Random::Manager is initialized before other objects. Note that it
476476 // requires MbedTls which itself may use Heap.
477477 Crypto::MbedTls mMbedTls ;
0 commit comments