1#!/usr/bin/env python 2# SPDX-License-Identifier: BSD-2-Clause 3# 4# Copyright (c) 2016, Linaro Limited 5# All rights reserved. 6# 7# Redistribution and use in source and binary forms, with or without 8# modification, are permitted provided that the following conditions are met: 9# 10# 1. Redistributions of source code must retain the above copyright notice, 11# this list of conditions and the following disclaimer. 12# 13# 2. Redistributions in binary form must reproduce the above copyright notice, 14# this list of conditions and the following disclaimer in the documentation 15# and/or other materials provided with the distribution. 16# 17# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 21# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27# POSSIBILITY OF SUCH DAMAGE. 28import struct 29 30def main(): 31 with open ("../out/arm/core/tee.bin", "rb") as f: 32 data = f.read(4) 33 magic = struct.unpack('<I', data) 34 print("Magic: \t\t0x%08x" % magic) 35 36 data = f.read(1) 37 version = struct.unpack('<B', data) 38 print("Version: \t0x%02x" % version) 39 40 data = f.read(1) 41 arch_id = struct.unpack('<B', data) 42 print("ArchID: \t0x%02x" % arch_id) 43 44 data = f.read(2) 45 flags = struct.unpack('<H', data) 46 print("Arch Flags: \t0x%04x" % arch_id) 47 48 data = f.read(4) 49 init_size = struct.unpack('<I', data) 50 print("Init size: \t0x%04x" % init_size) 51 52 data = f.read(4) 53 laddr_h = struct.unpack('<I', data) 54 print("Load addr high:\t0x%04x" % laddr_h) 55 56 data = f.read(4) 57 laddr_l = struct.unpack('<I', data) 58 print("Load addr low: \t0x%04x" % laddr_l) 59 60 data = f.read(4) 61 mem_usage = struct.unpack('<I', data) 62 print("Mem usage: \t0x%04x" % mem_usage) 63 64 data = f.read(4) 65 pgd_size = struct.unpack('<I', data) 66 print("Pages size: \t0x%04x" % pgd_size) 67 68if __name__ == "__main__": 69 main() 70