summaryrefslogtreecommitdiff
path: root/tools/build_utils.py
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2024-08-13 23:57:01 +0700
committerGitHub <[email protected]>2024-08-13 23:57:01 +0700
commitb8d3c0c4a8e005bcfcc4ed04556e6da54f235ccc (patch)
tree5b72c2a68a74f56c53e88c542f5596e589db1fc0 /tools/build_utils.py
parent9d8052b5da2ee7114fc691f44fcbea4fb1c44016 (diff)
Circi dynamic config (#2763)
Circleci * build cmake armgcc and arm clang on circleci * use docker medium+
Diffstat (limited to 'tools/build_utils.py')
-rw-r--r--tools/build_utils.py32
1 files changed, 15 insertions, 17 deletions
diff --git a/tools/build_utils.py b/tools/build_utils.py
index b66b64b97..32aca95dd 100644
--- a/tools/build_utils.py
+++ b/tools/build_utils.py
@@ -81,6 +81,19 @@ def skip_example(example, board):
return False
+def build_size(make_cmd):
+ size_output = subprocess.run(make_cmd + ' size', shell=True, stdout=subprocess.PIPE).stdout.decode("utf-8").splitlines()
+ for i, l in enumerate(size_output):
+ text_title = 'text data bss dec'
+ if text_title in l:
+ size_list = size_output[i+1].split('\t')
+ flash_size = int(size_list[0])
+ sram_size = int(size_list[1]) + int(size_list[2])
+ return (flash_size, sram_size)
+
+ return (0, 0)
+
+
def build_example(example, board, make_option):
start_time = time.monotonic()
flash_size = "-"
@@ -89,7 +102,7 @@ def build_example(example, board, make_option):
# succeeded, failed, skipped
ret = [0, 0, 0]
- make_cmd = "make -j -C examples/{} BOARD={} {}".format(example, board, make_option)
+ make_cmd = f"make -j -C examples/{example} BOARD={board} {make_option}"
# Check if board is skipped
if skip_example(example, board):
@@ -97,14 +110,12 @@ def build_example(example, board, make_option):
ret[2] = 1
print(build_format.format(example, board, status, '-', flash_size, sram_size))
else:
- #subprocess.run(make_cmd + " clean", shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
- build_result = subprocess.run(make_cmd + " all", shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ build_result = subprocess.run(f"{make_cmd} all", shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
if build_result.returncode == 0:
status = SUCCEEDED
ret[0] = 1
(flash_size, sram_size) = build_size(make_cmd)
- #subprocess.run(make_cmd + " copy-artifact", shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
else:
status = FAILED
ret[1] = 1
@@ -116,16 +127,3 @@ def build_example(example, board, make_option):
print(build_result.stdout.decode("utf-8"))
return ret
-
-
-def build_size(make_cmd):
- size_output = subprocess.run(make_cmd + ' size', shell=True, stdout=subprocess.PIPE).stdout.decode("utf-8").splitlines()
- for i, l in enumerate(size_output):
- text_title = 'text data bss dec'
- if text_title in l:
- size_list = size_output[i+1].split('\t')
- flash_size = int(size_list[0])
- sram_size = int(size_list[1]) + int(size_list[2])
- return (flash_size, sram_size)
-
- return (0, 0)