From a37694741c5e29a3373f034bedf92fca3fe0e080 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Fri, 26 Jul 2019 14:33:02 +0200 Subject: [PATCH] tiny-test-fw: support testing apps with flash encryption If CONFIG_SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT is set, pass --encrypted flag to esptool.py. --- tools/tiny-test-fw/IDF/IDFApp.py | 5 +++++ tools/tiny-test-fw/IDF/IDFDUT.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/tiny-test-fw/IDF/IDFApp.py b/tools/tiny-test-fw/IDF/IDFApp.py index 7033301ff5..82f42b0c35 100644 --- a/tools/tiny-test-fw/IDF/IDFApp.py +++ b/tools/tiny-test-fw/IDF/IDFApp.py @@ -135,6 +135,11 @@ class IDFApp(App.BaseApp): # offs, filename flash_files.append((args[idx], args[idx + 1])) + # The build metadata file does not currently have details, which files should be encrypted and which not. + # Assume that all files should be encrypted if flash encryption is enabled in development mode. + sdkconfig_dict = self.get_sdkconfig() + flash_settings["encrypt"] = "CONFIG_SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT" in sdkconfig_dict + # make file offsets into integers, make paths absolute flash_files = [(int(offs, 0), os.path.join(self.binary_path, path.strip())) for (offs, path) in flash_files] diff --git a/tools/tiny-test-fw/IDF/IDFDUT.py b/tools/tiny-test-fw/IDF/IDFDUT.py index c8ee24f236..bb217ca2c8 100644 --- a/tools/tiny-test-fw/IDF/IDFDUT.py +++ b/tools/tiny-test-fw/IDF/IDFDUT.py @@ -217,7 +217,7 @@ class IDFDUT(DUT.SerialDUT): 'no_stub': False, 'compress': True, 'verify': False, - 'encrypt': False, + 'encrypt': self.app.flash_settings.get("encrypt", False), 'erase_all': False, })