boolean EnumCodeBlocks(String file, String callback)

Calls the python function callback once for each code block in the binary file. A code block is a contiguous binary block that would be loaded to the device if file were to be debugged.

Example 1

def writeBlock(adr,bytes,name):
    log.info("Code block %s at %08x %d" % (name, adr,len(bytes)))
    dev.Write(adr,bytes,0,len(bytes)) # write block to device memory (ARM)

def load_file_and_pc(binary_path):
    deb.EnumCodeBlocks(binary_path, "writeBlock")

public String PeekFileType(String file)

Returns type of file as a string (either "hex", "coff", "ubrof8", or "nordic".)

Example 2

filetype = deb.PeekFileType(binary_path)
if "hex" == filetype or "elf" == filetype:
    deb.EnumCodeBlocks(binary_path, "writeBlock")