2 // Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
4 // SPDX-License-Identifier: BSD-2-Clause-Patent
7 ENTRY &ram_start &ram_size
9 ;If system is running then stop the execution so we can load symbols.
15 ;Create AREA to display the symbols we are loading.
17 AREA.Create SYMBOL 300. 100.
22 ;Added based on suggestion from Lauterbach support.
27 GOSUB load_symbols &ram_start &ram_size
29 ;Open some windows and enable semihosting.
35 WINPOS 0.0 17.0 72. 13. 0. 0. W000
38 WINPOS 0.0 0.0 110. 55. 13. 1. W001
39 WINTABS 10. 10. 25. 62.
45 System.Option.BigEndian OFF
47 tronchip.set swi on // ARM9/10/11 variant
49 // configure and open semihosting channel
50 winpos 50% 50% 50% 50%
51 term.heapinfo 0 0x20000 0x30000 0x20000
56 WINPOS 115.0 0. 70. 35. 0. 1. W002
59 WINPOS 115.10 45. 48. 9. 0. 0. W003
65 ENTRY &mem_start &mem_size
66 &mem_ptr=&mem_start+&mem_size
69 &mem_ptr=&mem_ptr-0x400000 // 4 MB
70 &word1=Data.LONG(D:&mem_ptr)
71 &word2=Data.LONG(D:&mem_ptr+0x04)
76 &result=Data.LONG(D:&mem_ptr+0x08)
81 WHILE &mem_ptr>&mem_start
87 IF Data.LONG(D:&guid)==0x49152E77
89 IF Data.LONG(D:&guid+0x04)==0x47641ADA
91 IF Data.LONG(D:&guid+0x08)==0xFE7AA2B7
93 IF Data.LONG(D:&guid+0x0C)==0x8B5ED9FE
102 find_debug_info_table_header:
104 &config_table_entries=Data.LONG(D:&system_table+0x40)
105 &config_table_pointer=Data.LONG(D:&system_table+0x44)
106 RPT &config_table_entries
108 GOSUB compare_guid &config_table_pointer
112 &result=Data.LONG(D:&config_table_pointer+0x10)
115 &config_table_pointer=&config_table_pointer+0x14
121 IF Data.BYTE(D:&header+0x00)==0x4D
123 IF Data.BYTE(D:&header+0x01)==0x5A
125 IF Data.BYTE(D:&header+0x80)==0x50
127 IF Data.BYTE(D:&header+0x81)==0x45
141 &more_string=data.string(d:&stringOffset)
143 if (string.len("&more_string")>=128.)
145 &string="&string"+"&more_string"
146 &stringOffset=&stringOffset+string.len("&more_string")
148 //Get remaining file string
149 GOSUB get_file_string &stringOffset
151 &string="&string"+"&more_string"
155 &string="&string"+"&more_string"
161 ENTRY &header &load_address
162 GOSUB valid_pe_header &header
167 &debugOffset=Data.LONG(D:&header+0x0128)
168 &stringOffset=&header+&debugOffset+0x002C
170 GOSUB get_file_string &stringOffset
173 PRINT "&filestring 0x" &load_address
174 TDIAG Data.load.elf &filestring &load_address /nocode /noclear
180 RETURN Data.LONG(D:&header+0x00AC)
183 ENTRY &mem_start &mem_size
184 GOSUB find_system_table &mem_start &mem_size
186 GOSUB find_debug_info_table_header &system_table
187 ENTRY &debug_info_table_header
188 &debug_info_table=Data.LONG(D:&debug_info_table_header+0x08)
189 &debug_info_table_size=Data.LONG(D:&debug_info_table_header+0x04)
191 RPT &debug_info_table_size
193 &debug_image_info=Data.LONG(D:&debug_info_table+&index)
194 IF &debug_image_info==0
196 &loaded_image_protocol=Data.LONG(D:&debug_image_info+0x04);
197 &image_base=Data.LONG(D:&loaded_image_protocol+0x20);
198 GOSUB pe_headersize &image_base
200 &image_load_address=&image_base+&header_size
201 GOSUB load_symbol_file &image_base &image_load_address