Skip to content

Commit e0e25c1

Browse files
The parameter is now stored in an object variable instead of a global variable
1 parent f8af872 commit e0e25c1

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

tools/memap.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
argparse_lowercase_hyphen_type, argparse_uppercase_type
1515

1616
DEBUG = False
17-
DETAILED = False
17+
1818
RE_ARMCC = re.compile(
1919
r'^\s+0x(\w{8})\s+0x(\w{8})\s+(\w+)\s+(\w+)\s+(\d+)\s+[*]?.+\s+(.+)$')
2020
RE_IAR = re.compile(
@@ -25,7 +25,7 @@ class MemapParser(object):
2525
"""An object that represents parsed results, parses the memory map files,
2626
and writes out different file types of memory results
2727
"""
28-
28+
2929
print_sections = ('.text', '.data', '.bss')
3030

3131
misc_flash_sections = ('.interrupts', '.flash_config')
@@ -41,7 +41,9 @@ class MemapParser(object):
4141
def __init__(self):
4242
""" General initialization
4343
"""
44-
44+
#
45+
self.detailed_misc = False
46+
4547
# list of all modules and their sections
4648
self.modules = dict()
4749

@@ -91,8 +93,8 @@ def check_new_section_gcc(self, line):
9193
else:
9294
return False # everything else, means no change in section
9395

94-
@staticmethod
95-
def path_object_to_module_name(txt):
96+
97+
def path_object_to_module_name(self, txt):
9698
""" Parse a path to object file to extract it's module and object data
9799
98100
Positional arguments:
@@ -116,7 +118,7 @@ def path_object_to_module_name(txt):
116118

117119
return [module_name, object_name]
118120

119-
elif DETAILED:
121+
elif self.detailed_misc:
120122
rex_obj_name = r'^.+\/(.+\.o\)*)$'
121123
test_rex_obj_name = re.match(rex_obj_name, txt)
122124
if test_rex_obj_name:
@@ -638,13 +640,14 @@ def main():
638640
sys.exit(1)
639641

640642

641-
args, remainder = parser.parse_known_args()
642-
643-
global DETAILED
644-
DETAILED = args.detailed
643+
args = parser.parse_args()
645644

646645
# Create memap object
647646
memap = MemapParser()
647+
648+
# Show Misc unfolded
649+
if args.detailed:
650+
memap.detailed_misc = True
648651

649652
# Parse and decode a map file
650653
if args.file and args.toolchain:

0 commit comments

Comments
 (0)