|
|
@@ -159,7 +159,8 @@ The template files contain place holders:
|
|
|
|
|
|
|
|
|
The device configuration of the template files is described in detail on the following pages:
|
|
|
- - \subpage startup_s_pg
|
|
|
+ - \subpage startup_c_pg
|
|
|
+ - \subpage startup_s_pg (deprecated)
|
|
|
- \subpage system_c_pg
|
|
|
- \subpage device_h_pg
|
|
|
\if ARMv8M
|
|
|
@@ -169,7 +170,91 @@ The device configuration of the template files is described in detail on the fol
|
|
|
|
|
|
/*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
|
|
|
/**
|
|
|
-\page startup_s_pg Startup File startup_<device>.s
|
|
|
+\page startup_c_pg Startup File startup_<device>.c
|
|
|
+
|
|
|
+The \ref startup_c_pg contains:
|
|
|
+ - The reset handler which is executed after CPU reset and typically calls the \ref SystemInit function.
|
|
|
+ - The setup values for the Main Stack Pointer (MSP).
|
|
|
+ - Exception vectors of the Cortex-M Processor with weak functions that implement default routines.
|
|
|
+ - Interrupt vectors that are device specific with weak functions that implement default routines.
|
|
|
+
|
|
|
+The file exists for each supported toolchain and is the only tool-chain specific CMSIS file.
|
|
|
+
|
|
|
+To adapt the file to a new device only the interrupt vector table needs to be extended with
|
|
|
+the device-specific interrupt handlers. The naming convention for the interrupt handler names are
|
|
|
+<interrupt_name>_IRQHandler. This table needs to be consistent with \ref IRQn_Type that defines all the
|
|
|
+IRQ numbers for each interrupt.
|
|
|
+
|
|
|
+\b Example:
|
|
|
+
|
|
|
+The following example shows the extension of the interrupt vector table for the LPC1100 device family.
|
|
|
+
|
|
|
+\code
|
|
|
+/*----------------------------------------------------------------------------
|
|
|
+ Exception / Interrupt Handler
|
|
|
+ *----------------------------------------------------------------------------*/
|
|
|
+/* Exceptions */
|
|
|
+void WAKEUP0_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
|
|
+void WAKEUP1_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
|
|
+void WAKEUP2_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
|
|
+// :
|
|
|
+// :
|
|
|
+void EINT1_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
|
|
+void EINT2_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
|
|
|
+// :
|
|
|
+// :
|
|
|
+
|
|
|
+/*----------------------------------------------------------------------------
|
|
|
+ Exception / Interrupt Vector table
|
|
|
+ *----------------------------------------------------------------------------*/
|
|
|
+extern const pFunc __VECTOR_TABLE[240];
|
|
|
+ const pFunc __VECTOR_TABLE[240] __VECTOR_TABLE_ATTRIBUTE = {
|
|
|
+ (pFunc)(&__INITIAL_SP), /* Initial Stack Pointer */
|
|
|
+ Reset_Handler, /* Reset Handler */
|
|
|
+ NMI_Handler, /* -14 NMI Handler */
|
|
|
+ HardFault_Handler, /* -13 Hard Fault Handler */
|
|
|
+ MemManage_Handler, /* -12 MPU Fault Handler */
|
|
|
+ BusFault_Handler, /* -11 Bus Fault Handler */
|
|
|
+ UsageFault_Handler, /* -10 Usage Fault Handler */
|
|
|
+ 0, /* Reserved */
|
|
|
+ 0, /* Reserved */
|
|
|
+ 0, /* Reserved */
|
|
|
+ 0, /* Reserved */
|
|
|
+ SVC_Handler, /* -5 SVCall Handler */
|
|
|
+ DebugMon_Handler, /* -4 Debug Monitor Handler */
|
|
|
+ 0, /* Reserved */
|
|
|
+ PendSV_Handler, /* -2 PendSV Handler */
|
|
|
+ SysTick_Handler, /* -1 SysTick Handler */
|
|
|
+
|
|
|
+ /* Interrupts */
|
|
|
+ WAKEUP0_IRQHandler, /* 0 Wakeup PIO0.0 */
|
|
|
+ WAKEUP1_IRQHandler, /* 1 Wakeup PIO0.1 */
|
|
|
+ WAKEUP2_IRQHandler, /* 2 Wakeup PIO0.2 */
|
|
|
+ // :
|
|
|
+ // :
|
|
|
+ EINT1_IRQHandler, /* 30 PIO INT1 */
|
|
|
+ EINT2_IRQHandler, /* 31 PIO INT2 */
|
|
|
+ // :
|
|
|
+ // :
|
|
|
+};
|
|
|
+\endcode
|
|
|
+
|
|
|
+\section startup_c_sec startup_Device.c Template File
|
|
|
+
|
|
|
+A compiler agnostic \ref startup_c_sec for an Armv7-M processor like Cortex-M3 is shown below.
|
|
|
+The C startup file relys on certain compiler specific preprocessor defines specified in CMSIS compiler headers:
|
|
|
+ - \ref __INITIAL_SP
|
|
|
+ - \ref __STACK_LIMIT
|
|
|
+ - \ref __PROGRAM_START
|
|
|
+ - \ref __VECTOR_TABLE
|
|
|
+ - \ref __VECTOR_TABLE_ATTRIBUTE
|
|
|
+
|
|
|
+\verbinclude "Source\startup_Device.c"
|
|
|
+*/
|
|
|
+
|
|
|
+/*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
|
|
|
+/**
|
|
|
+\page startup_s_pg Startup File startup_<device>.s (deprecated)
|
|
|
|
|
|
The \ref startup_s_pg contains:
|
|
|
- The reset handler which is executed after CPU reset and typically calls the \ref SystemInit function.
|
|
|
@@ -197,15 +282,15 @@ The following example shows the extension of the interrupt vector table for the
|
|
|
: :
|
|
|
DCD EINT1_IRQHandler ; 16+30: PIO INT1
|
|
|
DCD EINT0_IRQHandler ; 16+31: PIO INT0
|
|
|
- :
|
|
|
- :
|
|
|
+ :
|
|
|
+ :
|
|
|
EXPORT WAKEUP0_IRQHandler [WEAK]
|
|
|
EXPORT WAKEUP1_IRQHandler [WEAK]
|
|
|
EXPORT WAKEUP2_IRQHandler [WEAK]
|
|
|
: :
|
|
|
: :
|
|
|
- EXPORT EINT1_IRQHandler [WEAK]
|
|
|
- EXPORT EINT0_IRQHandler [WEAK]
|
|
|
+ EXPORT EINT1_IRQHandler [WEAK]
|
|
|
+ EXPORT EINT0_IRQHandler [WEAK]
|
|
|
|
|
|
WAKEUP0_IRQHandler
|
|
|
WAKEUP1_IRQHandler
|
|
|
@@ -332,8 +417,8 @@ If these <i>\#defines</i> are missing default values are used.
|
|
|
<td>0 .. 1</td>
|
|
|
<td>0</td>
|
|
|
<td>If this define is set to 1, then the default <b>SysTick_Config</b> function
|
|
|
- is excluded. In this case, the file <i><b>device.h</b></i>
|
|
|
- must contain a vendor specific implementation of this function.</td>
|
|
|
+ is excluded. In this case, the file <i><b>device.h</b></i>
|
|
|
+ must contain a vendor specific implementation of this function.</td>
|
|
|
</tr>
|
|
|
</table>
|
|
|
|
|
|
@@ -362,8 +447,8 @@ If these <i>\#defines</i> are missing default values are used.
|
|
|
<td>0 .. 1</td>
|
|
|
<td>0</td>
|
|
|
<td>If this define is set to 1, then the default <b>SysTick_Config</b> function
|
|
|
- is excluded. In this case, the file <i><b>device.h</b></i>
|
|
|
- must contain a vendor specific implementation of this function.</td>
|
|
|
+ is excluded. In this case, the file <i><b>device.h</b></i>
|
|
|
+ must contain a vendor specific implementation of this function.</td>
|
|
|
</tr>
|
|
|
</table>
|
|
|
|
|
|
@@ -398,8 +483,8 @@ If these <i>\#defines</i> are missing default values are used.
|
|
|
<td>0 .. 1</td>
|
|
|
<td>0</td>
|
|
|
<td>If this define is set to 1, then the default <b>SysTick_Config</b> function
|
|
|
- is excluded. In this case, the file <i><b>device.h</b></i>
|
|
|
- must contain a vendor specific implementation of this function.</td>
|
|
|
+ is excluded. In this case, the file <i><b>device.h</b></i>
|
|
|
+ must contain a vendor specific implementation of this function.</td>
|
|
|
</tr>
|
|
|
</table>
|
|
|
|
|
|
@@ -440,8 +525,8 @@ If these <i>\#defines</i> are missing default values are used.
|
|
|
<td>0 .. 1</td>
|
|
|
<td>0</td>
|
|
|
<td>If this define is set to 1, then the default <b>SysTick_Config</b> function
|
|
|
- is excluded. In this case, the file <i><b>device.h</b></i>
|
|
|
- must contain a vendor specific implementation of this function.</td>
|
|
|
+ is excluded. In this case, the file <i><b>device.h</b></i>
|
|
|
+ must contain a vendor specific implementation of this function.</td>
|
|
|
</tr>
|
|
|
</table>
|
|
|
|
|
|
@@ -476,8 +561,8 @@ If these <i>\#defines</i> are missing default values are used.
|
|
|
<td>0 .. 1</td>
|
|
|
<td>0</td>
|
|
|
<td>If this define is set to 1, then the default <b>SysTick_Config</b> function
|
|
|
- is excluded. In this case, the file <i><b>device.h</b></i>
|
|
|
- must contain a vendor specific implementation of this function.</td>
|
|
|
+ is excluded. In this case, the file <i><b>device.h</b></i>
|
|
|
+ must contain a vendor specific implementation of this function.</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td>__FPU_PRESENT</td>
|
|
|
@@ -491,30 +576,30 @@ If these <i>\#defines</i> are missing default values are used.
|
|
|
<td>0</td>
|
|
|
<td>The combination of the defines <b>__FPU_PRESENT</b> and <b>__FPU_DP</b>
|
|
|
determine the whether the FPU is with single or double precision as shown in the table below.
|
|
|
- \n\n
|
|
|
- <table class="cmtable" summary="">
|
|
|
- <tr bgcolor="cyan">
|
|
|
+ \n\n
|
|
|
+ <table class="cmtable" summary="">
|
|
|
+ <tr bgcolor="cyan">
|
|
|
<td><b>__FPU_PRESENT</b></td>
|
|
|
- <td><b>__FPU_DP</b></td>
|
|
|
- <td><b>Description</b></td>
|
|
|
- </tr>
|
|
|
- <tr>
|
|
|
- <td align="center">0</td>
|
|
|
- <td align="center"><i>ignored</i></td>
|
|
|
- <td>Processor has no FPU. The value set for <b>__FPU_DP</b> has no influence. </td>
|
|
|
- </tr>
|
|
|
- <tr>
|
|
|
- <td align="center">1</td>
|
|
|
- <td align="center">0</td>
|
|
|
- <td>Processor with FPU with single precision. The file <b>ARMCM7_SP.h</b> has preconfigured settings for this combination.</td>
|
|
|
- </tr>
|
|
|
- <tr>
|
|
|
- <td align="center">1</td>
|
|
|
- <td align="center">1</td>
|
|
|
+ <td><b>__FPU_DP</b></td>
|
|
|
+ <td><b>Description</b></td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <td align="center">0</td>
|
|
|
+ <td align="center"><i>ignored</i></td>
|
|
|
+ <td>Processor has no FPU. The value set for <b>__FPU_DP</b> has no influence. </td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <td align="center">1</td>
|
|
|
+ <td align="center">0</td>
|
|
|
+ <td>Processor with FPU with single precision. The file <b>ARMCM7_SP.h</b> has preconfigured settings for this combination.</td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <td align="center">1</td>
|
|
|
+ <td align="center">1</td>
|
|
|
<td>Processor with FPU with double precision. The file <b>ARMCM7_DP.h</b> has preconfigured settings for this combination.</td>
|
|
|
- </tr>
|
|
|
- </table>
|
|
|
- </td>
|
|
|
+ </tr>
|
|
|
+ </table>
|
|
|
+ </td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td>__ICACHE_PRESENT</td>
|
|
|
@@ -568,8 +653,8 @@ If these <i>\#defines</i> are missing default values are used.
|
|
|
<td>0 .. 1</td>
|
|
|
<td>0</td>
|
|
|
<td>If this define is set to 1, then the default <b>SysTick_Config</b> function
|
|
|
- is excluded. In this case, the file <i><b>device.h</b></i>
|
|
|
- must contain a vendor specific implementation of this function.</td>
|
|
|
+ is excluded. In this case, the file <i><b>device.h</b></i>
|
|
|
+ must contain a vendor specific implementation of this function.</td>
|
|
|
</tr>
|
|
|
</table>
|
|
|
\endif
|
|
|
@@ -606,8 +691,8 @@ If these <i>\#defines</i> are missing default values are used.
|
|
|
<td>0 .. 1</td>
|
|
|
<td>0</td>
|
|
|
<td>If this define is set to 1, then the default <b>SysTick_Config</b> function
|
|
|
- is excluded. In this case, the file <i><b>device.h</b></i>
|
|
|
- must contain a vendor specific implementation of this function.</td>
|
|
|
+ is excluded. In this case, the file <i><b>device.h</b></i>
|
|
|
+ must contain a vendor specific implementation of this function.</td>
|
|
|
</tr>
|
|
|
</table>
|
|
|
\endif
|
|
|
@@ -656,8 +741,8 @@ If these <i>\#defines</i> are missing default values are used.
|
|
|
<td>0 .. 1</td>
|
|
|
<td>0</td>
|
|
|
<td>If this define is set to 1, then the default <b>SysTick_Config</b> function
|
|
|
- is excluded. In this case, the file <i><b>device.h</b></i>
|
|
|
- must contain a vendor specific implementation of this function.</td>
|
|
|
+ is excluded. In this case, the file <i><b>device.h</b></i>
|
|
|
+ must contain a vendor specific implementation of this function.</td>
|
|
|
</tr>
|
|
|
</table>
|
|
|
\endif
|
|
|
@@ -706,8 +791,8 @@ If these <i>\#defines</i> are missing default values are used.
|
|
|
<td>0 .. 1</td>
|
|
|
<td>0</td>
|
|
|
<td>If this define is set to 1, then the default <b>SysTick_Config</b> function
|
|
|
- is excluded. In this case, the file <i><b>device.h</b></i>
|
|
|
- must contain a vendor specific implementation of this function.</td>
|
|
|
+ is excluded. In this case, the file <i><b>device.h</b></i>
|
|
|
+ must contain a vendor specific implementation of this function.</td>
|
|
|
</tr>
|
|
|
</table>
|
|
|
\endif
|