Merge branch 'feature/idf_py_print_flash_cmd' into 'master'
tiny-test-fw: Detect either 'download.config' or 'flash_project_args' See merge request idf/esp-idf!3252
This commit is contained in:
commit
a8754ccc6a
1 changed files with 22 additions and 8 deletions
|
@ -26,18 +26,23 @@ class IDFApp(App.BaseApp):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
IDF_DOWNLOAD_CONFIG_FILE = "download.config"
|
IDF_DOWNLOAD_CONFIG_FILE = "download.config"
|
||||||
|
IDF_FLASH_ARGS_FILE = "flash_project_args"
|
||||||
|
|
||||||
def __init__(self, app_path):
|
def __init__(self, app_path):
|
||||||
super(IDFApp, self).__init__(app_path)
|
super(IDFApp, self).__init__(app_path)
|
||||||
self.idf_path = self.get_sdk_path()
|
self.idf_path = self.get_sdk_path()
|
||||||
self.binary_path = self.get_binary_path(app_path)
|
self.binary_path = self.get_binary_path(app_path)
|
||||||
assert os.path.exists(self.binary_path)
|
assert os.path.exists(self.binary_path)
|
||||||
try:
|
if self.IDF_DOWNLOAD_CONFIG_FILE not in os.listdir(self.binary_path):
|
||||||
assert self.IDF_DOWNLOAD_CONFIG_FILE in os.listdir(self.binary_path)
|
if self.IDF_FLASH_ARGS_FILE not in os.listdir(self.binary_path):
|
||||||
except AssertionError as e:
|
msg = ("Neither {} nor {} exists. "
|
||||||
e.args += ("{} doesn't exist. Try to run 'make print_flash_cmd | tail -n 1 > {}/{}' for resolving the issue"
|
"Try to run 'make print_flash_cmd | tail -n 1 > {}/{}' "
|
||||||
"".format(self.IDF_DOWNLOAD_CONFIG_FILE, self.binary_path, self.IDF_DOWNLOAD_CONFIG_FILE),)
|
"or 'idf.py build' "
|
||||||
raise
|
"for resolving the issue."
|
||||||
|
"").format(self.IDF_DOWNLOAD_CONFIG_FILE, self.IDF_FLASH_ARGS_FILE,
|
||||||
|
self.binary_path, self.IDF_DOWNLOAD_CONFIG_FILE)
|
||||||
|
raise AssertionError(msg)
|
||||||
|
|
||||||
self.esptool, self.partition_tool = self.get_tools()
|
self.esptool, self.partition_tool = self.get_tools()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -85,8 +90,17 @@ class IDFApp(App.BaseApp):
|
||||||
|
|
||||||
:return: download config, partition info
|
:return: download config, partition info
|
||||||
"""
|
"""
|
||||||
with open(os.path.join(self.binary_path, self.IDF_DOWNLOAD_CONFIG_FILE), "r") as f:
|
|
||||||
configs = f.read().split(" ")
|
if self.IDF_FLASH_ARGS_FILE in os.listdir(self.binary_path):
|
||||||
|
with open(os.path.join(self.binary_path, self.IDF_FLASH_ARGS_FILE), "r") as f:
|
||||||
|
configs = []
|
||||||
|
for line in f:
|
||||||
|
line = line.strip()
|
||||||
|
if len(line) > 0:
|
||||||
|
configs += line.split()
|
||||||
|
else:
|
||||||
|
with open(os.path.join(self.binary_path, self.IDF_DOWNLOAD_CONFIG_FILE), "r") as f:
|
||||||
|
configs = f.read().split(" ")
|
||||||
|
|
||||||
download_configs = ["--chip", "auto", "--before", "default_reset",
|
download_configs = ["--chip", "auto", "--before", "default_reset",
|
||||||
"--after", "hard_reset", "write_flash", "-z"]
|
"--after", "hard_reset", "write_flash", "-z"]
|
||||||
|
|
Loading…
Reference in a new issue