]> begriffs open source - cmsis/blob - CMSIS/DoxyGen/Core/src/Template.txt
Merge pull request #4 from KeilChris/revert-3-SDCMSIS-431
[cmsis] / CMSIS / DoxyGen / Core / src / Template.txt
1 /**\r
2 \page Templates_pg Template Files\r
3 \r
4 \details\r
5 \r
6 ARM supplies CMSIS-CORE template files for the all supported Cortex-M processors and various compiler vendors.\r
7 Refer to the list of \ref tested_tools_sec for compliance.\r
8 These template files include the following:\r
9  - Register names of the Core Peripherals and names of the Core Exception Vectors.\r
10  - Functions to access core peripherals, special CPU instructions and SIMD instructions (for Cortex-M4 and Cortex-M7)\r
11  - Generic startup code and system configuration code.\r
12 \r
13 The detailed file structure of the CMSIS-CORE is shown in the following picture.\r
14 \r
15 \image html "CMSIS_CORE_Files.png" "CMSIS-CORE File Structure"\r
16 \r
17 \r
18 \section template_files_sec Template Files\r
19 \r
20 The CMSIS-CORE template files should be extended by the silicon vendor to reflect the actual device and device peripherals.\r
21 Silicon vendors add in this context the:\r
22  - <b>Device Peripheral Access Layer</b> that provides definitions for device-specific peripherals.\r
23  - <b>Access Functions for Peripherals</b> (optional) that provides additional helper functions to access device-specific peripherals.\r
24  - <b>Interrupt vectors</b> in the startup file that are device specific.\r
25 \r
26 <table class="cmtable">\r
27     <tr>\r
28       <th>Template File</th>\r
29       <th>Description</th>\r
30     </tr>\r
31     <tr>\r
32       <td>.\\Device\\\_Template_Vendor\\Vendor\\Device\\Source\\ARM\\startup_Device.s</td>\r
33       <td>Startup file template for ARM C/C++ Compiler.</td>\r
34     </tr>\r
35     <tr>\r
36       <td>.\\Device\\\_Template_Vendor\\Vendor\\Device\\Source\\GCC\\startup_Device.s</td>\r
37       <td>Startup file template for GNU GCC ARM Embedded Compiler.</td>\r
38     </tr>\r
39     <tr>\r
40       <td>.\\Device\\\_Template_Vendor\\Vendor\\Device\\Source\\IAR\\startup_Device.s</td>\r
41       <td>Startup file template for IAR C/C++ Compiler.</td>\r
42     </tr>\r
43     <tr>\r
44       <td>.\\Device\\\_Template_Vendor\\Vendor\\Device\\Source\\system_Device.c</td>\r
45       <td>Generic system_Device.c file for system configuration (i.e. processor clock and memory bus system).</td>\r
46     </tr>\r
47     <tr>\r
48       <td>.\\Device\\\_Template_Vendor\\Vendor\\Device\\Include\\Device.h</td>\r
49       <td>Generic device header file. Needs to be extended with the device-specific peripheral registers. Optionally functions that access the peripherals\r
50       can be part of that file.</td>\r
51     </tr>\r
52     <tr>\r
53       <td>.\\Device\\\_Template_Vendor\\Vendor\\Device\\Include\\system_Device.h</td>\r
54       <td>Generic system device configuration include file.</td>\r
55     </tr>\r
56 </table>\r
57 \r
58 \r
59 In addition ARM provides the following core header files that do not need any modifications.\r
60 \r
61 <table class="cmtable">\r
62     <tr>\r
63       <th>Core Header Files</th>\r
64       <th>Description</th>\r
65     </tr>\r
66     <tr>\r
67       <td><b>core_&lt;cpu&gt;.h</b></td>\r
68       <td>Defines the core peripherals and provides helper functions that access the core registers. This file is available for all supported processors:\r
69              - core_cm0.h: for the Cortex-M0 processor\r
70              - core_cm0plus.h: for the Cortex-M0+ processor\r
71              - core_cm3.h: for the Cortex-M3 processor\r
72              - core_cm4.h: for the Cortex-M4 processor\r
73              - core_cm7.h: for the Cortex-M7 processor\r
74              - core_sc000.h: for the SecurCore SC000 processor\r
75              - core_sc300.h: for the SecurCore SC300 processor\r
76              - core_armv8mbl.h: for the ARMv8-M Baseline processor\r
77              - core_armv8mml.h: for the ARMv8-M Mainline processor\r
78           </td>\r
79     </tr>\r
80     <tr>\r
81       <td><b>core_cminstr.h</b></td>\r
82       <td>Defines intrinsic functions to access special Cortex-M instructions.</td>\r
83     </tr>\r
84     <tr>\r
85       <td><b>core_cmiunc.h</b></td>\r
86       <td>Defines functions to access the Cortex-M core peripherals.</td>\r
87     </tr>\r
88     <tr>\r
89       <td><b>core_cmsimd.h</b></td>\r
90       <td>Defines intrinsic functions to access the SIMD instructions for Cortex-M4, Cortex-M7 and ARMv8MML.</td>\r
91     </tr>\r
92 </table>\r
93 \r
94 \r
95 \section adapt_template_files_sec Adaption of Template Files to Devices\r
96 \r
97 Copy the complete folder including files and replace:\r
98   - folder name 'Vendor' with the abbreviation for the device vendor  e.g.: NXP.\r
99   - folder name 'Device' with the specific device name e.g.: LPC17xx.\r
100   - in the filenames 'Device' with the specific device name e.g.: LPC17xx.\r
101 \r
102 Each template file contains comments that start with \b ToDo: that describe a required modification.\r
103 The template files contain placeholders:\r
104 \r
105 <table class="cmtable">\r
106     <tr>\r
107       <th>Placeholder</th>\r
108       <th>Replaced with</th>\r
109     </tr>\r
110     <tr>\r
111       <td>&lt;Device&gt;</td>\r
112       <td>the specific device name or device family name; i.e. LPC17xx.</td>\r
113     </tr>\r
114     <tr>\r
115       <td>&lt;DeviceInterrupt&gt;</td>\r
116       <td>a specific interrupt name of the device; i.e. TIM1 for Timer 1.</td>\r
117     <tr>\r
118       <td>&lt;DeviceAbbreviation&gt;</td>\r
119       <td>short name or abbreviation of the device family; i.e. LPC.</td>\r
120     </tr>\r
121     <tr>\r
122       <td>Cortex-M#</td>\r
123       <td>the specific Cortex-M processor name; i.e. Cortex-M3.</td>\r
124     </tr>\r
125 </table>\r
126 \r
127 \r
128 The adaption of the template files is described in detail on the following pages:\r
129   - \subpage startup_s_pg\r
130   - \subpage system_c_pg\r
131   - \subpage device_h_pg\r
132   - \subpage partition_h_pg\r
133 */\r
134 \r
135 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/\r
136 /**\r
137 \page startup_s_pg Startup File startup_<device>.s\r
138 \r
139 The \ref startup_s_pg contains:\r
140  - The reset handler which is executed after CPU reset and typically calls the \ref SystemInit function.\r
141  - The setup values for the Main Stack Pointer (MSP).\r
142  - Exception vectors of the Cortex-M Processor with weak functions that implement default routines.\r
143  - Interrupt vectors that are device specific with weak functions that implement default routines.\r
144 \r
145 The file exists for each supported toolchain and is the only tool-chain specific CMSIS file.\r
146 \r
147 To adapt the file to a new device only the interrupt vector table needs to be extended with\r
148 the device-specific interrupt handlers. The naming convention for the interrupt handler names are\r
149 &lt;interrupt_name&gt;_IRQHandler.  This table needs to be consistent with \ref IRQn_Type that defines all the\r
150 IRQ numbers for each interrupt.\r
151 \r
152 \b Example:\r
153 \r
154 The following example shows the extension of the interrupt vector table for the LPC1100 device family.\r
155 \r
156 \code\r
157                 ; External Interrupts\r
158                 DCD     WAKEUP0_IRQHandler       ; 16+ 0: Wakeup PIO0.0\r
159                 DCD     WAKEUP1_IRQHandler       ; 16+ 1: Wakeup PIO0.1\r
160                 DCD     WAKEUP2_IRQHandler       ; 16+ 2: Wakeup PIO0.2\r
161                  :       :\r
162                  :       :\r
163                 DCD     EINT1_IRQHandler         ; 16+30: PIO INT1\r
164                 DCD     EINT0_IRQHandler         ; 16+31: PIO INT0\r
165          :\r
166          :\r
167                 EXPORT  WAKEUP0_IRQHandler       [WEAK]\r
168                 EXPORT  WAKEUP1_IRQHandler       [WEAK]\r
169                 EXPORT  WAKEUP2_IRQHandler       [WEAK]\r
170                  :       :\r
171                  :       :\r
172                 EXPORT  EINT1_IRQHandler         [WEAK]\r
173                 EXPORT  EINT0_IRQHandler         [WEAK]\r
174 \r
175 WAKEUP0_IRQHandler\r
176 WAKEUP1_IRQHandler\r
177 WAKEUP1_IRQHandler\r
178       :\r
179       :\r
180 EINT1_IRQHandler\r
181 EINT0_IRQHandler\r
182                 B       .\r
183 \r
184 \endcode\r
185 \r
186 \section startup_s_sec startup_Device.s Template File\r
187 \r
188 The \ref startup_s_sec for the Cortex-M3 and the ARMCC compiler is shown below. The files for other compiler vendors\r
189 differ slightly in the syntax, but not in the overall structure.\r
190 \r
191 \verbinclude "Source\ARM\startup_Device.s"\r
192 */\r
193 \r
194 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/\r
195 /**\r
196 \page system_c_pg System Configuration Files system_<device>.c and system_<device>.h\r
197 \r
198 The \ref system_c_pg provides as a minimum the functions described under \ref system_init_gr.\r
199 These functions are device specific and need adaptations. In addition, the file might have\r
200 configuration settings for the device such as XTAL frequency or PLL prescaler settings.\r
201 \r
202 For devices with external memory BUS the system_<device>.c also configures the BUS system.\r
203 \r
204 The silicon vendor might expose other functions (i.e. for power configuration) in the system_<device>.c file.\r
205 In case of additional features the function prototypes need to be added to the system_<device>.h header file.\r
206 \r
207 \section system_Device_sec system_Device.c Template File\r
208 \r
209 The \ref system_Device_sec for the Cortex-M3 is shown below.\r
210 \r
211 \verbinclude "Source\system_Device.c"\r
212 \r
213 \section system_Device_h_sec system_Device.h Template File\r
214 \r
215 The system_<device>.h header file contains prototypes to access the public functions in the system_<device>.c file.\r
216 The \ref system_Device_h_sec is shown below.\r
217 \r
218 \verbinclude "Include\system_Device.h"\r
219 \r
220 */\r
221 \r
222 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/\r
223 /**\r
224 \page device_h_pg Device Header File <device.h>\r
225 \r
226 The \ref device_h_pg contains the following sections that are device specific:\r
227 \r
228   - \ref interrupt_number_sec provides interrupt numbers (IRQn) for all exceptions and interrupts of the device.\r
229   - \ref core_config_sect reflect the features of the device.\r
230   - \ref device_access provides definitions for the \ref peripheral_gr to all device peripherals. It contains all data structures and the address mapping for device-specific peripherals.\r
231   - <b>Access Functions for Peripherals (optional)</b> provide additional helper functions for peripherals that are useful for programming of these peripherals. Access Functions may be provided as inline functions or can be extern references to a device-specific library provided by the silicon vendor.\r
232 \r
233 <a href="Modules.html">\b Reference </a> describes the standard features and functions of the \ref device_h_pg in detail.\r
234 \r
235 \section interrupt_number_sec Interrupt Number Definition\r
236 \r
237 \ref device_h_pg contains the enumeration \ref IRQn_Type that defines all exceptions and interrupts of the device.\r
238   - Negative IRQn values represent processor core exceptions (internal interrupts).\r
239   - Positive IRQn values represent device-specific exceptions (external interrupts). The first device-specific interrupt has the IRQn value 0.\r
240     The IRQn values needs extension to reflect the device-specific interrupt vector table in the \ref startup_s_pg.\r
241 \r
242 \b Example:\r
243 \r
244 The following example shows the extension of the interrupt vector table for the LPC1100 device family.\r
245 \r
246 \code\r
247 typedef enum IRQn\r
248 {\r
249 /******  Cortex-M0 Processor Exceptions Numbers ***************************************************/\r
250   NonMaskableInt_IRQn           = -14,      /*!< 2 Non Maskable Interrupt                         */\r
251   HardFault_IRQn                = -13,      /*!< 3 Cortex-M0 Hard Fault Interrupt                 */\r
252   SVCall_IRQn                   = -5,       /*!< 11 Cortex-M0 SV Call Interrupt                   */\r
253   PendSV_IRQn                   = -2,       /*!< 14 Cortex-M0 Pend SV Interrupt                   */\r
254   SysTick_IRQn                  = -1,       /*!< 15 Cortex-M0 System Tick Interrupt               */\r
255 \r
256 /******  LPC11xx/LPC11Cxx Specific Interrupt Numbers **********************************************/\r
257   WAKEUP0_IRQn                  = 0,        /*!< All I/O pins can be used as wakeup source.       */\r
258   WAKEUP1_IRQn                  = 1,        /*!< There are 13 pins in total for LPC11xx           */\r
259   WAKEUP2_IRQn                  = 2,\r
260                  :       :\r
261                  :       :\r
262   EINT1_IRQn                    = 30,       /*!< External Interrupt 1 Interrupt                   */\r
263   EINT0_IRQn                    = 31,       /*!< External Interrupt 0 Interrupt                   */\r
264 } IRQn_Type;\r
265 \endcode\r
266 \r
267 \section core_config_sect Configuration of the Processor and Core Peripherals\r
268 \r
269 The \ref device_h_pg  configures the Cortex-M or SecurCore processor and the core peripherals with <i>\#defines</i>\r
270 that are set prior to including the file <b>core_<cpu>.h</b>.\r
271 \r
272 The following tables list the <i>\#defines</i> along with the possible values for each processor core.\r
273 If these <i>\#defines</i> are missing default values are used.\r
274 \r
275 \b core_cm0.h\r
276 <table class="cmtable">\r
277     <tr>\r
278       <th>\#define</th>\r
279       <th>Value Range</th>\r
280       <th>Default</th>\r
281       <th>Description</th>\r
282     </tr>\r
283     <tr>\r
284       <td>__CM0_REV</td>\r
285       <td>0x0000</td>\r
286       <td>0x0000</td>\r
287       <td>Core revision number ([15:8] revision number, [7:0] patch number)</td>\r
288     </tr>\r
289     <tr>\r
290       <td>__NVIC_PRIO_BITS</td>\r
291       <td>2</td>\r
292       <td>2</td>\r
293       <td>Number of priority bits implemented in the NVIC (device specific)</td>\r
294     </tr>\r
295     <tr>\r
296       <td>__Vendor_SysTickConfig</td>\r
297       <td>0 .. 1</td>\r
298       <td>0</td>\r
299       <td>If this define is set to 1, then the default <b>SysTick_Config</b> function\r
300                 is excluded. In this case, the file <i><b>device.h</b></i>\r
301                 must contain a vendor specific implementation of this function.</td>\r
302     </tr>\r
303 </table>\r
304 \r
305 \b core_cm0plus.h\r
306 <table class="cmtable">\r
307     <tr>\r
308       <th>\#define</th>\r
309       <th>Value Range</th>\r
310       <th>Default</th>\r
311       <th>Description</th>\r
312     </tr>\r
313     <tr>\r
314       <td>__CM0PLUS_REV</td>\r
315       <td>0x0000</td>\r
316       <td>0x0000</td>\r
317       <td>Core revision number ([15:8] revision number, [7:0] patch number)</td>\r
318     </tr>\r
319     <tr>\r
320       <td>__NVIC_PRIO_BITS</td>\r
321       <td>2</td>\r
322       <td>2</td>\r
323       <td>Number of priority bits implemented in the NVIC (device specific)</td>\r
324     </tr>\r
325     <tr>\r
326       <td>__Vendor_SysTickConfig</td>\r
327       <td>0 .. 1</td>\r
328       <td>0</td>\r
329       <td>If this define is set to 1, then the default <b>SysTick_Config</b> function\r
330                 is excluded. In this case, the file <i><b>device.h</b></i>\r
331                 must contain a vendor specific implementation of this function.</td>\r
332     </tr>\r
333 </table>\r
334 \r
335 \b core_cm3.h\r
336 <table class="cmtable">\r
337     <tr>\r
338       <th>\#define</th>\r
339       <th>Value Range</th>\r
340       <th>Default</th>\r
341       <th>Description</th>\r
342     </tr>\r
343     <tr>\r
344       <td>__CM3_REV</td>\r
345       <td>0x0101 | 0x0200</td>\r
346       <td>0x0200</td>\r
347       <td>Core revision number ([15:8] revision number, [7:0] patch number)</td>\r
348     </tr>\r
349     <tr>\r
350       <td>__NVIC_PRIO_BITS</td>\r
351       <td>2 .. 8</td>\r
352       <td>4</td>\r
353       <td>Number of priority bits implemented in the NVIC (device specific)</td>\r
354     </tr>\r
355     <tr>\r
356       <td>__MPU_PRESENT</td>\r
357       <td>0 .. 1</td>\r
358       <td>0</td>\r
359       <td>Defines if a MPU is present or not</td>\r
360     </tr>\r
361     <tr>\r
362       <td>__Vendor_SysTickConfig</td>\r
363       <td>0 .. 1</td>\r
364       <td>0</td>\r
365       <td>If this define is set to 1, then the default <b>SysTick_Config</b> function\r
366                 is excluded. In this case, the file <i><b>device.h</b></i>\r
367                 must contain a vendor specific implementation of this function.</td>\r
368     </tr>\r
369 </table>\r
370 \r
371 \b core_cm4.h\r
372 <table class="cmtable">\r
373     <tr>\r
374       <th>\#define</th>\r
375       <th>Value Range</th>\r
376       <th>Default</th>\r
377       <th>Description</th>\r
378     </tr>\r
379     <tr>\r
380       <td>__CM4_REV</td>\r
381       <td>0x0000</td>\r
382       <td>0x0000</td>\r
383       <td>Core revision number ([15:8] revision number, [7:0] patch number)</td>\r
384     </tr>\r
385     <tr>\r
386       <td>__NVIC_PRIO_BITS</td>\r
387       <td>2 .. 8</td>\r
388       <td>4</td>\r
389       <td>Number of priority bits implemented in the NVIC (device specific)</td>\r
390     </tr>\r
391     <tr>\r
392       <td>__MPU_PRESENT</td>\r
393       <td>0 .. 1</td>\r
394       <td>0</td>\r
395       <td>Defines if a MPU is present or not</td>\r
396     </tr>\r
397     <tr>\r
398       <td>__FPU_PRESENT</td>\r
399       <td>0 .. 1</td>\r
400       <td>0</td>\r
401       <td>Defines if a FPU is present or not</td>\r
402     </tr>\r
403     <tr>\r
404       <td>__Vendor_SysTickConfig</td>\r
405       <td>0 .. 1</td>\r
406       <td>0</td>\r
407       <td>If this define is set to 1, then the default <b>SysTick_Config</b> function\r
408                 is excluded. In this case, the file <i><b>device.h</b></i>\r
409                 must contain a vendor specific implementation of this function.</td>\r
410     </tr>\r
411 </table>\r
412 \r
413 \b core_cm7.h\r
414 <table class="cmtable" summary="">\r
415     <tr>\r
416       <th>\#define</th>\r
417       <th>Value Range</th>\r
418       <th>Default</th>\r
419       <th>Description</th>\r
420     </tr>\r
421     <tr>\r
422       <td>__CM7_REV</td>\r
423       <td>0x0000</td>\r
424       <td>0x0000</td>\r
425       <td>Core revision number ([15:8] revision number, [7:0] patch number)</td>\r
426     </tr>\r
427     <tr>\r
428       <td>__MPU_PRESENT</td>\r
429       <td>0 .. 1</td>\r
430       <td>0</td>\r
431       <td>Defines if a MPU is present or not</td>\r
432     </tr>\r
433     <tr>\r
434       <td>__NVIC_PRIO_BITS</td>\r
435       <td>2 .. 8</td>\r
436       <td>4</td>\r
437       <td>Number of priority bits implemented in the NVIC (device specific)</td>\r
438     </tr>\r
439     <tr>\r
440       <td>__Vendor_SysTickConfig</td>\r
441       <td>0 .. 1</td>\r
442       <td>0</td>\r
443       <td>If this define is set to 1, then the default <b>SysTick_Config</b> function\r
444                 is excluded. In this case, the file <i><b>device.h</b></i>\r
445                 must contain a vendor specific implementation of this function.</td>\r
446     </tr>\r
447     <tr>\r
448       <td>__FPU_PRESENT</td>\r
449       <td>0 .. 1</td>\r
450       <td>0</td>\r
451       <td>Defines if a FPU is present or not. See <b>__FPU_DP</b> description below.</td>\r
452     </tr>\r
453     <tr>\r
454       <td>__FPU_DP</td>\r
455       <td>0 .. 1</td>\r
456       <td>0</td>\r
457       <td>The combination of the defines <b>__FPU_PRESENT</b> and <b>__FPU_DP</b>\r
458          determine the whether the FPU is with single or double precision as shown in the table below.\r
459              \n\n\r
460              <table class="cmtable" summary="">\r
461                  <tr  bgcolor="cyan">\r
462            <td><b>__FPU_PRESENT</b></td>\r
463                    <td><b>__FPU_DP</b></td>\r
464                    <td><b>Description</b></td>\r
465                  </tr>\r
466                  <tr>\r
467                    <td align="center">0</td>\r
468                    <td align="center"><i>ignored</i></td>\r
469                    <td>Processor has no FPU. The value set for <b>__FPU_DP</b> has no influence. </td>\r
470                  </tr>\r
471                  <tr>\r
472                    <td align="center">1</td>\r
473                    <td align="center">0</td>\r
474                    <td>Processor with FPU with single precision. The file <b>ARMCM7_SP.h</b> has preconfigured settings for this combination.</td>\r
475                  </tr>\r
476                  <tr>\r
477                    <td align="center">1</td>\r
478                    <td align="center">1</td>\r
479            <td>Processor with FPU with double precision. The file <b>ARMCM7_DP.h</b> has preconfigured settings for this combination.</td>\r
480                  </tr>\r
481                  </table>\r
482           </td>\r
483     </tr>\r
484     <tr>\r
485       <td>__ICACHE_PRESENT</td>\r
486       <td>0 .. 1</td>\r
487       <td>1</td>\r
488       <td>Instruction Chache present or not</td>\r
489     </tr>\r
490     <tr>\r
491       <td>__DCACHE_PRESENT</td>\r
492       <td>0 .. 1</td>\r
493       <td>1</td>\r
494       <td>Data Chache present or not</td>\r
495     </tr>\r
496     <tr>\r
497       <td>__DTCM_PRESENT</td>\r
498       <td>0 .. 1</td>\r
499       <td>1</td>\r
500       <td>Data Tightly Coupled Memory is present or not</td>\r
501     </tr>\r
502 </table>\r
503 \r
504 \b core_sc000.h\r
505 <table class="cmtable">\r
506     <tr>\r
507       <th>\#define</th>\r
508       <th>Value Range</th>\r
509       <th>Default</th>\r
510       <th>Description</th>\r
511     </tr>\r
512     <tr>\r
513       <td>__SC000_REV</td>\r
514       <td>0x0000</td>\r
515       <td>0x0000</td>\r
516       <td>Core revision number ([15:8] revision number, [7:0] patch number)</td>\r
517     </tr>\r
518     <tr>\r
519       <td>__NVIC_PRIO_BITS</td>\r
520       <td>2</td>\r
521       <td>2</td>\r
522       <td>Number of priority bits implemented in the NVIC (device specific)</td>\r
523     </tr>\r
524     <tr>\r
525       <td>__MPU_PRESENT</td>\r
526       <td>0 .. 1</td>\r
527       <td>0</td>\r
528       <td>Defines if a MPU is present or not</td>\r
529     </tr>\r
530     <tr>\r
531       <td>__Vendor_SysTickConfig</td>\r
532       <td>0 .. 1</td>\r
533       <td>0</td>\r
534       <td>If this define is set to 1, then the default <b>SysTick_Config</b> function\r
535                 is excluded. In this case, the file <i><b>device.h</b></i>\r
536                 must contain a vendor specific implementation of this function.</td>\r
537     </tr>\r
538 </table>\r
539 \r
540 \b core_sc300.h\r
541 <table class="cmtable">\r
542     <tr>\r
543       <th>\#define</th>\r
544       <th>Value Range</th>\r
545       <th>Default</th>\r
546       <th>Description</th>\r
547     </tr>\r
548     <tr>\r
549       <td>__SC300_REV</td>\r
550       <td>0x0000</td>\r
551       <td>0x0000</td>\r
552       <td>Core revision number ([15:8] revision number, [7:0] patch number)</td>\r
553     </tr>\r
554     <tr>\r
555       <td>__NVIC_PRIO_BITS</td>\r
556       <td>2 .. 8</td>\r
557       <td>4</td>\r
558       <td>Number of priority bits implemented in the NVIC (device specific)</td>\r
559     </tr>\r
560     <tr>\r
561       <td>__MPU_PRESENT</td>\r
562       <td>0 .. 1</td>\r
563       <td>0</td>\r
564       <td>Defines if a MPU is present or not</td>\r
565     </tr>\r
566     <tr>\r
567       <td>__Vendor_SysTickConfig</td>\r
568       <td>0 .. 1</td>\r
569       <td>0</td>\r
570       <td>If this define is set to 1, then the default <b>SysTick_Config</b> function\r
571                 is excluded. In this case, the file <i><b>device.h</b></i>\r
572                 must contain a vendor specific implementation of this function.</td>\r
573     </tr>\r
574 </table>\r
575 \r
576 \b core_ARMv8MBL.h\r
577 <table class="cmtable">\r
578     <tr>\r
579       <th>\#define</th>\r
580       <th>Value Range</th>\r
581       <th>Default</th>\r
582       <th>Description</th>\r
583     </tr>\r
584     <tr>\r
585       <td>__ARMv8MBL_REV</td>\r
586       <td>0x0000</td>\r
587       <td>0x0000</td>\r
588       <td>Core revision number ([15:8] revision number, [7:0] patch number)</td>\r
589     </tr>\r
590     <tr>\r
591       <td>__MPU_PRESENT</td>\r
592       <td>0 .. 1</td>\r
593       <td>0</td>\r
594       <td>Defines if a MPU is present or not</td>\r
595     </tr>\r
596     <tr>\r
597       <td>__SAU_PRESENT</td>\r
598       <td>0 .. 1</td>\r
599       <td>0</td>\r
600       <td>Defines if a SAU is present or not</td>\r
601     </tr>\r
602     <tr>\r
603       <td>__VTOR_PRESENT</td>\r
604       <td>0 .. 1</td>\r
605       <td>0</td>\r
606       <td>Defines if a VTOR register is present or not</td>\r
607     </tr>\r
608     <tr>\r
609       <td>__NVIC_PRIO_BITS</td>\r
610       <td>2</td>\r
611       <td>2</td>\r
612       <td>Number of priority bits implemented in the NVIC (device specific)</td>\r
613     </tr>\r
614     <tr>\r
615       <td>__Vendor_SysTickConfig</td>\r
616       <td>0 .. 1</td>\r
617       <td>0</td>\r
618       <td>If this define is set to 1, then the default <b>SysTick_Config</b> function\r
619                 is excluded. In this case, the file <i><b>device.h</b></i>\r
620                 must contain a vendor specific implementation of this function.</td>\r
621     </tr>\r
622 </table>\r
623 \r
624 \b core_ARMv8MML.h\r
625 <table class="cmtable">\r
626     <tr>\r
627       <th>\#define</th>\r
628       <th>Value Range</th>\r
629       <th>Default</th>\r
630       <th>Description</th>\r
631     </tr>\r
632     <tr>\r
633       <td>__ARMv8MML_REV</td>\r
634       <td>0x0000</td>\r
635       <td>0x0000</td>\r
636       <td>Core revision number ([15:8] revision number, [7:0] patch number)</td>\r
637     </tr>\r
638     <tr>\r
639       <td>__MPU_PRESENT</td>\r
640       <td>0 .. 1</td>\r
641       <td>0</td>\r
642       <td>Defines if a MPU is present or not</td>\r
643     </tr>\r
644     <tr>\r
645       <td>__SAU_PRESENT</td>\r
646       <td>0 .. 1</td>\r
647       <td>0</td>\r
648       <td>Defines if a SAU is present or not</td>\r
649     </tr>\r
650     <tr>\r
651       <td>__FPU_PRESENT</td>\r
652       <td>0 .. 1</td>\r
653       <td>0</td>\r
654       <td>Defines if a FPU is present or not</td>\r
655     </tr>\r
656     <tr>\r
657       <td>__NVIC_PRIO_BITS</td>\r
658       <td>2 .. 8</td>\r
659       <td>3</td>\r
660       <td>Number of priority bits implemented in the NVIC (device specific)</td>\r
661     </tr>\r
662     <tr>\r
663       <td>__Vendor_SysTickConfig</td>\r
664       <td>0 .. 1</td>\r
665       <td>0</td>\r
666       <td>If this define is set to 1, then the default <b>SysTick_Config</b> function\r
667                 is excluded. In this case, the file <i><b>device.h</b></i>\r
668                 must contain a vendor specific implementation of this function.</td>\r
669     </tr>\r
670 </table>\r
671 \r
672 \b Example\r
673 \r
674 The following code exemplifies the configuration of the Cortex-M4 Processor and Core Peripherals.\r
675 \r
676 \code\r
677 #define __CM4_REV                 0x0001    /* Core revision r0p1                                 */\r
678 #define __MPU_PRESENT             1         /* MPU present or not                                 */\r
679 #define __NVIC_PRIO_BITS          3         /* Number of Bits used for Priority Levels            */\r
680 #define __Vendor_SysTickConfig    0         /* Set to 1 if different SysTick Config is used       */\r
681 #define __FPU_PRESENT             1         /* FPU present or not                                 */\r
682 .\r
683 .\r
684 #include <core_cm4.h>                       /* Cortex-M4 processor and core peripherals           */\r
685 \endcode\r
686 \r
687 \r
688 \section core_version_sect   CMSIS Version and Processor Information\r
689 \r
690 Defines in the core_<i>cpu</i>.h file identify the version of the CMSIS-CORE and the processor used.\r
691 The following shows the defines in the various core_<i>cpu</i>.h files that may be used in the \ref device_h_pg\r
692 to verify a minimum version or ensure that the right processor core is used.\r
693 \r
694 \b core_cm0.h\r
695 \code\r
696 #define __CM0_CMSIS_VERSION_MAIN  (5U)                                 /* [31:16] CMSIS HAL main version */\r
697 #define __CM0_CMSIS_VERSION_SUB   (0U)                                 /* [15:0]  CMSIS HAL sub version */\r
698 #define __CM0_CMSIS_VERSION       ((__CM0_CMSIS_VERSION_MAIN << 16U) | \\r
699                                     __CM0_CMSIS_VERSION_SUB          ) /* CMSIS HAL version number */\r
700  \r
701 #define __CORTEX_M                (0U)                                 /* Cortex-M Core */\r
702 \endcode\r
703 \r
704 \r
705 \b core_cm0plus.h\r
706 \code\r
707 #define __CM0PLUS_CMSIS_VERSION_MAIN  (5U)                                  /* [31:16] CMSIS HAL main version */\r
708 #define __CM0PLUS_CMSIS_VERSION_SUB   (0U)                                  /* [15:0]  CMSIS HAL sub version */\r
709 #define __CM0PLUS_CMSIS_VERSION       ((__CM0P_CMSIS_VERSION_MAIN << 16U) | \\r
710                                         __CM0P_CMSIS_VERSION_SUB          ) /* CMSIS HAL version number */\r
711  \r
712 #define __CORTEX_M                    (0U)                                  /* Cortex-M Core */\r
713 \endcode\r
714 \r
715 \r
716 \b core_cm3.h\r
717 \code\r
718 #define __CM3_CMSIS_VERSION_MAIN  (5U)                                 /* [31:16] CMSIS HAL main version */\r
719 #define __CM3_CMSIS_VERSION_SUB   (0U)                                 /* [15:0]  CMSIS HAL sub version */\r
720 #define __CM3_CMSIS_VERSION       ((__CM3_CMSIS_VERSION_MAIN << 16U) | \\r
721                                     __CM3_CMSIS_VERSION_SUB          ) /* CMSIS HAL version number */\r
722  \r
723 #define __CORTEX_M                (3U)                                 /* Cortex-M Core */\r
724 \endcode\r
725 \r
726 \b core_cm4.h\r
727 \code\r
728 #define __CM4_CMSIS_VERSION_MAIN  (5U)                                 /* [31:16] CMSIS HAL main version */\r
729 #define __CM4_CMSIS_VERSION_SUB   (0U)                                 /* [15:0]  CMSIS HAL sub version */\r
730 #define __CM4_CMSIS_VERSION       ((__CM4_CMSIS_VERSION_MAIN << 16U) | \\r
731                                     __CM4_CMSIS_VERSION_SUB          ) /* CMSIS HAL version number */\r
732  \r
733 #define __CORTEX_M                (4U)                                 /* Cortex-M Core */\r
734 \endcode\r
735 \r
736 \b core_cm7.h\r
737 \code\r
738 #define __CM7_CMSIS_VERSION_MAIN  (5U)                                 /* [31:16] CMSIS HAL main version */\r
739 #define __CM7_CMSIS_VERSION_SUB   (0U)                                 /* [15:0]  CMSIS HAL sub version */\r
740 #define __CM7_CMSIS_VERSION       ((__CM7_CMSIS_VERSION_MAIN << 16U) | \\r
741                                     __CM7_CMSIS_VERSION_SUB          ) /* CMSIS HAL version number */\r
742  \r
743 #define __CORTEX_M                (7U)                                 /* Cortex-M Core */\r
744 \endcode\r
745 \r
746 \b core_sc000.h\r
747 \code\r
748 #define __SC000_CMSIS_VERSION_MAIN  (5U)                                   /* [31:16] CMSIS HAL main version */\r
749 #define __SC000_CMSIS_VERSION_SUB   (0U)                                   /* [15:0]  CMSIS HAL sub version */\r
750 #define __SC000_CMSIS_VERSION       ((__SC000_CMSIS_VERSION_MAIN << 16U) | \\r
751                                       __SC000_CMSIS_VERSION_SUB          ) /* CMSIS HAL version number */\r
752  \r
753 #define __CORTEX_SC                 (0U)                                   /* Cortex secure core */\r
754 \endcode\r
755 \r
756 \b core_sc300.h\r
757 \code\r
758 #define __SC300_CMSIS_VERSION_MAIN  (5U)                                   /* [31:16] CMSIS HAL main version */\r
759 #define __SC300_CMSIS_VERSION_SUB   (0U)                                   /* [15:0]  CMSIS HAL sub version */\r
760 #define __SC300_CMSIS_VERSION       ((__SC300_CMSIS_VERSION_MAIN << 16U) | \\r
761                                       __SC300_CMSIS_VERSION_SUB          ) /* CMSIS HAL version number */\r
762  \r
763 #define __CORTEX_SC                 (300U)                                 /* Cortex secure core */\r
764 \endcode\r
765 \r
766 \b core_ARMv8MBL.h\r
767 \code\r
768 #define __ARMv8MBL_CMSIS_VERSION_MAIN  (5U)                                       /* [31:16] CMSIS HAL main version */\r
769 #define __ARMv8MBL_CMSIS_VERSION_SUB   (0U)                                       /* [15:0]  CMSIS HAL sub version */\r
770 #define __ARMv8MBL_CMSIS_VERSION       ((__ARMv8MBL_CMSIS_VERSION_MAIN << 16U) | \\r
771                                          __ARMv8MBL_CMSIS_VERSION_SUB           ) /* CMSIS HAL version number */\r
772  \r
773 #define __CORTEX_M                     (tbd)                                      /* Cortex secure core */\r
774 \endcode\r
775 \r
776 \b core_ARMv8MML.h\r
777 \code\r
778 #define __ARMv8MML_CMSIS_VERSION_MAIN  (5U)                                       /* [31:16] CMSIS HAL main version */\r
779 #define __ARMv8MML_CMSIS_VERSION_SUB   (0U)                                       /* [15:0]  CMSIS HAL sub version */\r
780 #define __ARMv8MML_CMSIS_VERSION       ((__ARMv8MML_CMSIS_VERSION_MAIN << 16U) | \\r
781                                          __ARMv8MML_CMSIS_VERSION_SUB           ) /* CMSIS HAL version number */\r
782  \r
783 #define __CORTEX_M                     (tbd)                                      /* Cortex secure core */\r
784 \endcode\r
785 \r
786 \r
787 \section device_access Device Peripheral Access Layer\r
788 \r
789 The \ref device_h_pg contains for each peripheral:\r
790  - Register Layout Typedef\r
791  - Base Address\r
792  - Access Definitions\r
793 \r
794 The section \ref peripheral_gr shows examples for peripheral definitions.\r
795 \r
796 \section device_h_sec Device.h Template File\r
797 \r
798 The silicon vendor needs to extend the Device.h template file with the CMSIS features described above.\r
799 In addition the \ref device_h_pg may contain functions to access device-specific peripherals.\r
800 The \ref system_Device_h_sec which is provided as part of the CMSIS specification is shown below.\r
801 \r
802 \verbinclude "Include\Device.h"\r
803 \r
804 */\r
805 \r
806 \r
807 \r
808 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/\r
809 /**\r
810 \page partition_h_pg System Partition Header File partition_<device>.h\r
811 \r
812 The \ref partition_h_pg contains the initial setup of the TrustZone hardware in an ARMv8-M system.\r
813 The function \ref TZ_SAU_Setup is call from \ref SystemInit and uses the settings in this file to \r
814 initialize the Secure Attribute Unit (SAU) and define non-secure interrupts (register NVIC_INIT_ITNS).\r
815 The following initializations are performed:\r
816 \r
817   - \ref sau_ctrlregister_sec provides settings for the SAU CTRL register.\r
818   - \ref sau_regions_sect provides configuration of the SAU Address Regions.\r
819   - \ref sau_sleepexception_sec provides device-specific deepsleep and exception settings.\r
820   - \ref sau_interrupttarget_sec provides device-specific interrupt target settings.\r
821 \r
822 \section sau_ctrlregister_sec  SAU CTRL register settings\r
823 <table class="cmtable">\r
824     <tr>\r
825       <th>\#define</th>\r
826       <th>Value Range</th>\r
827       <th>Default</th>\r
828       <th>Description</th>\r
829     </tr>\r
830     <tr>\r
831       <td>SAU_INIT_CTRL</td>\r
832       <td>0 .. 1</td>\r
833       <td>0</td>\r
834       <td>Initialize SAU CTRL register or not\r
835            - 0: do not initialize SAU CTRL register\r
836            - 1: initialize SAU CTRL register</td>\r
837     </tr>\r
838     <tr>\r
839       <td>SAU_INIT_CTRL_ENABLE</td>\r
840       <td>0 .. 1</td>\r
841       <td>0</td>\r
842       <td>enable/disable the SAU\r
843            - 0: disable SAU\r
844            - 1: enable SAU</td>\r
845     </tr>\r
846     <tr>\r
847       <td>SAU_INIT_CTRL_ALLNS</td>\r
848       <td>0 .. 1</td>\r
849       <td>0</td>\r
850       <td>value for SAU_CTRL register bit ALLNS\r
851            - 0: all Memory is Secure\r
852            - 1: all Memory is Non-Secure</td>\r
853     </tr>\r
854 </table>\r
855 \r
856 \section sau_regions_sect  Configuration of the SAU Address Regions\r
857 <table class="cmtable">\r
858     <tr>\r
859       <th>\#define</th>\r
860       <th>Value Range</th>\r
861       <th>Default</th>\r
862       <th>Description</th>\r
863     </tr>\r
864     <tr>\r
865       <td>SAU_NO_REGIONS</td>\r
866       <td>0 .. tbd</td>\r
867       <td>4</td>\r
868       <td>maximum number of SAU regions</td>\r
869     </tr>\r
870     <tr>\r
871       <td>SAU_INIT_REGION<number></td>\r
872       <td>0 .. 1</td>\r
873       <td>0</td>\r
874       <td>initialize SAU region or not\r
875            - 0: do not initialize SAU region\r
876            - 1: initialize SAU region</td>\r
877     </tr>\r
878     <tr>\r
879       <td>SAU_INIT_START<number></td>\r
880       <td>0x00000000 .. 0xFFFFFFE0\n\r
881           [in steps of 32]</td>\r
882       <td>0x00000000</td>\r
883       <td>region start address</td>\r
884     </tr>\r
885     <tr>\r
886       <td>SAU_INIT_END<number></td>\r
887       <td>0x00000000 .. 0xFFFFFFE0\n\r
888           [in steps of 32]</td>\r
889       <td>0x00000000</td>\r
890       <td>region start address</td>\r
891     </tr>\r
892     <tr>\r
893       <td>SAU_INIT_NSC<number></td>\r
894       <td>0 .. 1</td>\r
895       <td>0</td>\r
896       <td>SAU region attribute\r
897            - 0: Non-Secure\r
898            - 1: Secure, Non-Secure callable</td>\r
899     </tr>\r
900 </table>\r
901 \r
902 The range of \<number\> is from 0 .. SAU_NO_REGIONS.\r
903 A set of these macros must exist for each \<number\>.\r
904 \r
905 The following example shows a set of SAU region macros.\r
906 \r
907 \code\r
908 #define SAU_NO_REGIONS   4                  /* Max. number of SAU regions */\r
909  \r
910 #define SAU_INIT_REGION0    1\r
911 #define SAU_INIT_START0     0x00000000      /* start address of SAU region 0 */\r
912 #define SAU_INIT_END0       0x001FFFE0      /* end address of SAU region 0 */\r
913 #define SAU_INIT_NSC0       1\r
914  \r
915 #define SAU_INIT_REGION1    1\r
916 #define SAU_INIT_START1     0x00200000      /* start address of SAU region 1 */\r
917 #define SAU_INIT_END1       0x003FFFE0      /* end address of SAU region 1 */\r
918 #define SAU_INIT_NSC1       0\r
919  \r
920 #define SAU_INIT_REGION2    1\r
921 #define SAU_INIT_START2     0x20200000      /* start address of SAU region 2 */\r
922 #define SAU_INIT_END2       0x203FFFE0      /* end address of SAU region 2 */\r
923 #define SAU_INIT_NSC2       0\r
924  \r
925 #define SAU_INIT_REGION3    1\r
926 #define SAU_INIT_START3     0x40000000      /* start address of SAU region 3 */\r
927 #define SAU_INIT_END3       0x40040000      /* end address of SAU region 3 */\r
928 #define SAU_INIT_NSC3       0\r
929 \endcode\r
930 \r
931 \r
932 \section sau_sleepexception_sec  Configuration of Sleep and Exception behaviour\r
933 <table class="cmtable">\r
934     <tr>\r
935       <th>\#define</th>\r
936       <th>Value Range</th>\r
937       <th>Default</th>\r
938       <th>Description</th>\r
939     </tr>\r
940     <tr>\r
941       <td>CSR_INIT_DEEPSLEEPS</td>\r
942       <td>0 .. 1</td>\r
943       <td>0</td>\r
944       <td>value for SCB_CSR register bit DEEPSLEEPS\r
945            - 0: Deep Sleep can be enabled by Secure and Non-Secure state\r
946            - 1: Deep Sleep can be enabled by Secure state only</td>\r
947     </tr>\r
948     <tr>\r
949       <td>AIRCR_INIT_SYSRESETREQS</td>\r
950       <td>0 .. 1</td>\r
951       <td>0</td>\r
952       <td>value for SCB_AIRCR register bit SYSRESETREQS\r
953            - 0: System reset request accessible from Secure and Non-Secure state\r
954            - 1: System reset request accessible from Secure state only</td>\r
955     </tr>\r
956     <tr>\r
957       <td>AIRCR_INIT_PRIS</td>\r
958       <td>0 .. 1</td>\r
959       <td>0</td>\r
960       <td>value for SCB_AIRCR register bit PRIS\r
961            - 0: Priority of Non-Secure exceptions is Not altered\r
962            - 1: Priority of Non-Secure exceptions is Lowered to 0x80-0xFF</td>\r
963     </tr>\r
964     <tr>\r
965       <td>AIRCR_INIT_BFHFNMINS</td>\r
966       <td>0 .. 1</td>\r
967       <td>0</td>\r
968       <td>value for SCB_AIRCR register bit BFHFNMINS\r
969            - 0: BusFault, HardFault, and NMI target are Secure state\r
970            - 1: BusFault, HardFault, and NMI target are Non-Secure state</td>\r
971     </tr>\r
972 </table>\r
973 \r
974 \section sau_interrupttarget_sec Configuration of Interrupt Target settings\r
975 \r
976 Each interrupt has a configuration bit that defines the execution\r
977 in Secure or Non-secure state. The Non-Secure interrupts have a separate\r
978 vector table.  Refer to \ref Model_TrustZone for more information.\r
979 \r
980 <table class="cmtable">\r
981     <tr>\r
982       <th>\#define</th>\r
983       <th>Value Range</th>\r
984       <th>Default</th>\r
985       <th>Description</th>\r
986     </tr>\r
987     <tr>\r
988       <td>NVIC_INIT_ITNS<number></td>\r
989       <td>0x00000000 .. 0xFFFFFFFF\n\r
990           [each bit represents an interrupt]</td>\r
991       <td>0x00000000</td>\r
992       <td>Interrupt vector target\r
993            - 0: Secure state\r
994            - 1: Non-Secure state</td>\r
995     </tr>\r
996 </table>\r
997 \r
998 The range of \<number\> is 0 .. (\<number of external interrupts\> + 31) / 32.\r
999 \r
1000 The following example shows the configuration for a maximum of 64 external interrupts.\r
1001 \r
1002 \code\r
1003 #define NVIC_INIT_ITNS0      0x0000122B\r
1004 #define NVIC_INIT_ITNS1      0x0000003A\r
1005 \endcode\r
1006 \r
1007 \r
1008 */\r
1009 \r
1010 */