[flash] avoid build when not needed (#5235)

This commit is contained in:
Yakun Xu
2020-07-14 10:04:12 -07:00
committed by GitHub
parent dc1d47d2c0
commit b88f4fccba
2 changed files with 6 additions and 0 deletions
+4
View File
@@ -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
+2
View File
@@ -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