Skip to content

Commit 3eea822

Browse files
committed
Create a setting for comparing against a fixed build
1 parent 7f2eee5 commit 3eea822

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

tools/memap.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from abc import abstractmethod, ABCMeta
77
from sys import stdout, exit, argv
8-
from os import sep
8+
from os import sep, rename
99
from os.path import (basename, dirname, join, relpath, abspath, commonprefix,
1010
splitext)
1111
import re
@@ -20,6 +20,7 @@
2020

2121
from .utils import (argparse_filestring_type, argparse_lowercase_hyphen_type,
2222
argparse_uppercase_type)
23+
from .settings import COMPARE_FIXED
2324

2425

2526
class _Parser(object):
@@ -801,6 +802,8 @@ def parse(self, mapfile, toolchain):
801802
self.old_modules = parser().parse_mapfile(old_input)
802803
except IOError:
803804
self.old_modules = None
805+
if not COMPARE_FIXED:
806+
rename(mapfile, "%s.old" % mapfile)
804807
return True
805808

806809
except IOError as error:

tools/settings.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@
5858
# Print compiler warnings and errors as link format
5959
PRINT_COMPILER_OUTPUT_AS_LINK = False
6060

61+
# Compare against a fixed build of the project for space consumption
62+
COMPARE_FIXED = False
63+
6164
# Print warnings/errors in color
6265
COLOR = False
6366

@@ -91,7 +94,7 @@
9194
print("WARNING: MBED_%s set as environment variable but doesn't"
9295
" exist" % _n)
9396

94-
_ENV_VARS = ['PRINT_COMPILER_OUTPUT_AS_LINK', 'COLOR']
97+
_ENV_VARS = ['PRINT_COMPILER_OUTPUT_AS_LINK', 'COLOR', 'COMPARE_FIXED']
9598
for _n in _ENV_VARS:
9699
value = getenv('MBED_%s' % _n)
97100
if value:

0 commit comments

Comments
 (0)