Energy Micro IEC60355 Library Example Project 1.0 (internal use only!) GCC-Version
Example project demonstrating POST and BIST library functions

startup.c

Go to the documentation of this file.
00001 /***************************************************************************/
00030 #include "efm32.h"
00031 #include "config.h"
00032 #include "efm32g890f128_interrupt.h"
00033 #include "iec60335_class_b.h"
00034 
00035 /*******************************************************************************
00036 * Prototypes
00037 *******************************************************************************/
00038 void Reset(void) __attribute__ ((section ("._Reset")));
00039 void NMI_Handler(void);
00040 void HardFault_Handler(void);
00041 
00042 /*******************************************************************************
00043 * main Prototype
00044 *******************************************************************************/
00045 extern int main(void);
00046 extern void TimingDelay_Decrement(void);
00047 extern void DefaultHandler(void);
00048 
00049 /*******************************************************************************
00050 * Stack Location Definition
00051 *******************************************************************************/
00052 volatile unsigned long Stack[STACKSIZE>>2] __attribute__ ((section (".stack")));
00053 /*******************************************************************************
00054 * reference to linker symbols
00055 *******************************************************************************/
00056 //extern unsigned long _svector;        // start vector section
00057 extern unsigned long _stext;        // start text section
00058 extern unsigned long _etext;        // end text section
00059 extern unsigned long _sdata;        // start data section
00060 extern unsigned long _edata;        // end data section
00061 extern unsigned long _sbss;         // start bss section
00062 extern unsigned long _ebss;         // end bss section
00063 extern unsigned long _initial_sp;     // initial stack pointer
00064 
00065 //extern unsigned long _data;
00066 
00067 //extern unsigned long _bss;
00068 
00069 //extern unsigned long _crc_start;
00070 
00071 /*******************************************************************************
00072 * Location Definition
00073 *******************************************************************************/
00074 #define CRC32val  0x12345678
00075 
00076 /*******************************************************************************
00077 * Interrupt Vector Table
00078 *******************************************************************************/
00079 typedef void (* const IntFctPointer)(void);
00083 IntFctPointer interrupts[] __attribute__ ((section("_vector"))) =
00084 {
00085   (IntFctPointer)&_initial_sp,      
00086   Reset,                                  
00087   NMI_Handler,                            
00088   HardFault_Handler,                      
00089   MemManage_Handler,                      
00090   BusFault_Handler,                       
00091   UsageFault_Handler,                     
00092   0,                      
00093   0,                                      
00094   0,                                      
00095   0,                                      
00096   SVC_Handler,                            
00097   DebugMon_Handler,                           
00098   0,                                      
00099   PendSV_Handler,                         
00100   SysTick_Handler,                        
00102   DMA_IRQHandler,                         
00103   GPIO_EVEN_IRQHandler,         
00104   TIMER0_IRQHandler,            
00105   USART0_RX_IRQHandler,         
00106   USART0_TX_IRQHandler,         
00107   ACMP0_IRQHandler,           
00108   ADC0_IRQHandler,            
00109   DAC0_IRQHandler,            
00110   I2C0_IRQHandler,            
00111   GPIO_ODD_IRQHandler,          
00112   TIMER1_IRQHandler,            
00113   TIMER2_IRQHandler,            
00114   USART1_RX_IRQHandler,         
00115   USART1_TX_IRQHandler,         
00116   USART2_RX_IRQHandler,         
00117   USART2_TX_IRQHandler,         
00118   UART0_RX_IRQHandler,          
00119   UART0_TX_IRQHandler,          
00120   LEUART0_IRQHandler,           
00121   LEUART1_IRQHandler,           
00122   LETIMER0_IRQHandler,          
00123   PCNT0_IRQHandler,           
00124   PCNT1_IRQHandler,           
00125   PCNT2_IRQHandler,           
00126   RTC_IRQHandler,             
00127   CMU_IRQHandler,             
00128   VCMP_IRQHandler,            
00129   LCD_IRQHandler,             
00130   MSC_IRQHandler,             
00131   AES_IRQHandler,             
00132 };
00133 
00142 FlashCRC_t testsecond, testfirst;
00143 
00144 void Reset(void)
00145 {
00146   unsigned long *Src, *Dest;
00147 
00148   // POST test collection
00149   IEC60335_ClassB_POST();
00150 
00151   // this operation will destroy results from test before!
00152   // Copy the data segment initializers from flash to SRAM.
00153   Src = &_etext;
00154   for(Dest = &_sdata; Dest < &_edata; ) {
00155     *Dest++ = *Src++;
00156   }
00157 
00158   // Zero fill the bss segment.
00159   for(Dest = &_sbss; Dest < &_ebss; ) {
00160     *Dest++ = 0;
00161   }
00162 
00163   // Call main.
00164   main();
00165 }
00166 
00167 /************************************** EOF *********************************/