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