예제 #1
0
 def loadKal(self):
     import kalaccess
     if self.kal == None:
         self.kal = kalaccess.Kalaccess()
         self.kal.sym.load(self.elfname)
예제 #2
0
                  connection to a Kalimba core on startup. Whatever is specified by them will 
                  be passed as arguments to a call of 'kal.connect(...)'. For details of what 
                  values can be specified, please see the help text for kal.connect."""
    )
    parser.add_argument("-p",
                        "--proc",
                        help="Processor ID for default connection")
    parser.add_argument("-s",
                        "--subsys",
                        help="Subsystem ID for default connection")
    parser.add_argument("-t",
                        "--trans",
                        help="Transport string for default connect")
    args = parser.parse_args()

    kal = kalaccess.Kalaccess()

    hc = HistoryConsole(locals(), os.path.expanduser("~/.kalaccess.history"))

    print("""
    *** K A L S H E L L ***\n
    Based on Python """ + sys.version[:5] + """
    Type kal.connect() to get started
    Type kal.help() for more info\n
    Press Ctrl+D to quit""")

    sys.ps1 = "\n\001\033[1;36m\002>>> \001\033[0m\002"

    # If command line arguments were specified to create a connection on startup,
    # then act on them now by forming a call of kal.connect() and eval'ing it.
    if args.trans:
예제 #3
0
import sys
sys.path.append("/home/devtools/kal-python-tools/linux/" +
                "1.1.6/kal_python_tools_linux64_1.1.6/")
import kalaccess

CHECKSUM_SYM_NAME = "$__devtools_image_checksum"

if __name__ == '__main__':

    if len(sys.argv) < 3:
        sys.stderr.write(sys.argv[0] +
                         ": Error, Please provide two ELF files to compare\n")
        sys.exit(1)
    elf1 = sys.argv[1]
    elf2 = sys.argv[2]
    kal1 = kalaccess.Kalaccess()
    kal2 = kalaccess.Kalaccess()
    kal1.sym.load(elf1)
    kal2.sym.load(elf2)
    varfind1 = kal1.sym.varfind(CHECKSUM_SYM_NAME)
    varfind2 = kal2.sym.varfind(CHECKSUM_SYM_NAME)
    if len(varfind1) != 1 or len(varfind2) != 1:
        raise Exception("Symbol " + CHECKSUM_SYM_NAME + " NOT found")
    else:
        addr1 = varfind1[0][2]
        addr2 = varfind2[0][2]
        if addr1 != addr2:
            raise Exception("Checksum found at different addresses")
        elif kal1.sym.static_dm[addr1] == kal2.sym.static_dm[addr2]:
            print("ELFs checksums are equal")
            exit(0)