feat: add ESP32-S31 Function CoreBoard support (#2151)
* feat: add ESP32-S31 Function CoreBoard support * ci: build ESP32-S31 with IDF 6.1 --------- Co-authored-by: Xiaoxia <terrence.huang@tenclass.com>
This commit is contained in:
+10
-5
@@ -40,8 +40,9 @@ def get_project_version() -> Optional[str]:
|
||||
return None
|
||||
|
||||
|
||||
def merge_bin() -> None:
|
||||
if os.system("idf.py merge-bin") != 0:
|
||||
def merge_bin(preview: bool = False) -> None:
|
||||
idf_command = "idf.py --preview" if preview else "idf.py"
|
||||
if os.system(f"{idf_command} merge-bin") != 0:
|
||||
print("merge-bin failed", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
@@ -447,6 +448,10 @@ def release(
|
||||
with cfg_path.open(encoding='utf-8') as f:
|
||||
cfg = json.load(f)
|
||||
target = cfg["target"]
|
||||
preview = cfg.get("preview", False)
|
||||
if not isinstance(preview, bool):
|
||||
raise ValueError(f"{cfg_path}: preview must be a boolean")
|
||||
idf_command = "idf.py --preview" if preview else "idf.py"
|
||||
manufacturer = _get_manufacturer(cfg)
|
||||
|
||||
builds = _get_builds_for_idf(cfg, idf_version)
|
||||
@@ -495,7 +500,7 @@ def release(
|
||||
os.environ.pop("IDF_TARGET", None)
|
||||
|
||||
# Call set-target
|
||||
if os.system(f"idf.py set-target {target}") != 0:
|
||||
if os.system(f"{idf_command} set-target {target}") != 0:
|
||||
print("set-target failed", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
@@ -506,12 +511,12 @@ def release(
|
||||
for append in sdkconfig_append:
|
||||
f.write(f"{append}\n")
|
||||
# Build with macro BOARD_NAME defined to name
|
||||
if os.system(f"idf.py -DBOARD_NAME={name} -DBOARD_TYPE={board_type} build") != 0:
|
||||
if os.system(f"{idf_command} -DBOARD_NAME={name} -DBOARD_TYPE={board_type} build") != 0:
|
||||
print("build failed")
|
||||
sys.exit(1)
|
||||
|
||||
# merge-bin
|
||||
merge_bin()
|
||||
merge_bin(preview)
|
||||
|
||||
# Zip
|
||||
zip_bin(final_name, project_version)
|
||||
|
||||
@@ -24,13 +24,18 @@ class VersionTests(unittest.TestCase):
|
||||
def test_current_matrix_uniqueness_and_p4_variants(self):
|
||||
idf5 = release._collect_variants(idf_version=(5, 5, 4))
|
||||
idf6 = release._collect_variants(idf_version=(6, 0, 1))
|
||||
for variants in (idf5, idf6):
|
||||
idf61 = release._collect_variants(idf_version=(6, 1, 0))
|
||||
for variants in (idf5, idf6, idf61):
|
||||
names = [variant["full_name"] for variant in variants]
|
||||
self.assertEqual(len(names), len(set(names)))
|
||||
|
||||
idf6_names = {variant["full_name"] for variant in idf6}
|
||||
self.assertIn("esp-p4-function-ev-board", idf6_names)
|
||||
self.assertIn("esp-p4-function-ev-board-p4x", idf6_names)
|
||||
self.assertNotIn("esp-s31-function-coreboard-1", idf6_names)
|
||||
|
||||
idf61_names = {variant["full_name"] for variant in idf61}
|
||||
self.assertIn("esp-s31-function-coreboard-1", idf61_names)
|
||||
|
||||
|
||||
class BoardSelectionTests(unittest.TestCase):
|
||||
@@ -90,5 +95,13 @@ class InvalidConfigTests(unittest.TestCase):
|
||||
release._collect_variants(idf_version=(6, 0, 1))
|
||||
|
||||
|
||||
class PreviewTargetTests(unittest.TestCase):
|
||||
def test_merge_bin_enables_preview_mode(self):
|
||||
with mock.patch.object(release.os, "system", return_value=0) as system:
|
||||
release.merge_bin(preview=True)
|
||||
|
||||
system.assert_called_once_with("idf.py --preview merge-bin")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user