comparison compal/boot/code-deriv @ 401:4b6b595ae0a0

compal/boot/code-deriv: new analysis
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 14 Jan 2023 23:59:23 +0000
parents
children
comparison
equal deleted inserted replaced
400:5377f91aea97 401:4b6b595ae0a0
1 It is apparent that Compal's bootloader was genealogically derived from TI's
2 original FRBL (flash-resident bootloader) built into TCS211 reference fw. The
3 most "basic" or "pristine" version of Compal's bootloader is the one analyzed
4 in c123-boot.disasm, aided by symbolic information from R87.2.1.03.map; here we
5 shall analyze the diffs between this code and the original TCS211 version in
6 the ../../leo-obj/bootloader directory.
7
8 0x830: serial.obj .const section
9
10 Exact match to TCS211-20070608!
11
12 0x86c: bootloader.obj .text section
13
14 The only diffs from TCS211 are:
15
16 1) The addition of these instructions (right at _INT_Bootloader_Start) to set
17 VCLKOUT_DIV2 bit in the FFFF:FD02 register:
18
19 89c: e51f1020 ldr r1, =0xfffffd00 ; via 0x884
20 8a0: e1d120b2 ldrh r2, [r1, #2]
21 8a4: e51f002c ldr r0, =0x40 ; via 0x880
22 8a8: e1800002 orr r0, r0, r2
23 8ac: e1c100b2 strh r0, [r1, #2]
24
25 2) The addition of 32-bit word 0x40 to the literal at the beginning of this
26 .text section, before _INT_Bootloader_Start entry point.
27
28 0x968: start.obj .text section
29
30 Static function 0 (0x0 in reference object, 0x968 in Compal's bl) matches
31 exactly.
32
33 Static function 1 (0x2c in reference object, 0x994 in Compal's bl) matches
34 exactly.
35
36 Static function 2 (0xe0 in reference object, 0xa48 in Compal's bl) matches
37 exactly.
38
39 Final function sta_select_application():
40
41 * The beginning of the function is the same between TI and Compal versions:
42
43 - call to static function 0 (hw init)
44 - call to ser_initialize_serial_link()
45 - call to con_initialize_conversion()
46
47 * The remainder of the function differs fundamentally:
48
49 - TI's version calls cmd_check_application_in_flash(), followed by static
50 functions 1 and 2 that implement FRBL1 interrupt-boot window provision.
51
52 - Compal's version calls their heavily modified version of fluid_bootloader(),
53 which is where Compal's serial boot entry protocol is implemented, followed
54 by FTM_Tool_check() where the "ftmtool - (yes) - (modem)error" business
55 happens.
56
57 0xb10: boot.obj .text section
58
59 The dead code preamble before fluid_bootloader() function (5 32-bit ARM
60 instructions) is the same between TI and Compal versions.
61
62 The body of fluid_bootloader() is completely different, leaving only the now-
63 misleading function name: all FRBL2 code has been ripped out, replaced with
64 Compal's serial boot entry protocol.
65
66 The following functions from TI's original boot.c survive in Compal's version:
67
68 jump()
69 putchar()
70 getchar()
71 hardware_init() -- already a mostly-do-nothing in TCS211
72 uart_init()
73
74 The following functions in this module are entirely new in Compal's version:
75
76 SeekMsg()
77 FTM_Tool_check()
78 getchar_timeout()
79 UartTimeout() -- unused!
80 CheckFTMtoolMode()
81 putchar__() -- unused!
82 getchar__() -- unused!
83
84 0xfb4: branch_in_RAM.obj .text section
85
86 Exact match to TCS211-20070608, but then it's a trivial assembly module.
87
88 0xfb8: command.obj .text section
89
90 Exact match to TCS211-20070608!
91
92 0x13d0: convert.obj .text section
93
94 Exact match to TCS211-20070608, including the call to fluid_bootloader() in
95 con_get_command_from_string() which is now a complete bogon.
96
97 0x1594: optboot.obj .text section
98
99 Exact match to TCS211-20070608, except for one byte change in the ID returned
100 by opt_get_monitor_id().
101
102 0x165c: serial.obj .text section
103
104 Exact match to TCS211-20070608!
105
106 0x1cec: cmdboot.obj .text section
107
108 Exact match to TCS211-20070608!
109
110 0x1dd8: start.obj .text:v$3 section
111
112 Exact match to TCS211-20070608!