diff options
| author | hathach <[email protected]> | 2023-03-06 10:33:04 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2023-03-06 10:33:04 +0700 |
| commit | 956d1c9c4e6c26e1c7de70c1c2e01a5380dd3dfe (patch) | |
| tree | e502d00a4030e1916a7fec70c155f9b06260721e | |
| parent | 0a1a61bb6c921d033fc8bce0718b56e2d334323b (diff) | |
update size to fix macos ci
| -rw-r--r-- | examples/make.mk | 2 | ||||
| -rw-r--r-- | tools/build_utils.py | 12 |
2 files changed, 10 insertions, 4 deletions
diff --git a/examples/make.mk b/examples/make.mk index 8a0b6db6b..e02d226b6 100644 --- a/examples/make.mk +++ b/examples/make.mk @@ -61,7 +61,7 @@ ifdef USE_IAR AS = iasmarm LD = ilinkarm OBJCOPY = ielftool - SIZE = echo "size not available for IAR" + SIZE = size else CC = $(CROSS_COMPILE)gcc diff --git a/tools/build_utils.py b/tools/build_utils.py index ad1daf8c7..0dbfd3356 100644 --- a/tools/build_utils.py +++ b/tools/build_utils.py @@ -114,9 +114,15 @@ def build_example(example, board, make_option): def build_size(example, board): - elf_file = 'examples/{}/_build/{}/*.elf'.format(example, board) - size_output = subprocess.run('size {}'.format(elf_file), shell=True, stdout=subprocess.PIPE).stdout.decode("utf-8") - size_list = size_output.split('\n')[1].split('\t') + size_cmd = 'make -j -C examples/{} BOARD={} size'.format(example, board) + size_output = subprocess.run(size_cmd, 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') + break + flash_size = int(size_list[0]) sram_size = int(size_list[1]) + int(size_list[2]) return (flash_size, sram_size) + |
