/* Perform processor initialization */\r
sysinit();\r
\r
- printf("\n\n");\r
- \r
- /* Determine the last cause(s) of reset */\r
- if (MC_SRSH & MC_SRSH_SW_MASK)\r
- printf("Software Reset\n");\r
- if (MC_SRSH & MC_SRSH_LOCKUP_MASK)\r
- printf("Core Lockup Event Reset\n");\r
- if (MC_SRSH & MC_SRSH_JTAG_MASK)\r
- printf("JTAG Reset\n");\r
- \r
- if (MC_SRSL & MC_SRSL_POR_MASK)\r
- printf("Power-on Reset\n");\r
- if (MC_SRSL & MC_SRSL_PIN_MASK)\r
- printf("External Pin Reset\n");\r
- if (MC_SRSL & MC_SRSL_COP_MASK)\r
- printf("Watchdog(COP) Reset\n");\r
- if (MC_SRSL & MC_SRSL_LOC_MASK)\r
- printf("Loss of Clock Reset\n");\r
- if (MC_SRSL & MC_SRSL_LVD_MASK)\r
- printf("Low-voltage Detect Reset\n");\r
- if (MC_SRSL & MC_SRSL_WAKEUP_MASK)\r
- printf("LLWU Reset\n"); \r
- \r
+ /* Determine the flash revision */\r
+ flash_identify(); \r
\r
- /* Determine specific Kinetis device and revision */\r
- cpu_identify();\r
- \r
/* Jump to main process */\r
main();\r
\r
while(1);\r
}\r
/********************************************************************/\r
-/*!\r
- * \brief Kinetis Identify\r
- * \return None\r
- *\r
- * This is primarly a reporting function that displays information\r
- * about the specific CPU to the default terminal including:\r
- * - Kinetis family\r
- * - package\r
- * - die revision\r
- * - P-flash size\r
- * - Ram size\r
- */\r
-void cpu_identify (void)\r
-{\r
- /* Determine the Kinetis family */\r
- switch((SIM_SDID & SIM_SDID_FAMID(0x7))>>SIM_SDID_FAMID_SHIFT) \r
- { \r
- case 0x0:\r
- printf("\nK10-");\r
- break;\r
- case 0x1:\r
- printf("\nK20-");\r
- break;\r
- case 0x2:\r
- printf("\nK30-");\r
- break;\r
- case 0x3:\r
- printf("\nK40-");\r
- break;\r
- case 0x4:\r
- printf("\nK60-");\r
- break;\r
- case 0x5:\r
- printf("\nK70-");\r
- break;\r
- case 0x6:\r
- printf("\nK50-");\r
- break;\r
- case 0x7:\r
- printf("\nK53-");\r
- break;\r
- default:\r
- printf("\nUnrecognized Kinetis family device.\n"); \r
- break; \r
- }\r
-\r
- /* Determine the package size */\r
- switch((SIM_SDID & SIM_SDID_PINID(0xF))>>SIM_SDID_PINID_SHIFT) \r
- { \r
- case 0x2:\r
- printf("32pin ");\r
- break;\r
- case 0x4:\r
- printf("48pin ");\r
- break;\r
- case 0x5:\r
- printf("64pin ");\r
- break;\r
- case 0x6:\r
- printf("80pin ");\r
- break;\r
- case 0x7:\r
- printf("81pin ");\r
- break;\r
- case 0x8:\r
- printf("100pin ");\r
- break;\r
- case 0x9:\r
- printf("104pin ");\r
- break;\r
- case 0xA:\r
- printf("144pin ");\r
- break;\r
- case 0xC:\r
- printf("196pin ");\r
- break;\r
- case 0xE:\r
- printf("256pin ");\r
- break;\r
- default:\r
- printf("\nUnrecognized Kinetis package code. "); \r
- break; \r
- } \r
-\r
- /* Determine the revision ID */\r
- printf("Silicon rev %d \n", (SIM_SDID & SIM_SDID_REVID(0xF))>>SIM_SDID_REVID_SHIFT);\r
- \r
- \r
- /* Determine the flash revision */\r
- flash_identify(); \r
- \r
- /* Determine the P-flash size */\r
- switch((SIM_FCFG1 & SIM_FCFG1_FSIZE(0xFF))>>SIM_FCFG1_FSIZE_SHIFT)\r
- {\r
- case 0x0:\r
- printf("12 kBytes of P-flash ");\r
- break;\r
- case 0x1:\r
- printf("16 kBytes of P-flash ");\r
- break;\r
- case 0x2:\r
- printf("32 kBytes of P-flash ");\r
- break;\r
- case 0x3:\r
- printf("48 kBytes of P-flash ");\r
- break;\r
- case 0x4:\r
- printf("64 kBytes of P-flash ");\r
- break;\r
- case 0x5:\r
- printf("96 kBytes of P-flash ");\r
- break;\r
- case 0x6:\r
- printf("128 kBytes of P-flash ");\r
- break;\r
- case 0x7:\r
- printf("192 kBytes of P-flash ");\r
- break;\r
- case 0x8:\r
- printf("256 kBytes of P-flash ");\r
- break;\r
- case 0x9:\r
- printf("320 kBytes of P-flash ");\r
- break;\r
- case 0xA:\r
- printf("384 kBytes of P-flash ");\r
- break;\r
- case 0xB:\r
- printf("448 kBytes of P-flash ");\r
- break;\r
- case 0xC:\r
- printf("512 kBytes of P-flash ");\r
- break;\r
- case 0xFF:\r
- printf("Full size P-flash ");\r
- break;\r
- default:\r
- printf("ERR!! Undefined P-flash size\n"); \r
- break; \r
- }\r
-\r
- /* Determine the RAM size */\r
- switch((SIM_SOPT1 & SIM_SOPT1_RAMSIZE(0xF))>>SIM_SOPT1_RAMSIZE_SHIFT)\r
- {\r
- case 0x5:\r
- printf(" 32 kBytes of RAM\n\n");\r
- break;\r
- case 0x7:\r
- printf(" 64 kBytes of RAM\n\n");\r
- break;\r
- case 0x8:\r
- printf(" 96 kBytes of RAM\n\n");\r
- break;\r
- case 0x9:\r
- printf(" 128 kBytes of RAM\n\n");\r
- break;\r
- default:\r
- printf(" ERR!! Undefined RAM size\n\n"); \r
- break; \r
- }\r
-}\r
-/********************************************************************/\r
/*!\r
* \brief flash Identify\r
* \return None\r
/* Wait for the command to complete */\r
while(!(FTFL_FSTAT & FTFL_FSTAT_CCIF_MASK));\r
\r
- printf("Flash parameter version %d.%d.%d.%d\n",FTFL_FCCOB4,FTFL_FCCOB5,FTFL_FCCOB6,FTFL_FCCOB7);\r
-\r
/* Get the flash version ID */ \r
\r
/* Write the flash FCCOB registers with the values for a read resource command */\r
\r
/* Wait for the command to complete */\r
while(!(FTFL_FSTAT & FTFL_FSTAT_CCIF_MASK));\r
-\r
- printf("Flash version ID %d.%d.%d.%d\n",FTFL_FCCOB4,FTFL_FCCOB5,FTFL_FCCOB6,FTFL_FCCOB7); \r
}\r
/********************************************************************/\r
\r