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