@@ -71,7 +71,10 function TargetInstallPath { | |||||
71 | } |
|
71 | } | |
72 |
|
72 | |||
73 | function getBSP { |
|
73 | function getBSP { | |
|
74 | ||||
|
75 | if(more $1 | grep -i "BSP ="); then | |||
74 | BSP=`more $1 | grep -i "BSP" | sed s/BSP// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'` |
|
76 | BSP=`more $1 | grep -i "BSP" | sed s/BSP// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'` | |
|
77 | fi | |||
75 | } |
|
78 | } | |
76 |
|
79 | |||
77 | if [ -z "$1" ] ; then |
|
80 | if [ -z "$1" ] ; then | |
@@ -122,6 +125,15 if(echo $TEMPLATE | grep -i 'dir'); then | |||||
122 | done |
|
125 | done | |
123 | echo " @echo Code compiled" >> Makefile |
|
126 | echo " @echo Code compiled" >> Makefile | |
124 | echo "" >> Makefile |
|
127 | echo "" >> Makefile | |
|
128 | echo 'clean:' >> Makefile | |||
|
129 | for DIRS in $SUBDIRS | |||
|
130 | do | |||
|
131 | if [ -e "$DIRS/Makefile" ]; then | |||
|
132 | echo " make clean -C $DIRS">> Makefile | |||
|
133 | fi | |||
|
134 | done | |||
|
135 | echo " @echo Code compiled" >> Makefile | |||
|
136 | echo "" >> Makefile | |||
125 | else |
|
137 | else | |
126 | Target $PROJECTFILE |
|
138 | Target $PROJECTFILE | |
127 | Arch $PROJECTFILE |
|
139 | Arch $PROJECTFILE | |
@@ -130,10 +142,13 else | |||||
130 | HeadersInstallPath $PROJECTFILE |
|
142 | HeadersInstallPath $PROJECTFILE | |
131 | TargetInstallPath $PROJECTFILE |
|
143 | TargetInstallPath $PROJECTFILE | |
132 | getBSP $PROJECTFILE |
|
144 | getBSP $PROJECTFILE | |
|
145 | echo "Current BSP is $BSP" | |||
133 | echo $SRCFILES >> Makefile |
|
146 | echo $SRCFILES >> Makefile | |
|
147 | ||||
|
148 | if(echo $TEMPLATE|grep -i app); then | |||
134 | getFilesList $PROJECTFILE HEADERS >> Makefile |
|
149 | getFilesList $PROJECTFILE HEADERS >> Makefile | |
135 | getFilesList $PROJECTFILE SOURCES >> Makefile |
|
150 | getFilesList $PROJECTFILE SOURCES | sed 's/SOURCES/APPSOURCES/' >> Makefile | |
136 | echo 'OBJECTFILES = $(SOURCES:.c=.o)'>> Makefile |
|
151 | echo 'OBJECTFILES = $(APPSOURCES:.c=.o)'>> Makefile | |
137 | echo "ARCH = "'$(LIBUC)'"/rules/$ARCH" >> Makefile |
|
152 | echo "ARCH = "'$(LIBUC)'"/rules/$ARCH" >> Makefile | |
138 | echo "TARGET=$TARGET">> Makefile |
|
153 | echo "TARGET=$TARGET">> Makefile | |
139 | echo "LIBUC_INCLUDES=$INCLUDES">> Makefile |
|
154 | echo "LIBUC_INCLUDES=$INCLUDES">> Makefile | |
@@ -142,13 +157,23 else | |||||
142 | echo "HEADERSINSTALLPATH=$HEADERSINSTALLPATH">> Makefile |
|
157 | echo "HEADERSINSTALLPATH=$HEADERSINSTALLPATH">> Makefile | |
143 | echo "BSP=$BSP">> Makefile |
|
158 | echo "BSP=$BSP">> Makefile | |
144 | echo 'include $(ARCH)/rules.mk' >> Makefile |
|
159 | echo 'include $(ARCH)/rules.mk' >> Makefile | |
145 |
|
||||
146 | if(echo $TEMPLATE|grep -i app); then |
|
|||
147 | echo '' >> Makefile |
|
160 | echo '' >> Makefile | |
148 | echo 'all:bin' >> Makefile |
|
161 | echo 'all:bin' >> Makefile | |
149 | echo " @echo Code compiled" >> Makefile |
|
162 | echo " @echo Code compiled" >> Makefile | |
|
163 | echo '' >> Makefile | |||
150 | else |
|
164 | else | |
151 | if(echo $TEMPLATE|grep -i lib); then |
|
165 | if(echo $TEMPLATE|grep -i lib); then | |
|
166 | getFilesList $PROJECTFILE HEADERS >> Makefile | |||
|
167 | getFilesList $PROJECTFILE SOURCES | sed 's/SOURCES/LIBSOURCES/' >> Makefile | |||
|
168 | echo 'OBJECTFILES = $(LIBSOURCES:.c=.o)'>> Makefile | |||
|
169 | echo "ARCH = "'$(LIBUC)'"/rules/$ARCH" >> Makefile | |||
|
170 | echo "TARGET=$TARGET">> Makefile | |||
|
171 | echo "LIBUC_INCLUDES=$INCLUDES">> Makefile | |||
|
172 | echo "LIBUC_LIBRARIES=$LIBRARIES">> Makefile | |||
|
173 | echo "TARGETINSTALLPATH=$TARGETINSTALLPATH">> Makefile | |||
|
174 | echo "HEADERSINSTALLPATH=$HEADERSINSTALLPATH">> Makefile | |||
|
175 | echo "BSP=$BSP">> Makefile | |||
|
176 | echo 'include $(ARCH)/rules.mk' >> Makefile | |||
152 | echo '' >> Makefile |
|
177 | echo '' >> Makefile | |
153 | echo 'all:lib' >> Makefile |
|
178 | echo 'all:lib' >> Makefile | |
154 | echo " @echo Code compiled" >> Makefile |
|
179 | echo " @echo Code compiled" >> Makefile |
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -19,9 +19,18 | |||||
19 | -- Author : Alexis Jeandet |
|
19 | -- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@gmail.com |
|
20 | -- Mail : alexis.jeandet@gmail.com | |
21 | -------------------------------------------------------------------------------*/ |
|
21 | -------------------------------------------------------------------------------*/ | |
|
22 | #ifndef UART_H | |||
|
23 | #define UART_H | |||
22 | #include "LPC17xx.h" |
|
24 | #include "LPC17xx.h" | |
23 |
|
25 | |||
24 | struct ARM7uartRegs |
|
26 | ||
|
27 | #define uartNoParity 0 | |||
|
28 | #define uartOddParity 1 | |||
|
29 | #define uartEvenParity 3 | |||
|
30 | #define uartTrueParity 5 | |||
|
31 | #define uartFalseParity 7 | |||
|
32 | ||||
|
33 | struct LPC17XXuartRegs | |||
25 | { |
|
34 | { | |
26 | unsigned long RWreg; |
|
35 | unsigned long RWreg; | |
27 | unsigned long IntEN; |
|
36 | unsigned long IntEN; | |
@@ -32,12 +41,26 struct ARM7uartRegs | |||||
32 | unsigned long ScratchPad; |
|
41 | unsigned long ScratchPad; | |
33 | }; |
|
42 | }; | |
34 |
|
43 | |||
35 |
typedef struct |
|
44 | typedef volatile struct LPC17XXuartRegs uartDev; | |
36 |
|
45 | |||
37 | uartDev* uartopen(int count); |
|
46 | extern uartDev* uartopen(int count); | |
38 | void uartputc(uartDev* dev,char c); |
|
47 | extern void uarton(int count); | |
39 | void uartputs(uartDev* dev,char *s); |
|
48 | extern void uartoff(int count); | |
40 |
void uart |
|
49 | extern void uartputc(uartDev* dev,char c); | |
41 |
|
|
50 | extern void uartputs(uartDev* dev,char *s); | |
42 | void uartsetup(uartDev* dev,int baudRate,int cpuClk); |
|
51 | extern void uartgets(uartDev* dev,char *s); | |
|
52 | extern char uartgetc(uartDev* dev); | |||
|
53 | extern void uartsetbaudrate(uartDev* dev,unsigned int baudRate); | |||
|
54 | extern unsigned char uartgetpclkfactor(uartDev* dev); | |||
|
55 | extern void uartsetpclkfactor(uartDev* dev,unsigned char pclkfactor); | |||
|
56 | extern void uartsetup(uartDev* dev,unsigned int baudRate,unsigned char WordLength,unsigned char StopBitCnt,unsigned char Parity); | |||
43 |
|
57 | |||
|
58 | #endif | |||
|
59 | ||||
|
60 | ||||
|
61 | ||||
|
62 | ||||
|
63 | ||||
|
64 | ||||
|
65 | ||||
|
66 |
@@ -4,14 +4,15 LIBUC = /opt/libuc2 | |||||
4 |
|
4 | |||
5 | HEADERSINSTALLPATH = $(LIBUC_INC_DIR)/UART |
|
5 | HEADERSINSTALLPATH = $(LIBUC_INC_DIR)/UART | |
6 | HEADERS += uart.h |
|
6 | HEADERS += uart.h | |
7 | SOURCES += uart.c |
|
7 | LIBSOURCES += uart.c | |
8 | OBJECTFILES = $(SOURCES:.c=.o) |
|
8 | OBJECTFILES = $(LIBSOURCES:.c=.o) | |
9 | ARCH = $(LIBUC)/rules/lpc17XX-arm-noabi-gcc |
|
9 | ARCH = $(LIBUC)/rules/lpc17XX-arm-noabi-gcc | |
10 | TARGET=libuart |
|
10 | TARGET=libuart | |
11 | LIBUC_INCLUDES= |
|
11 | LIBUC_INCLUDES=$(LIBUC_INC_DIR_CORE) | |
12 | LIBUC_LIBRARIES= |
|
12 | LIBUC_LIBRARIES=$(LIBUC_LIBS_DIR_CORE) $(LIBUC_LIBS_CORE) | |
13 | TARGETINSTALLPATH=$(LIBUC_LIBS_DIR)/UART |
|
13 | TARGETINSTALLPATH=$(LIBUC_LIBS_DIR)/UART | |
14 | HEADERSINSTALLPATH=$(LIBUC_INC_DIR)/UART |
|
14 | HEADERSINSTALLPATH=$(LIBUC_INC_DIR)/UART | |
|
15 | BSP=generic | |||
15 | include $(ARCH)/rules.mk |
|
16 | include $(ARCH)/rules.mk | |
16 |
|
17 | |||
17 | all:lib |
|
18 | all:lib |
@@ -19,6 +19,7 | |||||
19 | -- Author : Alexis Jeandet |
|
19 | -- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@gmail.com |
|
20 | -- Mail : alexis.jeandet@gmail.com | |
21 | -------------------------------------------------------------------------------*/ |
|
21 | -------------------------------------------------------------------------------*/ | |
|
22 | #include "core.h" | |||
22 | #include "uart.h" |
|
23 | #include "uart.h" | |
23 |
|
24 | |||
24 |
|
25 | |||
@@ -42,8 +43,130 void uartgets(uartDev* dev,char *s) { | |||||
42 | while (*s && (*s!=0xd)) *s++ = uartgetc(dev); |
|
43 | while (*s && (*s!=0xd)) *s++ = uartgetc(dev); | |
43 | } |
|
44 | } | |
44 |
|
45 | |||
45 | void uartsetup(uartDev* dev,int baudRate,int cpuClk) |
|
46 | void uartoff(int count) | |
46 |
{ |
|
47 | { | |
|
48 | switch(count) | |||
|
49 | { | |||
|
50 | case 0: | |||
|
51 | LPC_SC->PCONP &= ~( 1 << 3 ); | |||
|
52 | break; | |||
|
53 | case 1: | |||
|
54 | LPC_SC->PCONP &= ~( 1 << 4 ); | |||
|
55 | break; | |||
|
56 | case 2: | |||
|
57 | LPC_SC->PCONP &= ~( 1 << 24 ); | |||
|
58 | break; | |||
|
59 | case 3: | |||
|
60 | LPC_SC->PCONP &= ~( 1 << 25 ); | |||
|
61 | break; | |||
|
62 | default: | |||
|
63 | break; | |||
|
64 | } | |||
|
65 | } | |||
|
66 | ||||
|
67 | void uarton(int count) | |||
|
68 | { | |||
|
69 | switch(count) | |||
|
70 | { | |||
|
71 | case 0: | |||
|
72 | LPC_SC->PCONP |= ( 1 << 3 ); | |||
|
73 | break; | |||
|
74 | case 1: | |||
|
75 | LPC_SC->PCONP |= ( 1 << 4 ); | |||
|
76 | break; | |||
|
77 | case 2: | |||
|
78 | LPC_SC->PCONP |= ( 1 << 24 ); | |||
|
79 | break; | |||
|
80 | case 3: | |||
|
81 | LPC_SC->PCONP |= ( 1 << 25 ); | |||
|
82 | break; | |||
|
83 | default: | |||
|
84 | break; | |||
|
85 | } | |||
|
86 | } | |||
|
87 | ||||
|
88 | ||||
|
89 | ||||
|
90 | void uartsetup(uartDev* dev,unsigned int baudRate,unsigned char WordLength,unsigned char StopBitCnt,unsigned char Parity) | |||
|
91 | { | |||
|
92 | if(WordLength>9)WordLength=8; | |||
|
93 | if((StopBitCnt>2)||(StopBitCnt==0))StopBitCnt=1; | |||
|
94 | if(Parity>7)Parity=0; | |||
|
95 | dev->LineCtrl = (WordLength-5) + ((StopBitCnt-1)<<2) + (Parity<<3); | |||
|
96 | uartsetbaudrate(dev,baudRate); | |||
|
97 | } | |||
|
98 | ||||
|
99 | unsigned char uartgetpclkfactor(uartDev* dev) | |||
|
100 | { | |||
|
101 | unsigned int clksel=0; | |||
|
102 | const char clkselDec[]={4,1,2,8}; | |||
|
103 | switch((int)dev) | |||
|
104 | { | |||
|
105 | case (int)LPC_UART0_BASE: | |||
|
106 | clksel = (LPC_SC->PCLKSEL0>>6) & 3; | |||
|
107 | break; | |||
|
108 | case (int)LPC_UART1_BASE: | |||
|
109 | clksel = (LPC_SC->PCLKSEL0>>8) & 3; | |||
|
110 | break; | |||
|
111 | case (int)LPC_UART2_BASE: | |||
|
112 | clksel = (LPC_SC->PCLKSEL1>>16) & 3; | |||
|
113 | break; | |||
|
114 | case (int)LPC_UART3_BASE: | |||
|
115 | clksel = (LPC_SC->PCLKSEL1>>18) & 3; | |||
|
116 | break; | |||
|
117 | default: | |||
|
118 | break; | |||
|
119 | } | |||
|
120 | return clkselDec[clksel]; | |||
|
121 | } | |||
|
122 | ||||
|
123 | void uartsetpclkfactor(uartDev* dev,unsigned char pclkfactor) | |||
|
124 | { | |||
|
125 | const char clkselDec[]={1,1,2,2,0,0,0,0,3}; | |||
|
126 | unsigned int clksel=0; | |||
|
127 | switch((int)dev) | |||
|
128 | { | |||
|
129 | case (int)LPC_UART0_BASE: | |||
|
130 | LPC_SC->PCLKSEL0 |= clkselDec[pclkfactor]<<6; | |||
|
131 | LPC_SC->PCLKSEL0 &= clkselDec[pclkfactor]<<6; | |||
|
132 | break; | |||
|
133 | case (int)LPC_UART1_BASE: | |||
|
134 | LPC_SC->PCLKSEL0 |= clkselDec[pclkfactor]<<8; | |||
|
135 | LPC_SC->PCLKSEL0 &= clkselDec[pclkfactor]<<8; | |||
|
136 | break; | |||
|
137 | case (int)LPC_UART2_BASE: | |||
|
138 | LPC_SC->PCLKSEL1 |= clkselDec[pclkfactor]<<16; | |||
|
139 | LPC_SC->PCLKSEL1 &= clkselDec[pclkfactor]<<16; | |||
|
140 | break; | |||
|
141 | case (int)LPC_UART3_BASE: | |||
|
142 | LPC_SC->PCLKSEL1 |= clkselDec[pclkfactor]<<18; | |||
|
143 | LPC_SC->PCLKSEL1 &= clkselDec[pclkfactor]<<18; | |||
|
144 | break; | |||
|
145 | default: | |||
|
146 | break; | |||
|
147 | } | |||
|
148 | } | |||
|
149 | ||||
|
150 | void uartsetbaudrate(uartDev* dev,unsigned int baudRate) | |||
|
151 | { | |||
|
152 | unsigned int cpuClk=0; | |||
|
153 | unsigned int pclk = 0; | |||
|
154 | unsigned int clksel=0; | |||
|
155 | unsigned int cpuclk=0; | |||
|
156 | if(dev==0)return; | |||
|
157 | cpuclk = coregetCpuFreq(); | |||
|
158 | pclk = cpuclk / uartgetpclkfactor(dev); | |||
|
159 | while((baudRate*16)>pclk) | |||
|
160 | { | |||
|
161 | unsigned char pclkfact= uartgetpclkfactor(dev); | |||
|
162 | if(pclkfact==1)return; | |||
|
163 | uartsetpclkfactor(dev,pclkfact/2); | |||
|
164 | pclk = cpuclk / uartgetpclkfactor(dev); | |||
|
165 | } | |||
|
166 | dev->LineCtrl |= 128; | |||
|
167 | dev->RWreg = pclk/(baudRate*16); | |||
|
168 | dev->LineCtrl &= ~(128); | |||
|
169 | } | |||
47 |
|
170 | |||
48 | uartDev* uartopen(int count){ |
|
171 | uartDev* uartopen(int count){ | |
49 | uartDev* dev; |
|
172 | uartDev* dev; |
@@ -1,11 +1,14 | |||||
1 |
uart.o: uart.c |
|
1 | uart.o: uart.c /opt/libuc2/lib/includes/lpc17XX/CORE/core.h \ | |
|
2 | /opt/libuc2/rules/lpc17XX-arm-noabi-gcc/LPC17xx.h \ | |||
2 | /opt/libuc2/rules/lpc17XX-arm-noabi-gcc/core_cm3.h \ |
|
3 | /opt/libuc2/rules/lpc17XX-arm-noabi-gcc/core_cm3.h \ | |
3 | /opt/libuc2/rules/lpc17XX-arm-noabi-gcc/system_LPC17xx.h |
|
4 | /opt/libuc2/rules/lpc17XX-arm-noabi-gcc/system_LPC17xx.h uart.h | |
4 |
|
5 | |||
5 | uart.h: |
|
6 | /opt/libuc2/lib/includes/lpc17XX/CORE/core.h: | |
6 |
|
7 | |||
7 | /opt/libuc2/rules/lpc17XX-arm-noabi-gcc/LPC17xx.h: |
|
8 | /opt/libuc2/rules/lpc17XX-arm-noabi-gcc/LPC17xx.h: | |
8 |
|
9 | |||
9 | /opt/libuc2/rules/lpc17XX-arm-noabi-gcc/core_cm3.h: |
|
10 | /opt/libuc2/rules/lpc17XX-arm-noabi-gcc/core_cm3.h: | |
10 |
|
11 | |||
11 | /opt/libuc2/rules/lpc17XX-arm-noabi-gcc/system_LPC17xx.h: |
|
12 | /opt/libuc2/rules/lpc17XX-arm-noabi-gcc/system_LPC17xx.h: | |
|
13 | ||||
|
14 | uart.h: |
@@ -19,9 +19,18 | |||||
19 | -- Author : Alexis Jeandet |
|
19 | -- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@gmail.com |
|
20 | -- Mail : alexis.jeandet@gmail.com | |
21 | -------------------------------------------------------------------------------*/ |
|
21 | -------------------------------------------------------------------------------*/ | |
|
22 | #ifndef UART_H | |||
|
23 | #define UART_H | |||
22 | #include "LPC17xx.h" |
|
24 | #include "LPC17xx.h" | |
23 |
|
25 | |||
24 | struct ARM7uartRegs |
|
26 | ||
|
27 | #define uartNoParity 0 | |||
|
28 | #define uartOddParity 1 | |||
|
29 | #define uartEvenParity 3 | |||
|
30 | #define uartTrueParity 5 | |||
|
31 | #define uartFalseParity 7 | |||
|
32 | ||||
|
33 | struct LPC17XXuartRegs | |||
25 | { |
|
34 | { | |
26 | unsigned long RWreg; |
|
35 | unsigned long RWreg; | |
27 | unsigned long IntEN; |
|
36 | unsigned long IntEN; | |
@@ -32,12 +41,26 struct ARM7uartRegs | |||||
32 | unsigned long ScratchPad; |
|
41 | unsigned long ScratchPad; | |
33 | }; |
|
42 | }; | |
34 |
|
43 | |||
35 |
typedef struct |
|
44 | typedef volatile struct LPC17XXuartRegs uartDev; | |
36 |
|
45 | |||
37 | uartDev* uartopen(int count); |
|
46 | extern uartDev* uartopen(int count); | |
38 | void uartputc(uartDev* dev,char c); |
|
47 | extern void uarton(int count); | |
39 | void uartputs(uartDev* dev,char *s); |
|
48 | extern void uartoff(int count); | |
40 |
void uart |
|
49 | extern void uartputc(uartDev* dev,char c); | |
41 |
|
|
50 | extern void uartputs(uartDev* dev,char *s); | |
42 | void uartsetup(uartDev* dev,int baudRate,int cpuClk); |
|
51 | extern void uartgets(uartDev* dev,char *s); | |
|
52 | extern char uartgetc(uartDev* dev); | |||
|
53 | extern void uartsetbaudrate(uartDev* dev,unsigned int baudRate); | |||
|
54 | extern unsigned char uartgetpclkfactor(uartDev* dev); | |||
|
55 | extern void uartsetpclkfactor(uartDev* dev,unsigned char pclkfactor); | |||
|
56 | extern void uartsetup(uartDev* dev,unsigned int baudRate,unsigned char WordLength,unsigned char StopBitCnt,unsigned char Parity); | |||
43 |
|
57 | |||
|
58 | #endif | |||
|
59 | ||||
|
60 | ||||
|
61 | ||||
|
62 | ||||
|
63 | ||||
|
64 | ||||
|
65 | ||||
|
66 |
@@ -4,7 +4,7 TARGET = libuart | |||||
4 | TARGETINSTALLPATH = $(LIBUC_LIBS_DIR)/UART |
|
4 | TARGETINSTALLPATH = $(LIBUC_LIBS_DIR)/UART | |
5 | HEADERSINSTALLPATH = $(LIBUC_INC_DIR)/UART |
|
5 | HEADERSINSTALLPATH = $(LIBUC_INC_DIR)/UART | |
6 |
|
6 | |||
7 | LIBS += |
|
7 | LIBS += CORE | |
8 |
|
8 | |||
9 | SOURCES += uart.c |
|
9 | SOURCES += uart.c | |
10 |
|
10 |
@@ -69,18 +69,21 LIBUC_CXXFLAGS_SOFT_FPU = -msoft-float | |||||
69 | LIBUC_CXXFLAGS_HARD_FPU = |
|
69 | LIBUC_CXXFLAGS_HARD_FPU = | |
70 |
|
70 | |||
71 | LIBUC_LIBS = |
|
71 | LIBUC_LIBS = | |
72 |
LIBUC_LIBS_ |
|
72 | LIBUC_LIBS_CORE = -static -lcore | |
73 |
LIBUC_LIBS_ |
|
73 | LIBUC_LIBS_UART = -static -luart | |
74 |
LIBUC_LIBS_ |
|
74 | LIBUC_LIBS_SPI = -static -lspi | |
75 |
LIBUC_LIBS_ |
|
75 | LIBUC_LIBS_IIC = -static -liic | |
|
76 | LIBUC_LIBS_ADC = -static -ladc | |||
76 |
|
77 | |||
77 | LIBUC_LIBS_DIR = $(LIBUC)/lib/bin/lpc17XX |
|
78 | LIBUC_LIBS_DIR = $(LIBUC)/lib/bin/lpc17XX | |
|
79 | LIBUC_LIBS_DIR_CORE = -L $(LIBUC_LIBS_DIR)/CORE | |||
78 | LIBUC_LIBS_DIR_UART = -L $(LIBUC_LIBS_DIR)/UART |
|
80 | LIBUC_LIBS_DIR_UART = -L $(LIBUC_LIBS_DIR)/UART | |
79 | LIBUC_LIBS_DIR_SPI = -L $(LIBUC_LIBS_DIR)/SPI |
|
81 | LIBUC_LIBS_DIR_SPI = -L $(LIBUC_LIBS_DIR)/SPI | |
80 | LIBUC_LIBS_DIR_IIC = -L $(LIBUC_LIBS_DIR)/IIC |
|
82 | LIBUC_LIBS_DIR_IIC = -L $(LIBUC_LIBS_DIR)/IIC | |
81 | LIBUC_LIBS_DIR_ADC = -L $(LIBUC_LIBS_DIR)/ADC |
|
83 | LIBUC_LIBS_DIR_ADC = -L $(LIBUC_LIBS_DIR)/ADC | |
82 |
|
84 | |||
83 | LIBUC_INC_DIR = $(LIBUC)/lib/includes/lpc17XX |
|
85 | LIBUC_INC_DIR = $(LIBUC)/lib/includes/lpc17XX | |
|
86 | LIBUC_INC_DIR_CORE = -I $(LIBUC_INC_DIR)/CORE | |||
84 | LIBUC_INC_DIR_UART = -I $(LIBUC_INC_DIR)/UART |
|
87 | LIBUC_INC_DIR_UART = -I $(LIBUC_INC_DIR)/UART | |
85 | LIBUC_INC_DIR_SPI = -I $(LIBUC_INC_DIR)/SPI |
|
88 | LIBUC_INC_DIR_SPI = -I $(LIBUC_INC_DIR)/SPI | |
86 | LIBUC_INC_DIR_IIC = -I $(LIBUC_INC_DIR)/IIC |
|
89 | LIBUC_INC_DIR_IIC = -I $(LIBUC_INC_DIR)/IIC | |
@@ -93,13 +96,13 LIBUC_INC_DIR_ADC = -I $(LIBUC_ | |||||
93 | LIBUC_BSP_DIR=$(LIBUC)/bsp |
|
96 | LIBUC_BSP_DIR=$(LIBUC)/bsp | |
94 | LIBUC_BSP_BIN_DIR= $(LIBUC_BSP_DIR)/bin |
|
97 | LIBUC_BSP_BIN_DIR= $(LIBUC_BSP_DIR)/bin | |
95 | LIBUC_BSP_INC_DIR= $(LIBUC_BSP_DIR)/includes |
|
98 | LIBUC_BSP_INC_DIR= $(LIBUC_BSP_DIR)/includes | |
96 | LIBUC_BSP = -L $(LIBUC_BSP_BIN_DIR)/$(BSP) -lbsp |
|
99 | LIBUC_BSP = -L $(LIBUC_BSP_BIN_DIR)/$(BSP) -static -lbsp | |
97 | LIBUC_BSP_INC = -I $(LIBUC_BSP_INC_DIR)/$(BSP) |
|
100 | LIBUC_BSP_INC = -I $(LIBUC_BSP_INC_DIR)/$(BSP) | |
98 | #--------------------------------------------------------------------------------- |
|
101 | #--------------------------------------------------------------------------------- | |
99 | # DEVICE SPECIAL FILES |
|
102 | # DEVICE SPECIAL FILES | |
100 | #--------------------------------------------------------------------------------- |
|
103 | #--------------------------------------------------------------------------------- | |
101 | LINKER_SCRIPT = $(ARCH)/LPC17xx.ld |
|
104 | LINKER_SCRIPT = $(ARCH)/LPC17xx.ld | |
102 | SOURCES += $(ARCH)/startup_LPC17xx.c $(ARCH)/core_cm3.c $(ARCH)/system_LPC17xx.c |
|
105 | APPSOURCES += $(ARCH)/startup_LPC17xx.c $(ARCH)/core_cm3.c $(ARCH)/system_LPC17xx.c | |
103 | LPC17XX_INCDIR=$(ARCH) |
|
106 | LPC17XX_INCDIR=$(ARCH) | |
104 |
|
107 | |||
105 |
|
108 | |||
@@ -118,17 +121,17 lib: $(TARGET).a | |||||
118 | %.a: $(OBJECTFILES) |
|
121 | %.a: $(OBJECTFILES) | |
119 | mkdir -p $(TARGETINSTALLPATH) |
|
122 | mkdir -p $(TARGETINSTALLPATH) | |
120 | mkdir -p $(HEADERSINSTALLPATH) |
|
123 | mkdir -p $(HEADERSINSTALLPATH) | |
121 |
|
|
124 | $(LIBUC_AR) rcs $(TARGETINSTALLPATH)/$@ $(OBJECTFILES) | |
122 | cp $(HEADERS) $(HEADERSINSTALLPATH)/ |
|
125 | cp -f $(HEADERS) $(HEADERSINSTALLPATH)/ | |
123 |
|
126 | |||
124 |
|
127 | |||
125 | %.o: %.c |
|
128 | %.o: %.c | |
126 | $(LIBUC_CC) -I $(LPC17XX_INCDIR) $(LIBUC_INCLUDES) $(LIBUC_BSP_INC) -MM $< -MF $*.d -MP |
|
129 | $(LIBUC_CC) -O3 -I $(LPC17XX_INCDIR) $(LIBUC_INCLUDES) $(LIBUC_BSP_INC) -MM $< -MF $*.d -MP | |
127 | $(LIBUC_CC) -I $(LPC17XX_INCDIR) $(LIBUC_INCLUDES) $(LIBUC_BSP_INC) -c $(LIBUC_CFLAGS) $< -o $@ |
|
130 | $(LIBUC_CC) -O3 -I $(LPC17XX_INCDIR) $(LIBUC_INCLUDES) $(LIBUC_BSP_INC) -c $(LIBUC_CFLAGS) $< -o $@ | |
128 |
|
131 | |||
129 |
|
132 | |||
130 | %.elf: $(LINKER_SCRIPT) $(OBJECTFILES) |
|
133 | %.elf: $(LINKER_SCRIPT) $(OBJECTFILES) | |
131 |
$(LIBUC_LD) -Map $(@:.elf=.map) $(LIBUC_LDFLAGS) |
|
134 | $(LIBUC_LD) -Map $(@:.elf=.map) $(LIBUC_LDFLAGS) -T $^ -o $@ $(LIBUC_BSP) $(LIBUC_LIBRARIES) | |
132 | $(LIBUC_OBJDUMP) $(LIBUC_ODFLAGS) $@ > $(@:.elf=.dump) |
|
135 | $(LIBUC_OBJDUMP) $(LIBUC_ODFLAGS) $@ > $(@:.elf=.dump) | |
133 | $(LIBUC_SIZE) $@ |
|
136 | $(LIBUC_SIZE) $@ | |
134 |
|
137 |
General Comments 0
You need to be logged in to leave comments.
Login now