From fcde321a852d7ae5bda82ecba9e1f268bbd73292 Mon Sep 17 00:00:00 2001 From: kraus Date: Fri, 30 Aug 2019 19:53:55 +0200 Subject: [PATCH] ctimer lpc804 --- sys/arm/lpc804/ctimer/Makefile | 145 +++++++++++++++++++++++ sys/arm/lpc804/ctimer/delay.c | 129 ++++++++++++++++++++ sys/arm/lpc804/ctimer/delay.h | 55 +++++++++ sys/arm/lpc804/ctimer/lpc804.ld | 177 ++++++++++++++++++++++++++++ sys/arm/lpc804/ctimer/main.c | 74 ++++++++++++ sys/arm/lpc804/ctimer/startup.c | 201 ++++++++++++++++++++++++++++++++ 6 files changed, 781 insertions(+) create mode 100644 sys/arm/lpc804/ctimer/Makefile create mode 100644 sys/arm/lpc804/ctimer/delay.c create mode 100644 sys/arm/lpc804/ctimer/delay.h create mode 100644 sys/arm/lpc804/ctimer/lpc804.ld create mode 100644 sys/arm/lpc804/ctimer/main.c create mode 100644 sys/arm/lpc804/ctimer/startup.c diff --git a/sys/arm/lpc804/ctimer/Makefile b/sys/arm/lpc804/ctimer/Makefile new file mode 100644 index 00000000..b92a9e35 --- /dev/null +++ b/sys/arm/lpc804/ctimer/Makefile @@ -0,0 +1,145 @@ +# +# Generic and Simple GNU ARM Makefile +# +# Desinged for the gnu-arm-none-eabi tool chain +# +# Features +# - create hex file +# - create assembler listing (.dis) +# +# Limitations +# - only C-files supported +# - no automatic dependency checking (call 'make clean' if any .h files are changed) +# +# Targets: +# make +# create hex file, no upload +# make upload +# create and upload hex file +# make clean +# delete all generated files +# +# Note: +# Display list make database: make -p -f/dev/null | less +# +#================================================ +# External tools + +# The base directory of gcc-arm-none-eabi +# Can be empty on Ubuntu and installed gcc-arm-none-eabi +# If set, GCCBINPATH must contain a "/" at the end. +GCCBINPATH:=/usr/bin/ + +#================================================ +# Project Information + +# The name for the project +TARGETNAME:=ctimer + +# The source files of the project +SRC:=$(wildcard *.c) + +# The CPU architecture (will be used for -mcpu) +# for the LPC804, can we use "cortex-m0plus" instead of "cortex-m0"? +MCPU:=cortex-m0plus + +# Include directory for the system include files +SYSINC:=../lpc_chip_804/inc +SYSSRC:=$(wildcard ../lpc_chip_804/src/*.c) + +# Include directory for the u8g2 include files +#U8G2INC:=../../../../csrc/ +#U8G2SRC:=$(wildcard ../../../../csrc/*.c) + +# directory for FatFS +#FFINC:=../fatfs +#FFSRC:=$(wildcard ../fatfs/*.c) + +# Directory for the linker script +LDSCRIPTDIR:=. +# Name of the linker script (must be the "keep" script, because the other script is not always working) +LDSCRIPT:=lpc804.ld + +#================================================ +# Main part of the Makefile starts here. Usually no changes are needed. + +# Internal Variable Names +LIBNAME:=$(TARGETNAME).a +ELFNAME:=$(TARGETNAME).elf +HEXNAME:=$(TARGETNAME).hex +DISNAME:=$(TARGETNAME).dis +MAPNAME:=$(TARGETNAME).map +OBJ:=$(SRC:.c=.o) $(SYSSRC:.c=.o) $(U8G2SRC:.c=.o) $(FFSRC:.c=.o) + +# Replace standard build tools by arm tools +CC:=$(GCCBINPATH)arm-none-eabi-gcc +AR:=$(GCCBINPATH)arm-none-eabi-ar +OBJCOPY:=$(GCCBINPATH)arm-none-eabi-objcopy +OBJDUMP:=$(GCCBINPATH)arm-none-eabi-objdump +SIZE:=$(GCCBINPATH)arm-none-eabi-size + +# Common flags +COMMON_FLAGS = -mthumb -mcpu=$(MCPU) +COMMON_FLAGS += -Wall -I. -I$(SYSINC) -I$(U8G2INC) +# define stack size (defaults to 0x0100) +# COMMON_FLAGS += -D__STACK_SIZE=0x0100 + +# COMMON_FLAGS += -Os -flto +COMMON_FLAGS += -Os +# COMMON_FLAGS += -fstack-protector +# COMMON_FLAGS += -finstrument-functions +# Do not use stand libs startup code. Uncomment this for gcclib procedures +# memcpy still works, but might be required for __aeabi_uidiv +# COMMON_FLAGS += -nostdlib +# remove unused data and function +COMMON_FLAGS += -ffunction-sections -fdata-sections +# COMMON_FLAGS += -ffunction-sections -fdata-sections -fshort-wchar +# C flags +CFLAGS:=$(COMMON_FLAGS) -std=gnu99 +# LD flags +# remove unreferenced procedures and variables, but keep "arm_stack_area" and __isr_vector +GC:=-Wl,--gc-sections -Wl,--undefined=arm_stack_area -Wl,--undefined=__isr_vector +MAP:=-Wl,-Map=$(MAPNAME) +LFLAGS:=$(COMMON_FLAGS) $(GC) $(MAP) +#LDLIBS:=--specs=nano.specs -L$(LDSCRIPTDIR) -T $(LDSCRIPT) +LDLIBS:=--specs=nosys.specs -L$(LDSCRIPTDIR) -T $(LDSCRIPT) + +# Additional Suffixes +.SUFFIXES: .elf .hex .bin .dis + +# Targets +.PHONY: all +all: $(DISNAME) $(HEXNAME) + $(SIZE) $(ELFNAME) + +.PHONY: upload +upload: $(DISNAME) $(HEXNAME) $(ELFNAME) + $(SIZE) $(ELFNAME) + +.PHONY: clean +clean: + $(RM) $(OBJ) $(HEXNAME) $(ELFNAME) $(LIBNAME) $(DISNAME) $(MAPNAME) libssp.a libssp_nonshared.a + +# implicit rules +.elf.hex: + $(OBJCOPY) -O ihex $< $@ + + + +# explicit rules + +$(ELFNAME): $(LIBNAME)($(OBJ)) libssp.a libssp_nonshared.a + $(LINK.o) $(LFLAGS) $(LIBNAME) $(LDLIBS) -o $@ + +$(DISNAME): $(ELFNAME) + $(OBJDUMP) -D -S $< > $@ + + +# create empty ssp libs for -fstack-protector-all -fstack-protector +libssp.a: + $(AR) rcs $@ + +libssp_nonshared.a: + $(AR) rcs $@ + + diff --git a/sys/arm/lpc804/ctimer/delay.c b/sys/arm/lpc804/ctimer/delay.c new file mode 100644 index 00000000..60111ea3 --- /dev/null +++ b/sys/arm/lpc804/ctimer/delay.c @@ -0,0 +1,129 @@ +/* + delay.c + + The delay function delay_micro_seconds() will use the global variable + SystemCoreClock. A call to SystemCoreClockUpdate() is required before + using delay_micro_seconds(). + + LPC804 Project + + Copyright (c) 2016, olikraus@gmail.com + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list + of conditions and the following disclaimer. + + * 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. + + 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. + + +*/ + +#include + +/* Generic ARM delay procedure, based on the system timer (SysTick) */ + +/* + Delay by the provided number of system ticks. + The delay must be smaller than the RELOAD value. + This delay has an imprecision of about +/- 20 system ticks. +*/ +static void _delay_system_ticks_sub(uint32_t sys_ticks) +{ + uint32_t start_val, end_val, curr_val; + uint32_t load; + + start_val = SysTick->VAL; + start_val &= 0x0ffffffUL; + end_val = start_val; + + if ( end_val < sys_ticks ) + { + /* check, if the operation after this if clause would lead to a negative result */ + /* if this would be the case, then add the reload value first */ + load = SysTick->LOAD; + load &= 0x0ffffffUL; + end_val += load; + } + /* counter goes towards zero, so end_val is below start value */ + end_val -= sys_ticks; + + + /* wait until interval is left */ + if ( start_val >= end_val ) + { + for(;;) + { + curr_val = SysTick->VAL; + curr_val &= 0x0ffffffUL; + if ( curr_val <= end_val ) + break; + if ( curr_val > start_val ) + break; + } + } + else + { + for(;;) + { + curr_val = SysTick->VAL; + curr_val &= 0x0ffffffUL; + if ( curr_val <= end_val && curr_val > start_val ) + break; + } + } +} + +/* + Delay by the provided number of system ticks. + Any values between 0 and 0x0ffffffff are allowed. +*/ +void delay_system_ticks(uint32_t sys_ticks) +{ + uint32_t load4; + load4 = SysTick->LOAD; + load4 &= 0x0ffffffUL; + load4 >>= 2; + + while ( sys_ticks > load4 ) + { + sys_ticks -= load4; + _delay_system_ticks_sub(load4); + } + _delay_system_ticks_sub(sys_ticks); +} + +/* + Delay by the provided number of micro seconds. + Limitation: "us" * System-Freq in MHz must now overflow in 32 bit. + Values between 0 and 1.000.000 (1 second) are ok. + + Important: Call SystemCoreClockUpdate() before calling this function. +*/ +void delay_micro_seconds(uint32_t us) +{ + uint32_t sys_ticks; + + sys_ticks = main_clk; + sys_ticks /=1000000UL; + sys_ticks *= us; + delay_system_ticks(sys_ticks); +} diff --git a/sys/arm/lpc804/ctimer/delay.h b/sys/arm/lpc804/ctimer/delay.h new file mode 100644 index 00000000..563724d4 --- /dev/null +++ b/sys/arm/lpc804/ctimer/delay.h @@ -0,0 +1,55 @@ +/* + delay.h + + LPC11U3x GPS Logger (https://github.com/olikraus/lpc11u3x-gps-logger) + + Copyright (c) 2016, olikraus@gmail.com + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list + of conditions and the following disclaimer. + + * 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. + + 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 _DELAY_H +#define _DELAY_H + +#include + +/* + Delay by the provided number of system ticks. + Any values between 0 and 0x0ffffffff are allowed. +*/ +void delay_system_ticks(uint32_t sys_ticks); + +/* + Delay by the provided number of micro seconds. + Limitation: "us" * System-Freq in MHz must now overflow in 32 bit. + Values between 0 and 1.000.000 (1 second) are ok. + + Important: Call SystemCoreClockUpdate() before calling this function. +*/ +void delay_micro_seconds(uint32_t us); + +#endif /* _DELAY_H */ diff --git a/sys/arm/lpc804/ctimer/lpc804.ld b/sys/arm/lpc804/ctimer/lpc804.ld new file mode 100644 index 00000000..dbd3ccdf --- /dev/null +++ b/sys/arm/lpc804/ctimer/lpc804.ld @@ -0,0 +1,177 @@ +/* source: gcc-arm-none-eabi-4_7-2013q1/share/gcc-arm-none-eabi/samples/ldscripts/mem.ld */ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + /* LPC804 */ + FLASH (rx) : ORIGIN = 0x0, LENGTH = 0x8000 /* 32K for LPC804 */ + RAM (rwx) : ORIGIN = 0x10000000, LENGTH = 0x1000 /* 4K for LPC804 */ +} + +/* source: gcc-arm-none-eabi-4_7-2013q1/share/gcc-arm-none-eabi/samples/ldscripts/sections.ld */ + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ + +/* entry point */ +ENTRY(Reset_Handler) + +/* extern declaration so that the value appears correctly for the LPC checksum calculation */ +EXTERN(NMI_Handler) +EXTERN(HardFault_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + end = __end__; + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .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 (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") + + /* + http://www.lpcware.com/content/forum/lpc1788-flash-signature-generation + Section 3.5.2/page 12 of the LPC82x User Manual + + Linker works with even addresses, however to indicate thumb address mode, + the lowest bit of the address is set to one. For the checksum calculation we + only have the even addresses, however later in the isr table the compiler will + store the odd addresses for the three handler subprocedures if compiled in + thumb mode. Because of this, 3 is added to consider the three odd handler calls. + */ + LPC_checksum = 0- (__StackTop + Reset_Handler + NMI_Handler + HardFault_Handler + 3 /* three entries */); +} + diff --git a/sys/arm/lpc804/ctimer/main.c b/sys/arm/lpc804/ctimer/main.c new file mode 100644 index 00000000..3d150a83 --- /dev/null +++ b/sys/arm/lpc804/ctimer/main.c @@ -0,0 +1,74 @@ +/* + use ctimer to do a LED blink +*/ + + +#include +#include +#include +#include +#include +#include + + +/*=======================================================================*/ +/* Configuration */ +#define SYS_TICK_PERIOD_IN_MS 100 + + +/*=======================================================================*/ +/* system procedures and sys tick master task */ + + + +volatile uint32_t sys_tick_irq_cnt=0; + + +void __attribute__ ((interrupt)) SysTick_Handler(void) +{ + sys_tick_irq_cnt++; +} + +/*=======================================================================*/ +/* + setup the hardware and start interrupts. + called by "Reset_Handler" +*/ +int __attribute__ ((noinline)) main(void) +{ + + /* call to the lpc lib setup procedure. This will set the IRC as clk src and main clk to 24 MHz */ + SystemInit(); + + /* if the clock or PLL has been changed, also update the global variable SystemCoreClock */ + SystemCoreClockUpdate(); + + /* set systick and start systick interrupt */ + SysTick_Config(main_clk/1000UL*(unsigned long)SYS_TICK_PERIOD_IN_MS); + + /* */ + GPIOInit(); + + /* enable clock for several subsystems */ + + Enable_Periph_Clock(CLK_IOCON); + Enable_Periph_Clock(CLK_SWM); + Enable_Periph_Clock(CLK_CTIMER0); + + GPIOSetDir( PORT0, 15, OUTPUT); + + LPC_CTIMER0->PR = 0; /* no prescale */ + LPC_CTIMER0->MR[3] = 15000000; /* PWM cycle length: one second with 15MHz AHB clock */ + LPC_CTIMER0->MCR |= 1<MR[0] = 5000000; /* PWM duty cycle in MR0 */ + LPC_CTIMER0->PWMC |= 1<PINASSIGN[T0_MAT0/4] |= ((0xffUL)<<(8*(T0_MAT0%4))); + /* then write the destination pin to it */ + LPC_SWM->PINASSIGN[T0_MAT0/4] &= ~((15UL^255UL)<<(8*(T0_MAT0%4))); + + LPC_CTIMER0->TCR |= 1< + + +/*=======================================================================*/ +/* external functions */ +void __attribute__ ((interrupt)) SysTick_Handler(void); +//void __attribute__ ((interrupt, used)) UART_IRQ(void); +int __attribute__ ((noinline)) main(void); + + + +/*=======================================================================*/ +/* + Reserve some space for the stack. This is used to check if global variables + stack exceed RAM size. + If -Wl,--gc-sections is used, then also define -Wl,--undefined=arm_stack_area to keep the variable in RAM. + The name of the variable (here: arm_stack_area) does not matter. + + Heap (=dynamic memory allocation) is not supported +*/ +#ifndef __STACK_SIZE +#define __STACK_SIZE 0x100 +#endif +unsigned char arm_stack_area[__STACK_SIZE] __attribute__ ((section(".stack"))) __attribute__ ((aligned(8))); + + +/*=======================================================================*/ +/* isr system procedures */ + +/* make the top of the stack known to the c compiler, value will be calculated by the linker script */ +void __StackTop(void); + +void __attribute__ ((interrupt)) __attribute__ ((noreturn)) Reset_Handler(void) +{ + register unsigned long *ptr; + register unsigned long *start; + register unsigned long *end; + + /* + The following two operations are not required in normal mode reset mode, + however it is usefull if the reset handler is started via ISP "Go" command + */ + __set_MSP((uint32_t)__StackTop); + //Chip_SYSCTL_Map(2); + LPC_SYSCON->SYSMEMREMAP = (uint32_t) 2; // user flash mode: use user isr vector table + + /* + Loop to copy data from read only memory to RAM. The ranges + of copy from/to are specified by following symbols evaluated in + linker script. + __etext: End of code section, i.e., begin of data sections to copy from. + __data_start__/__data_end__: RAM address range that data should be + copied to. Both must be aligned to 4 bytes boundary. + */ + extern unsigned long __data_start__[]; + extern unsigned long __data_end__[]; + extern unsigned long __etext[]; + ptr = __etext; + start = __data_start__; + end = __data_end__; + while( start < end ) + { + *start = *ptr; + start++; + ptr++; + } + + /* + Loop to zero out BSS section, which uses following symbols + in linker script: + __bss_start__: start of BSS section. Must align to 4 + __bss_end__: end of BSS section. Must align to 4 + */ + extern unsigned long __bss_start__[]; + extern unsigned long __bss_end__[]; + ptr = __bss_start__; + end = __bss_end__; + while( ptr < end ) + { + *ptr = 0; + ptr++; + } + + /* Call main procedure */ + main(); + + /* finished, do nothing. */ + for(;;) + ; +} + +/* "NMI_Handler" is used in the ld script to calculate the checksum */ +void __attribute__ ((interrupt)) NMI_Handler(void) +{ +} + +/* "HardFault_Handler" is used in the ld script to calculate the checksum */ +void __attribute__ ((interrupt)) HardFault_Handler(void) +{ +} + +/* make the checksum known to the c compiler, value will be calculated by the linker script */ +void LPC_checksum(void); + +/*=======================================================================*/ +/* isr vector */ +/* based on LPC8xx.h */ +/* see table 38 of the LPC804 user manual (page 39) */ + +typedef void (*isr_handler_t)(void); +isr_handler_t __isr_vector[48] __attribute__ ((section(".isr_vector"))) __attribute__ ((aligned(4)))= +{ + __StackTop, /* 0x00: Top of Stack, calculated by the linker script */ + Reset_Handler, /* -15, 0x04: Reset Handler, DO NOT CHANGE THE ISR NAME (used for LPC_checksum calculation) */ + NMI_Handler, /* .14, 0x08: NMI Handler, DO NOT CHANGE THE ISR NAME (used for LPC_checksum calculation) */ + HardFault_Handler, /* -13, 0x0c: Hard Fault Handler, DO NOT CHANGE THE ISR NAME (used for LPC_checksum calculation) */ + 0, /* 0x10: Reserved, must be 0 */ + 0, /* 0x14: Reserved, must be 0 */ + 0, /* 0x18: Reserved, must be 0 */ + LPC_checksum, /* 0x1c: Checksum, calculated by the linker script or the flash utility */ + 0, /* Reserved */ + 0, /* Reserved */ + 0, /* Reserved */ + 0, /* -5, SVCall Handler */ + 0, /* -4, Reserved */ + 0, /* -3, Reserved */ + 0, /* -2, PendSV Handler */ + SysTick_Handler, /* -1, SysTick Handler */ + + + 0, /* 0 SPI0_IRQn, SPI0 controller */ + 0, /* 1 Not used/Reserved */ + 0, /* 2 DAC0_IRQn, DAC0 Interrupt */ + 0, /* 3 UART0_IRQn, USART0 */ + 0, /* 4 UART1_IRQn, USART1 */ + 0, /* 5 Not used */ + 0, /* 6 Not used */ + 0, /* 7 I2C1 controller */ + 0, /* 8 I2C0 controller */ + 0, /* 9 Not used/Reserved */ + 0, /* 10 MRT_IRQnMulti-Rate Timer */ + 0, /* 11 CMP_IRQn, Analog Comparator /CapTouch*/ + 0, /* 12 WDT_IRQn WDT */ + 0, /* 13 BOD_IRQn BOD Brown Out Detect */ + 0, /* 14 FLASH_IRQn (/Reserved according to the user manual) */ + 0, /* 15 WKT_IRQn Self wake-up timer */ + 0, /* 16 ADC_SEQA_IRQn */ + 0, /* 17 ADC_SEQB_IRQn */ + 0, /* 18 ADC_THCMP_IRQn ADC threshold compare */ + 0, /* 19 ADC_OVR_IRQn ADC overrun */ + 0, /* 20 Not used/Reserved */ + 0, /* 21 Not used/Reserved */ + 0, /* 22 Not used/Reserved */ + 0, /* 23 CTIMER0_IRQn, CT32B0_IRQ */ + 0, /* 24 PIO INT0 */ + 0, /* 25 PIO INT1 */ + 0, /* 26 PIO INT2 */ + 0, /* 27 PIO INT3 */ + 0, /* 28 PIO INT4 */ + 0, /* 29 PIO INT5 */ + 0, /* 30 PIO INT6 */ + 0 /* 31 PIO INT7 */ +}; +