2 \page templates_pg CMSIS-Core Device Templates
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.
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.
15 The detailed file structure of the CMSIS-Core device templates is shown in the following picture.
17 \image html "CMSIS_CORE_Files.png" "CMSIS-Core File Structure"
19 \section CMSIS_Processor_files CMSIS-Core Processor Files
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_<cpu>.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:
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
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
37 core_sc000.h | for the SecurCore SC000 processor
38 core_sc300.h | for the SecurCore SC300 processor
41 core_armv8mbl.h | for the Armv8-M Baseline processor
42 core_armv8mml.h | for the Armv8-M Mainline processor
44 \section device_examples Device Examples
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>:
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
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
73 ARM SC000 | ARM SC000 | SC000 based device
74 ARM SC300 | ARM SC300 | SC300 based device
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
86 \section template_files_sec Template Files
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.
94 <table class="cmtable">
96 <th>Template File</th>
100 <td>.\\Device\\\_Template_Vendor\\Vendor\\Device\\Source\\ARM\\startup_Device.s</td>
101 <td>Startup file template for Arm C/C++ Compiler.</td>
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>
108 <td>.\\Device\\\_Template_Vendor\\Vendor\\Device\\Source\\IAR\\startup_Device.s</td>
109 <td>Startup file template for IAR C/C++ Compiler.</td>
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>
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>
121 <td>.\\Device\\\_Template_Vendor\\Vendor\\Device\\Include\\system_Device.h</td>
122 <td>Generic system device configuration include file.</td>
127 <b>Adapt Template Files to a Device</b>
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.
135 Each template file contains comments that start with \b ToDo: that describe a required modification.
136 The template files contain place holders:
138 <table class="cmtable">
141 <th>Replaced with</th>
144 <td><Device></td>
145 <td>the specific device name or device family name; i.e. LPC17xx.</td>
148 <td><DeviceInterrupt></td>
149 <td>a specific interrupt name of the device; i.e. TIM1 for Timer 1.</td>
151 <td><DeviceAbbreviation></td>
152 <td>short name or abbreviation of the device family; i.e. LPC.</td>
156 <td>the specific Cortex-M processor name; i.e. Cortex-M3.</td>
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
166 - \subpage partition_h_pg
170 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
172 \page startup_s_pg Startup File startup_<device>.s
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.
180 The file exists for each supported toolchain and is the only tool-chain specific CMSIS file.
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 <interrupt_name>_IRQHandler. This table needs to be consistent with \ref IRQn_Type that defines all the
185 IRQ numbers for each interrupt.
189 The following example shows the extension of the interrupt vector table for the LPC1100 device family.
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
198 DCD EINT1_IRQHandler ; 16+30: PIO INT1
199 DCD EINT0_IRQHandler ; 16+31: PIO INT0
202 EXPORT WAKEUP0_IRQHandler [WEAK]
203 EXPORT WAKEUP1_IRQHandler [WEAK]
204 EXPORT WAKEUP2_IRQHandler [WEAK]
207 EXPORT EINT1_IRQHandler [WEAK]
208 EXPORT EINT0_IRQHandler [WEAK]
221 \section startup_s_sec startup_Device.s Template File
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.
226 \verbinclude "Source\ARM\startup_Device.s"
229 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
231 \page system_c_pg System Configuration Files system_<device>.c and system_<device>.h
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.
237 For devices with external memory BUS the system_<device>.c also configures the BUS system.
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.
242 \section system_Device_sec system_Device.c Template File
244 The \ref system_Device_sec for the Cortex-M3 is shown below.
246 \verbinclude "Source\system_Device.c"
248 \section system_Device_h_sec system_Device.h Template File
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.
253 \verbinclude "Include\system_Device.h"
257 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
259 \page device_h_pg Device Header File <device.h>
261 The \ref device_h_pg contains the following sections that are device specific:
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.
268 <a href="Modules.html">\b Reference </a> describes the standard features and functions of the \ref device_h_pg in detail.
270 \section interrupt_number_sec Interrupt Number Definition
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.
279 The following example shows the extension of the interrupt vector table for the LPC1100 device family.
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 */
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 */
297 EINT1_IRQn = 30, /*!< External Interrupt 1 Interrupt */
298 EINT0_IRQn = 31, /*!< External Interrupt 0 Interrupt */
302 \section core_config_sect Configuration of the Processor and Core Peripherals
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>.
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.
311 <table class="cmtable">
322 <td>Core revision number ([15:8] revision number, [7:0] patch number)</td>
325 <td>__NVIC_PRIO_BITS</td>
328 <td>Number of priority bits implemented in the NVIC (device specific)</td>
331 <td>__Vendor_SysTickConfig</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>
341 <table class="cmtable">
349 <td>__CM0PLUS_REV</td>
352 <td>Core revision number ([15:8] revision number, [7:0] patch number)</td>
355 <td>__NVIC_PRIO_BITS</td>
358 <td>Number of priority bits implemented in the NVIC (device specific)</td>
361 <td>__Vendor_SysTickConfig</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>
371 <table class="cmtable">
380 <td>0x0101 | 0x0200</td>
382 <td>Core revision number ([15:8] revision number, [7:0] patch number)</td>
385 <td>__NVIC_PRIO_BITS</td>
388 <td>Number of priority bits implemented in the NVIC (device specific)</td>
391 <td>__MPU_PRESENT</td>
394 <td>Defines if a MPU is present or not</td>
397 <td>__Vendor_SysTickConfig</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>
407 <table class="cmtable">
418 <td>Core revision number ([15:8] revision number, [7:0] patch number)</td>
421 <td>__NVIC_PRIO_BITS</td>
424 <td>Number of priority bits implemented in the NVIC (device specific)</td>
427 <td>__MPU_PRESENT</td>
430 <td>Defines if a MPU is present or not</td>
433 <td>__FPU_PRESENT</td>
436 <td>Defines if a FPU is present or not</td>
439 <td>__Vendor_SysTickConfig</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>
449 <table class="cmtable" summary="">
460 <td>Core revision number ([15:8] revision number, [7:0] patch number)</td>
463 <td>__MPU_PRESENT</td>
466 <td>Defines if a MPU is present or not</td>
469 <td>__NVIC_PRIO_BITS</td>
472 <td>Number of priority bits implemented in the NVIC (device specific)</td>
475 <td>__Vendor_SysTickConfig</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>
483 <td>__FPU_PRESENT</td>
486 <td>Defines if a FPU is present or not. See <b>__FPU_DP</b> description below.</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.
495 <table class="cmtable" summary="">
497 <td><b>__FPU_PRESENT</b></td>
498 <td><b>__FPU_DP</b></td>
499 <td><b>Description</b></td>
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>
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>
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>
520 <td>__ICACHE_PRESENT</td>
523 <td>Instruction Chache present or not</td>
526 <td>__DCACHE_PRESENT</td>
529 <td>Data Chache present or not</td>
532 <td>__DTCM_PRESENT</td>
535 <td>Data Tightly Coupled Memory is present or not</td>
541 <table class="cmtable">
552 <td>Core revision number ([15:8] revision number, [7:0] patch number)</td>
555 <td>__NVIC_PRIO_BITS</td>
558 <td>Number of priority bits implemented in the NVIC (device specific)</td>
561 <td>__MPU_PRESENT</td>
564 <td>Defines if a MPU is present or not</td>
567 <td>__Vendor_SysTickConfig</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>
579 <table class="cmtable">
590 <td>Core revision number ([15:8] revision number, [7:0] patch number)</td>
593 <td>__NVIC_PRIO_BITS</td>
596 <td>Number of priority bits implemented in the NVIC (device specific)</td>
599 <td>__MPU_PRESENT</td>
602 <td>Defines if a MPU is present or not</td>
605 <td>__Vendor_SysTickConfig</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>
616 \b core_CM23.h or \b core_ARMv8MBL.h
617 <table class="cmtable">
625 <td>__ARMv8MBL_REV</td>
628 <td>Core revision number ([15:8] revision number, [7:0] patch number)</td>
631 <td>__MPU_PRESENT</td>
634 <td>Defines if a MPU is present or not</td>
637 <td>__SAUREGION_PRESENT</td>
640 <td>Defines if SAU regions are present or not</td>
643 <td>__VTOR_PRESENT</td>
646 <td>Defines if a VTOR register is present or not</td>
649 <td>__NVIC_PRIO_BITS</td>
652 <td>Number of priority bits implemented in the NVIC (device specific)</td>
655 <td>__Vendor_SysTickConfig</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>
666 \b core_CM33.h or \b core_cm35p.h or \b core_ARMv8MML.h
667 <table class="cmtable">
675 <td>__ARMv8MML_REV</td>
678 <td>Core revision number ([15:8] revision number, [7:0] patch number)</td>
681 <td>__MPU_PRESENT</td>
684 <td>Defines if a MPU is present or not</td>
687 <td>__SAUREGION_PRESENT</td>
690 <td>Defines if SAU regions are present or not</td>
693 <td>__FPU_PRESENT</td>
696 <td>Defines if a FPU is present or not</td>
699 <td>__NVIC_PRIO_BITS</td>
702 <td>Number of priority bits implemented in the NVIC (device specific)</td>
705 <td>__Vendor_SysTickConfig</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>
717 The following code exemplifies the configuration of the Cortex-M4 Processor and Core Peripherals.
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 */
727 #include <core_cm4.h> /* Cortex-M4 processor and core peripherals */
731 \section core_version_sect CMSIS Version and Processor Information
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.
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 */
744 #define __CORTEX_M (0U) /* Cortex-M Core */
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 */
755 #define __CORTEX_M (0U) /* Cortex-M Core */
761 #define __CM3_CMSIS_VERSION_MAIN (5U) /* [31:16] CMSIS HAL main version */
762 #define __CM3_CMSIS_VERSION_SUB (0U) /* [15:0] CMSIS HAL sub version */
763 #define __CM3_CMSIS_VERSION ((__CM3_CMSIS_VERSION_MAIN << 16U) | \
764 __CM3_CMSIS_VERSION_SUB ) /* CMSIS HAL version number */
766 #define __CORTEX_M (3U) /* Cortex-M Core */
771 #define __CM4_CMSIS_VERSION_MAIN (5U) /* [31:16] CMSIS HAL main version */
772 #define __CM4_CMSIS_VERSION_SUB (0U) /* [15:0] CMSIS HAL sub version */
773 #define __CM4_CMSIS_VERSION ((__CM4_CMSIS_VERSION_MAIN << 16U) | \
774 __CM4_CMSIS_VERSION_SUB ) /* CMSIS HAL version number */
776 #define __CORTEX_M (4U) /* Cortex-M Core */
781 #define __CM7_CMSIS_VERSION_MAIN (5U) /* [31:16] CMSIS HAL main version */
782 #define __CM7_CMSIS_VERSION_SUB (0U) /* [15:0] CMSIS HAL sub version */
783 #define __CM7_CMSIS_VERSION ((__CM7_CMSIS_VERSION_MAIN << 16U) | \
784 __CM7_CMSIS_VERSION_SUB ) /* CMSIS HAL version number */
786 #define __CORTEX_M (7U) /* Cortex-M Core */
792 #define __SC000_CMSIS_VERSION_MAIN (5U) /* [31:16] CMSIS HAL main version */
793 #define __SC000_CMSIS_VERSION_SUB (0U) /* [15:0] CMSIS HAL sub version */
794 #define __SC000_CMSIS_VERSION ((__SC000_CMSIS_VERSION_MAIN << 16U) | \
795 __SC000_CMSIS_VERSION_SUB ) /* CMSIS HAL version number */
797 #define __CORTEX_SC (0U) /* Cortex secure core */
804 #define __SC300_CMSIS_VERSION_MAIN (5U) /* [31:16] CMSIS HAL main version */
805 #define __SC300_CMSIS_VERSION_SUB (0U) /* [15:0] CMSIS HAL sub version */
806 #define __SC300_CMSIS_VERSION ((__SC300_CMSIS_VERSION_MAIN << 16U) | \
807 __SC300_CMSIS_VERSION_SUB ) /* CMSIS HAL version number */
809 #define __CORTEX_SC (300U) /* Cortex secure core */
816 #define __ARMv8MBL_CMSIS_VERSION_MAIN (5U) /* [31:16] CMSIS HAL main version */
817 #define __ARMv8MBL_CMSIS_VERSION_SUB (0U) /* [15:0] CMSIS HAL sub version */
818 #define __ARMv8MBL_CMSIS_VERSION ((__ARMv8MBL_CMSIS_VERSION_MAIN << 16U) | \
819 __ARMv8MBL_CMSIS_VERSION_SUB ) /* CMSIS HAL version number */
821 #define __CORTEX_M (tbd) /* Cortex secure core */
828 #define __ARMv8MML_CMSIS_VERSION_MAIN (5U) /* [31:16] CMSIS HAL main version */
829 #define __ARMv8MML_CMSIS_VERSION_SUB (0U) /* [15:0] CMSIS HAL sub version */
830 #define __ARMv8MML_CMSIS_VERSION ((__ARMv8MML_CMSIS_VERSION_MAIN << 16U) | \
831 __ARMv8MML_CMSIS_VERSION_SUB ) /* CMSIS HAL version number */
833 #define __CORTEX_M (tbd) /* Cortex secure core */
837 \section device_access Device Peripheral Access Layer
839 The \ref device_h_pg contains for each peripheral:
840 - Register Layout Typedef
844 The section \ref peripheral_gr shows examples for peripheral definitions.
846 \section device_h_sec Device.h Template File
848 The silicon vendor needs to extend the Device.h template file with the CMSIS features described above.
849 In addition the \ref device_h_pg may contain functions to access device-specific peripherals.
850 The \ref system_Device_h_sec which is provided as part of the CMSIS specification is shown below.
852 \verbinclude "Include\Device.h"
858 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
860 \if ARMv8M \page partition_h_pg System Partition Header File partition_<device>.h
862 The \ref partition_h_pg contains the initial setup of the TrustZone hardware in an Armv8-M system.
863 The function \ref TZ_SAU_Setup is call from \ref SystemInit and uses the settings in this file to
864 initialize the Secure Attribute Unit (SAU) and define non-secure interrupts (register NVIC_INIT_ITNS).
865 The following initializations are performed:
867 - \ref sau_ctrlregister_sec provides settings for the SAU CTRL register.
868 - \ref sau_regions_sect provides configuration of the SAU Address Regions.
869 - \ref sau_sleepexception_sec provides device-specific deepsleep and exception settings.
870 - \ref sau_interrupttarget_sec provides device-specific interrupt target settings.
872 \section sau_ctrlregister_sec SAU CTRL register settings
873 <table class="cmtable">
881 <td>SAU_INIT_CTRL</td>
884 <td>Initialize SAU CTRL register or not
885 - 0: do not initialize SAU CTRL register
886 - 1: initialize SAU CTRL register</td>
889 <td>SAU_INIT_CTRL_ENABLE</td>
892 <td>enable/disable the SAU
897 <td>SAU_INIT_CTRL_ALLNS</td>
900 <td>value for SAU_CTRL register bit ALLNS
901 - 0: all Memory is Secure
902 - 1: all Memory is Non-Secure</td>
906 \section sau_regions_sect Configuration of the SAU Address Regions
907 <table class="cmtable">
915 <td>SAU_REGIONS_MAX</td>
918 <td>maximum number of SAU regions</td>
921 <td>SAU_INIT_REGION<number></td>
924 <td>initialize SAU region or not
925 - 0: do not initialize SAU region
926 - 1: initialize SAU region</td>
929 <td>SAU_INIT_START<number></td>
930 <td>0x00000000 .. 0xFFFFFFE0\n
931 [in steps of 32]</td>
933 <td>region start address</td>
936 <td>SAU_INIT_END<number></td>
937 <td>0x00000000 .. 0xFFFFFFE0\n
938 [in steps of 32]</td>
940 <td>region start address</td>
943 <td>SAU_INIT_NSC<number></td>
946 <td>SAU region attribute
948 - 1: Secure, Non-Secure callable</td>
952 The range of \<number\> is from 0 .. SAU_REGIONS_MAX.
953 A set of these macros must exist for each \<number\>.
955 The following example shows a set of SAU region macros.
958 #define SAU_REGIONS_MAX 8 /* Max. number of SAU regions */
960 #define SAU_INIT_REGION0 1
961 #define SAU_INIT_START0 0x00000000 /* start address of SAU region 0 */
962 #define SAU_INIT_END0 0x001FFFE0 /* end address of SAU region 0 */
963 #define SAU_INIT_NSC0 1
965 #define SAU_INIT_REGION1 1
966 #define SAU_INIT_START1 0x00200000 /* start address of SAU region 1 */
967 #define SAU_INIT_END1 0x003FFFE0 /* end address of SAU region 1 */
968 #define SAU_INIT_NSC1 0
970 #define SAU_INIT_REGION2 1
971 #define SAU_INIT_START2 0x20200000 /* start address of SAU region 2 */
972 #define SAU_INIT_END2 0x203FFFE0 /* end address of SAU region 2 */
973 #define SAU_INIT_NSC2 0
975 #define SAU_INIT_REGION3 1
976 #define SAU_INIT_START3 0x40000000 /* start address of SAU region 3 */
977 #define SAU_INIT_END3 0x40040000 /* end address of SAU region 3 */
978 #define SAU_INIT_NSC3 0
980 #define SAU_INIT_REGION4 0
981 #define SAU_INIT_START4 0x00000000 /* start address of SAU region 4 */
982 #define SAU_INIT_END4 0x00000000 /* end address of SAU region 4 */
983 #define SAU_INIT_NSC4 0
985 #define SAU_INIT_REGION5 0
986 #define SAU_INIT_START5 0x00000000 /* start address of SAU region 5 */
987 #define SAU_INIT_END5 0x00000000 /* end address of SAU region 5 */
988 #define SAU_INIT_NSC5 0
990 #define SAU_INIT_REGION6 0
991 #define SAU_INIT_START6 0x00000000 /* start address of SAU region 6 */
992 #define SAU_INIT_END6 0x00000000 /* end address of SAU region 6 */
993 #define SAU_INIT_NSC6 0
995 #define SAU_INIT_REGION7 0
996 #define SAU_INIT_START7 0x00000000 /* start address of SAU region 7 */
997 #define SAU_INIT_END7 0x00000000 /* end address of SAU region 7 */
998 #define SAU_INIT_NSC7 0
1002 \section sau_sleepexception_sec Configuration of Sleep and Exception behaviour
1003 <table class="cmtable">
1006 <th>Value Range</th>
1008 <th>Description</th>
1011 <td>CSR_INIT_DEEPSLEEPS</td>
1014 <td>value for SCB_CSR register bit DEEPSLEEPS
1015 - 0: Deep Sleep can be enabled by Secure and Non-Secure state
1016 - 1: Deep Sleep can be enabled by Secure state only</td>
1019 <td>AIRCR_INIT_SYSRESETREQS</td>
1022 <td>value for SCB_AIRCR register bit SYSRESETREQS
1023 - 0: System reset request accessible from Secure and Non-Secure state
1024 - 1: System reset request accessible from Secure state only</td>
1027 <td>AIRCR_INIT_PRIS</td>
1030 <td>value for SCB_AIRCR register bit PRIS
1031 - 0: Priority of Non-Secure exceptions is Not altered
1032 - 1: Priority of Non-Secure exceptions is Lowered to 0x80-0xFF</td>
1035 <td>AIRCR_INIT_BFHFNMINS</td>
1038 <td>value for SCB_AIRCR register bit BFHFNMINS
1039 - 0: BusFault, HardFault, and NMI target are Secure state
1040 - 1: BusFault, HardFault, and NMI target are Non-Secure state</td>
1044 \section sau_interrupttarget_sec Configuration of Interrupt Target settings
1046 Each interrupt has a configuration bit that defines the execution
1047 in Secure or Non-secure state. The Non-Secure interrupts have a separate
1048 vector table. Refer to \ref Model_TrustZone for more information.
1050 <table class="cmtable">
1053 <th>Value Range</th>
1055 <th>Description</th>
1058 <td>NVIC_INIT_ITNS<number></td>
1059 <td>0x00000000 .. 0xFFFFFFFF\n
1060 [each bit represents an interrupt]</td>
1062 <td>Interrupt vector target
1064 - 1: Non-Secure state</td>
1068 The range of \<number\> is 0 .. (\<number of external interrupts\> + 31) / 32.
1070 The following example shows the configuration for a maximum of 64 external interrupts.
1073 #define NVIC_INIT_ITNS0 0x0000122B
1074 #define NVIC_INIT_ITNS1 0x0000003A