##// END OF EJS Templates
added bsp feature
jeandet -
r3:3953fa862d83 default
parent child
Show More
@@ -1,157 +1,164
1 #!/bin/bash
1 #!/bin/bash
2 #/*------------------------------------------------------------------------------
2 #/*------------------------------------------------------------------------------
3 #-- This file is a part of the libuc, microcontroler library
3 #-- This file is a part of the libuc, microcontroler library
4 #-- Copyright (C) 2011, Alexis Jeandet
4 #-- Copyright (C) 2011, Alexis Jeandet
5 #--
5 #--
6 #-- This program is free software; you can redistribute it and/or modify
6 #-- This program is free software; you can redistribute it and/or modify
7 #-- it under the terms of the GNU General Public License as published by
7 #-- it under the terms of the GNU General Public License as published by
8 #-- the Free Software Foundation; either version 3 of the License, or
8 #-- the Free Software Foundation; either version 3 of the License, or
9 #-- (at your option) any later version.
9 #-- (at your option) any later version.
10 #--
10 #--
11 #-- This program is distributed in the hope that it will be useful,
11 #-- This program is distributed in the hope that it will be useful,
12 #-- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #-- but WITHOUT ANY WARRANTY; without even the implied warranty of
13 #-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 #-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 #-- GNU General Public License for more details.
14 #-- GNU General Public License for more details.
15 #--
15 #--
16 #-- You should have received a copy of the GNU General Public License
16 #-- You should have received a copy of the GNU General Public License
17 #-- along with this program; if not, write to the Free Software
17 #-- along with this program; if not, write to the Free Software
18 #-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 #-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #-------------------------------------------------------------------------------
19 #-------------------------------------------------------------------------------
20 #-- Author : Alexis Jeandet
20 #-- Author : Alexis Jeandet
21 #-- Mail : alexis.jeandet@gmail.com
21 #-- Mail : alexis.jeandet@gmail.com
22 #-------------------------------------------------------------------------------*/
22 #-------------------------------------------------------------------------------*/
23 TEMPLATE=""
23 TEMPLATE=""
24 ARCH=""
24 ARCH=""
25 TARGET=""
25 TARGET=""
26 SRCFILES=""
26 SRCFILES=""
27 INCLUDES=""
27 INCLUDES=""
28 LIBRARIES=""
28 LIBRARIES=""
29 HEADERSINSTALLPATH=""
29 HEADERSINSTALLPATH=""
30 TARGETINSTALLPATH=""
30 TARGETINSTALLPATH=""
31 BSP="generic"
31
32
32 function getFilesList {
33 function getFilesList {
33 sed ':a;N;$!ba;s/\\\n/ /g' $1 | sed ':a;N;$!ba;s/\\ \n/ /g' | grep -i $2 | sed 's/\t//g'
34 sed ':a;N;$!ba;s/\\\n/ /g' $1 | sed ':a;N;$!ba;s/\\ \n/ /g' | grep -i $2 | sed 's/\t//g'
34 }
35 }
35
36
36
37
37 function Template {
38 function Template {
38 TEMPLATE=`more $1 | grep -i "TEMPLATE " | sed s/TEMPLATE// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'`
39 TEMPLATE=`more $1 | grep -i "TEMPLATE " | sed s/TEMPLATE// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'`
39 }
40 }
40
41
41 function Arch {
42 function Arch {
42 ARCH=`more $1 | grep -i "ARCH " | sed s/ARCH// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'`
43 ARCH=`more $1 | grep -i "ARCH " | sed s/ARCH// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'`
43 }
44 }
44
45
45 function Target {
46 function Target {
46 TARGET=`more $1 | grep -i "TARGET " | sed s/TARGET// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'`
47 TARGET=`more $1 | grep -i "TARGET " | sed s/TARGET// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'`
47 }
48 }
48
49
49 function Libs_Inc {
50 function Libs_Inc {
50 INCLUDEStmp=`more $1 | grep -i "LIBS " | sed s/LIBS// |sed s/+//|sed s/=//| sed 's/^[ \t]*//;s/[ \t]*$//'`
51 INCLUDEStmp=`more $1 | grep -i "LIBS " | sed s/LIBS// |sed s/+//|sed s/=//| sed 's/^[ \t]*//;s/[ \t]*$//'`
51 for FILES in $INCLUDEStmp
52 for FILES in $INCLUDEStmp
52 do
53 do
53 INCLUDES+='$('"LIBUC_INC_DIR_$FILES) "
54 INCLUDES+='$('"LIBUC_INC_DIR_$FILES) "
54 done
55 done
55 }
56 }
56 function Libs_Link {
57 function Libs_Link {
57 LIBRARIEStmp=`more $1 | grep -i "LIBS " | sed s/LIBS// |sed s/+//|sed s/=//| sed 's/^[ \t]*//;s/[ \t]*$//'`
58 LIBRARIEStmp=`more $1 | grep -i "LIBS " | sed s/LIBS// |sed s/+//|sed s/=//| sed 's/^[ \t]*//;s/[ \t]*$//'`
58 for FILES in $LIBRARIEStmp
59 for FILES in $LIBRARIEStmp
59 do
60 do
60 LIBRARIES+='$('"LIBUC_LIBS_DIR_$FILES) "'$('"LIBUC_LIBS_$FILES) "
61 LIBRARIES+='$('"LIBUC_LIBS_DIR_$FILES) "'$('"LIBUC_LIBS_$FILES) "
61 done
62 done
62 }
63 }
63
64
64 function HeadersInstallPath {
65 function HeadersInstallPath {
65 HEADERSINSTALLPATH=`more $1 | grep -i "HEADERSINSTALLPATH" | sed s/HEADERSINSTALLPATH// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'`
66 HEADERSINSTALLPATH=`more $1 | grep -i "HEADERSINSTALLPATH" | sed s/HEADERSINSTALLPATH// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'`
66 }
67 }
67
68
68 function TargetInstallPath {
69 function TargetInstallPath {
69 TARGETINSTALLPATH=`more $1 | grep -i "TARGETINSTALLPATH" | sed s/TARGETINSTALLPATH// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'`
70 TARGETINSTALLPATH=`more $1 | grep -i "TARGETINSTALLPATH" | sed s/TARGETINSTALLPATH// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'`
70 }
71 }
71
72
73 function getBSP {
74 BSP=`more $1 | grep -i "BSP" | sed s/BSP// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'`
75 }
76
72 if [ -z "$1" ] ; then
77 if [ -z "$1" ] ; then
73 echo "try to find a project file ..."
78 echo "try to find a project file ..."
74 TMP=`ls *.pro`
79 TMP=`ls *.pro`
75 i=1
80 i=1
76 for Files in $TMP
81 for Files in $TMP
77 do
82 do
78 echo "found $Files"
83 echo "found $Files"
79 PROJECTFILES[i]=$Files
84 PROJECTFILES[i]=$Files
80 i=$((i + 1))
85 i=$((i + 1))
81 done
86 done
82 if [ -z "${PROJECTFILES[1]}" ]; then
87 if [ -z "${PROJECTFILES[1]}" ]; then
83 exit
88 exit
84 else
89 else
85 PROJECTFILE=${PROJECTFILES[1]}
90 PROJECTFILE=${PROJECTFILES[1]}
86 fi
91 fi
87
92
88 else
93 else
89 PROJECTFILE=$1
94 PROJECTFILE=$1
90 fi
95 fi
91
96
92 CURRENTDIR=`pwd`
97 CURRENTDIR=`pwd`
93 Template $PROJECTFILE
98 Template $PROJECTFILE
99 echo "Template = $TEMPLATE"
94 echo '' > Makefile
100 echo '' > Makefile
95 echo 'PROJECTDIR = `pwd`'>> Makefile
101 echo 'PROJECTDIR = `pwd`'>> Makefile
96 echo "LIBUC = $libuc2" >> Makefile
102 echo "LIBUC = $libuc2" >> Makefile
97
103
98 if(echo $TEMPLATE|grep -i 'dir'); then
104 if(echo $TEMPLATE | grep -i 'dir'); then
99
105
100 echo 'include $(LIBUC)/rules/common/rules.mk' >> Makefile
106 echo 'include $(LIBUC)/rules/common/rules.mk' >> Makefile
101 SUBDIRS=`getFilesList $PROJECTFILE SUBDIRS | sed 's/SUBDIRS//' | sed 's/=//' | sed 's/+//' `
107 SUBDIRS=`getFilesList $PROJECTFILE SUBDIRS | sed 's/SUBDIRS//' | sed 's/=//' | sed 's/+//' `
102 CURRENTDIR=`pwd`
108 CURRENTDIR=`pwd`
103 echo $CURRENTDIR
104 echo "" >> Makefile
109 echo "" >> Makefile
105 echo 'all:subdir' >> Makefile
110 echo 'all:subdir' >> Makefile
106 for DIRS in $SUBDIRS
111 for DIRS in $SUBDIRS
107 do
112 do
113 echo "enter $DIRS"
108 cd $DIRS
114 cd $DIRS
115 echo "run $0"
109 $0
116 $0
110 cd $CURRENTDIR
117 cd $CURRENTDIR
118 echo "exit $DIRS"
111 if [ -e "$DIRS/Makefile" ]; then
119 if [ -e "$DIRS/Makefile" ]; then
112 echo " make -C $DIRS">> Makefile
120 echo " make -C $DIRS">> Makefile
113 fi
121 fi
114 done
122 done
115 echo " @echo Code compiled" >> Makefile
123 echo " @echo Code compiled" >> Makefile
116 echo "" >> Makefile
124 echo "" >> Makefile
117 else
125 else
118 Target $PROJECTFILE
126 Target $PROJECTFILE
119 Arch $PROJECTFILE
127 Arch $PROJECTFILE
120 Libs_Inc $PROJECTFILE
128 Libs_Inc $PROJECTFILE
121 Libs_Link $PROJECTFILE
129 Libs_Link $PROJECTFILE
122 HeadersInstallPath $PROJECTFILE
130 HeadersInstallPath $PROJECTFILE
123 TargetInstallPath $PROJECTFILE
131 TargetInstallPath $PROJECTFILE
132 getBSP $PROJECTFILE
124 echo $SRCFILES >> Makefile
133 echo $SRCFILES >> Makefile
125 getFilesList $PROJECTFILE HEADERS >> Makefile
134 getFilesList $PROJECTFILE HEADERS >> Makefile
126 getFilesList $PROJECTFILE SOURCES >> Makefile
135 getFilesList $PROJECTFILE SOURCES >> Makefile
127 echo 'OBJECTFILES = $(SOURCES:.c=.o)'>> Makefile
136 echo 'OBJECTFILES = $(SOURCES:.c=.o)'>> Makefile
128 echo "ARCH = "'$(LIBUC)'"/rules/$ARCH" >> Makefile
137 echo "ARCH = "'$(LIBUC)'"/rules/$ARCH" >> Makefile
129 echo "TARGET=$TARGET">> Makefile
138 echo "TARGET=$TARGET">> Makefile
130 echo "LIBUC_INCLUDES=$INCLUDES">> Makefile
139 echo "LIBUC_INCLUDES=$INCLUDES">> Makefile
131 echo "LIBUC_LIBRARIES=$LIBRARIES">> Makefile
140 echo "LIBUC_LIBRARIES=$LIBRARIES">> Makefile
132 echo "TARGETINSTALLPATH=$TARGETINSTALLPATH">> Makefile
141 echo "TARGETINSTALLPATH=$TARGETINSTALLPATH">> Makefile
133 echo "HEADERSINSTALLPATH=$HEADERSINSTALLPATH">> Makefile
142 echo "HEADERSINSTALLPATH=$HEADERSINSTALLPATH">> Makefile
143 echo "BSP=$BSP">> Makefile
134 echo 'include $(ARCH)/rules.mk' >> Makefile
144 echo 'include $(ARCH)/rules.mk' >> Makefile
135
145
136 if(echo $TEMPLATE|grep -i app); then
146 if(echo $TEMPLATE|grep -i app); then
137 echo '' >> Makefile
147 echo '' >> Makefile
138 echo 'all:bin' >> Makefile
148 echo 'all:bin' >> Makefile
139 echo " @echo Code compiled" >> Makefile
149 echo " @echo Code compiled" >> Makefile
140 else
150 else
141 if(echo $TEMPLATE|grep -i lib); then
151 if(echo $TEMPLATE|grep -i lib); then
142 echo '' >> Makefile
152 echo '' >> Makefile
143 echo 'all:lib' >> Makefile
153 echo 'all:lib' >> Makefile
144 echo " @echo Code compiled" >> Makefile
154 echo " @echo Code compiled" >> Makefile
145 fi
155 fi
146 fi
156 fi
147 fi
157 fi
148
158
149 echo $TEMPLATE
150 echo $TARGET
151 echo $ARCH
152
159
153
160
154
161
155
162
156
163
157
164
@@ -1,148 +1,157
1 #/*------------------------------------------------------------------------------
1 #/*------------------------------------------------------------------------------
2 #-- This file is a part of the libuc, microcontroler library
2 #-- This file is a part of the libuc, microcontroler library
3 #-- Copyright (C) 2011, Alexis Jeandet
3 #-- Copyright (C) 2011, Alexis Jeandet
4 #--
4 #--
5 #-- This program is free software; you can redistribute it and/or modify
5 #-- This program is free software; you can redistribute it and/or modify
6 #-- it under the terms of the GNU General Public License as published by
6 #-- it under the terms of the GNU General Public License as published by
7 #-- the Free Software Foundation; either version 3 of the License, or
7 #-- the Free Software Foundation; either version 3 of the License, or
8 #-- (at your option) any later version.
8 #-- (at your option) any later version.
9 #--
9 #--
10 #-- This program is distributed in the hope that it will be useful,
10 #-- This program is distributed in the hope that it will be useful,
11 #-- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 #-- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 #-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 #-- GNU General Public License for more details.
13 #-- GNU General Public License for more details.
14 #--
14 #--
15 #-- You should have received a copy of the GNU General Public License
15 #-- You should have received a copy of the GNU General Public License
16 #-- along with this program; if not, write to the Free Software
16 #-- along with this program; if not, write to the Free Software
17 #-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 #-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 #-------------------------------------------------------------------------------
18 #-------------------------------------------------------------------------------
19 #-- Author : Alexis Jeandet
19 #-- Author : Alexis Jeandet
20 #-- Mail : alexis.jeandet@gmail.com
20 #-- Mail : alexis.jeandet@gmail.com
21 #-------------------------------------------------------------------------------*/
21 #-------------------------------------------------------------------------------*/
22
22
23 #---------------------------------------------------------------------------------
23 #---------------------------------------------------------------------------------
24 # GCC EXECUTABLES
24 # GCC EXECUTABLES
25 #---------------------------------------------------------------------------------
25 #---------------------------------------------------------------------------------
26 LIBUC_PREFIX = arm-none-eabi-
26 LIBUC_PREFIX = arm-none-eabi-
27 LIBUC_CC = $(LIBUC_PREFIX)gcc
27 LIBUC_CC = $(LIBUC_PREFIX)gcc
28 LIBUC_CXX = $(LIBUC_PREFIX)g++
28 LIBUC_CXX = $(LIBUC_PREFIX)g++
29 LIBUC_AR = $(LIBUC_PREFIX)ar
29 LIBUC_AR = $(LIBUC_PREFIX)ar
30 LIBUC_AS = $(LIBUC_PREFIX)as
30 LIBUC_AS = $(LIBUC_PREFIX)as
31 LIBUC_LD = $(LIBUC_PREFIX)ld
31 LIBUC_LD = $(LIBUC_PREFIX)ld
32 LIBUC_SIZE = $(LIBUC_PREFIX)size
32 LIBUC_SIZE = $(LIBUC_PREFIX)size
33 LIBUC_STRIP = $(LIBUC_PREFIX)strip -s
33 LIBUC_STRIP = $(LIBUC_PREFIX)strip -s
34 LIBUC_READELF = $(LIBUC_PREFIX)readelf
34 LIBUC_READELF = $(LIBUC_PREFIX)readelf
35 LIBUC_OBJCOPY=$(LIBUC_PREFIX)objcopy
35 LIBUC_OBJCOPY=$(LIBUC_PREFIX)objcopy
36 LIBUC_OBJDUMP=$(LIBUC_PREFIX)objdump
36 LIBUC_OBJDUMP=$(LIBUC_PREFIX)objdump
37
37
38
38
39
39
40 #---------------------------------------------------------------------------------
40 #---------------------------------------------------------------------------------
41 # GCC FLAGS
41 # GCC FLAGS
42 #---------------------------------------------------------------------------------
42 #---------------------------------------------------------------------------------
43 LIBUC_FMCU = -mcpu=cortex-m3
43 LIBUC_FMCU = -mcpu=cortex-m3
44 LIBUC_CFLAGS = $(LIBUC_FMCU)
44 LIBUC_CFLAGS = $(LIBUC_FMCU)
45 LIBUC_CFLAGS = --std=gnu99 -fgnu89-inline -mcpu=cortex-m3 -mthumb
45 LIBUC_CFLAGS = --std=gnu99 -fgnu89-inline -mcpu=cortex-m3 -mthumb
46 LIBUC_CFLAGS += -ffunction-sections -fdata-sections
46 LIBUC_CFLAGS += -ffunction-sections -fdata-sections
47 LIBUC_LDFLAGS = --gc-sections
47 LIBUC_LDFLAGS = --gc-sections
48 LIBUC_ODFLAGS = -x --syms
48 LIBUC_ODFLAGS = -x --syms
49 LIBUC_CPFLAGS =
49 LIBUC_CPFLAGS =
50 LIBUC_CFLAGS_WARN_ON = -Wall
50 LIBUC_CFLAGS_WARN_ON = -Wall
51 LIBUC_CFLAGS_WARN_OFF = -w
51 LIBUC_CFLAGS_WARN_OFF = -w
52 LIBUC_CFLAGS_RELEASE = -O2
52 LIBUC_CFLAGS_RELEASE = -O2
53 LIBUC_CFLAGS_DEBUG = -g
53 LIBUC_CFLAGS_DEBUG = -g
54 LIBUC_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -g
54 LIBUC_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -g
55 LIBUC_CFLAGS_STATIC_LIB = -fPIC
55 LIBUC_CFLAGS_STATIC_LIB = -fPIC
56 LIBUC_CFLAGS_SOFT_FPU = -msoft-float
56 LIBUC_CFLAGS_SOFT_FPU = -msoft-float
57 LIBUC_CFLAGS_HARD_FPU =
57 LIBUC_CFLAGS_HARD_FPU =
58
58
59 LIBUC_CXXFLAGS = $(LIBUC_FMCU)
59 LIBUC_CXXFLAGS = $(LIBUC_FMCU)
60 LIBUC_CXXFLAGS += -g -gdwarf-2
60 LIBUC_CXXFLAGS += -g -gdwarf-2
61 LIBUC_CXXFLAGS += -Wextra -Wundef -Wcast-align -mthumb -msoft-float
61 LIBUC_CXXFLAGS += -Wextra -Wundef -Wcast-align -mthumb -msoft-float
62 LIBUC_CXXFLAGS_WARN_ON = -Wall
62 LIBUC_CXXFLAGS_WARN_ON = -Wall
63 LIBUC_CXXFLAGS_WARN_OFF = -w
63 LIBUC_CXXFLAGS_WARN_OFF = -w
64 LIBUC_CXXFLAGS_RELEASE = -O2
64 LIBUC_CXXFLAGS_RELEASE = -O2
65 LIBUC_CXXFLAGS_DEBUG = -g
65 LIBUC_CXXFLAGS_DEBUG = -g
66 LIBUC_CXXFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -g
66 LIBUC_CXXFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -g
67 LIBUC_CXXFLAGS_STATIC_LIB = -fPIC
67 LIBUC_CXXFLAGS_STATIC_LIB = -fPIC
68 LIBUC_CXXFLAGS_SOFT_FPU = -msoft-float
68 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_UART = -luart
72 LIBUC_LIBS_UART = -luart
73 LIBUC_LIBS_SPI = -lspi
73 LIBUC_LIBS_SPI = -lspi
74 LIBUC_LIBS_IIC = -liic
74 LIBUC_LIBS_IIC = -liic
75 LIBUC_LIBS_ADC = -ladc
75 LIBUC_LIBS_ADC = -ladc
76
76
77 LIBUC_LIBS_DIR = $(LIBUC)/lib/bin/lpc17XX
77 LIBUC_LIBS_DIR = $(LIBUC)/lib/bin/lpc17XX
78 LIBUC_LIBS_DIR_UART = -L $(LIBUC_LIBS_DIR)/UART
78 LIBUC_LIBS_DIR_UART = -L $(LIBUC_LIBS_DIR)/UART
79 LIBUC_LIBS_DIR_SPI = -L $(LIBUC_LIBS_DIR)/SPI
79 LIBUC_LIBS_DIR_SPI = -L $(LIBUC_LIBS_DIR)/SPI
80 LIBUC_LIBS_DIR_IIC = -L $(LIBUC_LIBS_DIR)/IIC
80 LIBUC_LIBS_DIR_IIC = -L $(LIBUC_LIBS_DIR)/IIC
81 LIBUC_LIBS_DIR_ADC = -L $(LIBUC_LIBS_DIR)/ADC
81 LIBUC_LIBS_DIR_ADC = -L $(LIBUC_LIBS_DIR)/ADC
82
82
83 LIBUC_INC_DIR = $(LIBUC)/lib/includes/lpc17XX
83 LIBUC_INC_DIR = $(LIBUC)/lib/includes/lpc17XX
84 LIBUC_INC_DIR_UART = -I $(LIBUC_INC_DIR)/UART
84 LIBUC_INC_DIR_UART = -I $(LIBUC_INC_DIR)/UART
85 LIBUC_INC_DIR_SPI = -I $(LIBUC_INC_DIR)/SPI
85 LIBUC_INC_DIR_SPI = -I $(LIBUC_INC_DIR)/SPI
86 LIBUC_INC_DIR_IIC = -I $(LIBUC_INC_DIR)/IIC
86 LIBUC_INC_DIR_IIC = -I $(LIBUC_INC_DIR)/IIC
87 LIBUC_INC_DIR_ADC = -I $(LIBUC_INC_DIR)/ADC
87 LIBUC_INC_DIR_ADC = -I $(LIBUC_INC_DIR)/ADC
88
88
89
90 #---------------------------------------------------------------------------------
91 # BOARD SUPORT PACKAGES
92 #---------------------------------------------------------------------------------
93 LIBUC_BSP_DIR=$(LIBUC)/bsp
94 LIBUC_BSP_BIN_DIR= $(LIBUC_BSP_DIR)/bin
95 LIBUC_BSP_INC_DIR= $(LIBUC_BSP_DIR)/includes
96 LIBUC_BSP = -L $(LIBUC_BSP_BIN_DIR)/$(BSP) -lbsp
97 LIBUC_BSP_INC = -I $(LIBUC_BSP_INC_DIR)/$(BSP)
89 #---------------------------------------------------------------------------------
98 #---------------------------------------------------------------------------------
90 # DEVICE SPECIAL FILES
99 # DEVICE SPECIAL FILES
91 #---------------------------------------------------------------------------------
100 #---------------------------------------------------------------------------------
92 LINKER_SCRIPT = $(ARCH)/LPC17xx.ld
101 LINKER_SCRIPT = $(ARCH)/LPC17xx.ld
93 SOURCES += $(ARCH)/startup_LPC17xx.c $(ARCH)/core_cm3.c $(ARCH)/system_LPC17xx.c
102 SOURCES += $(ARCH)/startup_LPC17xx.c $(ARCH)/core_cm3.c $(ARCH)/system_LPC17xx.c
94 LPC17XX_INCDIR=$(ARCH)
103 LPC17XX_INCDIR=$(ARCH)
95
104
96
105
97 all:
106 all:
98 @echo "lpc17XX-arm-noabi-gcc rules"
107 @echo "lpc17XX-arm-noabi-gcc rules"
99
108
100
109
101 bin: $(TARGET).bin $(TARGET).hex
110 bin: $(TARGET).bin $(TARGET).hex
102 @echo "compile bin"
111 @echo "compile bin"
103
112
104
113
105
114
106 lib: $(TARGET).a
115 lib: $(TARGET).a
107 @echo "compile lib"
116 @echo "compile lib"
108
117
109 %.a: $(OBJECTFILES)
118 %.a: $(OBJECTFILES)
110 mkdir -p $(TARGETINSTALLPATH)
119 mkdir -p $(TARGETINSTALLPATH)
111 mkdir -p $(HEADERSINSTALLPATH)
120 mkdir -p $(HEADERSINSTALLPATH)
112 ar rcs $(TARGETINSTALLPATH)/$@ $(OBJECTFILES)
121 ar rcs $(TARGETINSTALLPATH)/$@ $(OBJECTFILES)
113 cp $(HEADERS) $(HEADERSINSTALLPATH)/
122 cp $(HEADERS) $(HEADERSINSTALLPATH)/
114
123
115
124
116 %.o: %.c
125 %.o: %.c
117 $(LIBUC_CC) -I $(LPC17XX_INCDIR) $(LIBUC_INCLUDES) -MM $< -MF $*.d -MP
126 $(LIBUC_CC) -I $(LPC17XX_INCDIR) $(LIBUC_INCLUDES) $(LIBUC_BSP_INC) -MM $< -MF $*.d -MP
118 $(LIBUC_CC) -I $(LPC17XX_INCDIR) $(LIBUC_INCLUDES) -c $(LIBUC_CFLAGS) $< -o $@
127 $(LIBUC_CC) -I $(LPC17XX_INCDIR) $(LIBUC_INCLUDES) $(LIBUC_BSP_INC) -c $(LIBUC_CFLAGS) $< -o $@
119
128
120
129
121 %.elf: $(LINKER_SCRIPT) $(OBJECTFILES)
130 %.elf: $(LINKER_SCRIPT) $(OBJECTFILES)
122 $(LIBUC_LD) -Map $(@:.elf=.map) $(LIBUC_LDFLAGS) $(LIBUC_LIBRARIES) -T $^ -o $@
131 $(LIBUC_LD) -Map $(@:.elf=.map) $(LIBUC_LDFLAGS) $(LIBUC_LIBRARIES) $(LIBUC_BSP) -T $^ -o $@
123 $(LIBUC_OBJDUMP) $(LIBUC_ODFLAGS) $@ > $(@:.elf=.dump)
132 $(LIBUC_OBJDUMP) $(LIBUC_ODFLAGS) $@ > $(@:.elf=.dump)
124 $(LIBUC_SIZE) $@
133 $(LIBUC_SIZE) $@
125
134
126 %.bin: %.elf
135 %.bin: %.elf
127 $(LIBUC_OBJCOPY) $(LIBUC_CPFLAGS) -O binary $< $*.bin
136 $(LIBUC_OBJCOPY) $(LIBUC_CPFLAGS) -O binary $< $*.bin
128
137
129
138
130 %.hex: %.elf
139 %.hex: %.elf
131 $(LIBUC_OBJCOPY) $(LIBUC_CPFLAGS) -O ihex $< $*.hex
140 $(LIBUC_OBJCOPY) $(LIBUC_CPFLAGS) -O ihex $< $*.hex
132
141
133
142
134 clean:
143 clean:
135 rm -f *.o *.d *.bin *.hex *.dump *.map *.a
144 rm -f *.o *.d *.bin *.hex *.dump *.map *.a
136
145
137 distclean:
146 distclean:
138 rm -f $(TARGETINSTALLPATH)/*.bin
147 rm -f $(TARGETINSTALLPATH)/*.bin
139 rm -f $(TARGETINSTALLPATH)/*.a
148 rm -f $(TARGETINSTALLPATH)/*.a
140
149
141
150
142
151
143
152
144
153
145
154
146
155
147
156
148
157
General Comments 0
You need to be logged in to leave comments. Login now