📄 crtbegin.lis
字号:
ST9+ Family: Reset and Clock Control Unit (RCCU) control registers.
313 #if defined(HAS_SECINFO)
314
315 #include <sys/secinfo.h>
1 /*
2 * secinfo.h
3 *
4 * ST9+ Software Development Toolchain - Version 6.1.3 Sep 10 2001
5 *
6 * This file is part of GNU C Compiler for ST9+ Micro-controllers.
7 *
8 * Section Information of ST9+ Family
9 * Copyright (C) 1999 STMicroelectronics.
10 *
11 * This file is part of GNU C Compiler for ST9+ Micro-controllers.
12 *
13 * This file describes section information structures used by
14 * start-up file to initialize section before calling the main
15 * routine.
16 *
17 * This file could be included either by C source file, or
18 * by assembler file that should be preprocessed by cpp.
19 *
20 * This file is specific to ST9+ Micro-controllers and could
21 * not be used as is for other micro-controllers.
22 */
23
24 #ifndef _SYS_SECINFO_H
25 #define _SYS_SECINFO_H
26
27 /* Section information type
28 Macro defining the bit number of the entry identifier. */
29 #define SECINFO_END_OF_TABLE_BIT 0x00
30 #define SECINFO_MEMORY_DATA_BIT 0x01
31 #define SECINFO_MEMORY_BSS_BIT 0x02
32 #define SECINFO_RFILE_DATA_BIT 0x03
33 #define SECINFO_RFILE_BSS_BIT 0x04
34 #define SECINFO_RFILE_EXPLICIT_BIT 0x05
35 #define SECINFO_PAGE_SWITCH_BIT 0x06
36
37 /* Macro defined below can be used in assembler source
38 file. It describes all supported section information
39 type. */
40 #define SECINFO_END_OF_TABLE (1 << SECINFO_END_OF_TABLE_BIT)
41 #define SECINFO_MEMORY_DATA (1 << SECINFO_MEMORY_DATA_BIT)
42 #define SECINFO_MEMORY_BSS (1 << SECINFO_MEMORY_BSS_BIT)
43 #define SECINFO_RFILE_DATA (1 << SECINFO_RFILE_DATA_BIT)
44 #define SECINFO_RFILE_BSS (1 << SECINFO_RFILE_BSS_BIT)
45 #define SECINFO_RFILE_EXPLICIT (1 << SECINFO_RFILE_EXPLICIT_BIT)
46 #define SECINFO_PAGE_SWITCH (1 << SECINFO_PAGE_SWITCH_BIT)
47
48 #if !defined(__ASSEMBLER__)
49
50 /* Type for fill value */
51
52 typedef unsigned char secinfo_fill_t;
53
54 /* Structure defining an address for ST9+ or ST9OLD, as
55 they are stored in a secinfo table.
56 For ST9+, address is fully qualified by knowning
57 couple (page number, page offset). */
58
59 #if defined(ST9PLUS)
60
GAS LISTING C:\DOCUME~1\REF\LOCALS~1\Temp\cc001908.s page 10
ST9+ Family: Reset and Clock Control Unit (RCCU) control registers.
61 typedef struct {
62 unsigned char page;
63 unsigned short offset;
64 } secinfo_address_t;
65
66 #else /* ST9PLUS */
67
68 typedef struct {
69 unsigned short offset;
70 } secinfo_address_t;
71
72 #endif /* ST9PLUS */
73
74 /* We prefer use an enumeration in C source file
75 instead of macro definition. */
76 typedef enum {
77 secinfo_end_of_table_enum = SECINFO_END_OF_TABLE,
78 secinfo_initialized_data_enum = SECINFO_MEMORY_DATA,
79 secinfo_uninitialized_data_enum = SECINFO_MEMORY_BSS,
80 secinfo_initialized_regfile_enum = SECINFO_RFILE_DATA,
81 secinfo_uninitialized_regfile_enum = SECINFO_RFILE_BSS,
82 secinfo_explicit_init_regfile_enum = SECINFO_RFILE_EXPLICIT,
83 secinfo_page_switch_enum = SECINFO_PAGE_SWITCH
84 } secinfo_type_t;
85
86 /* Structure defining general header structure for
87 all secinfo entry in a table.
88 This header is composed of a type, describing
89 informations stored in structure. */
90
91 typedef struct {
92 secinfo_type_t type;
93 } secinfo_header_t;
94
95 /* Miscellaneous structure that handle the end of table
96 only. */
97
98 typedef struct {
99 secinfo_header_t header;
100 } secinfo_end_of_table_t;
101
102 /* Structure defining information about initialization
103 of a initialized data section in memory, i.e. copying bytes
104 from a load address to a run-time address. */
105
106 typedef struct {
107 secinfo_header_t header;
108 secinfo_address_t start_address;
109 unsigned short size;
110 secinfo_address_t load_address;
111 } secinfo_initialized_data_t;
112
113 /* Structure defining information about initialization
114 of a uninitialized data section in memory, i.e. setting
115 the content of such section to a fill value. */
116
117 typedef struct {
118 secinfo_header_t header;
119 secinfo_address_t start_address;
120 unsigned short size;
121 secinfo_fill_t fill;
122 } secinfo_uninitialized_data_t;
123
GAS LISTING C:\DOCUME~1\REF\LOCALS~1\Temp\cc001908.s page 11
ST9+ Family: Reset and Clock Control Unit (RCCU) control registers.
124 /* Structure defining information about initialization
125 of a initialized data section in register file, i.e.
126 copying byte from a memory space to a register file
127 one. */
128
129 typedef struct {
130 secinfo_header_t header;
131 unsigned char start_register;
132 unsigned char size;
133 secinfo_address_t load_address;
134 } secinfo_initialized_regfile_t;
135
136 /* Structure defining information about initialization
137 of a uninitialized data section in register file, i.e.
138 setting the content of section in register file to a
139 fill value. */
140
141 typedef struct {
142 secinfo_header_t header;
143 unsigned char start_register;
144 unsigned char size;
145 unsigned char fill;
146 } secinfo_uninitialized_regfile_t;
147
148 /* Structure handling information to initialize
149 a 'single' register. The register number is
150 the lowest register number according to
151 the size of the value. This structure is used
152 only for initialization of fixed register, i.e.
153 declaration of type:
154 #pragma REGISTER_FILE my_reg_102 102
155 unsigned int my_reg_102 = 0xcafe; */
156
157 typedef struct {
158 secinfo_header_t header;
159 unsigned char start_register;
160 unsigned char size;
161 unsigned char value[0];
162 } secinfo_explicit_init_regfile_t;
163
164 /* Internal structure used to force secinfo entry to be
165 aligned on to the next page. */
166
167 typedef struct {
168 secinfo_header_t header;
169 } secinfo_page_switch_t;
170
171 /* Here is the definition of the global structure
172 that handle all knowning entry type of a secinfo
173 table, i.e. an union of the 6 structures defined
174 above. */
175
176 typedef union {
177
178 /* General header of all entries */
179 secinfo_type_t type;
180 secinfo_header_t header;
181
182 /* Relevant structure for end-user */
183 secinfo_initialized_data_t initialized_data;
184 secinfo_uninitialized_data_t uninitialized_data;
185 secinfo_initialized_regfile_t initialized_regfile;
186 secinfo_uninitialized_regfile_t uninitialized_regfile;
GAS LISTING C:\DOCUME~1\REF\LOCALS~1\Temp\cc001908.s page 12
ST9+ Family: Reset and Clock Control Unit (RCCU) control registers.
187 secinfo_explicit_init_regfile_t explicit_init_regfile;
188
189 /* Miscellaneous/internal structure used
190 internally, based on initialization algorithms
191 used. */
192 secinfo_end_of_table_t eot;
193 secinfo_page_switch_t page_switch;
194
195 } secinfo_t;
196
197 #if defined(MEDIUM)
198
199 typedef const secinfo_t far *secinfo_pointer_t;
200
201 #else /* MEDIUM */
202
203 typedef const secinfo_t *secinfo_pointer_t;
204
205 #endif /* MEDIUM */
206
207 extern int secinfo_exists();
208 extern secinfo_pointer_t secinfo_get_table();
209 extern secinfo_pointer_t secinfo_get_next(secinfo_pointer_t);
210 extern int secinfo_end_of_table_reached(secinfo_pointer_t);
211
212 #endif /* !__ASSEMBLER___ */
213
214 #endif /* !_SYS_SECINFO_H */
215 ...
316
317 #define DPR1_MASK 0x40
318 #define DPR2_MASK 0x80
319
320 ;
321 ; Sections to initialize are described thru the section
322 ; information table constructed by the linker, located at
323 ; _secinfo_table address within .secinfo ELF section.
324 ;
325
326 LABEL(sections_init):
327
328:../startup/crtbegin.spp **** ld r0, #_has_secinfo_table ; load at run-time secinfo table
329 ; flag
330:../startup/crtbegin.spp **** or r0, r0
331:../startup/crtbegin.spp **** jpz LABEL(sections_fini) ; skip init process
332
333:../startup/crtbegin.spp **** ld DPR2_P, #pag(_secinfo_table) ; dpr2 get the page number of
334 ; the secinfo table
335:../startup/crtbegin.spp **** ldw rr10, #pof(_secinfo_table) ; load address of secinfo table
336:../startup/crtbegin.spp **** or r10, #DPR2_MASK ; secinfo table uses dpr2
337
338 LABEL(sections_begin):
339
340:../startup/crtbegin.spp **** ld r8, (rr10)+ ; load the next section type
341
342 ;
343 ; Init data-like sections (such .data section).
344 ; Data-like section initialization relies on the AT mechanism of ld
345 ;
346
347 LABEL(memory_data_init):
348
349:../startup/crtbegin.spp **** btjxf r8.1, LABEL(memory_data_end)
GAS LISTING C:\DOCUME~1\REF\LOCALS~1\Temp\cc001908.s page 13
ST9+ Family: Reset and Clock Control Unit (RCCU) control registers.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -