Skip to content

Commit c961f2d

Browse files
committed
Merge pull request #1066 from smeshlink/master
Add target XBED_LPC1768
2 parents 7c21ce5 + d043f7f commit c961f2d

File tree

5 files changed

+393
-0
lines changed

5 files changed

+393
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
/* Linker script for mbed LPC1768 */
2+
3+
/* Linker script to configure memory regions. */
4+
MEMORY
5+
{
6+
FLASH (rx) : ORIGIN = 0x00002000, LENGTH = 504K
7+
RAM (rwx) : ORIGIN = 0x100000C8, LENGTH = (32K - 0xC8)
8+
9+
USB_RAM(rwx) : ORIGIN = 0x2007C000, LENGTH = 16K
10+
ETH_RAM(rwx) : ORIGIN = 0x20080000, LENGTH = 16K
11+
}
12+
13+
/* Linker script to place sections and symbol values. Should be used together
14+
* with other linker script that defines memory regions FLASH and RAM.
15+
* It references following symbols, which must be defined in code:
16+
* Reset_Handler : Entry of reset handler
17+
*
18+
* It defines following symbols, which code can use without definition:
19+
* __exidx_start
20+
* __exidx_end
21+
* __etext
22+
* __data_start__
23+
* __preinit_array_start
24+
* __preinit_array_end
25+
* __init_array_start
26+
* __init_array_end
27+
* __fini_array_start
28+
* __fini_array_end
29+
* __data_end__
30+
* __bss_start__
31+
* __bss_end__
32+
* __end__
33+
* end
34+
* __HeapLimit
35+
* __StackLimit
36+
* __StackTop
37+
* __stack
38+
*/
39+
ENTRY(Reset_Handler)
40+
41+
SECTIONS
42+
{
43+
.text :
44+
{
45+
KEEP(*(.isr_vector))
46+
*(.text*)
47+
48+
KEEP(*(.init))
49+
KEEP(*(.fini))
50+
51+
/* .ctors */
52+
*crtbegin.o(.ctors)
53+
*crtbegin?.o(.ctors)
54+
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
55+
*(SORT(.ctors.*))
56+
*(.ctors)
57+
58+
/* .dtors */
59+
*crtbegin.o(.dtors)
60+
*crtbegin?.o(.dtors)
61+
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
62+
*(SORT(.dtors.*))
63+
*(.dtors)
64+
65+
*(.rodata*)
66+
67+
KEEP(*(.eh_frame*))
68+
} > FLASH
69+
70+
.ARM.extab :
71+
{
72+
*(.ARM.extab* .gnu.linkonce.armextab.*)
73+
} > FLASH
74+
75+
__exidx_start = .;
76+
.ARM.exidx :
77+
{
78+
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
79+
} > FLASH
80+
__exidx_end = .;
81+
82+
__etext = .;
83+
84+
.data : AT (__etext)
85+
{
86+
__data_start__ = .;
87+
Image$$RW_IRAM1$$Base = .;
88+
*(vtable)
89+
*(.data*)
90+
91+
. = ALIGN(4);
92+
/* preinit data */
93+
PROVIDE (__preinit_array_start = .);
94+
KEEP(*(.preinit_array))
95+
PROVIDE (__preinit_array_end = .);
96+
97+
. = ALIGN(4);
98+
/* init data */
99+
PROVIDE (__init_array_start = .);
100+
KEEP(*(SORT(.init_array.*)))
101+
KEEP(*(.init_array))
102+
PROVIDE (__init_array_end = .);
103+
104+
105+
. = ALIGN(4);
106+
/* finit data */
107+
PROVIDE (__fini_array_start = .);
108+
KEEP(*(SORT(.fini_array.*)))
109+
KEEP(*(.fini_array))
110+
PROVIDE (__fini_array_end = .);
111+
112+
. = ALIGN(4);
113+
/* All data end */
114+
__data_end__ = .;
115+
116+
} > RAM
117+
118+
119+
.bss :
120+
{
121+
__bss_start__ = .;
122+
*(.bss*)
123+
*(COMMON)
124+
__bss_end__ = .;
125+
Image$$RW_IRAM1$$ZI$$Limit = . ;
126+
} > RAM
127+
128+
129+
.heap :
130+
{
131+
__end__ = .;
132+
end = __end__;
133+
*(.heap*)
134+
__HeapLimit = .;
135+
} > RAM
136+
137+
/* .stack_dummy section doesn't contains any symbols. It is only
138+
* used for linker to calculate size of stack sections, and assign
139+
* values to stack symbols later */
140+
.stack_dummy :
141+
{
142+
*(.stack)
143+
} > RAM
144+
145+
/* Set stack top to end of RAM, and stack limit move down by
146+
* size of stack_dummy section */
147+
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
148+
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
149+
PROVIDE(__stack = __StackTop);
150+
151+
/* Check if data + heap + stack exceeds RAM limit */
152+
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
153+
154+
155+
/* Code can explicitly ask for data to be
156+
placed in these higher RAM banks where
157+
they will be left uninitialized.
158+
*/
159+
.AHBSRAM0 (NOLOAD):
160+
{
161+
Image$$RW_IRAM2$$Base = . ;
162+
*(AHBSRAM0)
163+
Image$$RW_IRAM2$$ZI$$Limit = .;
164+
} > USB_RAM
165+
166+
.AHBSRAM1 (NOLOAD):
167+
{
168+
Image$$RW_IRAM3$$Base = . ;
169+
*(AHBSRAM1)
170+
Image$$RW_IRAM3$$ZI$$Limit = .;
171+
} > ETH_RAM
172+
}
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
/* mbed Microcontroller Library
2+
* Copyright (c) 2006-2013 ARM Limited
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
#ifndef MBED_PINNAMES_H
17+
#define MBED_PINNAMES_H
18+
19+
#include "cmsis.h"
20+
21+
#ifdef __cplusplus
22+
extern "C" {
23+
#endif
24+
25+
typedef enum {
26+
PIN_INPUT,
27+
PIN_OUTPUT
28+
} PinDirection;
29+
30+
#define PORT_SHIFT 5
31+
32+
typedef enum {
33+
// LPC Pin Names
34+
P0_0 = LPC_GPIO0_BASE,
35+
P0_1, P0_2, P0_3, P0_4, P0_5, P0_6, P0_7, P0_8, P0_9, P0_10, P0_11, P0_12, P0_13, P0_14, P0_15, P0_16, P0_17, P0_18, P0_19, P0_20, P0_21, P0_22, P0_23, P0_24, P0_25, P0_26, P0_27, P0_28, P0_29, P0_30, P0_31,
36+
P1_0, P1_1, P1_2, P1_3, P1_4, P1_5, P1_6, P1_7, P1_8, P1_9, P1_10, P1_11, P1_12, P1_13, P1_14, P1_15, P1_16, P1_17, P1_18, P1_19, P1_20, P1_21, P1_22, P1_23, P1_24, P1_25, P1_26, P1_27, P1_28, P1_29, P1_30, P1_31,
37+
P2_0, P2_1, P2_2, P2_3, P2_4, P2_5, P2_6, P2_7, P2_8, P2_9, P2_10, P2_11, P2_12, P2_13, P2_14, P2_15, P2_16, P2_17, P2_18, P2_19, P2_20, P2_21, P2_22, P2_23, P2_24, P2_25, P2_26, P2_27, P2_28, P2_29, P2_30, P2_31,
38+
P3_0, P3_1, P3_2, P3_3, P3_4, P3_5, P3_6, P3_7, P3_8, P3_9, P3_10, P3_11, P3_12, P3_13, P3_14, P3_15, P3_16, P3_17, P3_18, P3_19, P3_20, P3_21, P3_22, P3_23, P3_24, P3_25, P3_26, P3_27, P3_28, P3_29, P3_30, P3_31,
39+
P4_0, P4_1, P4_2, P4_3, P4_4, P4_5, P4_6, P4_7, P4_8, P4_9, P4_10, P4_11, P4_12, P4_13, P4_14, P4_15, P4_16, P4_17, P4_18, P4_19, P4_20, P4_21, P4_22, P4_23, P4_24, P4_25, P4_26, P4_27, P4_28, P4_29, P4_30, P4_31,
40+
41+
// mbed DIP Pin Names
42+
p5 = P0_9,
43+
p6 = P0_8,
44+
p7 = P0_7,
45+
p8 = P0_6,
46+
p9 = P0_0,
47+
p10 = P0_1,
48+
p11 = P0_18,
49+
p12 = P0_17,
50+
p13 = P0_15,
51+
p14 = P0_16,
52+
p15 = P0_23,
53+
p16 = P0_24,
54+
p17 = P0_25,
55+
p18 = P0_26,
56+
p19 = P1_30,
57+
p20 = P1_31,
58+
p21 = P2_5,
59+
p22 = P2_4,
60+
p23 = P2_3,
61+
p24 = P2_2,
62+
p25 = P2_1,
63+
p26 = P2_0,
64+
p27 = P0_11,
65+
p28 = P0_10,
66+
p29 = P0_5,
67+
p30 = P0_4,
68+
69+
70+
LED1 = P1_18,
71+
LED2 = P1_20,
72+
LED3 = P1_21,
73+
LED4 = P1_23,
74+
75+
USBTX = P0_2,
76+
USBRX = P0_3,
77+
78+
//xbed lpc1768 Pin Names
79+
LED5 = P2_6,
80+
BTN1 = P2_8,
81+
SDA = P0_27,
82+
SCL = P0_28,
83+
ISP = P2_10,
84+
CLK = P1_27,
85+
86+
87+
88+
// Arch Pro Pin Names
89+
D0 = P4_29,
90+
D1 = P4_28,
91+
D2 = P0_4,
92+
D3 = P0_5,
93+
D4 = P2_2,
94+
D5 = P2_3,
95+
D6 = P2_4,
96+
D7 = P2_5,
97+
D8 = P0_0,
98+
D9 = P0_1,
99+
D10 = P0_6,
100+
D11 = P0_9,
101+
D12 = P0_8,
102+
D13 = P0_7,
103+
D14 = P0_27,
104+
D15 = P0_28,
105+
106+
A0 = P0_23,
107+
A1 = P0_24,
108+
A2 = P0_25,
109+
A3 = P0_26,
110+
A4 = P1_30,
111+
A5 = P1_31,
112+
113+
I2C_SCL = D15,
114+
I2C_SDA = D14,
115+
116+
// Not connected
117+
NC = (int)0xFFFFFFFF
118+
} PinName;
119+
120+
typedef enum {
121+
PullUp = 0,
122+
PullDown = 3,
123+
PullNone = 2,
124+
Repeater = 1,
125+
OpenDrain = 4,
126+
PullDefault = PullDown
127+
} PinMode;
128+
129+
// version of PINCON_TypeDef using register arrays
130+
typedef struct {
131+
__IO uint32_t PINSEL[11];
132+
uint32_t RESERVED0[5];
133+
__IO uint32_t PINMODE[10];
134+
__IO uint32_t PINMODE_OD[5];
135+
} PINCONARRAY_TypeDef;
136+
137+
#define PINCONARRAY ((PINCONARRAY_TypeDef *)LPC_PINCON_BASE)
138+
139+
#ifdef __cplusplus
140+
}
141+
#endif
142+
143+
#endif
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/* mbed Microcontroller Library
2+
* Copyright (c) 2006-2013 ARM Limited
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
#ifndef MBED_DEVICE_H
17+
#define MBED_DEVICE_H
18+
19+
#define DEVICE_PORTIN 1
20+
#define DEVICE_PORTOUT 1
21+
#define DEVICE_PORTINOUT 1
22+
23+
#define DEVICE_INTERRUPTIN 1
24+
25+
#define DEVICE_ANALOGIN 1
26+
#define DEVICE_ANALOGOUT 1
27+
28+
#define DEVICE_SERIAL 1
29+
#define DEVICE_SERIAL_FC 1
30+
31+
#define DEVICE_I2C 1
32+
#define DEVICE_I2CSLAVE 1
33+
34+
#define DEVICE_SPI 1
35+
#define DEVICE_SPISLAVE 1
36+
37+
#define DEVICE_CAN 1
38+
39+
#define DEVICE_RTC 1
40+
41+
#define DEVICE_ETHERNET 1
42+
43+
#define DEVICE_PWMOUT 1
44+
45+
#define DEVICE_SEMIHOST 1
46+
#define DEVICE_LOCALFILESYSTEM 1
47+
#define DEVICE_ID_LENGTH 32
48+
#define DEVICE_MAC_OFFSET 20
49+
50+
#define DEVICE_SLEEP 1
51+
52+
#define DEVICE_DEBUG_AWARENESS 1
53+
54+
#define DEVICE_STDIO_MESSAGES 1
55+
56+
#define DEVICE_ERROR_PATTERN 1
57+
58+
#include "objects.h"
59+
60+
#endif
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// List of reserved pins for MBED LPC1768
2+
3+
#ifndef RESERVED_PINS_H
4+
#define RESERVED_PINS_H
5+
6+
#define TARGET_RESERVED_PINS {}
7+
8+
#endif

0 commit comments

Comments
 (0)