diff --git a/src/core/utils/flash.cpp b/src/core/utils/flash.cpp index 4487427fe..aa533710d 100644 --- a/src/core/utils/flash.cpp +++ b/src/core/utils/flash.cpp @@ -35,6 +35,8 @@ #include "common/code_utils.hpp" #include "common/instance.hpp" +#if OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE + namespace ot { const uint32_t ot::Flash::sSwapActive; @@ -306,3 +308,5 @@ void Flash::Wipe(void) } } // namespace ot + +#endif // OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE diff --git a/tests/unit/test_flash.cpp b/tests/unit/test_flash.cpp index 92f8ccb43..4710a30c8 100644 --- a/tests/unit/test_flash.cpp +++ b/tests/unit/test_flash.cpp @@ -41,6 +41,7 @@ namespace ot { void TestFlash(void) { +#if OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE uint8_t readBuffer[256]; uint8_t writeBuffer[256]; @@ -182,6 +183,7 @@ void TestFlash(void) VerifyOrQuit(length == key, "Get() did not return expected length"); VerifyOrQuit(memcmp(readBuffer, writeBuffer, length) == 0, "Get() did not return expected value"); } +#endif // OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE } } // namespace ot