Skip to content

Commit 233979e

Browse files
committed
Merge pull request #54 from ytsuboi/master
Added LPC810 support
2 parents f813bb9 + 46003d4 commit 233979e

File tree

26 files changed

+2829
-5
lines changed

26 files changed

+2829
-5
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ NXP:
2424
* [LPC1768](http://mbed.org/handbook/mbed-NXP-LPC1768) (Cortex-M3)
2525
* [LPC11U24](http://mbed.org/handbook/mbed-NXP-LPC11U24) (Cortex-M0)
2626
* LPC2368 (ARM7TDMI-S)
27+
* LPC810 (Cortex-M0+)
2728
* LPC812 (Cortex-M0+)
2829
* LPC4088 (Cortex-M4)
2930
* LPC4330 (Cortex-M4 + Cortex-M0)

libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC810/LPC8xx.h

Lines changed: 687 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
LR_IROM1 0x00000000 0x1000 { ; load region size_region (4k)
3+
ER_IROM1 0x00000000 0x1000 { ; load address = execution address
4+
*.o (RESET, +First)
5+
*(InRoot$$Sections)
6+
.ANY (+RO)
7+
}
8+
; 8_byte_aligned(48 vect * 4 bytes) = 0xC0
9+
; 1KB(0x0400) - 0xC0 = 0x340
10+
RW_IRAM1 (0x10000000+0xC0) (0x400-0xC0) {
11+
.ANY (+RW +ZI)
12+
}
13+
}
14+
Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
;/*****************************************************************************
2+
; * @file: startup_LPC8xx.s
3+
; * @purpose: CMSIS Cortex-M0+ Core Device Startup File
4+
; * for the NXP LPC8xx Device Series
5+
; * @version: V1.0
6+
; * @date: 16. Aug. 2012
7+
; *------- <<< Use Configuration Wizard in Context Menu >>> ------------------
8+
; *
9+
; * Copyright (C) 2012 ARM Limited. All rights reserved.
10+
; * ARM Limited (ARM) is supplying this software for use with Cortex-M0+
11+
; * processor based microcontrollers. This file can be freely distributed
12+
; * within development tools that are supporting such ARM based processors.
13+
; *
14+
; * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
15+
; * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
16+
; * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
17+
; * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
18+
; * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
19+
; *
20+
; *****************************************************************************/
21+
22+
23+
; <h> Stack Configuration
24+
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
25+
; </h>
26+
27+
Stack_Size EQU 0x00000200
28+
29+
AREA STACK, NOINIT, READWRITE, ALIGN=3
30+
EXPORT __initial_sp
31+
32+
Stack_Mem SPACE Stack_Size
33+
__initial_sp EQU 0x10000400
34+
35+
36+
; <h> Heap Configuration
37+
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
38+
; </h>
39+
40+
Heap_Size EQU 0x00000000
41+
42+
AREA HEAP, NOINIT, READWRITE, ALIGN=3
43+
EXPORT __heap_base
44+
EXPORT __heap_limit
45+
46+
__heap_base
47+
Heap_Mem SPACE Heap_Size
48+
__heap_limit
49+
50+
PRESERVE8
51+
THUMB
52+
53+
54+
; Vector Table Mapped to Address 0 at Reset
55+
56+
AREA RESET, DATA, READONLY
57+
EXPORT __Vectors
58+
59+
__Vectors DCD __initial_sp ; Top of Stack
60+
DCD Reset_Handler ; Reset Handler
61+
DCD NMI_Handler ; NMI Handler
62+
DCD HardFault_Handler ; Hard Fault Handler
63+
DCD 0 ; Reserved
64+
DCD 0 ; Reserved
65+
DCD 0 ; Reserved
66+
DCD 0 ; Reserved
67+
DCD 0 ; Reserved
68+
DCD 0 ; Reserved
69+
DCD 0 ; Reserved
70+
DCD SVC_Handler ; SVCall Handler
71+
DCD 0 ; Reserved
72+
DCD 0 ; Reserved
73+
DCD PendSV_Handler ; PendSV Handler
74+
DCD SysTick_Handler ; SysTick Handler
75+
76+
; External Interrupts
77+
DCD SPI0_IRQHandler ; SPI0 controller
78+
DCD SPI1_IRQHandler ; SPI1 controller
79+
DCD 0 ; Reserved
80+
DCD UART0_IRQHandler ; UART0
81+
DCD UART1_IRQHandler ; UART1
82+
DCD UART2_IRQHandler ; UART2
83+
DCD 0 ; Reserved
84+
DCD 0 ; Reserved
85+
DCD I2C_IRQHandler ; I2C controller
86+
DCD SCT_IRQHandler ; Smart Counter Timer
87+
DCD MRT_IRQHandler ; Multi-Rate Timer
88+
DCD CMP_IRQHandler ; Comparator
89+
DCD WDT_IRQHandler ; PIO1 (0:11)
90+
DCD BOD_IRQHandler ; Brown Out Detect
91+
DCD 0 ; Reserved
92+
DCD WKT_IRQHandler ; Wakeup timer
93+
DCD 0 ; Reserved
94+
DCD 0 ; Reserved
95+
DCD 0 ; Reserved
96+
DCD 0 ; Reserved
97+
DCD 0 ; Reserved
98+
DCD 0 ; Reserved
99+
DCD 0 ; Reserved
100+
DCD 0 ; Reserved
101+
DCD PININT0_IRQHandler ; PIO INT0
102+
DCD PININT1_IRQHandler ; PIO INT1
103+
DCD PININT2_IRQHandler ; PIO INT2
104+
DCD PININT3_IRQHandler ; PIO INT3
105+
DCD PININT4_IRQHandler ; PIO INT4
106+
DCD PININT5_IRQHandler ; PIO INT5
107+
DCD PININT6_IRQHandler ; PIO INT6
108+
DCD PININT7_IRQHandler ; PIO INT7
109+
110+
111+
IF :LNOT::DEF:NO_CRP
112+
AREA |.ARM.__at_0x02FC|, CODE, READONLY
113+
CRP_Key DCD 0xFFFFFFFF
114+
ENDIF
115+
116+
117+
AREA |.text|, CODE, READONLY
118+
119+
120+
; Reset Handler
121+
122+
Reset_Handler PROC
123+
EXPORT Reset_Handler [WEAK]
124+
IMPORT SystemInit
125+
IMPORT __main
126+
LDR R0, =SystemInit
127+
BLX R0
128+
LDR R0, =__main
129+
BX R0
130+
ENDP
131+
132+
133+
; Dummy Exception Handlers (infinite loops which can be modified)
134+
; now, under COMMON lpc8xx_nmi.c and lpc8xx_nmi.h, a real NMI handler is created if NMI is enabled
135+
; for particular peripheral.
136+
;NMI_Handler PROC
137+
; EXPORT NMI_Handler [WEAK]
138+
; B .
139+
; ENDP
140+
HardFault_Handler\
141+
PROC
142+
EXPORT HardFault_Handler [WEAK]
143+
B .
144+
ENDP
145+
SVC_Handler PROC
146+
EXPORT SVC_Handler [WEAK]
147+
B .
148+
ENDP
149+
PendSV_Handler PROC
150+
EXPORT PendSV_Handler [WEAK]
151+
B .
152+
ENDP
153+
SysTick_Handler PROC
154+
EXPORT SysTick_Handler [WEAK]
155+
B .
156+
ENDP
157+
158+
Default_Handler PROC
159+
160+
EXPORT NMI_Handler [WEAK]
161+
EXPORT SPI0_IRQHandler [WEAK]
162+
EXPORT SPI1_IRQHandler [WEAK]
163+
EXPORT UART0_IRQHandler [WEAK]
164+
EXPORT UART1_IRQHandler [WEAK]
165+
EXPORT UART2_IRQHandler [WEAK]
166+
EXPORT I2C_IRQHandler [WEAK]
167+
EXPORT SCT_IRQHandler [WEAK]
168+
EXPORT MRT_IRQHandler [WEAK]
169+
EXPORT CMP_IRQHandler [WEAK]
170+
EXPORT WDT_IRQHandler [WEAK]
171+
EXPORT BOD_IRQHandler [WEAK]
172+
173+
EXPORT WKT_IRQHandler [WEAK]
174+
175+
EXPORT PININT0_IRQHandler [WEAK]
176+
EXPORT PININT1_IRQHandler [WEAK]
177+
EXPORT PININT2_IRQHandler [WEAK]
178+
EXPORT PININT3_IRQHandler [WEAK]
179+
EXPORT PININT4_IRQHandler [WEAK]
180+
EXPORT PININT5_IRQHandler [WEAK]
181+
EXPORT PININT6_IRQHandler [WEAK]
182+
EXPORT PININT7_IRQHandler [WEAK]
183+
184+
NMI_Handler
185+
SPI0_IRQHandler
186+
SPI1_IRQHandler
187+
UART0_IRQHandler
188+
UART1_IRQHandler
189+
UART2_IRQHandler
190+
I2C_IRQHandler
191+
SCT_IRQHandler
192+
MRT_IRQHandler
193+
CMP_IRQHandler
194+
WDT_IRQHandler
195+
BOD_IRQHandler
196+
WKT_IRQHandler
197+
PININT0_IRQHandler
198+
PININT1_IRQHandler
199+
PININT2_IRQHandler
200+
PININT3_IRQHandler
201+
PININT4_IRQHandler
202+
PININT5_IRQHandler
203+
PININT6_IRQHandler
204+
PININT7_IRQHandler
205+
206+
B .
207+
208+
ENDP
209+
210+
ALIGN
211+
END
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/* mbed Microcontroller Library - stackheap
2+
* Copyright (C) 2009-2011 ARM Limited. All rights reserved.
3+
*
4+
* Setup a fixed single stack/heap memory model,
5+
* between the top of the RW/ZI region and the stackpointer
6+
*/
7+
8+
#ifdef __cplusplus
9+
extern "C" {
10+
#endif
11+
12+
#include <rt_misc.h>
13+
#include <stdint.h>
14+
15+
extern char Image$$RW_IRAM1$$ZI$$Limit[];
16+
17+
extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) {
18+
uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit;
19+
uint32_t sp_limit = __current_sp();
20+
21+
zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned
22+
23+
struct __initial_stackheap r;
24+
r.heap_base = zi_limit;
25+
r.heap_limit = sp_limit;
26+
return r;
27+
}
28+
29+
#ifdef __cplusplus
30+
}
31+
#endif
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* mbed Microcontroller Library - CMSIS
2+
* Copyright (C) 2009-2011 ARM Limited. All rights reserved.
3+
*
4+
* A generic CMSIS include header, pulling in LPC8xx specifics
5+
*/
6+
7+
#ifndef MBED_CMSIS_H
8+
#define MBED_CMSIS_H
9+
10+
#include "LPC8xx.h"
11+
#include "cmsis_nvic.h"
12+
13+
#endif
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/* mbed Microcontroller Library - cmsis_nvic for LPC11U24
2+
* Copyright (c) 2011 ARM Limited. All rights reserved.
3+
*
4+
* CMSIS-style functionality to support dynamic vectors
5+
*/
6+
#include "cmsis_nvic.h"
7+
8+
#define NVIC_RAM_VECTOR_ADDRESS (0x10000000) // Vectors positioned at start of RAM
9+
#define NVIC_FLASH_VECTOR_ADDRESS (0x0) // Initial vector position in flash
10+
11+
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
12+
uint32_t *vectors = (uint32_t*)SCB->VTOR;
13+
uint32_t i;
14+
15+
// Copy and switch to dynamic vectors if the first time called
16+
if (SCB->VTOR == NVIC_FLASH_VECTOR_ADDRESS) {
17+
uint32_t *old_vectors = vectors;
18+
vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
19+
for (i=0; i<NVIC_NUM_VECTORS; i++) {
20+
vectors[i] = old_vectors[i];
21+
}
22+
SCB->VTOR = (uint32_t)NVIC_RAM_VECTOR_ADDRESS;
23+
}
24+
vectors[IRQn + 16] = vector;
25+
}
26+
27+
uint32_t NVIC_GetVector(IRQn_Type IRQn) {
28+
uint32_t *vectors = (uint32_t*)SCB->VTOR;
29+
return vectors[IRQn + 16];
30+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/* mbed Microcontroller Library - cmsis_nvic
2+
* Copyright (c) 2009-2011 ARM Limited. All rights reserved.
3+
*
4+
* CMSIS-style functionality to support dynamic vectors
5+
*/
6+
7+
#ifndef MBED_CMSIS_NVIC_H
8+
#define MBED_CMSIS_NVIC_H
9+
10+
#define NVIC_NUM_VECTORS (16 + 32) // CORE + MCU Peripherals
11+
#define NVIC_USER_IRQ_OFFSET 16
12+
13+
#include "cmsis.h"
14+
15+
#ifdef __cplusplus
16+
extern "C" {
17+
#endif
18+
19+
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector);
20+
uint32_t NVIC_GetVector(IRQn_Type IRQn);
21+
22+
#ifdef __cplusplus
23+
}
24+
#endif
25+
26+
#endif

0 commit comments

Comments
 (0)