MCPcopy Create free account
hub / github.com/ARMmbed/DAPLink / read

Method read

tools/flash_algo.py:334–354  ·  view source on GitHub ↗

Read program data from the elf file :param addr: physical address (load address) to read from :param size: number of bytes to read :return: Requested data or None if address is unmapped

(self, addr, size)

Source from the content-addressed store, hash-verified

332 return symbols
333
334 def read(self, addr, size):
335 """Read program data from the elf file
336
337 :param addr: physical address (load address) to read from
338 :param size: number of bytes to read
339 :return: Requested data or None if address is unmapped
340 """
341 for segment in self.iter_segments():
342 seg_addr = segment["p_paddr"]
343 seg_size = min(segment["p_memsz"], segment["p_filesz"])
344 if addr >= seg_addr + seg_size:
345 continue
346 if addr + size <= seg_addr:
347 continue
348 # There is at least some overlap
349
350 if addr >= seg_addr and addr + size <= seg_addr + seg_size:
351 # Region is fully contained
352 data = segment.data()
353 start = addr - seg_addr
354 return data[start:start + size]
355
356
357if __name__ == '__main__':

Callers 8

generate_version_fileFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
process_templateMethod · 0.45
__init__Method · 0.45
_sector_and_sz_itrMethod · 0.45
post_build_scriptFunction · 0.45
create_padded_imageFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected