Import Mbed OS hard-float snapshot
This commit is contained in:
1247
targets/TARGET_NXP/TARGET_LPC11U6X/device/LPC11U6x.h
Normal file
1247
targets/TARGET_NXP/TARGET_LPC11U6X/device/LPC11U6x.h
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,48 @@
|
||||
#! armcc -E
|
||||
|
||||
#if !defined(MBED_APP_START)
|
||||
#define MBED_APP_START 0x00000000
|
||||
#endif
|
||||
|
||||
; 256k flash
|
||||
#if !defined(MBED_APP_SIZE)
|
||||
#define MBED_APP_SIZE 0x40000
|
||||
#endif
|
||||
|
||||
; 32kB
|
||||
#if !defined(MBED_RAM_START)
|
||||
#define MBED_RAM_START 0x10000000
|
||||
#endif
|
||||
|
||||
#if !defined(MBED_RAM_SIZE)
|
||||
#define MBED_RAM_SIZE 0x00008000
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(MBED_BOOT_STACK_SIZE)
|
||||
#define MBED_BOOT_STACK_SIZE 0x400
|
||||
#endif
|
||||
|
||||
; 8_byte_aligned(16+47 vect * 4 bytes) = 0x100
|
||||
#define VECTOR_SIZE 0x100
|
||||
|
||||
#define RAM_FIXED_SIZE (MBED_BOOT_STACK_SIZE+VECTOR_SIZE)
|
||||
|
||||
LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
|
||||
|
||||
ER_IROM1 MBED_APP_START MBED_APP_SIZE { ; load address = execution address
|
||||
*.o (RESET, +First)
|
||||
*(InRoot$$Sections)
|
||||
.ANY (+RO)
|
||||
}
|
||||
|
||||
RW_IRAM1 (MBED_RAM_START+VECTOR_SIZE) (MBED_RAM_SIZE-VECTOR_SIZE) { ; RW data
|
||||
.ANY (+RW +ZI)
|
||||
}
|
||||
|
||||
ARM_LIB_HEAP AlignExpr(+0, 16) EMPTY (MBED_RAM_SIZE-RAM_FIXED_SIZE+MBED_RAM_START-AlignExpr(ImageLimit(RW_IRAM1), 16)) {
|
||||
}
|
||||
|
||||
ARM_LIB_STACK (MBED_RAM_START+MBED_RAM_SIZE) EMPTY -MBED_BOOT_STACK_SIZE { ; stack
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,216 @@
|
||||
;/**************************************************************************//**
|
||||
; * @file startup_LPC11U6x.s
|
||||
; * @brief CMSIS Cortex-M0+ Core Device Startup File for
|
||||
; * NXP LPC11U6x Device Series
|
||||
; * @version V1.00
|
||||
; * @date 22. October 2013
|
||||
; *
|
||||
; * @note
|
||||
; * Copyright (C) 2013 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.
|
||||
; *
|
||||
; ******************************************************************************/
|
||||
|
||||
|
||||
PRESERVE8
|
||||
THUMB
|
||||
|
||||
|
||||
; Vector Table Mapped to Address 0 at Reset
|
||||
|
||||
AREA RESET, DATA, READONLY
|
||||
EXPORT __Vectors
|
||||
IMPORT |Image$$ARM_LIB_STACK$$ZI$$Limit|
|
||||
|
||||
__Vectors DCD |Image$$ARM_LIB_STACK$$ZI$$Limit| ; Top of Stack
|
||||
DCD Reset_Handler ; Reset Handler
|
||||
DCD NMI_Handler ; NMI Handler
|
||||
DCD HardFault_Handler ; Hard Fault Handler
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD SVC_Handler ; SVCall Handler
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD PendSV_Handler ; PendSV Handler
|
||||
DCD SysTick_Handler ; SysTick Handler
|
||||
|
||||
; External Interrupts
|
||||
DCD PIN_INT0_IRQHandler ; 16+ 0 GPIO pin interrupt 0
|
||||
DCD PIN_INT1_IRQHandler ; 16+ 1 GPIO pin interrupt 1
|
||||
DCD PIN_INT2_IRQHandler ; 16+ 2 GPIO pin interrupt 2
|
||||
DCD PIN_INT3_IRQHandler ; 16+ 3 GPIO pin interrupt 3
|
||||
DCD PIN_INT4_IRQHandler ; 16+ 4 GPIO pin interrupt 4
|
||||
DCD PIN_INT5_IRQHandler ; 16+ 5 GPIO pin interrupt 5
|
||||
DCD PIN_INT6_IRQHandler ; 16+ 6 GPIO pin interrupt 6
|
||||
DCD PIN_INT7_IRQHandler ; 16+ 7 GPIO pin interrupt 7
|
||||
DCD GINT0_IRQHandler ; 16+ 8 GPIO GROUP0 interrupt
|
||||
DCD GINT1_IRQHandler ; 16+ 9 GPIO GROUP1 interrupt
|
||||
DCD I2C1_IRQHandler ; 16+10 I2C1 interrupt
|
||||
DCD USART1_4_IRQHandler ; 16+11 Combined USART1 and USART4 interrupts
|
||||
DCD USART2_3_IRQHandler ; 16+12 Combined USART2 and USART3 interrupts
|
||||
DCD SCT0_1_IRQHandler ; 16+13 Combined SCT0 and SCT1 interrupts
|
||||
DCD SSP1_IRQHandler ; 16+14 SSP1 interrupt
|
||||
DCD I2C0_IRQHandler ; 16+15 I2C0 interrupt
|
||||
DCD CT16B0_IRQHandler ; 16+16 CT16B0 interrupt
|
||||
DCD CT16B1_IRQHandler ; 16+17 CT16B1 interrupt
|
||||
DCD CT32B0_IRQHandler ; 16+18 CT32B0 interrupt
|
||||
DCD CT32B1_IRQHandler ; 16+19 CT32B1 interrupt
|
||||
DCD SSP0_IRQHandler ; 16+20 SSP0 interrupt
|
||||
DCD USART0_IRQHandler ; 16+21 USART0 interrupt
|
||||
DCD USB_IRQHandler ; 16+22 USB interrupt
|
||||
DCD USB_FIQ_IRQHandler ; 16+23 USB_FIQ interrupt
|
||||
DCD ADC_A_IRQHandler ; 16+24 Combined ADC_A end-of-sequence A and threshold crossing interrupts
|
||||
DCD RTC_IRQHandler ; 16+25 RTC interrupt
|
||||
DCD BOD_WDT_IRQHandler ; 16+26 Combined BOD and WWDT interrupt
|
||||
DCD FLASH_IRQHandler ; 16+27 Combined flash and EEPROM controller interrupts
|
||||
DCD DMA_IRQHandler ; 16+28 DMA interrupt
|
||||
DCD ADC_B_IRQHandler ; 16+29 Combined ADC_A end-of-sequence A and threshold crossing interrupts
|
||||
DCD USBWAKEUP_IRQHandler ; 16+30 USB_WAKEUP interrupt
|
||||
DCD 0 ; 16+31 Reserved
|
||||
|
||||
; <h> Code Read Protection
|
||||
; <o> Code Read Protection <0xFFFFFFFF=>CRP Disabled
|
||||
; <0x12345678=>CRP Level 1
|
||||
; <0x87654321=>CRP Level 2
|
||||
; <0x43218765=>CRP Level 3 (ARE YOU SURE?)
|
||||
; <0x4E697370=>NO ISP (ARE YOU SURE?)
|
||||
; </h>
|
||||
IF :LNOT::DEF:NO_CRP
|
||||
AREA |.ARM.__at_0x02FC|, CODE, READONLY
|
||||
DCD 0xFFFFFFFF
|
||||
ENDIF
|
||||
|
||||
AREA |.text|, CODE, READONLY
|
||||
|
||||
|
||||
; Reset Handler
|
||||
|
||||
Reset_Handler PROC
|
||||
EXPORT Reset_Handler [WEAK]
|
||||
IMPORT SystemInit
|
||||
IMPORT __main
|
||||
LDR R0, =SystemInit
|
||||
BLX R0
|
||||
LDR R0, =__main
|
||||
BX R0
|
||||
ENDP
|
||||
|
||||
|
||||
; Dummy Exception Handlers (infinite loops which can be modified)
|
||||
|
||||
NMI_Handler PROC
|
||||
EXPORT NMI_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
HardFault_Handler\
|
||||
PROC
|
||||
EXPORT HardFault_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
SVC_Handler PROC
|
||||
EXPORT SVC_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
PendSV_Handler PROC
|
||||
EXPORT PendSV_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
SysTick_Handler PROC
|
||||
EXPORT SysTick_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
Reserved_IRQHandler PROC
|
||||
EXPORT Reserved_IRQHandler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
|
||||
Default_Handler PROC
|
||||
EXPORT PIN_INT0_IRQHandler [WEAK]
|
||||
EXPORT PIN_INT1_IRQHandler [WEAK]
|
||||
EXPORT PIN_INT2_IRQHandler [WEAK]
|
||||
EXPORT PIN_INT3_IRQHandler [WEAK]
|
||||
EXPORT PIN_INT4_IRQHandler [WEAK]
|
||||
EXPORT PIN_INT5_IRQHandler [WEAK]
|
||||
EXPORT PIN_INT6_IRQHandler [WEAK]
|
||||
EXPORT PIN_INT7_IRQHandler [WEAK]
|
||||
EXPORT GINT0_IRQHandler [WEAK]
|
||||
EXPORT GINT1_IRQHandler [WEAK]
|
||||
EXPORT I2C1_IRQHandler [WEAK]
|
||||
EXPORT USART1_4_IRQHandler [WEAK]
|
||||
EXPORT USART2_3_IRQHandler [WEAK]
|
||||
EXPORT SCT0_1_IRQHandler [WEAK]
|
||||
EXPORT SSP1_IRQHandler [WEAK]
|
||||
EXPORT I2C0_IRQHandler [WEAK]
|
||||
EXPORT CT16B0_IRQHandler [WEAK]
|
||||
EXPORT CT16B1_IRQHandler [WEAK]
|
||||
EXPORT CT32B0_IRQHandler [WEAK]
|
||||
EXPORT CT32B1_IRQHandler [WEAK]
|
||||
EXPORT SSP0_IRQHandler [WEAK]
|
||||
EXPORT USART0_IRQHandler [WEAK]
|
||||
EXPORT USB_IRQHandler [WEAK]
|
||||
EXPORT USB_FIQ_IRQHandler [WEAK]
|
||||
EXPORT ADC_A_IRQHandler [WEAK]
|
||||
EXPORT RTC_IRQHandler [WEAK]
|
||||
EXPORT BOD_WDT_IRQHandler [WEAK]
|
||||
EXPORT FLASH_IRQHandler [WEAK]
|
||||
EXPORT DMA_IRQHandler [WEAK]
|
||||
EXPORT ADC_B_IRQHandler [WEAK]
|
||||
EXPORT USBWAKEUP_IRQHandler [WEAK]
|
||||
|
||||
PIN_INT0_IRQHandler
|
||||
PIN_INT1_IRQHandler
|
||||
PIN_INT2_IRQHandler
|
||||
PIN_INT3_IRQHandler
|
||||
PIN_INT4_IRQHandler
|
||||
PIN_INT5_IRQHandler
|
||||
PIN_INT6_IRQHandler
|
||||
PIN_INT7_IRQHandler
|
||||
GINT0_IRQHandler
|
||||
GINT1_IRQHandler
|
||||
I2C1_IRQHandler
|
||||
USART1_4_IRQHandler
|
||||
USART2_3_IRQHandler
|
||||
SCT0_1_IRQHandler
|
||||
SSP1_IRQHandler
|
||||
I2C0_IRQHandler
|
||||
CT16B0_IRQHandler
|
||||
CT16B1_IRQHandler
|
||||
CT32B0_IRQHandler
|
||||
CT32B1_IRQHandler
|
||||
SSP0_IRQHandler
|
||||
USART0_IRQHandler
|
||||
USB_IRQHandler
|
||||
USB_FIQ_IRQHandler
|
||||
ADC_A_IRQHandler
|
||||
RTC_IRQHandler
|
||||
BOD_WDT_IRQHandler
|
||||
FLASH_IRQHandler
|
||||
DMA_IRQHandler
|
||||
ADC_B_IRQHandler
|
||||
USBWAKEUP_IRQHandler
|
||||
|
||||
B .
|
||||
|
||||
ENDP
|
||||
|
||||
|
||||
ALIGN
|
||||
|
||||
|
||||
END
|
||||
@@ -0,0 +1,22 @@
|
||||
#! armcc -E
|
||||
|
||||
#if !defined(MBED_BOOT_STACK_SIZE)
|
||||
#define MBED_BOOT_STACK_SIZE 0x400
|
||||
#endif
|
||||
|
||||
#define Stack_Size MBED_BOOT_STACK_SIZE
|
||||
|
||||
LR_IROM1 0x00000000 0x40000 { ; load region size_region (256k)
|
||||
ER_IROM1 0x00000000 0x40000 { ; load address = execution address
|
||||
*.o (RESET, +First)
|
||||
*(InRoot$$Sections)
|
||||
.ANY (+RO)
|
||||
}
|
||||
; 8_byte_aligned(16+47 vect * 4 bytes) = 0x100
|
||||
; 32kB (0x8000) - 0x100 = 0x7F00
|
||||
RW_IRAM1 (0x10000000+0x100) (0x8000-0x100-Stack_Size) {
|
||||
.ANY (+RW +ZI)
|
||||
}
|
||||
ARM_LIB_STACK (0x10000000+0x8000) EMPTY -Stack_Size { ; stack
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,217 @@
|
||||
;/**************************************************************************//**
|
||||
; * @file startup_LPC11U6x.s
|
||||
; * @brief CMSIS Cortex-M0+ Core Device Startup File for
|
||||
; * NXP LPC11U6x Device Series
|
||||
; * @version V1.00
|
||||
; * @date 22. October 2013
|
||||
; *
|
||||
; * @note
|
||||
; * Copyright (C) 2013 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.
|
||||
; *
|
||||
; ******************************************************************************/
|
||||
|
||||
|
||||
PRESERVE8
|
||||
THUMB
|
||||
|
||||
|
||||
; Vector Table Mapped to Address 0 at Reset
|
||||
|
||||
AREA RESET, DATA, READONLY
|
||||
EXPORT __Vectors
|
||||
IMPORT |Image$$ARM_LIB_STACK$$ZI$$Limit|
|
||||
|
||||
__Vectors DCD |Image$$ARM_LIB_STACK$$ZI$$Limit| ; Top of Stack
|
||||
DCD Reset_Handler ; Reset Handler
|
||||
DCD NMI_Handler ; NMI Handler
|
||||
DCD HardFault_Handler ; Hard Fault Handler
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD SVC_Handler ; SVCall Handler
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD PendSV_Handler ; PendSV Handler
|
||||
DCD SysTick_Handler ; SysTick Handler
|
||||
|
||||
; External Interrupts
|
||||
DCD PIN_INT0_IRQHandler ; 16+ 0 GPIO pin interrupt 0
|
||||
DCD PIN_INT1_IRQHandler ; 16+ 1 GPIO pin interrupt 1
|
||||
DCD PIN_INT2_IRQHandler ; 16+ 2 GPIO pin interrupt 2
|
||||
DCD PIN_INT3_IRQHandler ; 16+ 3 GPIO pin interrupt 3
|
||||
DCD PIN_INT4_IRQHandler ; 16+ 4 GPIO pin interrupt 4
|
||||
DCD PIN_INT5_IRQHandler ; 16+ 5 GPIO pin interrupt 5
|
||||
DCD PIN_INT6_IRQHandler ; 16+ 6 GPIO pin interrupt 6
|
||||
DCD PIN_INT7_IRQHandler ; 16+ 7 GPIO pin interrupt 7
|
||||
DCD GINT0_IRQHandler ; 16+ 8 GPIO GROUP0 interrupt
|
||||
DCD GINT1_IRQHandler ; 16+ 9 GPIO GROUP1 interrupt
|
||||
DCD I2C1_IRQHandler ; 16+10 I2C1 interrupt
|
||||
DCD USART1_4_IRQHandler ; 16+11 Combined USART1 and USART4 interrupts
|
||||
DCD USART2_3_IRQHandler ; 16+12 Combined USART2 and USART3 interrupts
|
||||
DCD SCT0_1_IRQHandler ; 16+13 Combined SCT0 and SCT1 interrupts
|
||||
DCD SSP1_IRQHandler ; 16+14 SSP1 interrupt
|
||||
DCD I2C0_IRQHandler ; 16+15 I2C0 interrupt
|
||||
DCD CT16B0_IRQHandler ; 16+16 CT16B0 interrupt
|
||||
DCD CT16B1_IRQHandler ; 16+17 CT16B1 interrupt
|
||||
DCD CT32B0_IRQHandler ; 16+18 CT32B0 interrupt
|
||||
DCD CT32B1_IRQHandler ; 16+19 CT32B1 interrupt
|
||||
DCD SSP0_IRQHandler ; 16+20 SSP0 interrupt
|
||||
DCD USART0_IRQHandler ; 16+21 USART0 interrupt
|
||||
DCD USB_IRQHandler ; 16+22 USB interrupt
|
||||
DCD USB_FIQ_IRQHandler ; 16+23 USB_FIQ interrupt
|
||||
DCD ADC_A_IRQHandler ; 16+24 Combined ADC_A end-of-sequence A and threshold crossing interrupts
|
||||
DCD RTC_IRQHandler ; 16+25 RTC interrupt
|
||||
DCD BOD_WDT_IRQHandler ; 16+26 Combined BOD and WWDT interrupt
|
||||
DCD FLASH_IRQHandler ; 16+27 Combined flash and EEPROM controller interrupts
|
||||
DCD DMA_IRQHandler ; 16+28 DMA interrupt
|
||||
DCD ADC_B_IRQHandler ; 16+29 Combined ADC_A end-of-sequence A and threshold crossing interrupts
|
||||
DCD USBWAKEUP_IRQHandler ; 16+30 USB_WAKEUP interrupt
|
||||
DCD 0 ; 16+31 Reserved
|
||||
|
||||
; <h> Code Read Protection
|
||||
; <o> Code Read Protection <0xFFFFFFFF=>CRP Disabled
|
||||
; <0x12345678=>CRP Level 1
|
||||
; <0x87654321=>CRP Level 2
|
||||
; <0x43218765=>CRP Level 3 (ARE YOU SURE?)
|
||||
; <0x4E697370=>NO ISP (ARE YOU SURE?)
|
||||
; </h>
|
||||
IF :LNOT::DEF:NO_CRP
|
||||
AREA |.ARM.__at_0x02FC|, CODE, READONLY
|
||||
DCD 0xFFFFFFFF
|
||||
ENDIF
|
||||
|
||||
AREA |.text|, CODE, READONLY
|
||||
|
||||
|
||||
; Reset Handler
|
||||
|
||||
Reset_Handler PROC
|
||||
EXPORT Reset_Handler [WEAK]
|
||||
IMPORT SystemInit
|
||||
IMPORT __main
|
||||
LDR R0, =SystemInit
|
||||
BLX R0
|
||||
LDR R0, =__main
|
||||
BX R0
|
||||
ENDP
|
||||
|
||||
|
||||
; Dummy Exception Handlers (infinite loops which can be modified)
|
||||
|
||||
NMI_Handler PROC
|
||||
EXPORT NMI_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
HardFault_Handler\
|
||||
PROC
|
||||
EXPORT HardFault_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
SVC_Handler PROC
|
||||
EXPORT SVC_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
PendSV_Handler PROC
|
||||
EXPORT PendSV_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
SysTick_Handler PROC
|
||||
EXPORT SysTick_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
Reserved_IRQHandler PROC
|
||||
EXPORT Reserved_IRQHandler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
|
||||
Default_Handler PROC
|
||||
EXPORT PIN_INT0_IRQHandler [WEAK]
|
||||
EXPORT PIN_INT1_IRQHandler [WEAK]
|
||||
EXPORT PIN_INT2_IRQHandler [WEAK]
|
||||
EXPORT PIN_INT3_IRQHandler [WEAK]
|
||||
EXPORT PIN_INT4_IRQHandler [WEAK]
|
||||
EXPORT PIN_INT5_IRQHandler [WEAK]
|
||||
EXPORT PIN_INT6_IRQHandler [WEAK]
|
||||
EXPORT PIN_INT7_IRQHandler [WEAK]
|
||||
EXPORT GINT0_IRQHandler [WEAK]
|
||||
EXPORT GINT1_IRQHandler [WEAK]
|
||||
EXPORT I2C1_IRQHandler [WEAK]
|
||||
EXPORT USART1_4_IRQHandler [WEAK]
|
||||
EXPORT USART2_3_IRQHandler [WEAK]
|
||||
EXPORT SCT0_1_IRQHandler [WEAK]
|
||||
EXPORT SSP1_IRQHandler [WEAK]
|
||||
EXPORT I2C0_IRQHandler [WEAK]
|
||||
EXPORT CT16B0_IRQHandler [WEAK]
|
||||
EXPORT CT16B1_IRQHandler [WEAK]
|
||||
EXPORT CT32B0_IRQHandler [WEAK]
|
||||
EXPORT CT32B1_IRQHandler [WEAK]
|
||||
EXPORT SSP0_IRQHandler [WEAK]
|
||||
EXPORT USART0_IRQHandler [WEAK]
|
||||
EXPORT USB_IRQHandler [WEAK]
|
||||
EXPORT USB_FIQ_IRQHandler [WEAK]
|
||||
EXPORT ADC_A_IRQHandler [WEAK]
|
||||
EXPORT RTC_IRQHandler [WEAK]
|
||||
EXPORT BOD_WDT_IRQHandler [WEAK]
|
||||
EXPORT FLASH_IRQHandler [WEAK]
|
||||
EXPORT DMA_IRQHandler [WEAK]
|
||||
EXPORT ADC_B_IRQHandler [WEAK]
|
||||
EXPORT USBWAKEUP_IRQHandler [WEAK]
|
||||
|
||||
PIN_INT0_IRQHandler
|
||||
PIN_INT1_IRQHandler
|
||||
PIN_INT2_IRQHandler
|
||||
PIN_INT3_IRQHandler
|
||||
PIN_INT4_IRQHandler
|
||||
PIN_INT5_IRQHandler
|
||||
PIN_INT6_IRQHandler
|
||||
PIN_INT7_IRQHandler
|
||||
GINT0_IRQHandler
|
||||
GINT1_IRQHandler
|
||||
I2C1_IRQHandler
|
||||
USART1_4_IRQHandler
|
||||
USART2_3_IRQHandler
|
||||
SCT0_1_IRQHandler
|
||||
SSP1_IRQHandler
|
||||
I2C0_IRQHandler
|
||||
CT16B0_IRQHandler
|
||||
CT16B1_IRQHandler
|
||||
CT32B0_IRQHandler
|
||||
CT32B1_IRQHandler
|
||||
SSP0_IRQHandler
|
||||
USART0_IRQHandler
|
||||
USB_IRQHandler
|
||||
USB_FIQ_IRQHandler
|
||||
ADC_A_IRQHandler
|
||||
RTC_IRQHandler
|
||||
BOD_WDT_IRQHandler
|
||||
FLASH_IRQHandler
|
||||
DMA_IRQHandler
|
||||
ADC_B_IRQHandler
|
||||
USBWAKEUP_IRQHandler
|
||||
|
||||
B .
|
||||
|
||||
ENDP
|
||||
|
||||
|
||||
ALIGN
|
||||
|
||||
|
||||
END
|
||||
|
||||
@@ -0,0 +1,267 @@
|
||||
/*Based on following file*/
|
||||
/*
|
||||
* GENERATED FILE - DO NOT EDIT
|
||||
* (c) Code Red Technologies Ltd, 2008-13
|
||||
* (c) NXP Semiconductors 2013-2014
|
||||
* Generated linker script file for LPC11U68
|
||||
* Created from LibIncTemplate.ld (LPCXpresso v7.2 (0 [Build 153] [2014-05-19] ))
|
||||
* By LPCXpresso v7.2.0 [Build 153] [2014-05-19] on Sat Jun 14 15:26:54 JST 2014
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(MBED_BOOT_STACK_SIZE)
|
||||
#define MBED_BOOT_STACK_SIZE 0x400
|
||||
#endif
|
||||
|
||||
STACK_SIZE = MBED_BOOT_STACK_SIZE;
|
||||
|
||||
MEMORY
|
||||
{
|
||||
/* Define each memory region */
|
||||
MFlash256 (rx) : ORIGIN = 0x0, LENGTH = 0x40000 /* 256K bytes */
|
||||
Ram0_32 (rwx) : ORIGIN = 0x10000000+0x100, LENGTH = 0x8000-0x100 /* 32K bytes */
|
||||
Ram1_2 (rwx) : ORIGIN = 0x20000000, LENGTH = 0x800 /* 2K bytes */
|
||||
Ram2USB_2 (rwx) : ORIGIN = 0x20004000, LENGTH = 0x800 /* 2K bytes */
|
||||
|
||||
|
||||
}
|
||||
/* Define a symbol for the top of each memory region */
|
||||
__top_MFlash256 = 0x0 + 0x40000;
|
||||
__top_Ram0_32 = 0x10000000 + 0x8000;
|
||||
__top_Ram1_2 = 0x20000000 + 0x800;
|
||||
__top_Ram2USB_2 = 0x20004000 + 0x800;
|
||||
|
||||
ENTRY(ResetISR)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
|
||||
/* MAIN TEXT SECTION */
|
||||
.text : ALIGN(8)
|
||||
{
|
||||
FILL(0xff)
|
||||
__vectors_start__ = ABSOLUTE(.) ;
|
||||
KEEP(*(.isr_vector))
|
||||
|
||||
/* Global Section Table */
|
||||
. = ALIGN(8) ;
|
||||
__section_table_start = .;
|
||||
__data_section_table = .;
|
||||
LONG(LOADADDR(.data));
|
||||
LONG( ADDR(.data));
|
||||
LONG( SIZEOF(.data));
|
||||
LONG(LOADADDR(.data_RAM2));
|
||||
LONG( ADDR(.data_RAM2));
|
||||
LONG( SIZEOF(.data_RAM2));
|
||||
LONG(LOADADDR(.data_RAM3));
|
||||
LONG( ADDR(.data_RAM3));
|
||||
LONG( SIZEOF(.data_RAM3));
|
||||
__data_section_table_end = .;
|
||||
__bss_section_table = .;
|
||||
LONG( ADDR(.bss));
|
||||
LONG( SIZEOF(.bss));
|
||||
LONG( ADDR(.bss_RAM2));
|
||||
LONG( SIZEOF(.bss_RAM2));
|
||||
LONG( ADDR(.bss_RAM3));
|
||||
LONG( SIZEOF(.bss_RAM3));
|
||||
__bss_section_table_end = .;
|
||||
__section_table_end = . ;
|
||||
/* End of Global Section Table */
|
||||
|
||||
|
||||
*(.after_vectors*)
|
||||
|
||||
*(.text*)
|
||||
*(.rodata .rodata.*)
|
||||
. = ALIGN(8);
|
||||
|
||||
/* C++ constructors etc */
|
||||
. = ALIGN(8);
|
||||
KEEP(*(.init))
|
||||
|
||||
. = ALIGN(8);
|
||||
__preinit_array_start = .;
|
||||
KEEP (*(.preinit_array))
|
||||
__preinit_array_end = .;
|
||||
|
||||
. = ALIGN(8);
|
||||
__init_array_start = .;
|
||||
KEEP (*(SORT(.init_array.*)))
|
||||
KEEP (*(.init_array))
|
||||
__init_array_end = .;
|
||||
|
||||
KEEP(*(.fini));
|
||||
|
||||
. = ALIGN(0x4);
|
||||
KEEP (*crtbegin.o(.ctors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
|
||||
KEEP (*(SORT(.ctors.*)))
|
||||
KEEP (*crtend.o(.ctors))
|
||||
|
||||
. = ALIGN(0x4);
|
||||
KEEP (*crtbegin.o(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*crtend.o(.dtors))
|
||||
} > MFlash256
|
||||
|
||||
/*
|
||||
* for exception handling/unwind - some Newlib functions (in common
|
||||
* with C++ and STDC++) use this.
|
||||
*/
|
||||
.ARM.extab : ALIGN(8)
|
||||
{
|
||||
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
||||
} > MFlash256
|
||||
__exidx_start = .;
|
||||
|
||||
.ARM.exidx : ALIGN(8)
|
||||
{
|
||||
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
||||
} > MFlash256
|
||||
__exidx_end = .;
|
||||
|
||||
_etext = .;
|
||||
|
||||
/* possible MTB section for Ram1_2 */
|
||||
.mtb_buffer_RAM2 (NOLOAD) :
|
||||
{
|
||||
KEEP(*(.mtb.$RAM2*))
|
||||
KEEP(*(.mtb.$RAM1_2*))
|
||||
} > Ram1_2
|
||||
|
||||
/* DATA section for Ram1_2 */
|
||||
.data_RAM2 : ALIGN(8)
|
||||
{
|
||||
FILL(0xff)
|
||||
*(.ramfunc.$RAM2)
|
||||
*(.ramfunc.$Ram1_2)
|
||||
*(.data.$RAM2*)
|
||||
*(.data.$Ram1_2*)
|
||||
. = ALIGN(8) ;
|
||||
} > Ram1_2 AT>MFlash256
|
||||
/* possible MTB section for Ram2USB_2 */
|
||||
.mtb_buffer_RAM3 (NOLOAD) :
|
||||
{
|
||||
KEEP(*(.mtb.$RAM3*))
|
||||
KEEP(*(.mtb.$RAM2USB_2*))
|
||||
} > Ram2USB_2
|
||||
|
||||
/* DATA section for Ram2USB_2 */
|
||||
.data_RAM3 : ALIGN(8)
|
||||
{
|
||||
FILL(0xff)
|
||||
*(.ramfunc.$RAM3)
|
||||
*(.ramfunc.$Ram2USB_2)
|
||||
*(.data.$RAM3*)
|
||||
*(.data.$Ram2USB_2*)
|
||||
. = ALIGN(8) ;
|
||||
} > Ram2USB_2 AT>MFlash256
|
||||
|
||||
/* MAIN DATA SECTION */
|
||||
|
||||
/* Default MTB section */
|
||||
.mtb_buffer_default (NOLOAD) :
|
||||
{
|
||||
KEEP(*(.mtb*))
|
||||
} > Ram0_32
|
||||
|
||||
.uninit_RESERVED : ALIGN(8)
|
||||
{
|
||||
KEEP(*(.bss.$RESERVED*))
|
||||
. = ALIGN(8) ;
|
||||
_end_uninit_RESERVED = .;
|
||||
} > Ram0_32
|
||||
|
||||
|
||||
/* Main DATA section (Ram0_32) */
|
||||
.data : ALIGN(8)
|
||||
{
|
||||
FILL(0xff)
|
||||
_data = . ;
|
||||
*(vtable)
|
||||
*(.ramfunc*)
|
||||
*(.data*)
|
||||
. = ALIGN(8) ;
|
||||
_edata = . ;
|
||||
} > Ram0_32 AT>MFlash256
|
||||
|
||||
/* BSS section for Ram1_2 */
|
||||
.bss_RAM2 : ALIGN(8)
|
||||
{
|
||||
*(.bss.$RAM2*)
|
||||
*(.bss.$Ram1_2*)
|
||||
. = ALIGN(8) ;
|
||||
} > Ram1_2
|
||||
/* BSS section for Ram2USB_2 */
|
||||
.bss_RAM3 : ALIGN(8)
|
||||
{
|
||||
*(.bss.$RAM3*)
|
||||
*(.bss.$Ram2USB_2*)
|
||||
. = ALIGN(8) ;
|
||||
} > Ram2USB_2
|
||||
|
||||
/* MAIN BSS SECTION */
|
||||
.bss : ALIGN(8)
|
||||
{
|
||||
_bss = .;
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
. = ALIGN(8) ;
|
||||
_ebss = .;
|
||||
PROVIDE(end = .);
|
||||
__end__ = .;
|
||||
} > Ram0_32
|
||||
|
||||
/* NOINIT section for Ram1_2 */
|
||||
.noinit_RAM2 (NOLOAD) : ALIGN(8)
|
||||
{
|
||||
*(.noinit.$RAM2*)
|
||||
*(.noinit.$Ram1_2*)
|
||||
. = ALIGN(8) ;
|
||||
} > Ram1_2
|
||||
/* NOINIT section for Ram2USB_2 */
|
||||
.noinit_RAM3 (NOLOAD) : ALIGN(8)
|
||||
{
|
||||
*(.noinit.$RAM3*)
|
||||
*(.noinit.$Ram2USB_2*)
|
||||
. = ALIGN(8) ;
|
||||
} > Ram2USB_2
|
||||
|
||||
/* DEFAULT NOINIT SECTION */
|
||||
.noinit (NOLOAD): ALIGN(8)
|
||||
{
|
||||
_noinit = .;
|
||||
*(.noinit*)
|
||||
. = ALIGN(8) ;
|
||||
_end_noinit = .;
|
||||
} > Ram0_32
|
||||
|
||||
PROVIDE(_pvHeapStart = .);
|
||||
.heap :
|
||||
{
|
||||
__end__ = .;
|
||||
end = __end__;
|
||||
*(.heap*)
|
||||
. = ORIGIN(Ram0_32) + LENGTH(Ram0_32) - STACK_SIZE;
|
||||
__HeapLimit = .;
|
||||
} > Ram0_32
|
||||
|
||||
|
||||
/* .stack_dummy section doesn't contains any symbols. It is only
|
||||
* used for linker to calculate size of stack sections, and assign
|
||||
* values to stack symbols later */
|
||||
.stack_dummy :
|
||||
{
|
||||
*(.stack)
|
||||
} > Ram0_32
|
||||
|
||||
/* Set stack top to end of RAM, and stack limit move down by
|
||||
* size of stack_dummy section */
|
||||
__StackTop = ORIGIN(Ram0_32) + LENGTH(Ram0_32);
|
||||
__StackLimit = __StackTop - STACK_SIZE;
|
||||
PROVIDE(__stack = __StackTop);
|
||||
|
||||
PROVIDE(__stack = __StackTop);
|
||||
PROVIDE(_vStackTop = __StackTop);
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
extern "C" {
|
||||
|
||||
#include "LPC11U6x.h"
|
||||
|
||||
#define WEAK __attribute__ ((weak))
|
||||
#define ALIAS(f) __attribute__ ((weak, alias (#f)))
|
||||
#define AFTER_VECTORS __attribute__ ((section(".after_vectors")))void ResetISR(void);
|
||||
|
||||
extern unsigned int __data_section_table;
|
||||
extern unsigned int __data_section_table_end;
|
||||
extern unsigned int __bss_section_table;
|
||||
extern unsigned int __bss_section_table_end;
|
||||
|
||||
|
||||
extern void __libc_init_array(void);
|
||||
extern int main(void);
|
||||
extern void _vStackTop(void);
|
||||
extern void (* const g_pfnVectors[])(void);
|
||||
|
||||
void ResetISR(void);
|
||||
WEAK void NMI_Handler(void);
|
||||
WEAK void HardFault_Handler(void);
|
||||
WEAK void SVC_Handler(void);
|
||||
WEAK void PendSV_Handler(void);
|
||||
WEAK void SysTick_Handler(void);
|
||||
WEAK void IntDefaultHandler(void);
|
||||
|
||||
void PIN_INT0_IRQHandler (void) ALIAS(IntDefaultHandler);
|
||||
void PIN_INT1_IRQHandler (void) ALIAS(IntDefaultHandler);
|
||||
void PIN_INT2_IRQHandler (void) ALIAS(IntDefaultHandler);
|
||||
void PIN_INT3_IRQHandler (void) ALIAS(IntDefaultHandler);
|
||||
void PIN_INT4_IRQHandler (void) ALIAS(IntDefaultHandler);
|
||||
void PIN_INT5_IRQHandler (void) ALIAS(IntDefaultHandler);
|
||||
void PIN_INT6_IRQHandler (void) ALIAS(IntDefaultHandler);
|
||||
void PIN_INT7_IRQHandler (void) ALIAS(IntDefaultHandler);
|
||||
void GINT0_IRQHandler (void) ALIAS(IntDefaultHandler);
|
||||
void GINT1_IRQHandler (void) ALIAS(IntDefaultHandler);
|
||||
void I2C1_IRQHandler (void) ALIAS(IntDefaultHandler);
|
||||
void USART1_4_IRQHandler (void) ALIAS(IntDefaultHandler);
|
||||
void USART2_3_IRQHandler (void) ALIAS(IntDefaultHandler);
|
||||
void SCT0_1_IRQHandler (void) ALIAS(IntDefaultHandler);
|
||||
void SSP1_IRQHandler (void) ALIAS(IntDefaultHandler);
|
||||
void I2C0_IRQHandler (void) ALIAS(IntDefaultHandler);
|
||||
void TIMER16_0_IRQHandler (void) ALIAS(IntDefaultHandler);
|
||||
void TIMER16_1_IRQHandler (void) ALIAS(IntDefaultHandler);
|
||||
void TIMER32_0_IRQHandler (void) ALIAS(IntDefaultHandler);
|
||||
void TIMER32_1_IRQHandler (void) ALIAS(IntDefaultHandler);
|
||||
void SSP0_IRQHandler (void) ALIAS(IntDefaultHandler);
|
||||
void USART0_IRQHandler (void) ALIAS(IntDefaultHandler);
|
||||
void USB_IRQHandler (void) ALIAS(IntDefaultHandler);
|
||||
void USB_FIQHandler (void) ALIAS(IntDefaultHandler);
|
||||
void ADCA_IRQHandler (void) ALIAS(IntDefaultHandler);
|
||||
void RTC_IRQHandler (void) ALIAS(IntDefaultHandler);
|
||||
void BOD_WDT_IRQHandler (void) ALIAS(IntDefaultHandler);
|
||||
void FMC_IRQHandler (void) ALIAS(IntDefaultHandler);
|
||||
void DMA_IRQHandler (void) ALIAS(IntDefaultHandler);
|
||||
void ADCB_IRQHandler (void) ALIAS(IntDefaultHandler);
|
||||
void USBWakeup_IRQHandler (void) ALIAS(IntDefaultHandler);
|
||||
|
||||
__attribute__ ((section(".isr_vector")))
|
||||
void (* const g_pfnVectors[])(void) = {
|
||||
// Core Level - CM0
|
||||
&_vStackTop, // The initial stack pointer
|
||||
ResetISR, // The reset handler
|
||||
NMI_Handler, // The NMI handler
|
||||
HardFault_Handler, // The hard fault handler
|
||||
0, // Reserved
|
||||
0, // Reserved
|
||||
0, // Reserved
|
||||
0, // Reserved
|
||||
0, // Reserved
|
||||
0, // Reserved
|
||||
0, // Reserved
|
||||
SVC_Handler, // SVCall handler
|
||||
0, // Reserved
|
||||
0, // Reserved
|
||||
PendSV_Handler, // The PendSV handler
|
||||
SysTick_Handler, // The SysTick handler
|
||||
|
||||
// Chip Level - LPC11U68
|
||||
PIN_INT0_IRQHandler, // 0 - GPIO pin interrupt 0
|
||||
PIN_INT1_IRQHandler, // 1 - GPIO pin interrupt 1
|
||||
PIN_INT2_IRQHandler, // 2 - GPIO pin interrupt 2
|
||||
PIN_INT3_IRQHandler, // 3 - GPIO pin interrupt 3
|
||||
PIN_INT4_IRQHandler, // 4 - GPIO pin interrupt 4
|
||||
PIN_INT5_IRQHandler, // 5 - GPIO pin interrupt 5
|
||||
PIN_INT6_IRQHandler, // 6 - GPIO pin interrupt 6
|
||||
PIN_INT7_IRQHandler, // 7 - GPIO pin interrupt 7
|
||||
GINT0_IRQHandler, // 8 - GPIO GROUP0 interrupt
|
||||
GINT1_IRQHandler, // 9 - GPIO GROUP1 interrupt
|
||||
I2C1_IRQHandler, // 10 - I2C1
|
||||
USART1_4_IRQHandler, // 11 - combined USART1 & 4 interrupt
|
||||
USART2_3_IRQHandler, // 12 - combined USART2 & 3 interrupt
|
||||
SCT0_1_IRQHandler, // 13 - combined SCT0 and 1 interrupt
|
||||
SSP1_IRQHandler, // 14 - SPI/SSP1 Interrupt
|
||||
I2C0_IRQHandler, // 15 - I2C0
|
||||
TIMER16_0_IRQHandler, // 16 - CT16B0 (16-bit Timer 0)
|
||||
TIMER16_1_IRQHandler, // 17 - CT16B1 (16-bit Timer 1)
|
||||
TIMER32_0_IRQHandler, // 18 - CT32B0 (32-bit Timer 0)
|
||||
TIMER32_1_IRQHandler, // 19 - CT32B1 (32-bit Timer 1)
|
||||
SSP0_IRQHandler, // 20 - SPI/SSP0 Interrupt
|
||||
USART0_IRQHandler, // 21 - USART0
|
||||
USB_IRQHandler, // 22 - USB IRQ
|
||||
USB_FIQHandler, // 23 - USB FIQ
|
||||
ADCA_IRQHandler, // 24 - ADC A(A/D Converter)
|
||||
RTC_IRQHandler, // 25 - Real Time CLock interrpt
|
||||
BOD_WDT_IRQHandler, // 25 - Combined Brownout/Watchdog interrupt
|
||||
FMC_IRQHandler, // 27 - IP2111 Flash Memory Controller
|
||||
DMA_IRQHandler, // 28 - DMA interrupt
|
||||
ADCB_IRQHandler, // 24 - ADC B (A/D Converter)
|
||||
USBWakeup_IRQHandler, // 30 - USB wake-up interrupt
|
||||
0, // 31 - Reserved
|
||||
};
|
||||
/* End Vector */
|
||||
|
||||
AFTER_VECTORS void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
|
||||
unsigned int *pulDest = (unsigned int*) start;
|
||||
unsigned int *pulSrc = (unsigned int*) romstart;
|
||||
unsigned int loop;
|
||||
for (loop = 0; loop < len; loop = loop + 4) *pulDest++ = *pulSrc++;
|
||||
}
|
||||
|
||||
AFTER_VECTORS void bss_init(unsigned int start, unsigned int len) {
|
||||
unsigned int *pulDest = (unsigned int*) start;
|
||||
unsigned int loop;
|
||||
for (loop = 0; loop < len; loop = loop + 4) *pulDest++ = 0;
|
||||
}
|
||||
|
||||
|
||||
/* Reset entry point*/
|
||||
extern "C" void software_init_hook(void) __attribute__((weak));
|
||||
|
||||
AFTER_VECTORS void ResetISR(void) {
|
||||
unsigned int LoadAddr, ExeAddr, SectionLen;
|
||||
unsigned int *SectionTableAddr;
|
||||
|
||||
SectionTableAddr = &__data_section_table;
|
||||
|
||||
while (SectionTableAddr < &__data_section_table_end) {
|
||||
LoadAddr = *SectionTableAddr++;
|
||||
ExeAddr = *SectionTableAddr++;
|
||||
SectionLen = *SectionTableAddr++;
|
||||
data_init(LoadAddr, ExeAddr, SectionLen);
|
||||
}
|
||||
while (SectionTableAddr < &__bss_section_table_end) {
|
||||
ExeAddr = *SectionTableAddr++;
|
||||
SectionLen = *SectionTableAddr++;
|
||||
bss_init(ExeAddr, SectionLen);
|
||||
}
|
||||
|
||||
SystemInit();
|
||||
if (software_init_hook)
|
||||
software_init_hook();
|
||||
else {
|
||||
__libc_init_array();
|
||||
main();
|
||||
}
|
||||
while (1) {;}
|
||||
}
|
||||
|
||||
AFTER_VECTORS void NMI_Handler (void) {}
|
||||
AFTER_VECTORS void HardFault_Handler (void) {}
|
||||
AFTER_VECTORS void MemManage_Handler (void) {}
|
||||
AFTER_VECTORS void BusFault_Handler (void) {}
|
||||
AFTER_VECTORS void UsageFault_Handler(void) {}
|
||||
AFTER_VECTORS void SVC_Handler (void) {}
|
||||
AFTER_VECTORS void DebugMon_Handler (void) {}
|
||||
AFTER_VECTORS void PendSV_Handler (void) {}
|
||||
AFTER_VECTORS void SysTick_Handler (void) {}
|
||||
AFTER_VECTORS void IntDefaultHandler (void) {}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*###ICF### Section handled by ICF editor, don't touch! ****/
|
||||
/*-Editor annotation file-*/
|
||||
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
|
||||
/*-Specials-*/
|
||||
define symbol __ICFEDIT_intvec_start__ = 0x00000000;
|
||||
/*-Memory Regions-*/
|
||||
define symbol __ICFEDIT_region_ROM_start__ = 0x00000000;
|
||||
define symbol __ICFEDIT_region_ROM_end__ = 0x0003FFFF;
|
||||
define symbol __ICFEDIT_region_NVIC_start__ = 0x10000000;
|
||||
define symbol __ICFEDIT_region_NVIC_end__ = 0x100000FF;
|
||||
define symbol __ICFEDIT_region_RAM_start__ = 0x10000100;
|
||||
define symbol __ICFEDIT_region_RAM_end__ = 0x10007FDF;
|
||||
/*-Sizes-*/
|
||||
if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
|
||||
define symbol MBED_BOOT_STACK_SIZE = 0x400;
|
||||
}
|
||||
|
||||
define symbol __ICFEDIT_size_cstack__ = MBED_BOOT_STACK_SIZE;
|
||||
define symbol __ICFEDIT_size_heap__ = 0x2000;
|
||||
/**** End of ICF editor section. ###ICF###*/
|
||||
|
||||
define symbol __CRP_start__ = 0x000002FC;
|
||||
define symbol __CRP_end__ = 0x000002FF;
|
||||
|
||||
define symbol __RAM1_start__ = 0x20000000;
|
||||
define symbol __RAM1_end__ = 0x200007FF;
|
||||
|
||||
define symbol __RAM_USB_start__= 0x20004000;
|
||||
define symbol __RAM_USB_end__ = 0x200047FF;
|
||||
|
||||
define memory mem with size = 4G;
|
||||
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__] - mem:[from __CRP_start__ to __CRP_end__];
|
||||
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
|
||||
define region RAM1_region = mem:[from __RAM1_start__ to __RAM1_end__];
|
||||
define region RAM_USB_region = mem:[from __RAM_USB_start__ to __RAM_USB_end__];
|
||||
define region CRP_region = mem:[from __CRP_start__ to __CRP_end__];
|
||||
|
||||
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
|
||||
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
|
||||
|
||||
initialize by copy { readwrite };
|
||||
do not initialize { section .noinit };
|
||||
|
||||
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
|
||||
place in ROM_region { readonly };
|
||||
place in RAM_region { readwrite,
|
||||
block HEAP, block CSTACK };
|
||||
place in CRP_region { section .crp };
|
||||
place in RAM1_region { section .sram1 };
|
||||
place in RAM_USB_region { section .sram_usb };
|
||||
@@ -0,0 +1,251 @@
|
||||
;/*****************************************************************************
|
||||
; * @file: startup_LPC11u6x.s
|
||||
; * @purpose: CMSIS Cortex-M0PLUS Core Device Startup File
|
||||
; * for the NXP LPC11u6x Device Series (manually edited)
|
||||
; * @version: V1.00
|
||||
; * @date: 19. October 2009
|
||||
; *----------------------------------------------------------------------------
|
||||
; *
|
||||
; * Copyright (C) 2009 ARM Limited. All rights reserved.
|
||||
; *
|
||||
; * ARM Limited (ARM) is supplying this software for use with Cortex-Mx
|
||||
; * processor based microcontrollers. This file can be freely distributed
|
||||
; * within development tools that are supporting such ARM based processors.
|
||||
; *
|
||||
; * 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.
|
||||
; *
|
||||
; ******************************************************************************/
|
||||
|
||||
;
|
||||
; The modules in this file are included in the libraries, and may be replaced
|
||||
; by any user-defined modules that define the PUBLIC symbol _program_start or
|
||||
; a user defined start symbol.
|
||||
; To override the cstartup defined in the library, simply add your modified
|
||||
; version to the workbench project.
|
||||
;
|
||||
; The vector table is normally located at address 0.
|
||||
; When debugging in RAM, it can be located in RAM, aligned to at least 2^6.
|
||||
; The name "__vector_table" has special meaning for C-SPY:
|
||||
; it is where the SP start value is found, and the NVIC vector
|
||||
; table register (VTOR) is initialized to this address if != 0.
|
||||
;
|
||||
; Cortex-M version
|
||||
;
|
||||
|
||||
MODULE ?cstartup
|
||||
|
||||
;; Forward declaration of sections.
|
||||
SECTION CSTACK:DATA:NOROOT(3)
|
||||
|
||||
SECTION .intvec:CODE:NOROOT(2)
|
||||
|
||||
EXTERN __iar_program_start
|
||||
EXTERN SystemInit
|
||||
PUBLIC __vector_table
|
||||
PUBLIC __vector_table_0x1c
|
||||
PUBLIC __Vectors
|
||||
PUBLIC __Vectors_End
|
||||
PUBLIC __Vectors_Size
|
||||
|
||||
DATA
|
||||
|
||||
__vector_table
|
||||
DCD sfe(CSTACK)
|
||||
DCD Reset_Handler
|
||||
|
||||
DCD NMI_Handler
|
||||
DCD HardFault_Handler
|
||||
DCD 0
|
||||
DCD 0
|
||||
DCD 0
|
||||
__vector_table_0x1c
|
||||
DCD 0
|
||||
DCD 0
|
||||
DCD 0
|
||||
DCD 0
|
||||
DCD SVC_Handler
|
||||
DCD 0
|
||||
DCD 0
|
||||
DCD PendSV_Handler
|
||||
DCD SysTick_Handler
|
||||
|
||||
DCD PIN_INT0_IRQHandler ; Pin interrupt 0
|
||||
DCD PIN_INT1_IRQHandler ; Pin interrupt 1
|
||||
DCD PIN_INT2_IRQHandler ; Pin interrupt 2
|
||||
DCD PIN_INT3_IRQHandler ; Pin interrupt 3
|
||||
DCD PIN_INT4_IRQHandler ; Pin interrupt 4
|
||||
DCD PIN_INT5_IRQHandler ; Pin interrupt 5
|
||||
DCD PIN_INT6_IRQHandler ; Pin interrupt 6
|
||||
DCD PIN_INT7_IRQHandler ; Pin interrupt 7
|
||||
DCD GINT0_IRQHandler ; Port interrupt group 0
|
||||
DCD GINT1_IRQHandler ; Port interrupt group 1
|
||||
DCD I2C1_IRQHandler ; I2C1 interrupt
|
||||
DCD USART1_4_IRQHandler ; USARTS 1 and 4 shared interrupt
|
||||
DCD USART2_3_IRQHandler ; USARTS 2 and 3 shared interrupt
|
||||
DCD SCT0_1_IRQHandler ; SCT 0 and 1 shared interrupt
|
||||
DCD SSP1_IRQHandler ; SSP1 interrupt
|
||||
DCD I2C0_IRQHandler ; I2C0 interrupt
|
||||
DCD CT16B0_IRQHandler ; CT16B0 (16-bit Timer 0)
|
||||
DCD CT16B1_IRQHandler ; CT16B1 (16-bit Timer 1)
|
||||
DCD CT32B0_IRQHandler ; CT32B0 (32-bit Timer 0)
|
||||
DCD CT32B1_IRQHandler ; CT32B0 (32-bit Timer 1)
|
||||
DCD SSP0_IRQHandler ; SSP0 interrupt interrupt
|
||||
DCD USART0_IRQHandler ; USART 0 interrupt interrupt
|
||||
DCD USB_IRQHandler ; USB IRQ interrupt
|
||||
DCD USB_FIQ_IRQHandler ; USB FIQ interrupt
|
||||
DCD ADC_A_IRQHandler ; ADC A sequence (A/D Converter) interrupt
|
||||
DCD RTC_IRQHandler ; RTC interrupt
|
||||
DCD BOD_WDT_IRQHandler ; Shared BOD (Brownout Detect) and WDT interrupts
|
||||
DCD FLASH_IRQHandler ; Flash Memory Controller interrupt
|
||||
DCD DMA_IRQHandler ; DMA Controller interrupt
|
||||
DCD ADC_B_IRQHandler ; ADC B sequence interrupt
|
||||
DCD USBWakeup_IRQHandler ; USB wake-up interrupt
|
||||
DCD Reserved_IRQHandler
|
||||
|
||||
__Vectors_End
|
||||
|
||||
__Vectors EQU __vector_table
|
||||
__Vectors_Size EQU __Vectors_End - __Vectors
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; Default interrupt handlers.
|
||||
;;
|
||||
THUMB
|
||||
PUBWEAK Reset_Handler
|
||||
SECTION .text:CODE:NOROOT:REORDER(2)
|
||||
Reset_Handler
|
||||
LDR R0, =SystemInit
|
||||
BLX R0
|
||||
LDR R0, =__iar_program_start
|
||||
BX R0
|
||||
|
||||
PUBWEAK NMI_Handler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
NMI_Handler
|
||||
B .
|
||||
|
||||
PUBWEAK HardFault_Handler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
HardFault_Handler
|
||||
B .
|
||||
|
||||
PUBWEAK SVC_Handler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
SVC_Handler
|
||||
B .
|
||||
|
||||
PUBWEAK PendSV_Handler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
PendSV_Handler
|
||||
B .
|
||||
|
||||
PUBWEAK SysTick_Handler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
SysTick_Handler
|
||||
B .
|
||||
|
||||
PUBWEAK Reserved_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
Reserved_IRQHandler
|
||||
B .
|
||||
|
||||
|
||||
PUBWEAK PIN_INT0_IRQHandler
|
||||
PUBWEAK PIN_INT1_IRQHandler
|
||||
PUBWEAK PIN_INT2_IRQHandler
|
||||
PUBWEAK PIN_INT3_IRQHandler
|
||||
PUBWEAK PIN_INT4_IRQHandler
|
||||
PUBWEAK PIN_INT5_IRQHandler
|
||||
PUBWEAK PIN_INT6_IRQHandler
|
||||
PUBWEAK PIN_INT7_IRQHandler
|
||||
PUBWEAK GINT0_IRQHandler
|
||||
PUBWEAK GINT1_IRQHandler
|
||||
PUBWEAK I2C1_IRQHandler
|
||||
PUBWEAK USART1_4_IRQHandler
|
||||
PUBWEAK USART2_3_IRQHandler
|
||||
PUBWEAK SCT0_1_IRQHandler
|
||||
PUBWEAK SSP1_IRQHandler
|
||||
PUBWEAK I2C0_IRQHandler
|
||||
PUBWEAK CT16B0_IRQHandler
|
||||
PUBWEAK CT16B1_IRQHandler
|
||||
PUBWEAK CT32B0_IRQHandler
|
||||
PUBWEAK CT32B1_IRQHandler
|
||||
PUBWEAK SSP0_IRQHandler
|
||||
PUBWEAK USART0_IRQHandler
|
||||
PUBWEAK USB_IRQHandler
|
||||
PUBWEAK USB_FIQ_IRQHandler
|
||||
PUBWEAK ADC_A_IRQHandler
|
||||
PUBWEAK RTC_IRQHandler
|
||||
PUBWEAK BOD_WDT_IRQHandler
|
||||
PUBWEAK FLASH_IRQHandler
|
||||
PUBWEAK DMA_IRQHandler
|
||||
PUBWEAK ADC_B_IRQHandler
|
||||
PUBWEAK USBWakeup_IRQHandler
|
||||
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
THUMB
|
||||
|
||||
PIN_INT0_IRQHandler
|
||||
PIN_INT1_IRQHandler
|
||||
PIN_INT2_IRQHandler
|
||||
PIN_INT3_IRQHandler
|
||||
PIN_INT4_IRQHandler
|
||||
PIN_INT5_IRQHandler
|
||||
PIN_INT6_IRQHandler
|
||||
PIN_INT7_IRQHandler
|
||||
GINT0_IRQHandler
|
||||
GINT1_IRQHandler
|
||||
I2C1_IRQHandler
|
||||
USART1_4_IRQHandler
|
||||
USART2_3_IRQHandler
|
||||
SCT0_1_IRQHandler
|
||||
SSP1_IRQHandler
|
||||
I2C0_IRQHandler
|
||||
CT16B0_IRQHandler
|
||||
CT16B1_IRQHandler
|
||||
CT32B0_IRQHandler
|
||||
CT32B1_IRQHandler
|
||||
SSP0_IRQHandler
|
||||
USART0_IRQHandler
|
||||
USB_IRQHandler
|
||||
USB_FIQ_IRQHandler
|
||||
ADC_A_IRQHandler
|
||||
RTC_IRQHandler
|
||||
BOD_WDT_IRQHandler
|
||||
FLASH_IRQHandler
|
||||
DMA_IRQHandler
|
||||
ADC_B_IRQHandler
|
||||
USBWakeup_IRQHandler
|
||||
Default_Handler
|
||||
B Default_Handler
|
||||
|
||||
SECTION .crp:CODE:ROOT(2)
|
||||
DATA
|
||||
/* Code Read Protection
|
||||
NO_ISP 0x4E697370 - Prevents sampling of pin PIO0_1 for entering ISP mode
|
||||
CRP1 0x12345678 - Write to RAM command cannot access RAM below 0x10000300.
|
||||
- Copy RAM to flash command can not write to Sector 0.
|
||||
- Erase command can erase Sector 0 only when all sectors
|
||||
are selected for erase.
|
||||
- Compare command is disabled.
|
||||
- Read Memory command is disabled.
|
||||
CRP2 0x87654321 - Read Memory is disabled.
|
||||
- Write to RAM is disabled.
|
||||
- "Go" command is disabled.
|
||||
- Copy RAM to flash is disabled.
|
||||
- Compare is disabled.
|
||||
CRP3 0x43218765 - Access to chip via the SWD pins is disabled. ISP entry
|
||||
by pulling PIO0_1 LOW is disabled if a valid user code is
|
||||
present in flash sector 0.
|
||||
Caution: If CRP3 is selected, no future factory testing can be
|
||||
performed on the device.
|
||||
*/
|
||||
DCD 0xFFFFFFFF
|
||||
|
||||
END
|
||||
13
targets/TARGET_NXP/TARGET_LPC11U6X/device/cmsis.h
Normal file
13
targets/TARGET_NXP/TARGET_LPC11U6X/device/cmsis.h
Normal file
@@ -0,0 +1,13 @@
|
||||
/* mbed Microcontroller Library - CMSIS
|
||||
* Copyright (C) 2009-2011 ARM Limited. All rights reserved.
|
||||
*
|
||||
* A generic CMSIS include header, pulling in LPC8xx specifics
|
||||
*/
|
||||
|
||||
#ifndef MBED_CMSIS_H
|
||||
#define MBED_CMSIS_H
|
||||
|
||||
#include "LPC11U6x.h"
|
||||
#include "cmsis_nvic.h"
|
||||
|
||||
#endif
|
||||
37
targets/TARGET_NXP/TARGET_LPC11U6X/device/cmsis_nvic.h
Normal file
37
targets/TARGET_NXP/TARGET_LPC11U6X/device/cmsis_nvic.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/* mbed Microcontroller Library
|
||||
*******************************************************************************
|
||||
* Copyright (c) 2011 ARM Limited. All rights reserved.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of ARM Limited nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef MBED_CMSIS_NVIC_H
|
||||
#define MBED_CMSIS_NVIC_H
|
||||
|
||||
#define NVIC_NUM_VECTORS (16 + 32) // CORE + MCU Peripherals
|
||||
#define NVIC_RAM_VECTOR_ADDRESS 0x10000000 // Vectors positioned at start of RAM
|
||||
|
||||
#endif
|
||||
574
targets/TARGET_NXP/TARGET_LPC11U6X/device/system_LPC11U6x.c
Normal file
574
targets/TARGET_NXP/TARGET_LPC11U6X/device/system_LPC11U6x.c
Normal file
@@ -0,0 +1,574 @@
|
||||
/**************************************************************************//**
|
||||
* @file system_LPC11U6x.c
|
||||
* @brief CMSIS Cortex-M3 Device System Source File for
|
||||
* NXP LPC11U6x Device Series
|
||||
* @version V1.00
|
||||
* @date 19. July 2013
|
||||
*
|
||||
* @note
|
||||
* Copyright (C) 2013 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 "LPC11U6x.h"
|
||||
|
||||
/*
|
||||
//-------- <<< Use Configuration Wizard in Context Menu >>> ------------------
|
||||
*/
|
||||
|
||||
/*- SystemCoreClock Configuration -------------------------------------------*/
|
||||
// <e0> SystemCoreClock Configuration
|
||||
#define CLOCK_SETUP 1
|
||||
//
|
||||
// <h> System Oscillator Control (SYSOSCCTRL)
|
||||
// <o.0> BYPASS: System Oscillator Bypass Enable
|
||||
// <i> If enabled then PLL input (sys_osc_clk) is fed
|
||||
// <i> directly from XTALIN and XTALOUT pins.
|
||||
// <o.1> FREQRANGE: System Oscillator Frequency Range
|
||||
// <i> Determines frequency range for Low-power oscillator.
|
||||
// <0=> 1 - 20 MHz
|
||||
// <1=> 15 - 25 MHz
|
||||
// </h>
|
||||
#define SYSOSCCTRL_Val 0x00000000 // Reset value: 0x000
|
||||
//
|
||||
// <o.0..1> System PLL Clock Source Select (SYSPLLCLKSEL)
|
||||
// <0=> IRC Oscillator
|
||||
// <1=> Crystal Oscillator (SYSOSC)
|
||||
// <3=> RTC Oscillator (32 kHz)
|
||||
#define SYSPLLCLKSEL_Val 0x00000001 // Reset value: 0x000
|
||||
//
|
||||
// <e> Clock Configuration (Manual)
|
||||
#define CLOCK_SETUP_REG 1
|
||||
//
|
||||
// <h> WD Oscillator Setting (WDTOSCCTRL)
|
||||
// <o.0..4> DIVSEL: Select Divider for Fclkana
|
||||
// <i> wd_osc_clk = Fclkana / (2 <20> (1 + DIVSEL))
|
||||
// <0-31>
|
||||
// <o.5..8> FREQSEL: Select WD Oscillator Analog Output Frequency (Fclkana)
|
||||
// <1=> 0.5 MHz
|
||||
// <2=> 0.8 MHz
|
||||
// <3=> 1.1 MHz
|
||||
// <4=> 1.4 MHz
|
||||
// <5=> 1.6 MHz
|
||||
// <6=> 1.8 MHz
|
||||
// <7=> 2.0 MHz
|
||||
// <8=> 2.2 MHz
|
||||
// <9=> 2.4 MHz
|
||||
// <10=> 2.6 MHz
|
||||
// <11=> 2.7 MHz
|
||||
// <12=> 2.9 MHz
|
||||
// <13=> 3.1 MHz
|
||||
// <14=> 3.2 MHz
|
||||
// <15=> 3.4 MHz
|
||||
// </h>
|
||||
#define WDTOSCCTRL_Val 0x000000A0 // Reset value: 0x0A0
|
||||
//
|
||||
// <h> System PLL Setting (SYSPLLCTRL)
|
||||
// <i> F_clkout = M * F_clkin = F_CCO / (2 * P)
|
||||
// <i> F_clkin must be in the range of 10 MHz to 25 MHz
|
||||
// <i> F_CCO must be in the range of 156 MHz to 320 MHz
|
||||
// <o.0..4> MSEL: Feedback Divider Selection
|
||||
// <i> M = MSEL + 1
|
||||
// <0-31>
|
||||
// <o.5..6> PSEL: Post Divider Selection
|
||||
// <i> Post divider ratio P. Division ratio is 2 * P
|
||||
// <0=> P = 1
|
||||
// <1=> P = 2
|
||||
// <2=> P = 4
|
||||
// <3=> P = 8
|
||||
// </h>
|
||||
#define SYSPLLCTRL_Val 0x00000023 // Reset value: 0x000
|
||||
//
|
||||
// <o.0..1> Main Clock Source Select (MAINCLKSEL)
|
||||
// <0=> IRC Oscillator
|
||||
// <1=> PLL Input
|
||||
// <2=> WD Oscillator
|
||||
// <3=> PLL Output
|
||||
#define MAINCLKSEL_Val 0x00000003 // Reset value: 0x000
|
||||
//
|
||||
// <o.0..7> System AHB Clock Divider (SYSAHBCLKDIV.DIV)
|
||||
// <i> Divides main clock to provide system clock to core, memories, and peripherals.
|
||||
// <i> 0 = is disabled
|
||||
// <0-255>
|
||||
#define SYSAHBCLKDIV_Val 0x00000001 // Reset value: 0x001
|
||||
// </e>
|
||||
//
|
||||
// <e> Clock Configuration (via ROM PLL API)
|
||||
#define CLOCK_SETUP_API 0
|
||||
//
|
||||
// <o> PLL API Mode Select
|
||||
// <0=> Exact
|
||||
// <1=> Less than or equal
|
||||
// <2=> Greater than or equal
|
||||
// <3=> As close as possible
|
||||
#define PLL_API_MODE_Val 0
|
||||
//
|
||||
// <o> CPU Frequency [Hz] <1000000-50000000:1000>
|
||||
#define PLL_API_FREQ_Val 48000000
|
||||
// </e>
|
||||
//
|
||||
// <e> USB Clock Configuration
|
||||
#define USB_CLOCK_SETUP 1
|
||||
// <h> USB PLL Control (USBPLLCTRL)
|
||||
// <i> F_clkout = M * F_clkin = F_CCO / (2 * P)
|
||||
// <i> F_clkin must be in the range of 10 MHz to 25 MHz
|
||||
// <i> F_CCO must be in the range of 156 MHz to 320 MHz
|
||||
// <o.0..4> MSEL: Feedback Divider Selection
|
||||
// <i> M = MSEL + 1
|
||||
// <0-31>
|
||||
// <o.5..6> PSEL: Post Divider Selection
|
||||
// <i> Post divider ratio P. Division ratio is 2 * P
|
||||
// <0=> P = 1
|
||||
// <1=> P = 2
|
||||
// <2=> P = 4
|
||||
// <3=> P = 8
|
||||
// </h>
|
||||
#define USBPLLCTRL_Val 0x00000023 // Reset value: 0x000
|
||||
//
|
||||
// <o.0..1> USB PLL Clock Source Select (USBPLLCLKSEL.SEL)
|
||||
// <i> USB PLL clock source must be switched to System Oscillator for correct USB operation
|
||||
// <0=> IRC Oscillator
|
||||
// <1=> System Oscillator
|
||||
#define USBPLLCLKSEL_Val 0x00000001 // Reset value: 0x000
|
||||
//
|
||||
// <o.0..1> USB Clock Source Select (USBCLKSEL.SEL)
|
||||
// <0=> USB PLL out
|
||||
// <1=> Main clock
|
||||
#define USBCLKSEL_Val 0x00000000 // Reset value: 0x000
|
||||
//
|
||||
// <o.0..7> USB Clock Divider (USBCLKDIV.DIV)
|
||||
// <i> Divides USB clock to 48 MHz.
|
||||
// <i> 0 = is disabled
|
||||
// <0-255>
|
||||
#define USBCLKDIV_Val 0x00000001 // Reset Value: 0x001
|
||||
// </e>
|
||||
//
|
||||
// </e>
|
||||
//
|
||||
// <o0>System Oscillator (XTAL) Frequency [Hz] <1000000-25000000>
|
||||
// <i> XTAL frequency must be in the range of 1 MHz to 25 MHz
|
||||
//
|
||||
#define XTAL_CLK_Val 12000000
|
||||
|
||||
/*
|
||||
//-------- <<< end of configuration section >>> ------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
Define clocks
|
||||
*----------------------------------------------------------------------------*/
|
||||
#define __XTAL_CLK ( XTAL_CLK_Val) /* Oscillator freq */
|
||||
#define __SYS_OSC_CLK ( __XTAL_CLK) /* System oscillator freq */
|
||||
#define __IRC_OSC_CLK ( 12000000UL) /* Internal RC oscillator freq */
|
||||
#define __RTC_OSC_CLK ( 32768UL) /* RTC oscillator freq */
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
Check the register settings
|
||||
*----------------------------------------------------------------------------*/
|
||||
#define CHECK_RANGE(val, min, max) ((val < min) || (val > max))
|
||||
#define CHECK_RSVD(val, mask) (val & mask)
|
||||
|
||||
#if (CHECK_RSVD((SYSOSCCTRL_Val), ~0x00000003))
|
||||
#error "SYSOSCCTRL: Invalid values of reserved bits!"
|
||||
#endif
|
||||
|
||||
#if (CHECK_RSVD((WDTOSCCTRL_Val), ~0x000001FF))
|
||||
#error "WDTOSCCTRL: Invalid values of reserved bits!"
|
||||
#endif
|
||||
|
||||
#if (CHECK_RANGE((SYSPLLCLKSEL_Val), 0, 3))
|
||||
#error "SYSPLLCLKSEL: Value out of range!"
|
||||
#endif
|
||||
|
||||
#if (SYSPLLCLKSEL_Val == 3) // RTC Oscillator used as PLL input
|
||||
#if (CLOCK_SETUP_API == 1)
|
||||
#error "SYSPLLCLKSEL: RTC oscillator not allowed as PLL clock source!"
|
||||
#endif
|
||||
#if (CLOCK_SETUP_REG == 1) && (MAINCLKSEL_Val == 3) // RTC Oscillator used as PLL input
|
||||
#error "SYSPLLCLKSEL: RTC oscillator not allowed as PLL clock source!"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (CHECK_RSVD((SYSPLLCTRL_Val), ~0x0000007F))
|
||||
#error "SYSPLLCTRL: Invalid values of reserved bits!"
|
||||
#endif
|
||||
|
||||
#if (CHECK_RSVD((MAINCLKSEL_Val), ~0x00000003))
|
||||
#error "MAINCLKSEL: Invalid values of reserved bits!"
|
||||
#endif
|
||||
|
||||
#if (CHECK_RANGE((SYSAHBCLKDIV_Val), 0, 255))
|
||||
#error "SYSAHBCLKDIV: Value out of range!"
|
||||
#endif
|
||||
|
||||
#if ( CLOCK_SETUP_REG == CLOCK_SETUP_API )
|
||||
#error "You must select either manual or API based Clock Configuration!"
|
||||
#endif
|
||||
|
||||
#if (CHECK_RANGE((USBPLLCLKSEL_Val), 0, 1))
|
||||
#error "USBPLLCLKSEL: Value out of range!"
|
||||
#endif
|
||||
|
||||
#if (CHECK_RSVD((USBPLLCTRL_Val), ~0x000007F))
|
||||
#error "USBPLLCTRL: Invalid values of reserved bits!"
|
||||
#endif
|
||||
|
||||
#if (CHECK_RANGE((USBCLKSEL_Val), 0, 1))
|
||||
#error "USBCLKSEL: Value out of range!"
|
||||
#endif
|
||||
|
||||
#if (CHECK_RANGE((USBCLKDIV_Val), 0, 255))
|
||||
#error "USBCLKDIV: Value out of range!"
|
||||
#endif
|
||||
|
||||
#if (CHECK_RANGE(XTAL_CLK_Val, 1000000, 25000000))
|
||||
#error "XTAL frequency is out of bounds"
|
||||
#endif
|
||||
|
||||
#if (CHECK_RANGE(PLL_API_MODE_Val, 0, 3))
|
||||
#error "PLL API Mode Select not valid"
|
||||
#endif
|
||||
|
||||
#if (CHECK_RANGE(PLL_API_FREQ_Val, 1000000, 50000000))
|
||||
#error "CPU Frequency (API mode) not valid"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
Calculate system core clock
|
||||
*----------------------------------------------------------------------------*/
|
||||
#if (CLOCK_SETUP) /* Clock Setup */
|
||||
|
||||
/* sys_pllclkin calculation */
|
||||
#if ((SYSPLLCLKSEL_Val & 0x03) == 0)
|
||||
#define __SYS_PLLCLKIN (__IRC_OSC_CLK)
|
||||
#elif ((SYSPLLCLKSEL_Val & 0x03) == 1)
|
||||
#define __SYS_PLLCLKIN (__SYS_OSC_CLK)
|
||||
#elif ((SYSPLLCLKSEL_Val & 0x03) == 3)
|
||||
#define __SYS_PLLCLKIN (__RTC_OSC_CLK)
|
||||
#else
|
||||
#error "Oops"
|
||||
#endif
|
||||
|
||||
#if (CLOCK_SETUP_REG == 1) /* Clock Setup via Register */
|
||||
|
||||
#define __FREQSEL ((WDTOSCCTRL_Val >> 5) & 0x0F)
|
||||
#define __DIVSEL (((WDTOSCCTRL_Val & 0x1F) << 1) + 2)
|
||||
|
||||
#if (__FREQSEL == 0)
|
||||
#error "WDTOSCCTRL.FREQSEL undefined!"
|
||||
#elif (__FREQSEL == 1)
|
||||
#define __OSC_CLK ( 500000 / __DIVSEL)
|
||||
#elif (__FREQSEL == 2)
|
||||
#define __OSC_CLK ( 800000 / __DIVSEL)
|
||||
#elif (__FREQSEL == 3)
|
||||
#define __OSC_CLK (1100000 / __DIVSEL)
|
||||
#elif (__FREQSEL == 4)
|
||||
#define __OSC_CLK (1400000 / __DIVSEL)
|
||||
#elif (__FREQSEL == 5)
|
||||
#define __OSC_CLK (1600000 / __DIVSEL)
|
||||
#elif (__FREQSEL == 6)
|
||||
#define __OSC_CLK (1800000 / __DIVSEL)
|
||||
#elif (__FREQSEL == 7)
|
||||
#define __OSC_CLK (2000000 / __DIVSEL)
|
||||
#elif (__FREQSEL == 8)
|
||||
#define __OSC_CLK (2200000 / __DIVSEL)
|
||||
#elif (__FREQSEL == 9)
|
||||
#define __OSC_CLK (2400000 / __DIVSEL)
|
||||
#elif (__FREQSEL == 10)
|
||||
#define __OSC_CLK (2600000 / __DIVSEL)
|
||||
#elif (__FREQSEL == 11)
|
||||
#define __OSC_CLK (2700000 / __DIVSEL)
|
||||
#elif (__FREQSEL == 12)
|
||||
#define __OSC_CLK (2900000 / __DIVSEL)
|
||||
#elif (__FREQSEL == 13)
|
||||
#define __OSC_CLK (3100000 / __DIVSEL)
|
||||
#elif (__FREQSEL == 14)
|
||||
#define __OSC_CLK (3200000 / __DIVSEL)
|
||||
#else
|
||||
#define __OSC_CLK (3400000 / __DIVSEL)
|
||||
#endif
|
||||
|
||||
#define __SYS_PLLCLKOUT (__SYS_PLLCLKIN * ((SYSPLLCTRL_Val & 0x01F) + 1))
|
||||
|
||||
/* main clock calculation */
|
||||
#if ((MAINCLKSEL_Val & 0x03) == 0)
|
||||
#define __MAIN_CLOCK (__IRC_OSC_CLK)
|
||||
#elif ((MAINCLKSEL_Val & 0x03) == 1)
|
||||
#define __MAIN_CLOCK (__SYS_PLLCLKIN)
|
||||
#elif ((MAINCLKSEL_Val & 0x03) == 2)
|
||||
#define __MAIN_CLOCK (__OSC_CLK)
|
||||
#elif ((MAINCLKSEL_Val & 0x03) == 3)
|
||||
#define __MAIN_CLOCK (__SYS_PLLCLKOUT)
|
||||
#else
|
||||
#error "Oops"
|
||||
#endif
|
||||
|
||||
#define __SYSTEM_CLOCK (__MAIN_CLOCK / SYSAHBCLKDIV_Val)
|
||||
#endif /* Clock Setup via Register */
|
||||
|
||||
#if (CLOCK_SETUP_API == 1) /* Clock Setup via ROM API */
|
||||
#define __SYSTEM_CLOCK (PLL_API_FREQ_Val)
|
||||
#endif /* Clock Setup via PLL API */
|
||||
|
||||
#else
|
||||
#define __SYSTEM_CLOCK (__IRC_OSC_CLK)
|
||||
#endif /* CLOCK_SETUP */
|
||||
|
||||
|
||||
|
||||
#if ((CLOCK_SETUP == 1) && (CLOCK_SETUP_API == 1)) /* PLL Setup via PLL API */
|
||||
#include "power_api.h"
|
||||
|
||||
typedef struct _ROM {
|
||||
const unsigned p_dev0;
|
||||
const unsigned p_dev1;
|
||||
const unsigned p_dev2;
|
||||
const PWRD * pPWRD; /* ROM Power Management API */
|
||||
const unsigned p_dev4;
|
||||
const unsigned p_dev5;
|
||||
const unsigned p_dev6;
|
||||
const unsigned p_dev7;
|
||||
} ROM;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
PLL API Function
|
||||
*----------------------------------------------------------------------------*/
|
||||
static void setPLL(const uint32_t pllMode, const uint32_t pllInFreq, const uint32_t reqCpuFreq)
|
||||
{
|
||||
uint32_t cmd[5], res[5];
|
||||
ROM ** rom = (ROM **) 0x1FFF1FF8; /* pointer to power API calls */
|
||||
|
||||
cmd[0] = pllInFreq; /* PLL's input freq in KHz */
|
||||
cmd[1] = reqCpuFreq; /* requested CPU freq in KHz */
|
||||
cmd[2] = pllMode;
|
||||
cmd[3] = 0; /* no timeout for PLL to lock */
|
||||
|
||||
/* Execute API call */
|
||||
(*rom)->pPWRD->set_pll(cmd, res); /* call API function */
|
||||
if ((res[0] != PLL_CMD_SUCCESS)){ /* in case of an error ... */
|
||||
while(1); /* ... stay here */
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
Clock Variable definitions
|
||||
*----------------------------------------------------------------------------*/
|
||||
uint32_t SystemCoreClock = __SYSTEM_CLOCK; /* System Clock Frequency */
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
Clock functions
|
||||
*----------------------------------------------------------------------------*/
|
||||
void SystemCoreClockUpdate (void) /* Get Core Clock Frequency */
|
||||
{
|
||||
uint32_t oscClk = 0;
|
||||
|
||||
/* Determine clock frequency according to clock register values */
|
||||
switch ((LPC_SYSCON->WDTOSCCTRL >> 5) & 0x0F) {
|
||||
case 0: oscClk = 0; break;
|
||||
case 1: oscClk = 500000; break;
|
||||
case 2: oscClk = 800000; break;
|
||||
case 3: oscClk = 1100000; break;
|
||||
case 4: oscClk = 1400000; break;
|
||||
case 5: oscClk = 1600000; break;
|
||||
case 6: oscClk = 1800000; break;
|
||||
case 7: oscClk = 2000000; break;
|
||||
case 8: oscClk = 2200000; break;
|
||||
case 9: oscClk = 2400000; break;
|
||||
case 10: oscClk = 2600000; break;
|
||||
case 11: oscClk = 2700000; break;
|
||||
case 12: oscClk = 2900000; break;
|
||||
case 13: oscClk = 3100000; break;
|
||||
case 14: oscClk = 3200000; break;
|
||||
case 15: oscClk = 3400000; break;
|
||||
}
|
||||
oscClk /= ((LPC_SYSCON->WDTOSCCTRL & 0x1F) << 1) + 2;
|
||||
|
||||
switch (LPC_SYSCON->MAINCLKSEL & 0x03) {
|
||||
case 0: /* Internal RC oscillator */
|
||||
SystemCoreClock = __IRC_OSC_CLK;
|
||||
break;
|
||||
case 1: /* Input Clock to System PLL */
|
||||
switch (LPC_SYSCON->SYSPLLCLKSEL & 0x03) {
|
||||
case 0: /* Internal RC oscillator */
|
||||
SystemCoreClock = __IRC_OSC_CLK;
|
||||
break;
|
||||
case 1: /* System oscillator */
|
||||
SystemCoreClock = __SYS_OSC_CLK;
|
||||
break;
|
||||
case 2: /* Reserved */
|
||||
case 3: /* Reserved */
|
||||
SystemCoreClock = 0;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2: /* WDT Oscillator */
|
||||
SystemCoreClock = oscClk;
|
||||
break;
|
||||
case 3: /* System PLL Clock Out */
|
||||
switch (LPC_SYSCON->SYSPLLCLKSEL & 0x03) {
|
||||
case 0: /* Internal RC oscillator */
|
||||
SystemCoreClock = __IRC_OSC_CLK * ((LPC_SYSCON->SYSPLLCTRL & 0x01F) + 1);
|
||||
break;
|
||||
case 1: /* System oscillator */
|
||||
SystemCoreClock = __SYS_OSC_CLK * ((LPC_SYSCON->SYSPLLCTRL & 0x01F) + 1);
|
||||
break;
|
||||
case 2: /* Reserved */
|
||||
case 3: /* Reserved */
|
||||
SystemCoreClock = 0;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
SystemCoreClock /= LPC_SYSCON->SYSAHBCLKDIV;
|
||||
|
||||
}
|
||||
|
||||
#define PDRUN_VALID_BITS 0x000025FFL
|
||||
#define PDRUN_RESERVED_ONE 0x0000C800L
|
||||
|
||||
static void power_down_config(uint32_t val)
|
||||
{
|
||||
volatile uint32_t tmp;
|
||||
tmp = (LPC_SYSCON->PDRUNCFG & PDRUN_VALID_BITS);
|
||||
tmp |= (val & PDRUN_VALID_BITS);
|
||||
LPC_SYSCON->PDRUNCFG = (tmp | PDRUN_RESERVED_ONE);
|
||||
}
|
||||
|
||||
static void power_up_config(uint32_t val)
|
||||
{
|
||||
volatile uint32_t tmp;
|
||||
tmp = (LPC_SYSCON->PDRUNCFG & PDRUN_VALID_BITS);
|
||||
tmp &= ~(val & PDRUN_VALID_BITS);
|
||||
LPC_SYSCON->PDRUNCFG = (tmp | PDRUN_RESERVED_ONE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the system
|
||||
*
|
||||
* @param none
|
||||
* @return none
|
||||
*
|
||||
* @brief Setup the microcontroller system.
|
||||
*/
|
||||
void SystemInit (void) {
|
||||
#if (CLOCK_SETUP)
|
||||
volatile uint32_t i;
|
||||
#endif
|
||||
LPC_SYSCON->SYSAHBCLKCTRL |= (1<<16);
|
||||
LPC_SYSCON->SYSPLLCTRL = SYSPLLCTRL_Val;
|
||||
|
||||
#if (CLOCK_SETUP) /* Clock Setup */
|
||||
|
||||
#if ((SYSPLLCLKSEL_Val & 0x03) == 1)
|
||||
// Initialize XTALIN/XTALOUT pins
|
||||
LPC_IOCON->PIO2_0 = 0x01;
|
||||
LPC_IOCON->PIO2_1 = 0x01;
|
||||
|
||||
LPC_SYSCON->SYSOSCCTRL = SYSOSCCTRL_Val;
|
||||
power_up_config(1<<5); /* Power-up sysosc */
|
||||
for (i = 0; i < 2500; i++) __NOP(); /* Wait for osc to stabilize */
|
||||
#endif
|
||||
|
||||
#if ((SYSPLLCLKSEL_Val & 0x03) == 3)
|
||||
LPC_SYSCON->RTCOSCCTRL = (1 << 0); /* Enable 32 kHz output */
|
||||
for (i = 0; i < 200; i++) __NOP(); /* Wait for osc to stabilize */
|
||||
#endif
|
||||
|
||||
LPC_SYSCON->SYSPLLCLKSEL = SYSPLLCLKSEL_Val; /* Select PLL Input */
|
||||
LPC_SYSCON->SYSPLLCLKUEN = 0x01; /* Update Clock Source */
|
||||
LPC_SYSCON->SYSPLLCLKUEN = 0x00; /* Toggle Update Register */
|
||||
LPC_SYSCON->SYSPLLCLKUEN = 0x01;
|
||||
while (!(LPC_SYSCON->SYSPLLCLKUEN & 0x01)); /* Wait Until Updated */
|
||||
|
||||
#if (CLOCK_SETUP_REG == 1) /* Clock Setup via Register */
|
||||
|
||||
#if (((MAINCLKSEL_Val & 0x03) == 2) )
|
||||
LPC_SYSCON->WDTOSCCTRL = WDTOSCCTRL_Val;
|
||||
LPC_SYSCON->PDRUNCFG &= ~(1 << 6); /* Power-up WDT Clock */
|
||||
for (i = 0; i < 2000; i++) __NOP(); /* Wait for osc to stabilize */
|
||||
#endif
|
||||
|
||||
#if ((MAINCLKSEL_Val & 0x03) == 3) /* Main Clock is PLL Out */
|
||||
power_down_config(1<<7); /* Power-down SYSPLL */
|
||||
LPC_SYSCON->SYSPLLCTRL = SYSPLLCTRL_Val;
|
||||
power_up_config(1<<7); /* Power-up SYSPLL */
|
||||
while (!(LPC_SYSCON->SYSPLLSTAT & 0x01)); /* Wait Until PLL Locked */
|
||||
#endif
|
||||
|
||||
LPC_SYSCON->MAINCLKSEL = MAINCLKSEL_Val; /* Select Clock Source */
|
||||
LPC_SYSCON->MAINCLKUEN = 0x01; /* Update MCLK Clock Source */
|
||||
LPC_SYSCON->MAINCLKUEN = 0x00; /* Toggle Update Register */
|
||||
LPC_SYSCON->MAINCLKUEN = 0x01;
|
||||
while (!(LPC_SYSCON->MAINCLKUEN & 0x01)); /* Wait Until Updated */
|
||||
|
||||
LPC_SYSCON->SYSAHBCLKDIV = SYSAHBCLKDIV_Val;
|
||||
#endif /* Clock Setup via Register */
|
||||
|
||||
#if (CLOCK_SETUP_API == 1) /* Clock Setup via PLL API */
|
||||
// LPC_SYSCON->SYSPLLCLKSEL = 0x00; /* Use IRC */
|
||||
// LPC_SYSCON->SYSPLLCLKUEN = 0x01; /* Update Clock Source */
|
||||
// LPC_SYSCON->SYSPLLCLKUEN = 0x00; /* Toggle Update Register */
|
||||
// LPC_SYSCON->SYSPLLCLKUEN = 0x01;
|
||||
// while (!(LPC_SYSCON->SYSPLLCLKUEN & 0x01)); /* Wait Until Updated */
|
||||
|
||||
LPC_SYSCON->MAINCLKSEL = SYSPLLCLKSEL_Val; /* Select same as SYSPLL */
|
||||
LPC_SYSCON->MAINCLKUEN = 0x01; /* Update MCLK Clock Source */
|
||||
LPC_SYSCON->MAINCLKUEN = 0x00; /* Toggle Update Register */
|
||||
LPC_SYSCON->MAINCLKUEN = 0x01;
|
||||
while (!(LPC_SYSCON->MAINCLKUEN & 0x01)); /* Wait Until Updated */
|
||||
|
||||
LPC_SYSCON->SYSAHBCLKDIV = 1;
|
||||
|
||||
setPLL(PLL_API_MODE_Val, __SYS_PLLCLKIN / 1000, PLL_API_FREQ_Val / 1000);
|
||||
#endif /* Clock Setup via PLL API */
|
||||
|
||||
#if (USB_CLOCK_SETUP == 1) /* USB clock is used */
|
||||
LPC_SYSCON->PDRUNCFG &= ~(1 << 10); /* Power-up USB PHY */
|
||||
|
||||
#if ((USBCLKSEL_Val & 0x003) == 0) /* USB clock is USB PLL out */
|
||||
LPC_SYSCON->PDRUNCFG &= ~(1 << 8); /* Power-up USB PLL */
|
||||
LPC_SYSCON->USBPLLCLKSEL = USBPLLCLKSEL_Val; /* Select PLL Input */
|
||||
LPC_SYSCON->USBPLLCLKUEN = 0x01; /* Update Clock Source */
|
||||
LPC_SYSCON->USBPLLCLKUEN = 0x00; /* Toggle Update Register */
|
||||
LPC_SYSCON->USBPLLCLKUEN = 0x01;
|
||||
while (!(LPC_SYSCON->USBPLLCLKUEN & 0x01)); /* Wait Until Updated */
|
||||
|
||||
LPC_SYSCON->USBPLLCTRL = USBPLLCTRL_Val;
|
||||
while (!(LPC_SYSCON->USBPLLSTAT & 0x01)); /* Wait Until PLL Locked */
|
||||
|
||||
LPC_SYSCON->USBCLKSEL = 0x00; /* Select USB PLL */
|
||||
#endif
|
||||
|
||||
LPC_SYSCON->USBCLKSEL = USBCLKSEL_Val; /* Select USB Clock */
|
||||
LPC_SYSCON->USBCLKDIV = USBCLKDIV_Val; /* Set USB clock divider */
|
||||
|
||||
#else /* USB clock is not used */
|
||||
LPC_SYSCON->PDRUNCFG |= (1 << 10); /* Power-down USB PHY */
|
||||
LPC_SYSCON->PDRUNCFG |= (1 << 8); /* Power-down USB PLL */
|
||||
#endif
|
||||
|
||||
#endif /* Clock Setup */
|
||||
|
||||
}
|
||||
64
targets/TARGET_NXP/TARGET_LPC11U6X/device/system_LPC11U6x.h
Normal file
64
targets/TARGET_NXP/TARGET_LPC11U6X/device/system_LPC11U6x.h
Normal file
@@ -0,0 +1,64 @@
|
||||
/**************************************************************************//**
|
||||
* @file system_LPC11U6x.h
|
||||
* @brief CMSIS Cortex-M3 Device System Header File for
|
||||
* NXP LPC11U6x Device Series
|
||||
* @version V1.00
|
||||
* @date 19. July 2013
|
||||
*
|
||||
* @note
|
||||
* Copyright (C) 2013 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#ifndef __SYSTEM_LPC11U6x_H
|
||||
#define __SYSTEM_LPC11U6x_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
|
||||
|
||||
|
||||
/**
|
||||
* Initialize the system
|
||||
*
|
||||
* @param none
|
||||
* @return none
|
||||
*
|
||||
* @brief Setup the microcontroller system.
|
||||
* Initialize the System and update the SystemCoreClock variable.
|
||||
*/
|
||||
extern void SystemInit (void);
|
||||
|
||||
/**
|
||||
* Update SystemCoreClock variable
|
||||
*
|
||||
* @param none
|
||||
* @return none
|
||||
*
|
||||
* @brief Updates the SystemCoreClock with current core Clock
|
||||
* retrieved from cpu registers.
|
||||
*/
|
||||
extern void SystemCoreClockUpdate (void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __SYSTEM_LPC11U6x_H */
|
||||
Reference in New Issue
Block a user