Permalink
Browse files

make CMSIS happy

  • Loading branch information...
1 parent 7b53d1f commit 7a1dc28e3de667ab4dc34ea6fe5e0426b3175e3f @corecode committed Sep 23, 2012
Showing with 226 additions and 7 deletions.
  1. +80 −2 toolchain/crt0/system_k20.c
  2. +141 −0 toolchain/include/mchck.h
  3. +5 −5 toolchain/include/mchck_internal.h
@@ -1,4 +1,82 @@
-void
-SystemInit(void)
+/**************************************************************************//**
+ * @file system_k20.c
+ * @brief CMSIS Cortex-M# Device Peripheral Access Layer Source File for
+ * Freescale Kinetis K20
+ * @version V3.01
+ * @date 06. March 2012
+ *
+ * @note
+ * Copyright (C) 2010-2012 ARM Limited. All rights reserved.
+ *
+ * @par
+ * ARM Limited (ARM) is supplying this software for use with Cortex-M
+ * processor based microcontrollers. This file can be freely distributed
+ * within development tools that are supporting such ARM based processors.
+ *
+ * @par
+ * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
+ * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
+ * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
+ * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
+ *
+ ******************************************************************************/
+
+
+#include <stdint.h>
+#include <mchck.h>
+
+
+/*----------------------------------------------------------------------------
+ DEFINES
+ *----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+ Define clocks
+ *----------------------------------------------------------------------------*/
+/* ToDo: add here your necessary defines for device initialization
+ following is an example for different system frequencies */
+#define __HSI ( 6000000UL)
+#define __XTAL (12000000UL) /* Oscillator frequency */
+#define __SYS_OSC_CLK ( ___HSI) /* Main oscillator frequency */
+
+#define __SYSTEM_CLOCK (4*__XTAL)
+
+
+/*----------------------------------------------------------------------------
+ Clock Variable definitions
+ *----------------------------------------------------------------------------*/
+/* ToDo: initialize SystemCoreClock with the system core clock frequency value
+ achieved after system intitialization.
+ This means system core clock frequency after call to SystemInit() */
+uint32_t SystemCoreClock = __SYSTEM_CLOCK; /*!< System Clock Frequency (Core Clock)*/
+
+
+/*----------------------------------------------------------------------------
+ Clock functions
+ *----------------------------------------------------------------------------*/
+void SystemCoreClockUpdate (void) /* Get Core Clock Frequency */
{
+/* ToDo: add code to calculate the system frequency based upon the current
+ register settings.
+ This function can be used to retrieve the system core clock frequeny
+ after user changed register sittings. */
+ SystemCoreClock = __SYSTEM_CLOCK;
+}
+
+/**
+ * Initialize the system
+ *
+ * @param none
+ * @return none
+ *
+ * @brief Setup the microcontroller system.
+ * Initialize the System.
+ */
+void SystemInit (void)
+{
+/* ToDo: add code to initialize the system
+ do not use global variables because this function is called before
+ reaching pre-main. RW section maybe overwritten afterwards. */
+ SystemCoreClock = __SYSTEM_CLOCK;
}
View
@@ -5,7 +5,148 @@
#error Build system error: mchck_internal.h not included by compiler
#endif
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+
+#include <stdint.h>
+
+
+/* From CMSIS: */
+
+typedef enum IRQn
+{
+/****** Cortex-M# Processor Exceptions Numbers ***************************************************/
+
+ NonMaskableInt_IRQn = -14, /*!< 2 Non Maskable Interrupt */
+ MemoryManagement_IRQn = -12, /*!< 4 Memory Management Interrupt */
+ BusFault_IRQn = -11, /*!< 5 Bus Fault Interrupt */
+ UsageFault_IRQn = -10, /*!< 6 Usage Fault Interrupt */
+ SVCall_IRQn = -5, /*!< 11 SV Call Interrupt */
+ DebugMonitor_IRQn = -4, /*!< 12 Debug Monitor Interrupt */
+ PendSV_IRQn = -2, /*!< 14 Pend SV Interrupt */
+ SysTick_IRQn = -1, /*!< 15 System Tick Interrupt */
+
+/****** Device Specific Interrupt Numbers ********************************************************/
+ DMA0_IRQn,
+ DMA1_IRQn,
+ DMA2_IRQn,
+ DMA3_IRQn,
+ DMA4_IRQn,
+ DMA5_IRQn,
+ DMA6_IRQn,
+ DMA7_IRQn,
+ DMA8_IRQn,
+ DMA9_IRQn,
+ DMA10_IRQn,
+ DMA11_IRQn,
+ DMA12_IRQn,
+ DMA13_IRQn,
+ DMA14_IRQn,
+ DMA15_IRQn,
+ DMA_Error_IRQn,
+ MCM_IRQn,
+ FTFL_IRQn,
+ Read_Collision_IRQn,
+ LVD_LVW_IRQn,
+ LLW_IRQn,
+ Watchdog_IRQn,
+ Reserved39_IRQn,
+ I2C0_IRQn,
+ I2C1_IRQn,
+ SPI0_IRQn,
+ SPI1_IRQn,
+ SPI2_IRQn,
+ CAN0_ORed_Message_buffer_IRQn,
+ CAN0_Bus_Off_IRQn,
+ CAN0_Error_IRQn,
+ CAN0_Tx_Warning_IRQn,
+ CAN0_Rx_Warning_IRQn,
+ CAN0_Wake_Up_IRQn,
+ Reserved51_IRQn,
+ Reserved52_IRQn,
+ CAN1_ORed_Message_buffer_IRQn,
+ CAN1_Bus_Off_IRQn,
+ CAN1_Error_IRQn,
+ CAN1_Tx_Warning_IRQn,
+ CAN1_Rx_Warning_IRQn,
+ CAN1_Wake_Up_IRQn,
+ Reserved59_IRQn,
+ Reserved60_IRQn,
+ UART0_RX_TX_IRQn,
+ UART0_ERR_IRQn,
+ UART1_RX_TX_IRQn,
+ UART1_ERR_IRQn,
+ UART2_RX_TX_IRQn,
+ UART2_ERR_IRQn,
+ UART3_RX_TX_IRQn,
+ UART3_ERR_IRQn,
+ UART4_RX_TX_IRQn,
+ UART4_ERR_IRQn,
+ UART5_RX_TX_IRQn,
+ UART5_ERR_IRQn,
+ ADC0_IRQn,
+ ADC1_IRQn,
+ CMP0_IRQn,
+ CMP1_IRQn,
+ CMP2_IRQn,
+ FTM0_IRQn,
+ FTM1_IRQn,
+ FTM2_IRQn,
+ CMT_IRQn,
+ RTC_IRQn,
+ Reserved83_IRQn,
+ PIT0_IRQn,
+ PIT1_IRQn,
+ PIT2_IRQn,
+ PIT3_IRQn,
+ PDB0_IRQn,
+ USB0_IRQn,
+ USBDCD_IRQn,
+ Reserved91_IRQn,
+ Reserved92_IRQn,
+ Reserved93_IRQn,
+ Reserved94_IRQn,
+ I2S0_IRQn,
+ SDHC_IRQn,
+ DAC0_IRQn,
+ DAC1_IRQn,
+ TSI0_IRQn,
+ MCG_IRQn,
+ LPTimer_IRQn,
+ Reserved102_IRQn,
+ PORTA_IRQn,
+ PORTB_IRQn,
+ PORTC_IRQn,
+ PORTD_IRQn,
+ PORTE_IRQn,
+ Reserved108_IRQn,
+ Reserved109_IRQn,
+ Reserved110_IRQn,
+ Reserved111_IRQn,
+ Reserved112_IRQn,
+ Reserved113_IRQn,
+ Reserved114_IRQn,
+ Reserved115_IRQn,
+ Reserved116_IRQn,
+ Reserved117_IRQn,
+ Reserved118_IRQn,
+ Reserved119_IRQn
+} IRQn_Type;
+
#include <core_cm4.h>
#include <MK20DZ10.h>
+
+extern uint32_t SystemCoreClock;
+
+extern void SystemInit(void);
+extern void SystemCoreClockUpdate(void);
+
+
+#ifdef __cplusplus
+}
+#endif
+
#endif
@@ -1,10 +1,10 @@
#ifndef __MCHCK_INTERNAL_H
#define __MCHCK_INTERNAL_H
-#define __CM4_REV 0x000
-#define __FPU_PRESENT 0
-#define __MPU_PRESENT 0
-#define __NVIC_PRIO_BITS 4
-#define __Vendor_SysTickConfig 0
+#define __CM4_REV 0x0000
+#define __NVIC_PRIO_BITS 4
+#define __Vendor_SysTickConfig 0
+#define __MPU_PRESENT 0
+#define __FPU_PRESENT 0
#endif

0 comments on commit 7a1dc28

Please sign in to comment.