2 * Modifications for use with Code Red's toolchain - 2011/11/24
\r
4 /**********************************************************************
\r
5 * $Id$ system_LPC18xx.c 2011-06-02
\r
7 * @file system_LPC18xx.c
\r
8 * @brief Cortex-M3 Device System Source File for NXP LPC18xx Series.
\r
10 * @date 02. June. 2011
\r
11 * @author NXP MCU SW Application Team
\r
13 * Copyright(C) 2011, NXP Semiconductor
\r
14 * All rights reserved.
\r
16 ***********************************************************************
\r
17 * Software that is described herein is for illustrative purposes only
\r
18 * which provides customers with programming information regarding the
\r
19 * products. This software is supplied "AS IS" without any warranties.
\r
20 * NXP Semiconductors assumes no responsibility or liability for the
\r
21 * use of the software, conveys no license or title under any patent,
\r
22 * copyright, or mask work right to the product. NXP Semiconductors
\r
23 * reserves the right to make changes in the software without
\r
24 * notification. NXP Semiconductors also make no representation or
\r
25 * warranty that such application will be suitable for the specified
\r
26 * use without further testing or modification.
\r
27 **********************************************************************/
\r
29 #include "LPC18xx.h"
\r
30 #include "lpc18xx_cgu.h"
\r
31 /*----------------------------------------------------------------------------
\r
33 *----------------------------------------------------------------------------*/
\r
34 #define __IRC (12000000UL) /* IRC Oscillator frequency */
\r
36 /*----------------------------------------------------------------------------
\r
37 Clock Variable definitions
\r
38 *----------------------------------------------------------------------------*/
\r
39 uint32_t SystemCoreClock = __IRC * 10UL; /*!< System Clock Frequency (Core Clock)*/
\r
42 extern uint32_t getPC(void);
\r
46 * Initialize the system
\r
51 * @brief Setup the microcontroller system.
\r
52 * Initialize the System.
\r
54 void SystemInit (void)
\r
57 // CodeRed startup code will modify VTOR register to match
\r
58 // when code has been linked to run from.
\r
60 // Check whether we are running from external flash
\r
61 if (SCB->VTOR == 0x1C000000)
\r
62 /*Enable Buffer for External Flash*/
\r
63 LPC_EMC->STATICCONFIG0 |= 1<<19;
\r
65 // Call clock initialisation code
\r
69 // Enable VTOR register to point to vector table
\r
70 SCB->VTOR = getPC() & 0xFFF00000;
\r
71 /*Enable Buffer for External Flash*/
\r
72 LPC_EMC->STATICCONFIG0 |= 1<<19;
\r