Skip to content

Commit

Permalink
Added address describe.
Browse files Browse the repository at this point in the history
  • Loading branch information
chintal committed Jul 26, 2016
1 parent cb9ab5b commit 99fd845
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
6 changes: 6 additions & 0 deletions fpvgcc/fpv.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,8 @@ def main():
help='Print list of loaded files.')
action.add_argument('--la', action='store_true',
help='Print list of detected aliases.')
action.add_argument('--addr', metavar='ADDRESS',
help='Describe contents at address.')
args = parser.parse_args()
if args.verbose == 0:
logging.basicConfig(level=logging.ERROR)
Expand Down Expand Up @@ -758,6 +760,10 @@ def main():
for node in state_machine.memory_map.root.all_nodes():
if node.objfile == args.lobj:
print(node)
elif args.addr:
for node in state_machine.memory_map.root.all_nodes():
if node.contains_address(args.addr):
print(node)


if __name__ == '__main__':
Expand Down
8 changes: 8 additions & 0 deletions fpvgcc/gccMemoryMap.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ def address(self):
def address(self, value):
self._address = int(value, 16)

def contains_address(self, addr):
if not self.address or self.region in ['DISCARDED', 'UNDEF']:
return False
if int(self.address, 0) <= int(addr, 0) < \
(int(self.address, 0) + self.size):
return True
return False

@property
def defsize(self):
return self._defsize
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def read(fname):

setup(
name="fpv-gcc",
version="0.4",
version="0.5",
author="Chintalagiri Shashank",
author_email="[email protected]",
description="Analysing code footprint on embedded microcontrollers "
Expand Down

0 comments on commit 99fd845

Please sign in to comment.