2 \page templates_pg Template Files
6 ARM supplies CMSIS-CORE 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 These template files include the following:
9 - Register names of the Core Peripherals and names of the Core Exception Vectors.
10 - Functions to access core peripherals, special CPU instructions and SIMD instructions (for Cortex-M4 and Cortex-M7)
11 - Generic startup code and system configuration code.
13 The detailed file structure of the CMSIS-CORE is shown in the following picture.
15 \image html "CMSIS_CORE_Files.png" "CMSIS-CORE File Structure"
18 \section template_files_sec Template Files
20 The CMSIS-CORE template files should be extended by the silicon vendor to reflect the actual device and device peripherals.
21 Silicon vendors add in this context the:
22 - <b>Device Peripheral Access Layer</b> that provides definitions for device-specific peripherals.
23 - <b>Access Functions for Peripherals</b> (optional) that provides additional helper functions to access device-specific peripherals.
24 - <b>Interrupt vectors</b> in the startup file that are device specific.
26 <table class="cmtable">
28 <th>Template File</th>
32 <td>.\\Device\\\_Template_Vendor\\Vendor\\Device\\Source\\ARM\\startup_Device.s</td>
33 <td>Startup file template for ARM C/C++ Compiler.</td>
36 <td>.\\Device\\\_Template_Vendor\\Vendor\\Device\\Source\\GCC\\startup_Device.s</td>
37 <td>Startup file template for GNU GCC ARM Embedded Compiler.</td>
40 <td>.\\Device\\\_Template_Vendor\\Vendor\\Device\\Source\\IAR\\startup_Device.s</td>
41 <td>Startup file template for IAR C/C++ Compiler.</td>
44 <td>.\\Device\\\_Template_Vendor\\Vendor\\Device\\Source\\system_Device.c</td>
45 <td>Generic system_Device.c file for system configuration (i.e. processor clock and memory bus system).</td>
48 <td>.\\Device\\\_Template_Vendor\\Vendor\\Device\\Include\\Device.h</td>
49 <td>Generic device header file. Needs to be extended with the device-specific peripheral registers. Optionally functions that access the peripherals
50 can be part of that file.</td>
53 <td>.\\Device\\\_Template_Vendor\\Vendor\\Device\\Include\\system_Device.h</td>
54 <td>Generic system device configuration include file.</td>
59 In addition ARM provides the following core header files that do not need any modifications.
61 <table class="cmtable">
63 <th>Core Header Files</th>
67 <td><b>core_<cpu>.h</b></td>
68 <td>Defines the core peripherals and provides helper functions that access the core registers. This file is available for all supported processors:
69 - core_cm0.h: for the Cortex-M0 processor
70 - core_cm0plus.h: for the Cortex-M0+ processor
71 - core_cm3.h: for the Cortex-M3 processor
72 - core_cm4.h: for the Cortex-M4 processor
73 - core_cm7.h: for the Cortex-M7 processor
74 - core_sc000.h: for the SecurCore SC000 processor
75 - core_sc300.h: for the SecurCore SC300 processor
76 - core_armv8mbl.h: for the ARMv8-M Baseline processor
77 - core_armv8mml.h: for the ARMv8-M Mainline processor
83 \section adapt_template_files_sec Adaption of Template Files to Devices
85 Copy the complete folder including files and replace:
86 - folder name 'Vendor' with the abbreviation for the device vendor e.g.: NXP.
87 - folder name 'Device' with the specific device name e.g.: LPC17xx.
88 - in the filenames 'Device' with the specific device name e.g.: LPC17xx.
90 Each template file contains comments that start with \b ToDo: that describe a required modification.
91 The template files contain placeholders:
93 <table class="cmtable">
96 <th>Replaced with</th>
99 <td><Device></td>
100 <td>the specific device name or device family name; i.e. LPC17xx.</td>
103 <td><DeviceInterrupt></td>
104 <td>a specific interrupt name of the device; i.e. TIM1 for Timer 1.</td>
106 <td><DeviceAbbreviation></td>
107 <td>short name or abbreviation of the device family; i.e. LPC.</td>
111 <td>the specific Cortex-M processor name; i.e. Cortex-M3.</td>
116 The adaption of the template files is described in detail on the following pages:
117 - \subpage startup_s_pg
118 - \subpage system_c_pg
119 - \subpage device_h_pg
120 - \subpage partition_h_pg
123 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
125 \page startup_s_pg Startup File startup_<device>.s
127 The \ref startup_s_pg contains:
128 - The reset handler which is executed after CPU reset and typically calls the \ref SystemInit function.
129 - The setup values for the Main Stack Pointer (MSP).
130 - Exception vectors of the Cortex-M Processor with weak functions that implement default routines.
131 - Interrupt vectors that are device specific with weak functions that implement default routines.
133 The file exists for each supported toolchain and is the only tool-chain specific CMSIS file.
135 To adapt the file to a new device only the interrupt vector table needs to be extended with
136 the device-specific interrupt handlers. The naming convention for the interrupt handler names are
137 <interrupt_name>_IRQHandler. This table needs to be consistent with \ref IRQn_Type that defines all the
138 IRQ numbers for each interrupt.
142 The following example shows the extension of the interrupt vector table for the LPC1100 device family.
145 ; External Interrupts
146 DCD WAKEUP0_IRQHandler ; 16+ 0: Wakeup PIO0.0
147 DCD WAKEUP1_IRQHandler ; 16+ 1: Wakeup PIO0.1
148 DCD WAKEUP2_IRQHandler ; 16+ 2: Wakeup PIO0.2
151 DCD EINT1_IRQHandler ; 16+30: PIO INT1
152 DCD EINT0_IRQHandler ; 16+31: PIO INT0
155 EXPORT WAKEUP0_IRQHandler [WEAK]
156 EXPORT WAKEUP1_IRQHandler [WEAK]
157 EXPORT WAKEUP2_IRQHandler [WEAK]
160 EXPORT EINT1_IRQHandler [WEAK]
161 EXPORT EINT0_IRQHandler [WEAK]
174 \section startup_s_sec startup_Device.s Template File
176 An ARM Compiler \ref startup_s_sec for an ARMv7-M processor like Cortex-M3 is shown below.
177 The files for other compiler vendors differ slightly in the syntax, but not in the overall structure.
179 \verbinclude "Source\ARM\startup_Device.s"
182 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
184 \page system_c_pg System Configuration Files system_<device>.c and system_<device>.h
186 The \ref system_c_pg provides as a minimum the functions described under \ref system_init_gr.
187 These functions are device specific and need adaptations. In addition, the file might have
188 configuration settings for the device such as XTAL frequency or PLL prescaler settings.
190 For devices with external memory BUS the system_<device>.c also configures the BUS system.
192 The silicon vendor might expose other functions (i.e. for power configuration) in the system_<device>.c file.
193 In case of additional features the function prototypes need to be added to the system_<device>.h header file.
195 \section system_Device_sec system_Device.c Template File
197 The \ref system_Device_sec for the Cortex-M3 is shown below.
199 \verbinclude "Source\system_Device.c"
201 \section system_Device_h_sec system_Device.h Template File
203 The system_<device>.h header file contains prototypes to access the public functions in the system_<device>.c file.
204 The \ref system_Device_h_sec is shown below.
206 \verbinclude "Include\system_Device.h"
210 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
212 \page device_h_pg Device Header File <device.h>
214 The \ref device_h_pg contains the following sections that are device specific:
216 - \ref interrupt_number_sec provides interrupt numbers (IRQn) for all exceptions and interrupts of the device.
217 - \ref core_config_sect reflect the features of the device.
218 - \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.
219 - <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.
221 <a href="Modules.html">\b Reference </a> describes the standard features and functions of the \ref device_h_pg in detail.
223 \section interrupt_number_sec Interrupt Number Definition
225 \ref device_h_pg contains the enumeration \ref IRQn_Type that defines all exceptions and interrupts of the device.
226 - Negative IRQn values represent processor core exceptions (internal interrupts).
227 - Positive IRQn values represent device-specific exceptions (external interrupts). The first device-specific interrupt has the IRQn value 0.
228 The IRQn values needs extension to reflect the device-specific interrupt vector table in the \ref startup_s_pg.
232 The following example shows the extension of the interrupt vector table for the LPC1100 device family.
237 /****** Cortex-M0 Processor Exceptions Numbers ***************************************************/
238 NonMaskableInt_IRQn = -14, /*!< 2 Non Maskable Interrupt */
239 HardFault_IRQn = -13, /*!< 3 Cortex-M0 Hard Fault Interrupt */
240 SVCall_IRQn = -5, /*!< 11 Cortex-M0 SV Call Interrupt */
241 PendSV_IRQn = -2, /*!< 14 Cortex-M0 Pend SV Interrupt */
242 SysTick_IRQn = -1, /*!< 15 Cortex-M0 System Tick Interrupt */
244 /****** LPC11xx/LPC11Cxx Specific Interrupt Numbers **********************************************/
245 WAKEUP0_IRQn = 0, /*!< All I/O pins can be used as wakeup source. */
246 WAKEUP1_IRQn = 1, /*!< There are 13 pins in total for LPC11xx */
250 EINT1_IRQn = 30, /*!< External Interrupt 1 Interrupt */
251 EINT0_IRQn = 31, /*!< External Interrupt 0 Interrupt */
255 \section core_config_sect Configuration of the Processor and Core Peripherals
257 The \ref device_h_pg configures the Cortex-M or SecurCore processor and the core peripherals with <i>\#defines</i>
258 that are set prior to including the file <b>core_<cpu>.h</b>.
260 The following tables list the <i>\#defines</i> along with the possible values for each processor core.
261 If these <i>\#defines</i> are missing default values are used.
264 <table class="cmtable">
275 <td>Core revision number ([15:8] revision number, [7:0] patch number)</td>
278 <td>__NVIC_PRIO_BITS</td>
281 <td>Number of priority bits implemented in the NVIC (device specific)</td>
284 <td>__Vendor_SysTickConfig</td>
287 <td>If this define is set to 1, then the default <b>SysTick_Config</b> function
288 is excluded. In this case, the file <i><b>device.h</b></i>
289 must contain a vendor specific implementation of this function.</td>
294 <table class="cmtable">
302 <td>__CM0PLUS_REV</td>
305 <td>Core revision number ([15:8] revision number, [7:0] patch number)</td>
308 <td>__NVIC_PRIO_BITS</td>
311 <td>Number of priority bits implemented in the NVIC (device specific)</td>
314 <td>__Vendor_SysTickConfig</td>
317 <td>If this define is set to 1, then the default <b>SysTick_Config</b> function
318 is excluded. In this case, the file <i><b>device.h</b></i>
319 must contain a vendor specific implementation of this function.</td>
324 <table class="cmtable">
333 <td>0x0101 | 0x0200</td>
335 <td>Core revision number ([15:8] revision number, [7:0] patch number)</td>
338 <td>__NVIC_PRIO_BITS</td>
341 <td>Number of priority bits implemented in the NVIC (device specific)</td>
344 <td>__MPU_PRESENT</td>
347 <td>Defines if a MPU is present or not</td>
350 <td>__Vendor_SysTickConfig</td>
353 <td>If this define is set to 1, then the default <b>SysTick_Config</b> function
354 is excluded. In this case, the file <i><b>device.h</b></i>
355 must contain a vendor specific implementation of this function.</td>
360 <table class="cmtable">
371 <td>Core revision number ([15:8] revision number, [7:0] patch number)</td>
374 <td>__NVIC_PRIO_BITS</td>
377 <td>Number of priority bits implemented in the NVIC (device specific)</td>
380 <td>__MPU_PRESENT</td>
383 <td>Defines if a MPU is present or not</td>
386 <td>__FPU_PRESENT</td>
389 <td>Defines if a FPU is present or not</td>
392 <td>__Vendor_SysTickConfig</td>
395 <td>If this define is set to 1, then the default <b>SysTick_Config</b> function
396 is excluded. In this case, the file <i><b>device.h</b></i>
397 must contain a vendor specific implementation of this function.</td>
402 <table class="cmtable" summary="">
413 <td>Core revision number ([15:8] revision number, [7:0] patch number)</td>
416 <td>__MPU_PRESENT</td>
419 <td>Defines if a MPU is present or not</td>
422 <td>__NVIC_PRIO_BITS</td>
425 <td>Number of priority bits implemented in the NVIC (device specific)</td>
428 <td>__Vendor_SysTickConfig</td>
431 <td>If this define is set to 1, then the default <b>SysTick_Config</b> function
432 is excluded. In this case, the file <i><b>device.h</b></i>
433 must contain a vendor specific implementation of this function.</td>
436 <td>__FPU_PRESENT</td>
439 <td>Defines if a FPU is present or not. See <b>__FPU_DP</b> description below.</td>
445 <td>The combination of the defines <b>__FPU_PRESENT</b> and <b>__FPU_DP</b>
446 determine the whether the FPU is with single or double precision as shown in the table below.
448 <table class="cmtable" summary="">
450 <td><b>__FPU_PRESENT</b></td>
451 <td><b>__FPU_DP</b></td>
452 <td><b>Description</b></td>
455 <td align="center">0</td>
456 <td align="center"><i>ignored</i></td>
457 <td>Processor has no FPU. The value set for <b>__FPU_DP</b> has no influence. </td>
460 <td align="center">1</td>
461 <td align="center">0</td>
462 <td>Processor with FPU with single precision. The file <b>ARMCM7_SP.h</b> has preconfigured settings for this combination.</td>
465 <td align="center">1</td>
466 <td align="center">1</td>
467 <td>Processor with FPU with double precision. The file <b>ARMCM7_DP.h</b> has preconfigured settings for this combination.</td>
473 <td>__ICACHE_PRESENT</td>
476 <td>Instruction Chache present or not</td>
479 <td>__DCACHE_PRESENT</td>
482 <td>Data Chache present or not</td>
485 <td>__DTCM_PRESENT</td>
488 <td>Data Tightly Coupled Memory is present or not</td>
493 <table class="cmtable">
504 <td>Core revision number ([15:8] revision number, [7:0] patch number)</td>
507 <td>__NVIC_PRIO_BITS</td>
510 <td>Number of priority bits implemented in the NVIC (device specific)</td>
513 <td>__MPU_PRESENT</td>
516 <td>Defines if a MPU is present or not</td>
519 <td>__Vendor_SysTickConfig</td>
522 <td>If this define is set to 1, then the default <b>SysTick_Config</b> function
523 is excluded. In this case, the file <i><b>device.h</b></i>
524 must contain a vendor specific implementation of this function.</td>
529 <table class="cmtable">
540 <td>Core revision number ([15:8] revision number, [7:0] patch number)</td>
543 <td>__NVIC_PRIO_BITS</td>
546 <td>Number of priority bits implemented in the NVIC (device specific)</td>
549 <td>__MPU_PRESENT</td>
552 <td>Defines if a MPU is present or not</td>
555 <td>__Vendor_SysTickConfig</td>
558 <td>If this define is set to 1, then the default <b>SysTick_Config</b> function
559 is excluded. In this case, the file <i><b>device.h</b></i>
560 must contain a vendor specific implementation of this function.</td>
565 <table class="cmtable">
573 <td>__ARMv8MBL_REV</td>
576 <td>Core revision number ([15:8] revision number, [7:0] patch number)</td>
579 <td>__MPU_PRESENT</td>
582 <td>Defines if a MPU is present or not</td>
585 <td>__SAUREGION_PRESENT</td>
588 <td>Defines if SAU regions are present or not</td>
591 <td>__VTOR_PRESENT</td>
594 <td>Defines if a VTOR register is present or not</td>
597 <td>__NVIC_PRIO_BITS</td>
600 <td>Number of priority bits implemented in the NVIC (device specific)</td>
603 <td>__Vendor_SysTickConfig</td>
606 <td>If this define is set to 1, then the default <b>SysTick_Config</b> function
607 is excluded. In this case, the file <i><b>device.h</b></i>
608 must contain a vendor specific implementation of this function.</td>
613 <table class="cmtable">
621 <td>__ARMv8MML_REV</td>
624 <td>Core revision number ([15:8] revision number, [7:0] patch number)</td>
627 <td>__MPU_PRESENT</td>
630 <td>Defines if a MPU is present or not</td>
633 <td>__SAUREGION_PRESENT</td>
636 <td>Defines if SAU regions are present or not</td>
639 <td>__FPU_PRESENT</td>
642 <td>Defines if a FPU is present or not</td>
645 <td>__NVIC_PRIO_BITS</td>
648 <td>Number of priority bits implemented in the NVIC (device specific)</td>
651 <td>__Vendor_SysTickConfig</td>
654 <td>If this define is set to 1, then the default <b>SysTick_Config</b> function
655 is excluded. In this case, the file <i><b>device.h</b></i>
656 must contain a vendor specific implementation of this function.</td>
662 The following code exemplifies the configuration of the Cortex-M4 Processor and Core Peripherals.
665 #define __CM4_REV 0x0001 /* Core revision r0p1 */
666 #define __MPU_PRESENT 1 /* MPU present or not */
667 #define __NVIC_PRIO_BITS 3 /* Number of Bits used for Priority Levels */
668 #define __Vendor_SysTickConfig 0 /* Set to 1 if different SysTick Config is used */
669 #define __FPU_PRESENT 1 /* FPU present or not */
672 #include <core_cm4.h> /* Cortex-M4 processor and core peripherals */
676 \section core_version_sect CMSIS Version and Processor Information
678 Defines in the core_<i>cpu</i>.h file identify the version of the CMSIS-CORE and the processor used.
679 The following shows the defines in the various core_<i>cpu</i>.h files that may be used in the \ref device_h_pg
680 to verify a minimum version or ensure that the right processor core is used.
684 #define __CM0_CMSIS_VERSION_MAIN (5U) /* [31:16] CMSIS HAL main version */
685 #define __CM0_CMSIS_VERSION_SUB (0U) /* [15:0] CMSIS HAL sub version */
686 #define __CM0_CMSIS_VERSION ((__CM0_CMSIS_VERSION_MAIN << 16U) | \
687 __CM0_CMSIS_VERSION_SUB ) /* CMSIS HAL version number */
689 #define __CORTEX_M (0U) /* Cortex-M Core */
695 #define __CM0PLUS_CMSIS_VERSION_MAIN (5U) /* [31:16] CMSIS HAL main version */
696 #define __CM0PLUS_CMSIS_VERSION_SUB (0U) /* [15:0] CMSIS HAL sub version */
697 #define __CM0PLUS_CMSIS_VERSION ((__CM0P_CMSIS_VERSION_MAIN << 16U) | \
698 __CM0P_CMSIS_VERSION_SUB ) /* CMSIS HAL version number */
700 #define __CORTEX_M (0U) /* Cortex-M Core */
706 #define __CM3_CMSIS_VERSION_MAIN (5U) /* [31:16] CMSIS HAL main version */
707 #define __CM3_CMSIS_VERSION_SUB (0U) /* [15:0] CMSIS HAL sub version */
708 #define __CM3_CMSIS_VERSION ((__CM3_CMSIS_VERSION_MAIN << 16U) | \
709 __CM3_CMSIS_VERSION_SUB ) /* CMSIS HAL version number */
711 #define __CORTEX_M (3U) /* Cortex-M Core */
716 #define __CM4_CMSIS_VERSION_MAIN (5U) /* [31:16] CMSIS HAL main version */
717 #define __CM4_CMSIS_VERSION_SUB (0U) /* [15:0] CMSIS HAL sub version */
718 #define __CM4_CMSIS_VERSION ((__CM4_CMSIS_VERSION_MAIN << 16U) | \
719 __CM4_CMSIS_VERSION_SUB ) /* CMSIS HAL version number */
721 #define __CORTEX_M (4U) /* Cortex-M Core */
726 #define __CM7_CMSIS_VERSION_MAIN (5U) /* [31:16] CMSIS HAL main version */
727 #define __CM7_CMSIS_VERSION_SUB (0U) /* [15:0] CMSIS HAL sub version */
728 #define __CM7_CMSIS_VERSION ((__CM7_CMSIS_VERSION_MAIN << 16U) | \
729 __CM7_CMSIS_VERSION_SUB ) /* CMSIS HAL version number */
731 #define __CORTEX_M (7U) /* Cortex-M Core */
736 #define __SC000_CMSIS_VERSION_MAIN (5U) /* [31:16] CMSIS HAL main version */
737 #define __SC000_CMSIS_VERSION_SUB (0U) /* [15:0] CMSIS HAL sub version */
738 #define __SC000_CMSIS_VERSION ((__SC000_CMSIS_VERSION_MAIN << 16U) | \
739 __SC000_CMSIS_VERSION_SUB ) /* CMSIS HAL version number */
741 #define __CORTEX_SC (0U) /* Cortex secure core */
746 #define __SC300_CMSIS_VERSION_MAIN (5U) /* [31:16] CMSIS HAL main version */
747 #define __SC300_CMSIS_VERSION_SUB (0U) /* [15:0] CMSIS HAL sub version */
748 #define __SC300_CMSIS_VERSION ((__SC300_CMSIS_VERSION_MAIN << 16U) | \
749 __SC300_CMSIS_VERSION_SUB ) /* CMSIS HAL version number */
751 #define __CORTEX_SC (300U) /* Cortex secure core */
756 #define __ARMv8MBL_CMSIS_VERSION_MAIN (5U) /* [31:16] CMSIS HAL main version */
757 #define __ARMv8MBL_CMSIS_VERSION_SUB (0U) /* [15:0] CMSIS HAL sub version */
758 #define __ARMv8MBL_CMSIS_VERSION ((__ARMv8MBL_CMSIS_VERSION_MAIN << 16U) | \
759 __ARMv8MBL_CMSIS_VERSION_SUB ) /* CMSIS HAL version number */
761 #define __CORTEX_M (tbd) /* Cortex secure core */
766 #define __ARMv8MML_CMSIS_VERSION_MAIN (5U) /* [31:16] CMSIS HAL main version */
767 #define __ARMv8MML_CMSIS_VERSION_SUB (0U) /* [15:0] CMSIS HAL sub version */
768 #define __ARMv8MML_CMSIS_VERSION ((__ARMv8MML_CMSIS_VERSION_MAIN << 16U) | \
769 __ARMv8MML_CMSIS_VERSION_SUB ) /* CMSIS HAL version number */
771 #define __CORTEX_M (tbd) /* Cortex secure core */
775 \section device_access Device Peripheral Access Layer
777 The \ref device_h_pg contains for each peripheral:
778 - Register Layout Typedef
782 The section \ref peripheral_gr shows examples for peripheral definitions.
784 \section device_h_sec Device.h Template File
786 The silicon vendor needs to extend the Device.h template file with the CMSIS features described above.
787 In addition the \ref device_h_pg may contain functions to access device-specific peripherals.
788 The \ref system_Device_h_sec which is provided as part of the CMSIS specification is shown below.
790 \verbinclude "Include\Device.h"
796 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
798 \page partition_h_pg System Partition Header File partition_<device>.h
800 The \ref partition_h_pg contains the initial setup of the TrustZone hardware in an ARMv8-M system.
801 The function \ref TZ_SAU_Setup is call from \ref SystemInit and uses the settings in this file to
802 initialize the Secure Attribute Unit (SAU) and define non-secure interrupts (register NVIC_INIT_ITNS).
803 The following initializations are performed:
805 - \ref sau_ctrlregister_sec provides settings for the SAU CTRL register.
806 - \ref sau_regions_sect provides configuration of the SAU Address Regions.
807 - \ref sau_sleepexception_sec provides device-specific deepsleep and exception settings.
808 - \ref sau_interrupttarget_sec provides device-specific interrupt target settings.
810 \section sau_ctrlregister_sec SAU CTRL register settings
811 <table class="cmtable">
819 <td>SAU_INIT_CTRL</td>
822 <td>Initialize SAU CTRL register or not
823 - 0: do not initialize SAU CTRL register
824 - 1: initialize SAU CTRL register</td>
827 <td>SAU_INIT_CTRL_ENABLE</td>
830 <td>enable/disable the SAU
835 <td>SAU_INIT_CTRL_ALLNS</td>
838 <td>value for SAU_CTRL register bit ALLNS
839 - 0: all Memory is Secure
840 - 1: all Memory is Non-Secure</td>
844 \section sau_regions_sect Configuration of the SAU Address Regions
845 <table class="cmtable">
853 <td>SAU_REGIONS_MAX</td>
856 <td>maximum number of SAU regions</td>
859 <td>SAU_INIT_REGION<number></td>
862 <td>initialize SAU region or not
863 - 0: do not initialize SAU region
864 - 1: initialize SAU region</td>
867 <td>SAU_INIT_START<number></td>
868 <td>0x00000000 .. 0xFFFFFFE0\n
869 [in steps of 32]</td>
871 <td>region start address</td>
874 <td>SAU_INIT_END<number></td>
875 <td>0x00000000 .. 0xFFFFFFE0\n
876 [in steps of 32]</td>
878 <td>region start address</td>
881 <td>SAU_INIT_NSC<number></td>
884 <td>SAU region attribute
886 - 1: Secure, Non-Secure callable</td>
890 The range of \<number\> is from 0 .. SAU_REGIONS_MAX.
891 A set of these macros must exist for each \<number\>.
893 The following example shows a set of SAU region macros.
896 #define SAU_REGIONS_MAX 8 /* Max. number of SAU regions */
898 #define SAU_INIT_REGION0 1
899 #define SAU_INIT_START0 0x00000000 /* start address of SAU region 0 */
900 #define SAU_INIT_END0 0x001FFFE0 /* end address of SAU region 0 */
901 #define SAU_INIT_NSC0 1
903 #define SAU_INIT_REGION1 1
904 #define SAU_INIT_START1 0x00200000 /* start address of SAU region 1 */
905 #define SAU_INIT_END1 0x003FFFE0 /* end address of SAU region 1 */
906 #define SAU_INIT_NSC1 0
908 #define SAU_INIT_REGION2 1
909 #define SAU_INIT_START2 0x20200000 /* start address of SAU region 2 */
910 #define SAU_INIT_END2 0x203FFFE0 /* end address of SAU region 2 */
911 #define SAU_INIT_NSC2 0
913 #define SAU_INIT_REGION3 1
914 #define SAU_INIT_START3 0x40000000 /* start address of SAU region 3 */
915 #define SAU_INIT_END3 0x40040000 /* end address of SAU region 3 */
916 #define SAU_INIT_NSC3 0
918 #define SAU_INIT_REGION4 0
919 #define SAU_INIT_START4 0x00000000 /* start address of SAU region 4 */
920 #define SAU_INIT_END4 0x00000000 /* end address of SAU region 4 */
921 #define SAU_INIT_NSC4 0
923 #define SAU_INIT_REGION5 0
924 #define SAU_INIT_START5 0x00000000 /* start address of SAU region 5 */
925 #define SAU_INIT_END5 0x00000000 /* end address of SAU region 5 */
926 #define SAU_INIT_NSC5 0
928 #define SAU_INIT_REGION6 0
929 #define SAU_INIT_START6 0x00000000 /* start address of SAU region 6 */
930 #define SAU_INIT_END6 0x00000000 /* end address of SAU region 6 */
931 #define SAU_INIT_NSC6 0
933 #define SAU_INIT_REGION7 0
934 #define SAU_INIT_START7 0x00000000 /* start address of SAU region 7 */
935 #define SAU_INIT_END7 0x00000000 /* end address of SAU region 7 */
936 #define SAU_INIT_NSC7 0
940 \section sau_sleepexception_sec Configuration of Sleep and Exception behaviour
941 <table class="cmtable">
949 <td>CSR_INIT_DEEPSLEEPS</td>
952 <td>value for SCB_CSR register bit DEEPSLEEPS
953 - 0: Deep Sleep can be enabled by Secure and Non-Secure state
954 - 1: Deep Sleep can be enabled by Secure state only</td>
957 <td>AIRCR_INIT_SYSRESETREQS</td>
960 <td>value for SCB_AIRCR register bit SYSRESETREQS
961 - 0: System reset request accessible from Secure and Non-Secure state
962 - 1: System reset request accessible from Secure state only</td>
965 <td>AIRCR_INIT_PRIS</td>
968 <td>value for SCB_AIRCR register bit PRIS
969 - 0: Priority of Non-Secure exceptions is Not altered
970 - 1: Priority of Non-Secure exceptions is Lowered to 0x80-0xFF</td>
973 <td>AIRCR_INIT_BFHFNMINS</td>
976 <td>value for SCB_AIRCR register bit BFHFNMINS
977 - 0: BusFault, HardFault, and NMI target are Secure state
978 - 1: BusFault, HardFault, and NMI target are Non-Secure state</td>
982 \section sau_interrupttarget_sec Configuration of Interrupt Target settings
984 Each interrupt has a configuration bit that defines the execution
985 in Secure or Non-secure state. The Non-Secure interrupts have a separate
986 vector table. Refer to \ref Model_TrustZone for more information.
988 <table class="cmtable">
996 <td>NVIC_INIT_ITNS<number></td>
997 <td>0x00000000 .. 0xFFFFFFFF\n
998 [each bit represents an interrupt]</td>
1000 <td>Interrupt vector target
1002 - 1: Non-Secure state</td>
1006 The range of \<number\> is 0 .. (\<number of external interrupts\> + 31) / 32.
1008 The following example shows the configuration for a maximum of 64 external interrupts.
1011 #define NVIC_INIT_ITNS0 0x0000122B
1012 #define NVIC_INIT_ITNS1 0x0000003A