///////////////////////////////////////////////////////////////////////////////
//                                                                            /
// IAR ANSI C/C++ Compiler V6.30.1.53127/W32 for ARM    08/Mar/2012  18:18:26 /
// Copyright 1999-2011 IAR Systems AB.                                        /
//                                                                            /
//    Cpu mode     =  thumb                                                   /
//    Endian       =  little                                                  /
//    Source file  =  D:\Profiles\b01252\My Documents\Freescale\P0\software\s /
//                    ample code cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50MHz_ /
//                    sc\src\cpu\start.c                                      /
//    Command line =  "D:\Profiles\b01252\My Documents\Freescale\P0\software\ /
//                    sample code cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50MHz /
//                    _sc\src\cpu\start.c" -D IAR -D TOWER -D TWR_K20D50M     /
//                    -lCN "D:\Profiles\b01252\My                             /
//                    Documents\Freescale\P0\software\sample code             /
//                    cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50MHz_sc\build\ia /
//                    r\TWRK20D50M_Demo\FLASH_128KB_PFLASH\List\" -lB         /
//                    "D:\Profiles\b01252\My Documents\Freescale\P0\software\ /
//                    sample code cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50MHz /
//                    _sc\build\iar\TWRK20D50M_Demo\FLASH_128KB_PFLASH\List\" /
//                     -o "D:\Profiles\b01252\My                              /
//                    Documents\Freescale\P0\software\sample code             /
//                    cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50MHz_sc\build\ia /
//                    r\TWRK20D50M_Demo\FLASH_128KB_PFLASH\Obj\" --no_cse     /
//                    --no_unroll --no_inline --no_code_motion --no_tbaa      /
//                    --no_clustering --no_scheduling --debug                 /
//                    --endian=little --cpu=Cortex-M4 -e --fpu=None           /
//                    --dlib_config "C:\Program Files\IAR Systems\Embedded    /
//                    Workbench 6.0_5\arm\INC\c\DLib_Config_Normal.h" -I      /
//                    "D:\Profiles\b01252\My Documents\Freescale\P0\software\ /
//                    sample code cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50MHz /
//                    _sc\build\iar\TWRK20D50M_Demo\..\..\..\src\common\" -I  /
//                    "D:\Profiles\b01252\My Documents\Freescale\P0\software\ /
//                    sample code cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50MHz /
//                    _sc\build\iar\TWRK20D50M_Demo\..\..\..\src\cpu\" -I     /
//                    "D:\Profiles\b01252\My Documents\Freescale\P0\software\ /
//                    sample code cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50MHz /
//                    _sc\build\iar\TWRK20D50M_Demo\..\..\..\src\cpu\headers\ /
//                    " -I "D:\Profiles\b01252\My                             /
//                    Documents\Freescale\P0\software\sample code             /
//                    cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50MHz_sc\build\ia /
//                    r\TWRK20D50M_Demo\..\..\..\src\drivers\uart\" -I        /
//                    "D:\Profiles\b01252\My Documents\Freescale\P0\software\ /
//                    sample code cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50MHz /
//                    _sc\build\iar\TWRK20D50M_Demo\..\..\..\src\drivers\mcg\ /
//                    " -I "D:\Profiles\b01252\My                             /
//                    Documents\Freescale\P0\software\sample code             /
//                    cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50MHz_sc\build\ia /
//                    r\TWRK20D50M_Demo\..\..\..\src\drivers\wdog\" -I        /
//                    "D:\Profiles\b01252\My Documents\Freescale\P0\software\ /
//                    sample code cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50MHz /
//                    _sc\build\iar\TWRK20D50M_Demo\..\..\..\src\drivers\rcm\ /
//                    " -I "D:\Profiles\b01252\My                             /
//                    Documents\Freescale\P0\software\sample code             /
//                    cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50MHz_sc\build\ia /
//                    r\TWRK20D50M_Demo\..\..\..\src\drivers\lptmr\" -I       /
//                    "D:\Profiles\b01252\My Documents\Freescale\P0\software\ /
//                    sample code cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50MHz /
//                    _sc\build\iar\TWRK20D50M_Demo\..\..\..\src\platforms\"  /
//                    -I "D:\Profiles\b01252\My Documents\Freescale\P0\softwa /
//                    re\sample code cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50 /
//                    MHz_sc\build\iar\TWRK20D50M_Demo\..\" -I                /
//                    "D:\Profiles\b01252\My Documents\Freescale\P0\software\ /
//                    sample code cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50MHz /
//                    _sc\build\iar\TWRK20D50M_Demo\..\..\..\src\projects\TWR /
//                    K20D50M_Demo\" -I "D:\Profiles\b01252\My                /
//                    Documents\Freescale\P0\software\sample code             /
//                    cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50MHz_sc\build\ia /
//                    r\TWRK20D50M_Demo\..\..\..\src\projects\TWRK20D50M_Demo /
//                    \dma\" -I "D:\Profiles\b01252\My                        /
//                    Documents\Freescale\P0\software\sample code             /
//                    cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50MHz_sc\build\ia /
//                    r\TWRK20D50M_Demo\..\..\..\src\projects\TWRK20D50M_Demo /
//                    \adc16\" -I "D:\Profiles\b01252\My                      /
//                    Documents\Freescale\P0\software\sample code             /
//                    cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50MHz_sc\build\ia /
//                    r\TWRK20D50M_Demo\..\..\..\src\projects\TWRK20D50M_Demo /
//                    \i2c\" -I "D:\Profiles\b01252\My                        /
//                    Documents\Freescale\P0\software\sample code             /
//                    cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50MHz_sc\build\ia /
//                    r\TWRK20D50M_Demo\..\..\..\src\projects\TWRK20D50M_Demo /
//                    \tsi\" -I "D:\Profiles\b01252\My                        /
//                    Documents\Freescale\P0\software\sample code             /
//                    cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50MHz_sc\build\ia /
//                    r\TWRK20D50M_Demo\..\..\..\src\projects\TWRK20D50M_Demo /
//                    \adc_test\" -I "D:\Profiles\b01252\My                   /
//                    Documents\Freescale\P0\software\sample code             /
//                    cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50MHz_sc\build\ia /
//                    r\TWRK20D50M_Demo\..\..\..\src\projects\TWRK20D50M_Demo /
//                    \angle_calculation\" -I "D:\Profiles\b01252\My          /
//                    Documents\Freescale\P0\software\sample code             /
//                    cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50MHz_sc\build\ia /
//                    r\TWRK20D50M_Demo\..\..\..\src\projects\TWRK20D50M_Demo /
//                    \buzzer\" -I "D:\Profiles\b01252\My                     /
//                    Documents\Freescale\P0\software\sample code             /
//                    cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50MHz_sc\build\ia /
//                    r\TWRK20D50M_Demo\..\..\..\src\projects\TWRK20D50M_Demo /
//                    \fft_test\" -I "D:\Profiles\b01252\My                   /
//                    Documents\Freescale\P0\software\sample code             /
//                    cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50MHz_sc\build\ia /
//                    r\TWRK20D50M_Demo\..\..\..\src\projects\TWRK20D50M_Demo /
//                    \irda_test\" -I "D:\Profiles\b01252\My                  /
//                    Documents\Freescale\P0\software\sample code             /
//                    cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50MHz_sc\build\ia /
//                    r\TWRK20D50M_Demo\..\..\..\src\projects\TWRK20D50M_Demo /
//                    \cmt_test\" -I "D:\Profiles\b01252\My                   /
//                    Documents\Freescale\P0\software\sample code             /
//                    cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50MHz_sc\build\ia /
//                    r\TWRK20D50M_Demo\..\..\..\src\projects\TWRK20D50M_Demo /
//                    \protocol\" -I "D:\Profiles\b01252\My                   /
//                    Documents\Freescale\P0\software\sample code             /
//                    cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50MHz_sc\build\ia /
//                    r\TWRK20D50M_Demo\..\..\..\src\projects\TWRK20D50M_Demo /
//                    \task_mgr\" -I "D:\Profiles\b01252\My                   /
//                    Documents\Freescale\P0\software\sample code             /
//                    cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50MHz_sc\build\ia /
//                    r\TWRK20D50M_Demo\..\..\..\src\projects\TWRK20D50M_Demo /
//                    \TWRK20_specific\" -I "D:\Profiles\b01252\My            /
//                    Documents\Freescale\P0\software\sample code             /
//                    cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50MHz_sc\build\ia /
//                    r\TWRK20D50M_Demo\..\..\..\src\projects\TWRK20D50M_Demo /
//                    \rtc\" -I "D:\Profiles\b01252\My                        /
//                    Documents\Freescale\P0\software\sample code             /
//                    cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50MHz_sc\build\ia /
//                    r\TWRK20D50M_Demo\..\..\..\src\CMSIS\DSP_Lib\Lib\interm /
//                    ediateFiles\" -I "D:\Profiles\b01252\My                 /
//                    Documents\Freescale\P0\software\sample code             /
//                    cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50MHz_sc\build\ia /
//                    r\TWRK20D50M_Demo\..\..\..\src\CMSIS\DSP_Lib\Include\"  /
//                    -I "D:\Profiles\b01252\My Documents\Freescale\P0\softwa /
//                    re\sample code cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50 /
//                    MHz_sc\build\iar\TWRK20D50M_Demo\..\..\..\src\CMSIS\CM4 /
//                    \DeviceSupport\ARM\ARMCM4\" -I "D:\Profiles\b01252\My   /
//                    Documents\Freescale\P0\software\sample code             /
//                    cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50MHz_sc\build\ia /
//                    r\TWRK20D50M_Demo\..\..\..\src\CMSIS\CM4\CoreSupport\"  /
//                    -I "D:\Profiles\b01252\My Documents\Freescale\P0\softwa /
//                    re\sample code cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50 /
//                    MHz_sc\build\iar\TWRK20D50M_Demo\..\..\..\src\CMSIS\CM4 /
//                    \CoreSupportLiker Options-Library\" -I                  /
//                    "D:\Profiles\b01252\My Documents\Freescale\P0\software\ /
//                    sample code cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50MHz /
//                    _sc\build\iar\TWRK20D50M_Demo\..\..\..\src\CMSIS\DSP_Li /
//                    b\Lib\intermediateFiles\arm_cortexM4_math.lib\" -I      /
//                    "D:\Profiles\b01252\My Documents\Freescale\P0\software\ /
//                    sample code cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50MHz /
//                    _sc\build\iar\TWRK20D50M_Demo\..\..\..\build\" -Ol      /
//                    --use_c++_inline -I "C:\Program Files\IAR               /
//                    Systems\Embedded Workbench 6.0_5\arm\CMSIS\Include\"    /
//                    -D ARM_MATH_CM4                                         /
//    List file    =  D:\Profiles\b01252\My Documents\Freescale\P0\software\s /
//                    ample code cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50MHz_ /
//                    sc\build\iar\TWRK20D50M_Demo\FLASH_128KB_PFLASH\List\st /
//                    art.s                                                   /
//                                                                            /
//                                                                            /
///////////////////////////////////////////////////////////////////////////////

        NAME start

        #define SHT_PROGBITS 0x1

        EXTERN common_startup
        EXTERN main
        EXTERN outSRS
        EXTERN printf
        EXTERN sysinit
        EXTERN wdog_disable

        PUBLIC cpu_identify
        PUBLIC flash_identify
        PUBLIC start

// D:\Profiles\b01252\My Documents\Freescale\P0\software\sample code cesar\TWR-K20D50M_LABS_AND_CE\kinetis_50MHz_sc\src\cpu\start.c
//    1 /****************************************************************************************************/
//    2 /**
//    3 \file       start.c
//    4 \brief      kinetis startup routines
//    5 \author     Freescale Semiconductor
//    6 \author     
//    7 \version    1.0
//    8 \date       Sep 14, 2011
//    9 \warning    need to check with Si
//   10  
//   11 */
//   12 #include "start.h"
//   13 #include "common.h"
//   14 #include "wdog.h"
//   15 #include "rcm.h"
//   16 #include "sysinit.h"
//   17 
//   18 /********************************************************************/
//   19 /*!
//   20  * \brief   Kinetis Start
//   21  * \return  None
//   22  *
//   23  * This function calls all of the needed starup routines and then 
//   24  * branches to the main process.
//   25  */

        SECTION `.text`:CODE:NOROOT(1)
        THUMB
//   26 void start(void)
//   27 {
start:
        PUSH     {R7,LR}
//   28 	/* Disable the watchdog timer */
//   29 	wdog_disable();
        BL       wdog_disable
//   30         
//   31 	/* Copy any vector or data sections that need to be in RAM */
//   32 	common_startup();
        BL       common_startup
//   33         
//   34 	/* Perform processor initialization */
//   35 	sysinit();
        BL       sysinit
//   36 
//   37         /* Determine the last cause(s) of reset */
//   38         outSRS();
        BL       outSRS
//   39 
//   40 	/* Determine specific Kinetis device and revision */
//   41 	cpu_identify();
        BL       cpu_identify
//   42 
//   43 #ifndef KEIL	
//   44 	/* Jump to main process */
//   45 	main();
        BL       main
//   46 
//   47 	/* No actions to perform after this so wait forever */
//   48 	while(1);
??start_0:
        B.N      ??start_0
//   49 #endif
//   50 }
//   51 /********************************************************************/
//   52 /*!
//   53  * \brief   Kinetis CPU Identify
//   54  * \params  None
//   55  *
//   56  * This is primarly a reporting function that displays information
//   57  * about the specific CPU to the default terminal including:
//   58  * - Kinetis family
//   59  * - package
//   60  * - die revision
//   61  * - P-flash size
//   62  * - Ram size
//   63  \warning   flash_identify() not implemented
//   64  */

        SECTION `.text`:CODE:NOROOT(1)
        THUMB
//   65 void cpu_identify (void)
//   66 {
cpu_identify:
        PUSH     {R7,LR}
//   67     /* Determine the Kinetis family */
//   68     printf("\n FAM_ID = 0x%x",(SIM_SDID & SIM_SDID_FAMID_MASK)>>SIM_SDID_FAMID_SHIFT);
        LDR.N    R0,??DataTable0  ;; 0x40048024
        LDR      R0,[R0, #+0]
        UBFX     R1,R0,#+4,#+3
        LDR.N    R0,??DataTable0_1
        BL       printf
//   69     switch((SIM_SDID & SIM_SDID_FAMID_MASK)>>SIM_SDID_FAMID_SHIFT) 
        LDR.N    R0,??DataTable0  ;; 0x40048024
        LDR      R0,[R0, #+0]
        LSRS     R0,R0,#+4
        ANDS     R0,R0,#0x7
        CMP      R0,#+0
        BEQ.N    ??cpu_identify_0
        CMP      R0,#+2
        BEQ.N    ??cpu_identify_1
        BCC.N    ??cpu_identify_2
        CMP      R0,#+4
        BEQ.N    ??cpu_identify_3
        BCC.N    ??cpu_identify_4
        B.N      ??cpu_identify_5
//   70  //    switch((SIM_SDID & SIM_SDID_DIEID(0x7))>>SIM_SDID_DIEID_SHIFT)   for P3
//   71     { 
//   72               
//   73              
//   74     	case 0x0:
//   75     		printf("\nK10-");
??cpu_identify_0:
        LDR.N    R0,??DataTable0_2
        BL       printf
//   76     		break;
        B.N      ??cpu_identify_6
//   77     	case 0x1:
//   78     		printf("\nK20-");
??cpu_identify_2:
        LDR.N    R0,??DataTable0_3
        BL       printf
//   79     		break;
        B.N      ??cpu_identify_6
//   80     	case 0x2:
//   81     		printf("\nK30-");
??cpu_identify_1:
        LDR.N    R0,??DataTable0_4
        BL       printf
//   82     		break;
        B.N      ??cpu_identify_6
//   83     	case 0x3:
//   84     		printf("\nK40-");
??cpu_identify_4:
        LDR.N    R0,??DataTable0_5
        BL       printf
//   85     		break;
        B.N      ??cpu_identify_6
//   86     	case 0x4:
//   87     		printf("\nK60-");
??cpu_identify_3:
        LDR.N    R0,??DataTable0_6
        BL       printf
//   88     		break;
        B.N      ??cpu_identify_6
//   89 	default:
//   90 		printf("\nUnrecognized Kinetis family device.\n");  
??cpu_identify_5:
        LDR.N    R0,??DataTable0_7
        BL       printf
//   91 		break;  	
//   92     }
//   93 
//   94     printf("\n PIN_ID = 0x%x",(SIM_SDID & SIM_SDID_PINID_MASK)>>SIM_SDID_PINID_SHIFT);
??cpu_identify_6:
        LDR.N    R0,??DataTable0  ;; 0x40048024
        LDR      R0,[R0, #+0]
        ANDS     R1,R0,#0xF
        LDR.N    R0,??DataTable0_8
        BL       printf
//   95  
//   96     /* Determine the package size */
//   97     switch((SIM_SDID & SIM_SDID_PINID_MASK)>>SIM_SDID_PINID_SHIFT) 
        LDR.N    R0,??DataTable0  ;; 0x40048024
        LDR      R0,[R0, #+0]
        ANDS     R0,R0,#0xF
        CMP      R0,#+2
        BEQ.N    ??cpu_identify_7
        CMP      R0,#+4
        BEQ.N    ??cpu_identify_8
        CMP      R0,#+5
        BEQ.N    ??cpu_identify_9
        CMP      R0,#+6
        BEQ.N    ??cpu_identify_10
        CMP      R0,#+7
        BEQ.N    ??cpu_identify_11
        CMP      R0,#+8
        BEQ.N    ??cpu_identify_12
        CMP      R0,#+9
        BEQ.N    ??cpu_identify_13
        CMP      R0,#+10
        BEQ.N    ??cpu_identify_14
        CMP      R0,#+12
        BEQ.N    ??cpu_identify_15
        CMP      R0,#+14
        BEQ.N    ??cpu_identify_16
        B.N      ??cpu_identify_17
//   98     {  
//   99     	case 0x2:
//  100     		printf("32pin\n");
??cpu_identify_7:
        LDR.N    R0,??DataTable0_9
        BL       printf
//  101     		break;
        B.N      ??cpu_identify_18
//  102     	case 0x4:
//  103     		printf("48pin\n");
??cpu_identify_8:
        LDR.N    R0,??DataTable0_10
        BL       printf
//  104     		break;
        B.N      ??cpu_identify_18
//  105     	case 0x5:
//  106     		printf("64pin\n");
??cpu_identify_9:
        LDR.N    R0,??DataTable0_11
        BL       printf
//  107     		break;
        B.N      ??cpu_identify_18
//  108     	case 0x6:
//  109     		printf("80pin\n");
??cpu_identify_10:
        LDR.N    R0,??DataTable0_12
        BL       printf
//  110     		break;
        B.N      ??cpu_identify_18
//  111     	case 0x7:
//  112     		printf("81pin\n");
??cpu_identify_11:
        LDR.N    R0,??DataTable0_13
        BL       printf
//  113     		break;
        B.N      ??cpu_identify_18
//  114     	case 0x8:
//  115     		printf("100pin\n");
??cpu_identify_12:
        LDR.N    R0,??DataTable0_14
        BL       printf
//  116     		break;
        B.N      ??cpu_identify_18
//  117     	case 0x9:
//  118     		printf("104pin\n");
??cpu_identify_13:
        LDR.N    R0,??DataTable0_15
        BL       printf
//  119     		break;
        B.N      ??cpu_identify_18
//  120     	case 0xA:
//  121     		printf("144pin\n");
??cpu_identify_14:
        LDR.N    R0,??DataTable0_16
        BL       printf
//  122     		break;
        B.N      ??cpu_identify_18
//  123     	case 0xC:
//  124     		printf("196pin\n");
??cpu_identify_15:
        LDR.N    R0,??DataTable0_17
        BL       printf
//  125     		break;
        B.N      ??cpu_identify_18
//  126     	case 0xE:
//  127     		printf("256pin\n");
??cpu_identify_16:
        LDR.N    R0,??DataTable0_18
        BL       printf
//  128     		break;
        B.N      ??cpu_identify_18
//  129 	default:
//  130 		printf("\nUnrecognized Kinetis package code .\n");  
??cpu_identify_17:
        LDR.N    R0,??DataTable0_19
        BL       printf
//  131 		break;  	
//  132     }                
//  133 
//  134        printf("\n REV_ID = 0x%x \n",(SIM_SDID & SIM_SDID_REVID_MASK)>>SIM_SDID_REVID_SHIFT);
??cpu_identify_18:
        LDR.N    R0,??DataTable0  ;; 0x40048024
        LDR      R0,[R0, #+0]
        UBFX     R1,R0,#+12,#+4
        LDR.N    R0,??DataTable0_20
        BL       printf
//  135  
//  136     /* Determine the revision ID */
//  137     switch((SIM_SDID & SIM_SDID_REVID_MASK)>>SIM_SDID_REVID_SHIFT) 
        LDR.N    R0,??DataTable0  ;; 0x40048024
        LDR      R0,[R0, #+0]
        LSRS     R0,R0,#+12
        ANDS     R0,R0,#0xF
        CMP      R0,#+0
        BEQ.N    ??cpu_identify_19
        CMP      R0,#+2
        BEQ.N    ??cpu_identify_20
        BCC.N    ??cpu_identify_21
        B.N      ??cpu_identify_22
//  138     {
//  139         case 0x0:
//  140                 printf("Silicon rev 1.0\n");
??cpu_identify_19:
        LDR.N    R0,??DataTable0_21
        BL       printf
//  141                 break;
        B.N      ??cpu_identify_23
//  142         case 0x1:
//  143                 printf("Silicon rev 1.1\n");
??cpu_identify_21:
        LDR.N    R0,??DataTable0_22
        BL       printf
//  144                 break;
        B.N      ??cpu_identify_23
//  145         case 0x2:
//  146                 printf("Silicon rev 1.2\n");
??cpu_identify_20:
        LDR.N    R0,??DataTable0_23
        BL       printf
//  147                 break;
        B.N      ??cpu_identify_23
//  148         default:
//  149                 printf("\nThis version of software doesn't recognize the revision code.");
??cpu_identify_22:
        LDR.N    R0,??DataTable0_24
        BL       printf
//  150                 break;
//  151     }
//  152 
//  153       /* Determine the flash revision */
//  154     flash_identify();   
??cpu_identify_23:
        BL       flash_identify
//  155 
//  156 
//  157     /* Determine the RAM size */
//  158    printf("\n RAM_SIZE_ID = 0x%x \n",(SIM_SOPT1 & SIM_SOPT1_RAMSIZE_MASK)>>SIM_SOPT1_RAMSIZE_SHIFT);
        LDR.N    R0,??DataTable0_25  ;; 0x40047000
        LDR      R0,[R0, #+0]
        UBFX     R1,R0,#+12,#+4
        LDR.N    R0,??DataTable0_26
        BL       printf
//  159 
//  160     switch((SIM_SOPT1 & SIM_SOPT1_RAMSIZE_MASK)>>SIM_SOPT1_RAMSIZE_SHIFT)
        LDR.N    R0,??DataTable0_25  ;; 0x40047000
        LDR      R0,[R0, #+0]
        LSRS     R0,R0,#+12
        ANDS     R0,R0,#0xF
        CMP      R0,#+1
        BEQ.N    ??cpu_identify_24
        CMP      R0,#+3
        BEQ.N    ??cpu_identify_25
        CMP      R0,#+5
        BEQ.N    ??cpu_identify_26
        CMP      R0,#+7
        BEQ.N    ??cpu_identify_27
        CMP      R0,#+8
        BEQ.N    ??cpu_identify_28
        CMP      R0,#+9
        BEQ.N    ??cpu_identify_29
        B.N      ??cpu_identify_30
//  161     {
//  162       
//  163    	case 0x1:
//  164     		printf("8 kBytes of RAM\n\n");
??cpu_identify_24:
        LDR.N    R0,??DataTable0_27
        BL       printf
//  165     		break;
        B.N      ??cpu_identify_31
//  166     	case 0x3:
//  167     		printf("16 kBytes of RAM\n\n");
??cpu_identify_25:
        LDR.N    R0,??DataTable0_28
        BL       printf
//  168     		break;    
        B.N      ??cpu_identify_31
//  169    //LP following are not present on P0     
//  170     	case 0x5:
//  171     		printf("32 kBytes of RAM\n\n");
??cpu_identify_26:
        LDR.N    R0,??DataTable0_29
        BL       printf
//  172     		break;
        B.N      ??cpu_identify_31
//  173     	case 0x7:
//  174     		printf("64 kBytes of RAM\n\n");
??cpu_identify_27:
        LDR.N    R0,??DataTable0_30
        BL       printf
//  175     		break;
        B.N      ??cpu_identify_31
//  176     	case 0x8:
//  177     		printf("96 kBytes of RAM\n\n");
??cpu_identify_28:
        LDR.N    R0,??DataTable0_31
        BL       printf
//  178     		break;
        B.N      ??cpu_identify_31
//  179     	case 0x9:
//  180     		printf("128 kBytes of RAM\n\n");
??cpu_identify_29:
        LDR.N    R0,??DataTable0_32
        BL       printf
//  181     		break;
        B.N      ??cpu_identify_31
//  182             
//  183 		default:
//  184 			printf(" ERR!! Undefined RAM size\n\n");  
??cpu_identify_30:
        LDR.N    R0,??DataTable0_33
        BL       printf
//  185 			break;  		
//  186     }
//  187 }
??cpu_identify_31:
        POP      {R0,PC}          ;; return

        SECTION `.text`:CODE:NOROOT(2)
        SECTION_TYPE SHT_PROGBITS, 0
        DATA
??DataTable0:
        DC32     0x40048024

        SECTION `.text`:CODE:NOROOT(2)
        SECTION_TYPE SHT_PROGBITS, 0
        DATA
??DataTable0_1:
        DC32     `?<Constant "\\n FAM_ID = 0x%x">`

        SECTION `.text`:CODE:NOROOT(2)
        SECTION_TYPE SHT_PROGBITS, 0
        DATA
??DataTable0_2:
        DC32     `?<Constant "\\nK10-">`

        SECTION `.text`:CODE:NOROOT(2)
        SECTION_TYPE SHT_PROGBITS, 0
        DATA
??DataTable0_3:
        DC32     `?<Constant "\\nK20-">`

        SECTION `.text`:CODE:NOROOT(2)
        SECTION_TYPE SHT_PROGBITS, 0
        DATA
??DataTable0_4:
        DC32     `?<Constant "\\nK30-">`

        SECTION `.text`:CODE:NOROOT(2)
        SECTION_TYPE SHT_PROGBITS, 0
        DATA
??DataTable0_5:
        DC32     `?<Constant "\\nK40-">`

        SECTION `.text`:CODE:NOROOT(2)
        SECTION_TYPE SHT_PROGBITS, 0
        DATA
??DataTable0_6:
        DC32     `?<Constant "\\nK60-">`

        SECTION `.text`:CODE:NOROOT(2)
        SECTION_TYPE SHT_PROGBITS, 0
        DATA
??DataTable0_7:
        DC32     `?<Constant "\\nUnrecognized Kinetis...">`

        SECTION `.text`:CODE:NOROOT(2)
        SECTION_TYPE SHT_PROGBITS, 0
        DATA
??DataTable0_8:
        DC32     `?<Constant "\\n PIN_ID = 0x%x">`

        SECTION `.text`:CODE:NOROOT(2)
        SECTION_TYPE SHT_PROGBITS, 0
        DATA
??DataTable0_9:
        DC32     `?<Constant "32pin\\n">`

        SECTION `.text`:CODE:NOROOT(2)
        SECTION_TYPE SHT_PROGBITS, 0
        DATA
??DataTable0_10:
        DC32     `?<Constant "48pin\\n">`

        SECTION `.text`:CODE:NOROOT(2)
        SECTION_TYPE SHT_PROGBITS, 0
        DATA
??DataTable0_11:
        DC32     `?<Constant "64pin\\n">`

        SECTION `.text`:CODE:NOROOT(2)
        SECTION_TYPE SHT_PROGBITS, 0
        DATA
??DataTable0_12:
        DC32     `?<Constant "80pin\\n">`

        SECTION `.text`:CODE:NOROOT(2)
        SECTION_TYPE SHT_PROGBITS, 0
        DATA
??DataTable0_13:
        DC32     `?<Constant "81pin\\n">`

        SECTION `.text`:CODE:NOROOT(2)
        SECTION_TYPE SHT_PROGBITS, 0
        DATA
??DataTable0_14:
        DC32     `?<Constant "100pin\\n">`

        SECTION `.text`:CODE:NOROOT(2)
        SECTION_TYPE SHT_PROGBITS, 0
        DATA
??DataTable0_15:
        DC32     `?<Constant "104pin\\n">`

        SECTION `.text`:CODE:NOROOT(2)
        SECTION_TYPE SHT_PROGBITS, 0
        DATA
??DataTable0_16:
        DC32     `?<Constant "144pin\\n">`

        SECTION `.text`:CODE:NOROOT(2)
        SECTION_TYPE SHT_PROGBITS, 0
        DATA
??DataTable0_17:
        DC32     `?<Constant "196pin\\n">`

        SECTION `.text`:CODE:NOROOT(2)
        SECTION_TYPE SHT_PROGBITS, 0
        DATA
??DataTable0_18:
        DC32     `?<Constant "256pin\\n">`

        SECTION `.text`:CODE:NOROOT(2)
        SECTION_TYPE SHT_PROGBITS, 0
        DATA
??DataTable0_19:
        DC32     `?<Constant "\\nUnrecognized Kinetis...">_1`

        SECTION `.text`:CODE:NOROOT(2)
        SECTION_TYPE SHT_PROGBITS, 0
        DATA
??DataTable0_20:
        DC32     `?<Constant "\\n REV_ID = 0x%x \\n">`

        SECTION `.text`:CODE:NOROOT(2)
        SECTION_TYPE SHT_PROGBITS, 0
        DATA
??DataTable0_21:
        DC32     `?<Constant "Silicon rev 1.0\\n">`

        SECTION `.text`:CODE:NOROOT(2)
        SECTION_TYPE SHT_PROGBITS, 0
        DATA
??DataTable0_22:
        DC32     `?<Constant "Silicon rev 1.1\\n">`

        SECTION `.text`:CODE:NOROOT(2)
        SECTION_TYPE SHT_PROGBITS, 0
        DATA
??DataTable0_23:
        DC32     `?<Constant "Silicon rev 1.2\\n">`

        SECTION `.text`:CODE:NOROOT(2)
        SECTION_TYPE SHT_PROGBITS, 0
        DATA
??DataTable0_24:
        DC32     `?<Constant "\\nThis version of soft...">`

        SECTION `.text`:CODE:NOROOT(2)
        SECTION_TYPE SHT_PROGBITS, 0
        DATA
??DataTable0_25:
        DC32     0x40047000

        SECTION `.text`:CODE:NOROOT(2)
        SECTION_TYPE SHT_PROGBITS, 0
        DATA
??DataTable0_26:
        DC32     `?<Constant "\\n RAM_SIZE_ID = 0x%x \\n">`

        SECTION `.text`:CODE:NOROOT(2)
        SECTION_TYPE SHT_PROGBITS, 0
        DATA
??DataTable0_27:
        DC32     `?<Constant "8 kBytes of RAM\\n\\n">`

        SECTION `.text`:CODE:NOROOT(2)
        SECTION_TYPE SHT_PROGBITS, 0
        DATA
??DataTable0_28:
        DC32     `?<Constant "16 kBytes of RAM\\n\\n">`

        SECTION `.text`:CODE:NOROOT(2)
        SECTION_TYPE SHT_PROGBITS, 0
        DATA
??DataTable0_29:
        DC32     `?<Constant "32 kBytes of RAM\\n\\n">`

        SECTION `.text`:CODE:NOROOT(2)
        SECTION_TYPE SHT_PROGBITS, 0
        DATA
??DataTable0_30:
        DC32     `?<Constant "64 kBytes of RAM\\n\\n">`

        SECTION `.text`:CODE:NOROOT(2)
        SECTION_TYPE SHT_PROGBITS, 0
        DATA
??DataTable0_31:
        DC32     `?<Constant "96 kBytes of RAM\\n\\n">`

        SECTION `.text`:CODE:NOROOT(2)
        SECTION_TYPE SHT_PROGBITS, 0
        DATA
??DataTable0_32:
        DC32     `?<Constant "128 kBytes of RAM\\n\\n">`

        SECTION `.text`:CODE:NOROOT(2)
        SECTION_TYPE SHT_PROGBITS, 0
        DATA
??DataTable0_33:
        DC32     `?<Constant " ERR!! Undefined RAM ...">`
//  188 
//  189 
//  190 /********************************************************************/
//  191 /*!
//  192  * \brief   flash Identify
//  193  * \return  None
//  194  *
//  195  * This is primarly a reporting function that displays information
//  196  * about the specific flash parameters and flash version ID for 
//  197  * the current device. These parameters are obtained using a special
//  198  * flash command call "read resource." The first four bytes returned
//  199  * are the flash parameter revision, and the second four bytes are
//  200  * the flash version ID.
//  201  */

        SECTION `.text`:CODE:NOROOT(1)
        THUMB
//  202 void flash_identify (void)
//  203 {
//  204     /* Get the flash parameter version */
//  205 #if 0
//  206     /* Write the flash FCCOB registers with the values for a read resource command */
//  207     FTFE_FCCOB0 = 0x03;
//  208     FTFE_FCCOB1 = 0x00;
//  209     FTFE_FCCOB2 = 0x00;
//  210     FTFE_FCCOB3 = 0x00;
//  211     FTFE_FCCOB4 = 0x01;   
//  212 
//  213     /* All required FCCOBx registers are written, so launch the command */
//  214     FTFE_FSTAT = FTFE_FSTAT_CCIF_MASK;
//  215 
//  216     /* Wait for the command to complete */
//  217     while(!(FTFE_FSTAT & FTFE_FSTAT_CCIF_MASK));
//  218     
//  219     printf("Flash parameter version %d.%d.%d.%d\n",FTFE_FCCOB4,FTFE_FCCOB5,FTFE_FCCOB6,FTFE_FCCOB7);
//  220 
//  221     /* Get the flash version ID */   
//  222 
//  223     /* Write the flash FCCOB registers with the values for a read resource command */
//  224     FTFE_FCCOB0 = 0x03;
//  225     FTFE_FCCOB1 = 0x00;
//  226     FTFE_FCCOB2 = 0x00;
//  227     FTFE_FCCOB3 = 0x04;
//  228     FTFE_FCCOB4 = 0x01; 
//  229     
//  230     /* All required FCCOBx registers are written, so launch the command */
//  231     FTFE_FSTAT = FTFE_FSTAT_CCIF_MASK;
//  232 
//  233     /* Wait for the command to complete */
//  234     while(!(FTFE_FSTAT & FTFE_FSTAT_CCIF_MASK));
//  235 
//  236     printf("Flash version ID %d.%d.%d.%d\n",FTFE_FCCOB4,FTFE_FCCOB5,FTFE_FCCOB6,FTFE_FCCOB7);  
//  237     
//  238     /* Clear all of the flags in the flash status register */
//  239     FTFE_FSTAT = 0xFF;
//  240 #endif
//  241     
//  242     
//  243 }
flash_identify:
        BX       LR               ;; return

        SECTION `.iar_vfe_header`:DATA:REORDER:NOALLOC:NOROOT(2)
        SECTION_TYPE SHT_PROGBITS, 0
        DATA
        DC32 0

        SECTION __DLIB_PERTHREAD:DATA:REORDER:NOROOT(0)
        SECTION_TYPE SHT_PROGBITS, 0

        SECTION __DLIB_PERTHREAD_init:DATA:REORDER:NOROOT(0)
        SECTION_TYPE SHT_PROGBITS, 0

        SECTION `.rodata`:CONST:REORDER:NOROOT(2)
`?<Constant "\\n FAM_ID = 0x%x">`:
        DATA
        DC8 "\012 FAM_ID = 0x%x"

        SECTION `.rodata`:CONST:REORDER:NOROOT(2)
`?<Constant "\\nK10-">`:
        DATA
        DC8 "\012K10-"
        DC8 0, 0

        SECTION `.rodata`:CONST:REORDER:NOROOT(2)
`?<Constant "\\nK20-">`:
        DATA
        DC8 "\012K20-"
        DC8 0, 0

        SECTION `.rodata`:CONST:REORDER:NOROOT(2)
`?<Constant "\\nK30-">`:
        DATA
        DC8 "\012K30-"
        DC8 0, 0

        SECTION `.rodata`:CONST:REORDER:NOROOT(2)
`?<Constant "\\nK40-">`:
        DATA
        DC8 "\012K40-"
        DC8 0, 0

        SECTION `.rodata`:CONST:REORDER:NOROOT(2)
`?<Constant "\\nK60-">`:
        DATA
        DC8 "\012K60-"
        DC8 0, 0

        SECTION `.rodata`:CONST:REORDER:NOROOT(2)
`?<Constant "\\nUnrecognized Kinetis...">`:
        DATA
        DC8 "\012Unrecognized Kinetis family device.\012"
        DC8 0, 0

        SECTION `.rodata`:CONST:REORDER:NOROOT(2)
`?<Constant "\\n PIN_ID = 0x%x">`:
        DATA
        DC8 "\012 PIN_ID = 0x%x"

        SECTION `.rodata`:CONST:REORDER:NOROOT(2)
`?<Constant "32pin\\n">`:
        DATA
        DC8 "32pin\012"
        DC8 0

        SECTION `.rodata`:CONST:REORDER:NOROOT(2)
`?<Constant "48pin\\n">`:
        DATA
        DC8 "48pin\012"
        DC8 0

        SECTION `.rodata`:CONST:REORDER:NOROOT(2)
`?<Constant "64pin\\n">`:
        DATA
        DC8 "64pin\012"
        DC8 0

        SECTION `.rodata`:CONST:REORDER:NOROOT(2)
`?<Constant "80pin\\n">`:
        DATA
        DC8 "80pin\012"
        DC8 0

        SECTION `.rodata`:CONST:REORDER:NOROOT(2)
`?<Constant "81pin\\n">`:
        DATA
        DC8 "81pin\012"
        DC8 0

        SECTION `.rodata`:CONST:REORDER:NOROOT(2)
`?<Constant "100pin\\n">`:
        DATA
        DC8 "100pin\012"

        SECTION `.rodata`:CONST:REORDER:NOROOT(2)
`?<Constant "104pin\\n">`:
        DATA
        DC8 "104pin\012"

        SECTION `.rodata`:CONST:REORDER:NOROOT(2)
`?<Constant "144pin\\n">`:
        DATA
        DC8 "144pin\012"

        SECTION `.rodata`:CONST:REORDER:NOROOT(2)
`?<Constant "196pin\\n">`:
        DATA
        DC8 "196pin\012"

        SECTION `.rodata`:CONST:REORDER:NOROOT(2)
`?<Constant "256pin\\n">`:
        DATA
        DC8 "256pin\012"

        SECTION `.rodata`:CONST:REORDER:NOROOT(2)
`?<Constant "\\nUnrecognized Kinetis...">_1`:
        DATA
        DC8 "\012Unrecognized Kinetis package code .\012"
        DC8 0, 0

        SECTION `.rodata`:CONST:REORDER:NOROOT(2)
`?<Constant "\\n REV_ID = 0x%x \\n">`:
        DATA
        DC8 "\012 REV_ID = 0x%x \012"
        DC8 0, 0

        SECTION `.rodata`:CONST:REORDER:NOROOT(2)
`?<Constant "Silicon rev 1.0\\n">`:
        DATA
        DC8 "Silicon rev 1.0\012"
        DC8 0, 0, 0

        SECTION `.rodata`:CONST:REORDER:NOROOT(2)
`?<Constant "Silicon rev 1.1\\n">`:
        DATA
        DC8 "Silicon rev 1.1\012"
        DC8 0, 0, 0

        SECTION `.rodata`:CONST:REORDER:NOROOT(2)
`?<Constant "Silicon rev 1.2\\n">`:
        DATA
        DC8 "Silicon rev 1.2\012"
        DC8 0, 0, 0

        SECTION `.rodata`:CONST:REORDER:NOROOT(2)
`?<Constant "\\nThis version of soft...">`:
        DATA
        DC8 0AH, 54H, 68H, 69H, 73H, 20H, 76H, 65H
        DC8 72H, 73H, 69H, 6FH, 6EH, 20H, 6FH, 66H
        DC8 20H, 73H, 6FH, 66H, 74H, 77H, 61H, 72H
        DC8 65H, 20H, 64H, 6FH, 65H, 73H, 6EH, 27H
        DC8 74H, 20H, 72H, 65H, 63H, 6FH, 67H, 6EH
        DC8 69H, 7AH, 65H, 20H, 74H, 68H, 65H, 20H
        DC8 72H, 65H, 76H, 69H, 73H, 69H, 6FH, 6EH
        DC8 20H, 63H, 6FH, 64H, 65H, 2EH, 0
        DC8 0

        SECTION `.rodata`:CONST:REORDER:NOROOT(2)
`?<Constant "\\n RAM_SIZE_ID = 0x%x \\n">`:
        DATA
        DC8 "\012 RAM_SIZE_ID = 0x%x \012"
        DC8 0

        SECTION `.rodata`:CONST:REORDER:NOROOT(2)
`?<Constant "8 kBytes of RAM\\n\\n">`:
        DATA
        DC8 "8 kBytes of RAM\012\012"
        DC8 0, 0

        SECTION `.rodata`:CONST:REORDER:NOROOT(2)
`?<Constant "16 kBytes of RAM\\n\\n">`:
        DATA
        DC8 "16 kBytes of RAM\012\012"
        DC8 0

        SECTION `.rodata`:CONST:REORDER:NOROOT(2)
`?<Constant "32 kBytes of RAM\\n\\n">`:
        DATA
        DC8 "32 kBytes of RAM\012\012"
        DC8 0

        SECTION `.rodata`:CONST:REORDER:NOROOT(2)
`?<Constant "64 kBytes of RAM\\n\\n">`:
        DATA
        DC8 "64 kBytes of RAM\012\012"
        DC8 0

        SECTION `.rodata`:CONST:REORDER:NOROOT(2)
`?<Constant "96 kBytes of RAM\\n\\n">`:
        DATA
        DC8 "96 kBytes of RAM\012\012"
        DC8 0

        SECTION `.rodata`:CONST:REORDER:NOROOT(2)
`?<Constant "128 kBytes of RAM\\n\\n">`:
        DATA
        DC8 "128 kBytes of RAM\012\012"

        SECTION `.rodata`:CONST:REORDER:NOROOT(2)
`?<Constant " ERR!! Undefined RAM ...">`:
        DATA
        DC8 " ERR!! Undefined RAM size\012\012"

        END
//  244 /********************************************************************/
//  245 
// 
// 548 bytes in section .rodata
// 582 bytes in section .text
// 
// 582 bytes of CODE  memory
// 548 bytes of CONST memory
//
//Errors: none
//Warnings: none
