##// END OF EJS Templates
LFR's Leon3 target added and and tested with simple hello world.
jeandet@PC-DE-JEANDET.lpp.polytechnique.fr -
r13:8ca866292111 default
parent child
Show More
@@ -0,0 +1,4
1 int bsp_init()
2 {
3 return 1;
4 }
@@ -0,0 +1,1
1 extern int bsp_init();
@@ -0,0 +1,14
1 TEMPLATE = lib
2
3 lpc17XX.ARCH = sparc-elf-gcc
4 lpc17XX.TARGET = libbsp
5 lpc17XX.TARGETINSTALLPATH = $(LIBUC_BSP_BIN_DIR)/LFR-142200
6 lpc17XX.HEADERSINSTALLPATH = $(LIBUC_BSP_INC_DIR)/LFR-142200
7 lpc17XX.LIBS +=
8 lpc17XX.SOURCES += bsp.c
9 lpc17XX.HEADERS += bsp.h
10
11
12
13
14
@@ -0,0 +1,9
1 TEMPLATE = dir
2 SUBDIRS += helloWorld \
3 IIRFilter
4
5
6
7
8
9
@@ -0,0 +1,12
1 TEMPLATE = app
2 ARCH = sparc-elf-gcc
3 TARGET = helloWorld
4 BSP = LFR-142200
5
6 LIBS += APB
7
8 SOURCES += main.c
9
10
11 HEADERS +=
12
@@ -0,0 +1,15
1 #include <stdio.h>
2 #include <bsp.h>
3
4
5 int main(void)
6 {
7 bsp_init();
8 printf("hello world");
9 return 0;
10 }
11
12
13
14
15
@@ -0,0 +1,122
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPP VHDL IP LIBRARY
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 --
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
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
9 --
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
14 --
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
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 ----------------------------------------------------------------------------*/
22 #include "apb.h"
23 #include <stdio.h>
24
25
26
27 int* apbgetdevice(int PID,int VID,int count)
28 {
29 struct apbPnPreg* dev = (struct apbPnPreg*)(APB_TBL_HEAD + sizeof(struct apbPnPreg));
30 int id;
31 id = (PID<<12) | (VID<<24);
32 while(dev != (struct apbPnPreg*)(APB_TBL_HEAD|0xFFF))
33 {
34 if((dev->idReg & 0xFFFFF000) == id)
35 {
36 if(count == 0)
37 {
38 return (int*) (APB_BASE_ADDRS | (dev->bar&0xFFF00000)>>12);
39 }
40 count-=1;
41 }
42 dev += 1;
43 }
44 return NULL;
45 }
46
47
48 void apbgetdeviceinfofromdevptr(const struct apbPnPreg* dev,struct apbdevinfo* devinfo)
49 {
50
51 devinfo->productID = (dev->idReg>>12) & 0xFFF;
52 devinfo->vendorID = (dev->idReg>>24) & 0xFF;
53 devinfo->address = ((dev->bar>>12) & 0xFFF00)|APB_BASE_ADDRS;
54 devinfo->irq = dev->idReg & 0x1F;
55 devinfo->mask = (dev->bar>>4)&0xFFF;
56 devinfo->version = (dev->idReg>>5)&0x1F;
57 }
58
59 void apbgetdeviceinfofromid(int PID,int VID,int count,struct apbdevinfo* devinfo)
60 {
61 struct apbPnPreg* dev = (struct apbPnPreg*)(APB_TBL_HEAD + sizeof(struct apbPnPreg));
62 int id;
63 id = (PID<<12) | (VID<<24);
64 while(dev != (struct apbPnPreg*)(APB_TBL_HEAD|0xFFF))
65 {
66 if((dev->idReg & 0xFFFFF000) == id)
67 {
68 if(count == 0)
69 {
70 devinfo->productID = PID;
71 devinfo->vendorID = VID;
72 devinfo->address = ((dev->bar>>12) & 0xFFF00)|APB_BASE_ADDRS;
73 devinfo->irq = dev->idReg & 0x1F;
74 devinfo->mask = (dev->bar>>4)&0xFFF;
75 devinfo->version = (dev->idReg>>5)&0x1F;
76 return;
77 }
78 count-=1;
79 }
80 dev += 1;
81 }
82 }
83
84
85
86 void apbprintdeviceinfo(struct apbdevinfo devinfo)
87 {
88 printf("Vendor ID = 0x%x\n",devinfo.vendorID);
89 printf("Product ID = 0x%x\n",devinfo.productID);
90 printf("Device address = 0x%x\n",devinfo.address);
91 printf("Device Irq = %d\n",devinfo.irq);
92 printf("Device mask = 0x%x\n",devinfo.mask);
93 printf("Device Version = %d\n",devinfo.version);
94 }
95
96
97 void apbprintdeviceslist()
98 {
99 struct apbdevinfo devinfo;
100 struct apbPnPreg* dev = (struct apbPnPreg*)(APB_TBL_HEAD );//+ sizeof(struct apbPnPreg));
101 int i =0;
102 int fisrtBAR;
103 while((dev->idReg == 0) && (i<APB_MAX_DEVICES))
104 {
105 dev += 1;
106 i+=1;
107 }
108 fisrtBAR = dev->bar;
109 for(i=i;i<APB_MAX_DEVICES;i++)
110 {
111 if((dev->idReg != 0 ))
112 {
113 apbgetdeviceinfofromdevptr(dev,&devinfo);
114 printf("\n\n======= new device found========\n");
115 apbprintdeviceinfo(devinfo);
116 }
117 dev += 1;
118 if(dev->bar == fisrtBAR)
119 break;
120 }
121 }
122
@@ -0,0 +1,135
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPP VHDL IP LIBRARY
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 --
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
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
9 --
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
14 --
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
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 ----------------------------------------------------------------------------*/
22 #ifndef LPP_APB_FUNCTIONS_H
23 #define LPP_APB_FUNCTIONS_H
24
25 #define APB_TBL_HEAD 0x800FF000 /**< Start address of APB devices list on AHB2APB bridge*/
26 #define APB_BASE_ADDRS 0x80000000 /**< Start address of APB bus*/
27 #define APB_MAX_DEVICES 256 /**< Maximun device count on APB bus*/
28
29 #include "apb_devices_list.h"
30
31
32 /*! \file lpp_apb_functions.h
33 \brief General purpose APB functions.
34
35 This library is written to work with AHB2APB VHDL module from Gaisler's GRLIB. It help you to find your device
36 on the APB bus by providing scan functions, it extract information such as device Version, IRQ value, Address mask.
37 You can use it to print the APB devices list on your SOC.
38
39 \author Alexis Jeandet alexis.jeandet@lpp.polytechnique.fr
40 \todo implemente a descriptor structure for any APB device
41
42 */
43
44
45 /*! \struct apbPnPreg
46 \brief Structure representing a device descriptor register on Grlib's AHB2APB brige with plug and play feature
47 */
48 struct apbPnPreg
49 {
50 int idReg; /**< \brief id register composed of Vendor ID [31:24], Device ID [23:12], CT [11:10], Version [9:5], IRQ [4:0] */
51 int bar; /**< \brief Bank Address Register composed of Device's ADDRESS [31:20], MASK [14:4], TYPE [3:0] */
52 };
53
54
55 /*! \struct apbdevinfo
56 \brief Structure holding an APB device informations
57
58 This information are extracted from the descriptor registers on Grlib's AHB2APB brige with plug and play feature
59 */
60 struct apbdevinfo
61 {
62 int vendorID; /**< \brief Stores the Vendor ID of the current device */
63 int productID; /**< \brief Stores the Product ID of the current device */
64 int version; /**< \brief Stores the Version of the current device */
65 int irq; /**< \brief Stores the interrupt Number of the current device */
66 int address; /**< \brief Stores the base address of the current device */
67 int mask; /**< \brief Stores the address mask of the current device, it gives the address space of this device */
68 };
69
70
71
72
73 /*! \fn int* apbgetdevice(int PID,int VID,int count);
74 \brief Find device with given VID/PID
75
76 This Function scans APB devices table and returns counth device according to VID and PID
77
78 \param PID The PID of the device you whant to get.
79 \param VID The VID of the device you whant to get.
80 \param count The number of the device you whant to get. For example if you have 3 UARTS on your SOC you whant
81 to use UART1 so count = 2.
82
83 \return The pointer to the device.
84 */
85 int* apbgetdevice(int PID,int VID,int count);
86
87 /*! \fn void apbgetdeviceinfofromid(int PID,int VID,int count,struct apbdevinfo* devinfo);
88 \brief Record device informations with given VID/PID
89
90 This Function scans APB devices table and returns counth device informations according VID and PID.
91
92 \param PID The PID of the device you whant to get.
93 \param VID The VID of the device you whant to get.
94 \param count The number of the device you whant to get. For example if you have 3 UARTS on your SOC you whant
95 to use UART1 so count = 2.
96 \param devinfo The device information structure to be populated.
97 \example scanAPB.c
98 */
99 void apbgetdeviceinfofromid(int PID,int VID,int count,struct apbdevinfo* devinfo);
100
101
102 /*! \fn void apbgetdeviceinfofromdevptr(const struct apbPnPreg* dev,struct apbdevinfo* devinfo);
103 \brief Record device informations with given AHB2APB Plugn'Play register.
104
105 This Function extract device informations from the given AHB2APB Plugn'Play register end write them in devinfo.
106
107 \param dev AHB2APB Plugn'Play register corresponding to the device.
108 \param devinfo The device information structure to be populated.
109 */
110 void apbgetdeviceinfofromdevptr(const struct apbPnPreg* dev,struct apbdevinfo* devinfo);
111
112
113
114 /*! \fn void apbprintdeviceinfo(struct apbdevinfo devinfo);
115 \brief Print given device informations in stdout.
116
117 \param devinfo The device information structure to be printed.
118 */
119 void apbprintdeviceinfo(struct apbdevinfo devinfo);
120
121
122
123 /*! \fn void apbprintdeviceslist();
124 \brief Print APB devices informations in stdout.
125
126 This function list all devices on APB bus and print theirs informations.
127
128 \example scanAPB.c
129 */
130 void apbprintdeviceslist();
131
132
133
134 #endif // LPP_APB_FUNCTIONS_H
135
@@ -0,0 +1,16
1 TEMPLATE = lib
2 ARCH = sparc-elf-gcc
3 TARGET = libapb
4 TARGETINSTALLPATH = $(LIBUC_LIBS_DIR_APB)
5 HEADERSINSTALLPATH = $(LIBUC_INC_DIR_APB)
6
7 LIBS +=
8
9 SOURCES += apb.c
10
11
12 HEADERS += apb.h \
13 apb_devices_list.h
14
15
16
@@ -0,0 +1,25
1
2
3 /*===============================================================================
4
5 THIS FILE IS GENERATED BY A SCRIPT, DON'T TRY TO EDIT
6
7 TAKE A LOOK AT VHD_LIB/APB_DEVICES FOLDER TO ADD A DEVICE ID OR VENDOR ID
8
9 ===============================================================================*/
10 #define VENDOR_LPP 0x19
11
12 #define ROCKET_TM 0x1
13 #define otherCore 0x2
14 #define LPP_SIMPLE_DIODE 0x3
15 #define LPP_MULTI_DIODE 0x4
16 #define LPP_LCD_CTRLR 0x5
17 #define LPP_UART 0x6
18 #define LPP_CNA 0x7
19 #define LPP_APB_ADC 0x8
20 #define LPP_CHENILLARD 0x9
21 #define LPP_IIR_CEL_FILTER 0x10
22 #define LPP_FIFO_PID 0x11
23 #define LPP_FFT 0x12
24 #define LPP_MATRIX 0x13
25 #define LPP_BALISE 0x14
@@ -0,0 +1,5
1 TEMPLATE = dir
2 SUBDIRS += APB
3
4
5
@@ -1,19 +1,21
1 1
2 2 PROJECTDIR = `pwd`
3 3 LIBUC = /opt/libuc2
4 4 include $(LIBUC)/rules/common/rules.mk
5 5
6 6 all:subdir
7 7 make -C generic
8 8 make -C LandTiger
9 9 make -C LandTigerdualssp
10 10 make -C mbed
11 make -C LFR-142200
11 12 @echo Code compiled
12 13
13 14 clean:
14 15 make clean -C generic
15 16 make clean -C LandTiger
16 17 make clean -C LandTigerdualssp
17 18 make clean -C mbed
19 make clean -C LFR-142200
18 20 @echo Code compiled
19 21
@@ -1,5 +1,13
1 1 TEMPLATE = dir
2 2 SUBDIRS += generic \
3 3 LandTiger \
4 4 LandTigerdualssp \
5 mbed
5 mbed \
6 LFR-142200
7
8
9
10
11
12
13
@@ -1,30 +1,9
1 1
2 2 PROJECTDIR = `pwd`
3 3 LIBUC = /opt/libuc2
4 4
5 HEADERSINSTALLPATH = $(LIBUC_BSP_INC_DIR)/generic
6 HEADERS += bsp.h
7 LIBSOURCES += bsp.c
8 OBJDIR = obj
9 BINDIR = bin
10 OBJECTFILES = $(LIBSOURCES:.c=.o)
11 OBJECTFILES := $(addprefix $(OBJDIR)/,$(OBJECTFILES))
12 ARCH = lpc17XX-arm-noabi-gcc
13 ARCHFOLDER = $(LIBUC)/rules/lpc17XX-arm-noabi-gcc
14 TARGET=libbsp
15 LIBUC_INCLUDES=
16 LIBUC_LIBRARIES=
17 TARGETINSTALLPATH=$(LIBUC_BSP_BIN_DIR)/generic
18 HEADERSINSTALLPATH=$(LIBUC_BSP_INC_DIR)/generic
19 BSP=generic
20 include $(ARCHFOLDER)/rules.mk
21
22 all:lib
23 @echo Code compiled
5 all:
6 make -f lpc17XX.mk
24 7
25 8 clean:
26 rm -f $(OBJDIR)/*.o
27 rm -f $(TARGETINSTALLPATH)/*.a
28 rm -f $(HEADERSINSTALLPATH)/*.h
29 rm -f $(DEVSOURCESND)
30 rm -f *.d
9 make clean -f lpc17XX.mk
@@ -0,0 +1,4
1 int bsp_init()
2 {
3 return 1;
4 }
@@ -0,0 +1,1
1 extern int bsp_init();
@@ -1,12 +1,14
1 1 TEMPLATE = lib
2 ARCH = lpc17XX-arm-noabi-gcc
3 TARGET = libbsp
4 TARGETINSTALLPATH = $(LIBUC_BSP_BIN_DIR)/generic
5 HEADERSINSTALLPATH = $(LIBUC_BSP_INC_DIR)/generic
6 2
7 LIBS +=
8
9 SOURCES += bsp.c
3 lpc17XX.ARCH = lpc17XX-arm-noabi-gcc
4 lpc17XX.TARGET = libbsp
5 lpc17XX.TARGETINSTALLPATH = $(LIBUC_BSP_BIN_DIR)/generic
6 lpc17XX.HEADERSINSTALLPATH = $(LIBUC_BSP_INC_DIR)/generic
7 lpc17XX.LIBS +=
8 lpc17XX.SOURCES += bsp.c
9 lpc17XX.HEADERS += bsp.h
10 10
11 11
12 HEADERS += bsp.h
12
13
14
@@ -1,19 +1,21
1 1
2 2 PROJECTDIR = `pwd`
3 3 LIBUC = /opt/libuc2
4 4 include $(LIBUC)/rules/common/rules.mk
5 5
6 6 all:subdir
7 7 make -C lpc17XX
8 8 make -C SDCARD
9 9 make -C SDCARD2
10 10 make -C MP3Player
11 make -C LFR
11 12 @echo Code compiled
12 13
13 14 clean:
14 15 make clean -C lpc17XX
15 16 make clean -C SDCARD
16 17 make clean -C SDCARD2
17 18 make clean -C MP3Player
19 make clean -C LFR
18 20 @echo Code compiled
19 21
@@ -1,5 +1,12
1 1 TEMPLATE = dir
2 2 SUBDIRS += lpc17XX \
3 3 SDCARD \
4 4 SDCARD2 \
5 MP3Player
5 MP3Player \
6 LFR
7
8
9
10
11
12
@@ -1,107 +1,117
1 1 /*------------------------------------------------------------------------------
2 2 -- This file is a part of the libuc, microcontroler library
3 3 -- Copyright (C) 2011, Alexis Jeandet
4 4 --
5 5 -- This program is free software; you can redistribute it and/or modify
6 6 -- it under the terms of the GNU General Public License as published by
7 7 -- the Free Software Foundation; either version 3 of the License, or
8 8 -- (at your option) any later version.
9 9 --
10 10 -- This program is distributed in the hope that it will be useful,
11 11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 13 -- GNU General Public License for more details.
14 14 --
15 15 -- You should have received a copy of the GNU General Public License
16 16 -- along with this program; if not, write to the Free Software
17 17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 18 -------------------------------------------------------------------------------
19 19 -- Author : Alexis Jeandet
20 20 -- Mail : alexis.jeandet@gmail.com
21 21 -------------------------------------------------------------------------------*/
22 22
23 23 #include "LPC17xx.h"
24 24 #include "bsp.h"
25 25 #include "core.h"
26 26 #include "uart.h"
27 27 #include "libucstrings.h"
28 28 #define __delay(t) for(volatile int i=0;i<t;i++);
29 29 #define ledspos1 LED1_OFF;LED2_ON;LED3_OFF;LED4_ON;LED5_OFF;LED6_ON;LED7_OFF;LED8_ON
30 30 #define ledspos2 LED1_ON;LED2_OFF;LED3_ON;LED4_OFF;LED5_ON;LED6_OFF;LED7_ON;LED8_OFF
31 31 #define tableSize 256
32 32
33 #define data0Size 3
34 volatile int16_t data0[data0Size] __attribute__ ((section (".testData"))) = {0x1234,0x4567,0xFF00};
35 const int* const test1[]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
33 36
34 37 void eepromTest();
35 38
36 39 int main (void)
37 40 {
41 int i=0;
42 volatile int16_t* testptr = 0x2007C000 + (16*1024) - 6;
38 43 bsp_init();
39 44 uartsetbaudrate(UART0,38400);
40 45 eepromTest();
41 46 libucprintf("CPU Freq =%dMHz\n\r",currentCpuFreq/1000000);
42 47 libucprintf("IIC Freq =%dKHz\n\r",i2cgetdatarate(IIC0)/1000);
48 libucprintf("data0 = %x",data0);
49 for(i=0;i<data0Size;i++)
50 libucprintf("data0[%d] = %x",i,0xFFFF&data0[i]);
51 for(i=0;i<20;i++)
52 libucprintf("test1[%d] = %x",i,test1[i]);
43 53 while(1)
44 54 {
45 55 ledspos1;
46 56
47 57 __delay(1024*1024);
48 58 ledspos2;
49 59
50 60 __delay(1024*1024);
51 61
52 62 }
53 63 return 0;
54 64
55 65 }
56 66
57 67
58 68
59 69
60 70
61 71 void eepromTest()
62 72 {
63 73 unsigned char val1,val2;
64 74 unsigned char table1[256];
65 75 unsigned char table2[256];
66 76 int i=0;
67 77 for(i=0;i<tableSize;i++)table1[i]=i;
68 78 libucprintf("Writing 0x56 @ 0x10...");
69 79 eeprom24lc0xbytewrite(eeprom0,0x10,0x56);
70 80 libucprintf("\tdone\n\r");
71 81 libucprintf("Writing 0xF1 @ 0x39...");
72 82 eeprom24lc0xbytewrite(eeprom0,0x39,0xF1);
73 83 libucprintf("\tdone\n\r");
74 84 libucprintf("Reading @ 0x10 ...");
75 85 val1=eeprom24lc0xbyteread(eeprom0,0x10);
76 86 libucprintf("\tdone result = 0x%X\n\r",val1);
77 87 libucprintf("Reading @ 0x39 ...");
78 88 val2=eeprom24lc0xbyteread(eeprom0,0x39);
79 89 libucprintf("\tdone result = 0x%X\n\r",val2);
80 90
81 91
82 92 libucprintf("Writing folowing table @ 0x00");
83 93 libucprintchartable(table1,tableSize,"0x%X"," ");
84 94 libucprintf("...");
85 95 eeprom24lc0xwriten(eeprom0,0,table1, tableSize);
86 96 libucprintf("\tdone\n\r");
87 97 libucprintf("Reading table @ 0x00 ...");
88 98 eeprom24lc0xreadn(eeprom0,0,table2, tableSize);
89 99 libucprintf("\tdone\n\r");
90 100 libucprintf("result = ");
91 101 libucprintchartable(table2,tableSize,"0x%X"," ");
92 102 libucprintf("\n\r");
93 103 }
94 104
95 105
96 106
97 107
98 108
99 109
100 110
101 111
102 112
103 113
104 114
105 115
106 116
107 117
@@ -1,21 +1,23
1 1
2 2 PROJECTDIR = `pwd`
3 3 LIBUC = /opt/libuc2
4 4 include $(LIBUC)/rules/common/rules.mk
5 5
6 6 all:subdir
7 7 make -C common/UHANDLE
8 8 make -C lpc21XX
9 9 make -C lpc17XX
10 make -C LEON3
10 11 make -C common
11 12 make -C apps
12 13 @echo Code compiled
13 14
14 15 clean:
15 16 make clean -C common/UHANDLE
16 17 make clean -C lpc21XX
17 18 make clean -C lpc17XX
19 make clean -C LEON3
18 20 make clean -C common
19 21 make clean -C apps
20 22 @echo Code compiled
21 23
@@ -1,112 +1,151
1 1 #---------------------------------------------------------------------------------
2 2 # LIBRARY DEFINITIONS
3 3 #---------------------------------------------------------------------------------
4 4 LIBUC_LIBS =
5 LIBUC_LIBS_CORE = -static -lcore
6 LIBUC_LIBS_UCSTRINGS = -static -lucstrings
7 LIBUC_LIBS_UART = -static -luart
8 LIBUC_LIBS_SPI = -static -lspi
9 LIBUC_LIBS_SSP = -static -lssp
5
6 LIBUC_LIBS_CORE = -static -lcore
7 LIBUC_LIBS_DIR_CORE = $(LIBUC_LIBS_DIR)/CORE
8 LIBUC_LIBS_DIR_CORE_CMD = -L $(LIBUC_LIBS_DIR_CORE)
9 LIBUC_INC_DIR_CORE = $(LIBUC_INC_DIR)/CORE
10 LIBUC_INC_DIR_CORE_CMD = -I $(LIBUC_INC_DIR_CORE)
11
12 LIBUC_LIBS_APB = -static -lapb
13 LIBUC_LIBS_DIR_APB = $(LIBUC_LIBS_DIR)/APB
14 LIBUC_LIBS_DIR_APB_CMD = -L $(LIBUC_LIBS_DIR_APB)
15 LIBUC_INC_DIR_APB = $(LIBUC_INC_DIR)/APB
16 LIBUC_INC_DIR_APB_CMD = -I $(LIBUC_INC_DIR_APB)
17
18 LIBUC_LIBS_UCSTRINGS = -static -lucstrings
19 LIBUC_LIBS_DIR_UCSTRINGS = $(LIBUC_LIBS_DIR)/STRINGS/$(ARCH)
20 LIBUC_LIBS_DIR_UCSTRINGS_CMD = -L $(LIBUC_LIBS_DIR_UCSTRINGS)
21 LIBUC_INC_DIR_UCSTRINGS = $(LIBUC_INC_DIR)/STRINGS/$(ARCH)
22 LIBUC_INC_DIR_UCSTRINGS_CMD = -I $(LIBUC_INC_DIR_UCSTRINGS)
23
24 LIBUC_LIBS_UART = -static -luart
25 LIBUC_LIBS_DIR_UART = $(LIBUC_LIBS_DIR)/UART
26 LIBUC_LIBS_DIR_UART_CMD = -L $(LIBUC_LIBS_DIR_UART)
27 LIBUC_INC_DIR_UART = $(LIBUC_INC_DIR)/UART
28 LIBUC_INC_DIR_UART_CMD = -I $(LIBUC_INC_DIR_UART)
29
30 LIBUC_LIBS_SPI = -static -lspi
31 LIBUC_LIBS_DIR_SPI = $(LIBUC_LIBS_DIR)/SPI
32 LIBUC_LIBS_DIR_SPI_CMD = -L $(LIBUC_LIBS_DIR_SPI)
33 LIBUC_INC_DIR_SPI = $(LIBUC_INC_DIR)/SPI
34 LIBUC_INC_DIR_SPI_CMD = -I $(LIBUC_INC_DIR_SPI)
35
36 LIBUC_LIBS_SSP = -static -lssp
37 LIBUC_LIBS_DIR_SSP = $(LIBUC_LIBS_DIR)/SSP
38 LIBUC_LIBS_DIR_SSP_CMD = -L $(LIBUC_LIBS_DIR_SSP)
39 LIBUC_INC_DIR_SSP = $(LIBUC_INC_DIR)/SSP
40 LIBUC_INC_DIR_SSP_CMD = -I $(LIBUC_INC_DIR_SSP)
41
10 42 LIBUC_LIBS_IIC = -static -liic
43 LIBUC_LIBS_DIR_IIC = $(LIBUC_LIBS_DIR)/IIC
44 LIBUC_LIBS_DIR_IIC_CMD = -L $(LIBUC_LIBS_DIR_IIC)
45 LIBUC_INC_DIR_IIC = $(LIBUC_INC_DIR)/IIC
46 LIBUC_INC_DIR_IIC_CMD = -I $(LIBUC_INC_DIR_IIC)
47
11 48 LIBUC_LIBS_ADC = -static -ladc
12 LIBUC_LIBS_24LC0X = -static -l24lc0X
13 LIBUC_LIBS_SDCARD = -static -lsdcard
14 LIBUC_LIBS_BLKDEVICE = -static -lblkdevice
15 LIBUC_LIBS_FAT32 = -static -lfat32
16 LIBUC_LIBS_VS10XX = -static -lvs10XX
17 LIBUC_LIBS_UHANDLE = -static -luhandle
18 LIBUC_LIBS_HEXVIEWER = -static -lhexviewer
19 LIBUC_LIBS_MBR = -static -lmbr
20 LIBUC_LIBS_UCDIRENT = -static -lucdirent
21 LIBUC_LIBS_FS = -static -lfs
22 LIBUC_LIBS_ALLFS = $(LIBUC_LIBS_UCDIRENT) $(LIBUC_LIBS_FS) $(LIBUC_LIBS_MBR) $(LIBUC_LIBS_FAT32) $(LIBUC_LIBS_SDCARD) $(LIBUC_LIBS_BLKDEVICE)
23 LIBUC_LIBS_FSEXPLORER = -static -lfsexplorer
49 LIBUC_LIBS_DIR_ADC = $(LIBUC_LIBS_DIR)/ADC
50 LIBUC_LIBS_DIR_ADC_CMD = -L $(LIBUC_LIBS_DIR_ADC)
51 LIBUC_INC_DIR_ADC = $(LIBUC_INC_DIR)/ADC
52 LIBUC_INC_DIR_ADC_CMD = -I $(LIBUC_INC_DIR_ADC)
24 53
25 LIBUC_LIBS_DIR_CORE = $(LIBUC_LIBS_DIR)/CORE
26 LIBUC_LIBS_DIR_UCSTRINGS = $(LIBUC_LIBS_DIR)/STRINGS/$(ARCH)
27 LIBUC_LIBS_DIR_UART = $(LIBUC_LIBS_DIR)/UART
28 LIBUC_LIBS_DIR_SPI = $(LIBUC_LIBS_DIR)/SPI
29 LIBUC_LIBS_DIR_SSP = $(LIBUC_LIBS_DIR)/SSP
30 LIBUC_LIBS_DIR_IIC = $(LIBUC_LIBS_DIR)/IIC
31 LIBUC_LIBS_DIR_ADC = $(LIBUC_LIBS_DIR)/ADC
54 LIBUC_LIBS_24LC0X = -static -l24lc0X
32 55 LIBUC_LIBS_DIR_24LC0X = $(LIBUC_LIBS_DIR)/24LCXX/24LC0X
33 LIBUC_LIBS_DIR_SDCARD = $(LIBUC_LIBS_DIR)/SDCARD
34 LIBUC_LIBS_DIR_VS10XX = $(LIBUC_LIBS_DIR)/VS10XX
35 LIBUC_LIBS_DIR_BLKDEVICE = $(LIBUC_LIBS_DIR)/BLKDEVICE
36 LIBUC_LIBS_DIR_FAT32 = $(LIBUC_LIBS_DIR)/FAT32
37 LIBUC_LIBS_DIR_UHANDLE = $(LIBUC_LIBS_DIR)/UHANDLE
38 LIBUC_LIBS_DIR_HEXVIEWER = $(LIBUC_LIBS_DIR)/HEXVIEWER
39 LIBUC_LIBS_DIR_MBR = $(LIBUC_LIBS_DIR)/MBR
40 LIBUC_LIBS_DIR_UCDIRENT = $(LIBUC_LIBS_DIR)/UCDIRENT
41 LIBUC_LIBS_DIR_FS = $(LIBUC_LIBS_DIR)/FS
42 LIBUC_LIBS_DIR_FSEXPLORER = $(LIBUC_LIBS_DIR)/FSEXPLORER
56 LIBUC_LIBS_DIR_24LC0X_CMD = -L $(LIBUC_LIBS_DIR_24LC0X)
57 LIBUC_INC_DIR_24LC0X = $(LIBUC_INC_DIR)/24LCXX/24LC0X
58 LIBUC_INC_DIR_24LC0X_CMD = -I $(LIBUC_INC_DIR_24LC0X)
43 59
44 LIBUC_LIBS_DIR_CORE_CMD = -L $(LIBUC_LIBS_DIR_CORE)
45 LIBUC_LIBS_DIR_UCSTRINGS_CMD = -L $(LIBUC_LIBS_DIR_UCSTRINGS)
46 LIBUC_LIBS_DIR_UART_CMD = -L $(LIBUC_LIBS_DIR_UART)
47 LIBUC_LIBS_DIR_SPI_CMD = -L $(LIBUC_LIBS_DIR_SPI)
48 LIBUC_LIBS_DIR_SSP_CMD = -L $(LIBUC_LIBS_DIR_SSP)
49 LIBUC_LIBS_DIR_IIC_CMD = -L $(LIBUC_LIBS_DIR_IIC)
50 LIBUC_LIBS_DIR_ADC_CMD = -L $(LIBUC_LIBS_DIR_ADC)
51 LIBUC_LIBS_DIR_24LC0X_CMD = -L $(LIBUC_LIBS_DIR_24LC0X)
52 LIBUC_LIBS_DIR_SDCARD_CMD = -L $(LIBUC_LIBS_DIR_SDCARD)
53 LIBUC_LIBS_DIR_VS10XX_CMD = -L $(LIBUC_LIBS_DIR_VS10XX)
54 LIBUC_LIBS_DIR_BLKDEVICE_CMD = -L $(LIBUC_LIBS_DIR_BLKDEVICE)
55 LIBUC_LIBS_DIR_FAT32_CMD = -L $(LIBUC_LIBS_DIR_FAT32)
56 LIBUC_LIBS_DIR_UHANDLE_CMD = -L $(LIBUC_LIBS_DIR_UHANDLE)
57 LIBUC_LIBS_DIR_HEXVIEWER_CMD = -L $(LIBUC_LIBS_DIR_HEXVIEWER)
58 LIBUC_LIBS_DIR_MBR_CMD = -L $(LIBUC_LIBS_DIR_MBR)
59 LIBUC_LIBS_DIR_UCDIRENT_CMD = -L $(LIBUC_LIBS_DIR_UCDIRENT)
60 LIBUC_LIBS_DIR_FS_CMD = -L $(LIBUC_LIBS_DIR_FS)
61 LIBUC_LIBS_DIR_ALLFS_CMD = $(LIBUC_LIBS_DIR_UCDIRENT_CMD) $(LIBUC_LIBS_DIR_FS_CMD) $(LIBUC_LIBS_DIR_MBR_CMD) $(LIBUC_LIBS_DIR_FAT32_CMD) $(LIBUC_LIBS_DIR_SDCARD_CMD) $(LIBUC_LIBS_DIR_BLKDEVICE_CMD)
62 LIBUC_LIBS_DIR_FSEXPLORER_CMD = -L $(LIBUC_LIBS_DIR_FSEXPLORER)
60 LIBUC_LIBS_SDCARD = -static -lsdcard
61 LIBUC_LIBS_DIR_SDCARD = $(LIBUC_LIBS_DIR)/SDCARD
62 LIBUC_LIBS_DIR_SDCARD_CMD = -L $(LIBUC_LIBS_DIR_SDCARD)
63 LIBUC_INC_DIR_SDCARD = $(LIBUC_INC_DIR)/SDCARD
64 LIBUC_INC_DIR_SDCARD_CMD = -I $(LIBUC_INC_DIR_SDCARD)
65
66 LIBUC_LIBS_VS10XX = -static -lvs10XX
67 LIBUC_LIBS_DIR_VS10XX = $(LIBUC_LIBS_DIR)/VS10XX
68 LIBUC_LIBS_DIR_VS10XX_CMD = -L $(LIBUC_LIBS_DIR_VS10XX)
69 LIBUC_INC_DIR_VS10XX = $(LIBUC_INC_DIR)/VS10XX
70 LIBUC_INC_DIR_VS10XX_CMD = -I $(LIBUC_INC_DIR_VS10XX)
71
72 LIBUC_LIBS_BLKDEVICE = -static -lblkdevice
73 LIBUC_LIBS_DIR_BLKDEVICE = $(LIBUC_LIBS_DIR)/BLKDEVICE
74 LIBUC_LIBS_DIR_BLKDEVICE_CMD = -L $(LIBUC_LIBS_DIR_BLKDEVICE)
75 LIBUC_INC_DIR_BLKDEVICE = $(LIBUC_INC_DIR)/BLKDEVICE
76 LIBUC_INC_DIR_BLKDEVICE_CMD = -I $(LIBUC_INC_DIR_BLKDEVICE)
77
78 LIBUC_LIBS_FAT32 = -static -lfat32
79 LIBUC_LIBS_DIR_FAT32 = $(LIBUC_LIBS_DIR)/FAT32
80 LIBUC_LIBS_DIR_FAT32_CMD = -L $(LIBUC_LIBS_DIR_FAT32)
81 LIBUC_INC_DIR_FAT32 = $(LIBUC_INC_DIR)/FAT32
82 LIBUC_INC_DIR_FAT32_CMD = -I $(LIBUC_INC_DIR_FAT32)
83
84 LIBUC_LIBS_UHANDLE = -static -luhandle
85 LIBUC_LIBS_DIR_UHANDLE = $(LIBUC_LIBS_DIR)/UHANDLE
86 LIBUC_LIBS_DIR_UHANDLE_CMD = -L $(LIBUC_LIBS_DIR_UHANDLE)
87 LIBUC_INC_DIR_UHANDLE = $(LIBUC_INC_DIR)/UHANDLE
88 LIBUC_INC_DIR_UHANDLE_CMD = -I $(LIBUC_INC_DIR_UHANDLE)
63 89
64 LIBUC_INC_DIR_CORE = $(LIBUC_INC_DIR)/CORE
65 LIBUC_INC_DIR_UCSTRINGS = $(LIBUC_INC_DIR)/STRINGS/$(ARCH)
66 LIBUC_INC_DIR_UART = $(LIBUC_INC_DIR)/UART
67 LIBUC_INC_DIR_SPI = $(LIBUC_INC_DIR)/SPI
68 LIBUC_INC_DIR_SSP = $(LIBUC_INC_DIR)/SSP
69 LIBUC_INC_DIR_IIC = $(LIBUC_INC_DIR)/IIC
70 LIBUC_INC_DIR_ADC = $(LIBUC_INC_DIR)/ADC
71 LIBUC_INC_DIR_24LC0X = $(LIBUC_INC_DIR)/24LCXX/24LC0X
72 LIBUC_INC_DIR_SDCARD = $(LIBUC_INC_DIR)/SDCARD
73 LIBUC_INC_DIR_VS10XX = $(LIBUC_INC_DIR)/VS10XX
74 LIBUC_INC_DIR_BLKDEVICE = $(LIBUC_INC_DIR)/BLKDEVICE
75 LIBUC_INC_DIR_FAT32 = $(LIBUC_INC_DIR)/FAT32
76 LIBUC_INC_DIR_UHANDLE = $(LIBUC_INC_DIR)/UHANDLE
77 LIBUC_INC_DIR_HEXVIEWER = $(LIBUC_INC_DIR)/HEXVIEWER
78 LIBUC_INC_DIR_MBR = $(LIBUC_INC_DIR)/MBR
79 LIBUC_INC_DIR_UCDIRENT = $(LIBUC_INC_DIR)/UCDIRENT
80 LIBUC_INC_DIR_FS = $(LIBUC_INC_DIR)/FS
81 LIBUC_INC_DIR_FSEXPLORER = $(LIBUC_INC_DIR)/FSEXPLORER
90 LIBUC_LIBS_HEXVIEWER = -static -lhexviewer
91 LIBUC_LIBS_DIR_HEXVIEWER = $(LIBUC_LIBS_DIR)/HEXVIEWER
92 LIBUC_LIBS_DIR_HEXVIEWER_CMD = -L $(LIBUC_LIBS_DIR_HEXVIEWER)
93 LIBUC_INC_DIR_HEXVIEWER = $(LIBUC_INC_DIR)/HEXVIEWER
94 LIBUC_INC_DIR_HEXVIEWER_CMD = -I $(LIBUC_INC_DIR_HEXVIEWER)
95
96 LIBUC_LIBS_MBR = -static -lmbr
97 LIBUC_LIBS_DIR_MBR = $(LIBUC_LIBS_DIR)/MBR
98 LIBUC_LIBS_DIR_MBR_CMD = -L $(LIBUC_LIBS_DIR_MBR)
99 LIBUC_INC_DIR_MBR = $(LIBUC_INC_DIR)/MBR
100 LIBUC_INC_DIR_MBR_CMD = -I $(LIBUC_INC_DIR_MBR)
82 101
83 LIBUC_INC_DIR_CORE_CMD = -I $(LIBUC_INC_DIR_CORE)
84 LIBUC_INC_DIR_UCSTRINGS_CMD = -I $(LIBUC_INC_DIR_UCSTRINGS)
85 LIBUC_INC_DIR_UART_CMD = -I $(LIBUC_INC_DIR_UART)
86 LIBUC_INC_DIR_SPI_CMD = -I $(LIBUC_INC_DIR_SPI)
87 LIBUC_INC_DIR_SSP_CMD = -I $(LIBUC_INC_DIR_SSP)
88 LIBUC_INC_DIR_IIC_CMD = -I $(LIBUC_INC_DIR_IIC)
89 LIBUC_INC_DIR_ADC_CMD = -I $(LIBUC_INC_DIR_ADC)
90 LIBUC_INC_DIR_24LC0X_CMD = -I $(LIBUC_INC_DIR_24LC0X)
91 LIBUC_INC_DIR_SDCARD_CMD = -I $(LIBUC_INC_DIR_SDCARD)
92 LIBUC_INC_DIR_VS10XX_CMD = -I $(LIBUC_INC_DIR_VS10XX)
93 LIBUC_INC_DIR_BLKDEVICE_CMD = -I $(LIBUC_INC_DIR_BLKDEVICE)
94 LIBUC_INC_DIR_FAT32_CMD = -I $(LIBUC_INC_DIR_FAT32)
95 LIBUC_INC_DIR_UHANDLE_CMD = -I $(LIBUC_INC_DIR_UHANDLE)
96 LIBUC_INC_DIR_HEXVIEWER_CMD = -I $(LIBUC_INC_DIR_HEXVIEWER)
97 LIBUC_INC_DIR_MBR_CMD = -I $(LIBUC_INC_DIR_MBR)
98 LIBUC_INC_DIR_UCDIRENT_CMD = -I $(LIBUC_INC_DIR_UCDIRENT)
99 LIBUC_INC_DIR_FS_CMD = -I $(LIBUC_INC_DIR_FS)
100 LIBUC_INC_DIR_ALLFS_CMD = $(LIBUC_INC_DIR_UCDIRENT_CMD) $(LIBUC_INC_DIR_FS_CMD) $(LIBUC_INC_DIR_MBR_CMD) $(LIBUC_INC_DIR_FAT32_CMD) $(LIBUC_INC_DIR_SDCARD_CMD) $(LIBUC_INC_DIR_BLKDEVICE_CMD)
101 LIBUC_INC_DIR_FSEXPLORER_CMD = -I $(LIBUC_INC_DIR_FSEXPLORER)
102 LIBUC_LIBS_UCDIRENT = -static -lucdirent
103 LIBUC_LIBS_DIR_UCDIRENT = $(LIBUC_LIBS_DIR)/UCDIRENT
104 LIBUC_LIBS_DIR_UCDIRENT_CMD = -L $(LIBUC_LIBS_DIR_UCDIRENT)
105 LIBUC_INC_DIR_UCDIRENT = $(LIBUC_INC_DIR)/UCDIRENT
106 LIBUC_INC_DIR_UCDIRENT_CMD = -I $(LIBUC_INC_DIR_UCDIRENT)
107
108 LIBUC_LIBS_FS = -static -lfs
109 LIBUC_LIBS_DIR_FS = $(LIBUC_LIBS_DIR)/FS
110 LIBUC_LIBS_DIR_FS_CMD = -L $(LIBUC_LIBS_DIR_FS)
111 LIBUC_INC_DIR_FS = $(LIBUC_INC_DIR)/FS
112 LIBUC_INC_DIR_FS_CMD = -I $(LIBUC_INC_DIR_FS)
113
114 LIBUC_LIBS_FSEXPLORER = -static -lfsexplorer
115 LIBUC_LIBS_DIR_FSEXPLORER = $(LIBUC_LIBS_DIR)/FSEXPLORER
116 LIBUC_LIBS_DIR_FSEXPLORER_CMD = -L $(LIBUC_LIBS_DIR_FSEXPLORER)
117 LIBUC_INC_DIR_FSEXPLORER = $(LIBUC_INC_DIR)/FSEXPLORER
118 LIBUC_INC_DIR_FSEXPLORER_CMD = -I $(LIBUC_INC_DIR_FSEXPLORER)
119
120 LIBUC_LIBS_DIR_ALLFS_CMD = $(LIBUC_LIBS_DIR_UCDIRENT_CMD) $(LIBUC_LIBS_DIR_FS_CMD) $(LIBUC_LIBS_DIR_MBR_CMD) $(LIBUC_LIBS_DIR_FAT32_CMD) $(LIBUC_LIBS_DIR_SDCARD_CMD) $(LIBUC_LIBS_DIR_BLKDEVICE_CMD)
121 LIBUC_INC_DIR_ALLFS_CMD = $(LIBUC_INC_DIR_UCDIRENT_CMD) $(LIBUC_INC_DIR_FS_CMD) $(LIBUC_INC_DIR_MBR_CMD) $(LIBUC_INC_DIR_FAT32_CMD) $(LIBUC_INC_DIR_SDCARD_CMD) $(LIBUC_INC_DIR_BLKDEVICE_CMD)
122 LIBUC_LIBS_ALLFS = $(LIBUC_LIBS_UCDIRENT) $(LIBUC_LIBS_FS) $(LIBUC_LIBS_MBR) $(LIBUC_LIBS_FAT32) $(LIBUC_LIBS_SDCARD) $(LIBUC_LIBS_BLKDEVICE)
102 123
103 124
104 125
105 126
106 127
107 128
108 129
109 130
110 131
111 132
112 133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
@@ -1,182 +1,191
1 1 /* THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
2 2 * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
3 3 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
4 4 * THE AUTHORS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
5 5 * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. USE IT AT YOUR OWN RISK */
6 6
7 7 MEMORY
8 8 {
9 9 /* LPC1768 : 512k ROM + 64k SRAM */
10 10 /*------------------------------ */
11 11
12 12 /* On-chip ROM is a readable (r), executable region (x) */
13 13 /* On-chip SRAM is a readable (r), writable (w) and */
14 14 /* executable region (x) */
15 15
16 16 /* Main ROM region - 512k for LPC1768 */
17 17 IROM (rx) : ORIGIN = 0x00000000, LENGTH = 512k
18 18
19 19 /* local static RAM - 32k for LPC1756 */
20 20 IRAM0 (rwx) : ORIGIN = 0x10000000, LENGTH = 32k
21 21
22 22 /* AHB SRAM - 16k for LPC1756 - often used for USB */
23 23 IRAM1 (rwx) : ORIGIN = 0x2007C000, LENGTH = 16k
24 24 IRAM2 (rwx) : ORIGIN = 0x20080000, LENGTH = 16k
25 25 }
26 26
27 27 /* SECTION command : Define mapping of input sections */
28 28 /* into output sections. */
29 29
30 30 SECTIONS
31 31 {
32 32 /******************************************/
33 33 /* code section */
34 34
35 35 /* "normal" code */
36 36
37 37 .text :
38 38 {
39 39 KEEP(*(.isr_vector .isr_vector.*))
40 40 *(.text .text.*)
41 41 *(.gnu.linkonce.t.*)
42 42 *(.glue_7)
43 43 *(.glue_7t)
44 44 *(.gcc_except_table)
45 45 *(.rodata .rodata*)
46 46 *(.gnu.linkonce.r.*)
47 47 } >IROM
48 .testData :
49 {
50 _sitestdata = LOADADDR (.testData);
51 . = ALIGN(4);
52 _stestdata = .;
53 *(.testData .testData.*)
54 . = ALIGN(4);
55 _etestdata = . ;
56 } >IRAM1 AT >IROM
48 57
49 58 /******************************************/
50 59 /* .ctors .dtors are used for c++ constructors/destructors */
51 60 .ctors :
52 61 {
53 62 . = ALIGN(4);
54 63 PROVIDE(__ctors_start = .);
55 64 KEEP(*(SORT(.ctors.*)))
56 65 KEEP(*(.ctors))
57 66 PROVIDE(__ctors_end = .);
58 67 } >IROM
59 68
60 69 .dtors :
61 70 {
62 71 . = ALIGN(4);
63 72 PROVIDE(__dtors_start = .);
64 73 KEEP(*(SORT(.dtors.*)))
65 74 KEEP(*(.dtors))
66 75 PROVIDE(__dtors_end = .);
67 76
68 77 . = ALIGN(4);
69 78 /* End Of .text section */
70 79 _etext = .;
71 80 _sifastcode = .;
72 81 } >IROM
73 82
74 83 /**************************************************/
75 84 /* fastcode - copied at startup & executed in RAM */
76 85
77 86 .fastcode :
78 87 {
79 88 . = ALIGN (4);
80 89 _sfastcode = . ;
81 90
82 91 *(.glue_7t) *(.glue_7)
83 92 *(.fastcode)
84 93
85 94 /* add other modules here ... */
86 95
87 96 . = ALIGN (4);
88 97 _efastcode = . ;
89 98 _sidata = .;
90 99 } >IRAM0 AT>IROM
91 100
92 101 /******************************************/
93 102 /* This used for USB RAM section */
94 103 .usb_ram (NOLOAD):
95 104 {
96 105 *.o (USB_RAM)
97 106 } > IRAM1
98 107
99 108 /******************************************/
100 109 /* data section */
101 110 .data :
102 111 {
103 112 _sidata = LOADADDR (.data);
104 113 . = ALIGN(4);
105 114 _sdata = .;
106 115
107 116 *(vtable vtable.*)
108 117 *(.data .data.*)
109 118 *(.gnu.linkonce.d*)
110 119
111 120 . = ALIGN(4);
112 121 _edata = . ;
113 122 } >IRAM0 AT>IROM
114 123
115 124 /******************************************/
116 125 /* For no-init variables section */
117 126 .bss (NOLOAD) :
118 127 {
119 128 . = ALIGN(4);
120 129 _sbss = . ;
121 130
122 131 *(.bss .bss.*)
123 132 *(.gnu.linkonce.b*)
124 133 *(COMMON)
125 134
126 135 . = ALIGN(4);
127 136 _ebss = . ;
128 137 } >IRAM0
129 138
130 139 /******************************************/
131 140 /* For stack section */
132 141 .stackarea (NOLOAD) :
133 142 {
134 143 . = ALIGN(8);
135 144 _sstack = .;
136 145
137 146 *(.stackarea .stackarea.*)
138 147
139 148 . = ALIGN(8);
140 149 _estack = .;
141 150
142 151 . = ALIGN(4);
143 152 _end = . ;
144 153 PROVIDE (end = .);
145 154
146 155 } > IRAM0
147 156
148 157 /******************************************/
149 158 /* Stabs debugging sections. */
150 159 .stab 0 : { *(.stab) }
151 160 .stabstr 0 : { *(.stabstr) }
152 161 .stab.excl 0 : { *(.stab.excl) }
153 162 .stab.exclstr 0 : { *(.stab.exclstr) }
154 163 .stab.index 0 : { *(.stab.index) }
155 164 .stab.indexstr 0 : { *(.stab.indexstr) }
156 165 /* .comment 0 : { *(.comment) } */
157 166 /* DWARF debug sections.
158 167 Symbols in the DWARF debugging sections are relative to the beginning
159 168 of the section so we begin them at 0. */
160 169 /* DWARF 1 */
161 170 .debug 0 : { *(.debug) }
162 171 .line 0 : { *(.line) }
163 172 /* GNU DWARF 1 extensions */
164 173 .debug_srcinfo 0 : { *(.debug_srcinfo) }
165 174 .debug_sfnames 0 : { *(.debug_sfnames) }
166 175 /* DWARF 1.1 and DWARF 2 */
167 176 .debug_aranges 0 : { *(.debug_aranges) }
168 177 .debug_pubnames 0 : { *(.debug_pubnames) }
169 178 /* DWARF 2 */
170 179 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
171 180 .debug_abbrev 0 : { *(.debug_abbrev) }
172 181 .debug_line 0 : { *(.debug_line) }
173 182 .debug_frame 0 : { *(.debug_frame) }
174 183 .debug_str 0 : { *(.debug_str) }
175 184 .debug_loc 0 : { *(.debug_loc) }
176 185 .debug_macinfo 0 : { *(.debug_macinfo) }
177 186 /* SGI/MIPS DWARF 2 extensions */
178 187 .debug_weaknames 0 : { *(.debug_weaknames) }
179 188 .debug_funcnames 0 : { *(.debug_funcnames) }
180 189 .debug_typenames 0 : { *(.debug_typenames) }
181 190 .debug_varnames 0 : { *(.debug_varnames) }
182 191 }
@@ -1,288 +1,298
1 1 /****************************************************************************//**
2 2 * @file : startup_LPC17xx.c
3 3 * @brief : CMSIS Cortex-M3 Core Device Startup File
4 4 * @version : V1.01
5 5 * @date : 4. Feb. 2009
6 6 *
7 7 *----------------------------------------------------------------------------
8 8 *
9 9 * Copyright (C) 2009 ARM Limited. All rights reserved.
10 10 *
11 11 * ARM Limited (ARM) is supplying this software for use with Cortex-Mx
12 12 * processor based microcontrollers. This file can be freely distributed
13 13 * within development tools that are supporting such ARM based processors.
14 14 *
15 15 * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
16 16 * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
17 17 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
18 18 * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
19 19 * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
20 20 *
21 21 ******************************************************************************/
22 22
23 23 // Mod by nio for the .fastcode part
24 24
25 25 #include "LPC17xx.h"
26 26
27 27 #define WEAK __attribute__ ((weak))
28 28 //*****************************************************************************
29 29 //
30 30 // Forward declaration of the default fault handlers.
31 31 //
32 32 //*****************************************************************************
33 33 /* System exception vector handler */
34 34 void WEAK Reset_Handler(void); /* Reset Handler */
35 35 void WEAK NMI_Handler(void); /* NMI Handler */
36 36 void WEAK HardFault_Handler(void); /* Hard Fault Handler */
37 37 void WEAK MemManage_Handler(void); /* MPU Fault Handler */
38 38 void WEAK BusFault_Handler(void); /* Bus Fault Handler */
39 39 void WEAK UsageFault_Handler(void); /* Usage Fault Handler */
40 40 void WEAK SVC_Handler(void); /* SVCall Handler */
41 41 void WEAK DebugMon_Handler(void); /* Debug Monitor Handler */
42 42 void WEAK PendSV_Handler(void); /* PendSV Handler */
43 43 void WEAK SysTick_Handler(void); /* SysTick Handler */
44 44
45 45 /* External interrupt vector handler */
46 46 void WEAK WDT_IRQHandler(void); /* Watchdog Timer */
47 47 void WEAK TIMER0_IRQHandler(void); /* Timer0 */
48 48 void WEAK TIMER1_IRQHandler(void); /* Timer1 */
49 49 void WEAK TIMER2_IRQHandler(void); /* Timer2 */
50 50 void WEAK TIMER3_IRQHandler(void); /* Timer3 */
51 51 void WEAK UART0_IRQHandler(void); /* UART0 */
52 52 void WEAK UART1_IRQHandler(void); /* UART1 */
53 53 void WEAK UART2_IRQHandler(void); /* UART2 */
54 54 void WEAK UART3_IRQHandler(void); /* UART3 */
55 55 void WEAK PWM1_IRQHandler(void); /* PWM1 */
56 56 void WEAK I2C0_IRQHandler(void); /* I2C0 */
57 57 void WEAK I2C1_IRQHandler(void); /* I2C1 */
58 58 void WEAK I2C2_IRQHandler(void); /* I2C2 */
59 59 void WEAK SPI_IRQHandler(void); /* SPI */
60 60 void WEAK SSP0_IRQHandler(void); /* SSP0 */
61 61 void WEAK SSP1_IRQHandler(void); /* SSP1 */
62 62 void WEAK PLL0_IRQHandler(void); /* PLL0 (Main PLL) */
63 63 void WEAK RTC_IRQHandler(void); /* Real Time Clock */
64 64 void WEAK EINT0_IRQHandler(void); /* External Interrupt 0 */
65 65 void WEAK EINT1_IRQHandler(void); /* External Interrupt 1 */
66 66 void WEAK EINT2_IRQHandler(void); /* External Interrupt 2 */
67 67 void WEAK EINT3_IRQHandler(void); /* External Interrupt 3 */
68 68 void WEAK ADC_IRQHandler(void); /* A/D Converter */
69 69 void WEAK BOD_IRQHandler(void); /* Brown Out Detect */
70 70 void WEAK USB_IRQHandler(void); /* USB */
71 71 void WEAK CAN_IRQHandler(void); /* CAN */
72 72 void WEAK DMA_IRQHandler(void); /* GP DMA */
73 73 void WEAK I2S_IRQHandler(void); /* I2S */
74 74 void WEAK ENET_IRQHandler(void); /* Ethernet */
75 75 void WEAK RIT_IRQHandler(void); /* Repetitive Interrupt Timer */
76 76 void WEAK MCPWM_IRQHandler(void); /* Motor Control PWM */
77 77 void WEAK QEI_IRQHandler(void); /* Quadrature Encoder Interface */
78 78 void WEAK PLL1_IRQHandler(void); /* PLL1 (USB PLL) */
79 79
80 80
81 81
82 82 /* Exported types --------------------------------------------------------------*/
83 83 /* Exported constants --------------------------------------------------------*/
84 84 extern unsigned long _etext;
85 85 extern unsigned long _sidata; /* start address for the initialization values of the .data section. defined in linker script */
86 86 extern unsigned long _sdata; /* start address for the .data section. defined in linker script */
87 87 extern unsigned long _edata; /* end address for the .data section. defined in linker script */
88 extern unsigned long _sitestdata; /* start address for the initialization values of the .data section. defined in linker script */
89 extern unsigned long _stestdata; /* start address for the .data section. defined in linker script */
90 extern unsigned long _etestdata;
91
88 92
89 93 extern unsigned long _sifastcode; /* start address for the initialization values of the .fastcode section. defined in linker script */
90 94 extern unsigned long _sfastcode; /* start address for the .fastcode section. defined in linker script */
91 95 extern unsigned long _efastcode; /* end address for the .fastcode section. defined in linker script */
92 96
93 97 extern unsigned long _sbss; /* start address for the .bss section. defined in linker script */
94 98 extern unsigned long _ebss; /* end address for the .bss section. defined in linker script */
95 99
96 100 extern void _estack; /* init value for the stack pointer. defined in linker script */
97 101
98 102
99 103
100 104 /* Private typedef -----------------------------------------------------------*/
101 105 /* function prototypes ------------------------------------------------------*/
102 106 void Reset_Handler(void) __attribute__((__interrupt__));
103 107 extern int main(void);
104 108
105 109
106 110 /******************************************************************************
107 111 *
108 112 * The minimal vector table for a Cortex M3. Note that the proper constructs
109 113 * must be placed on this to ensure that it ends up at physical address
110 114 * 0x0000.0000.
111 115 *
112 116 ******************************************************************************/
113 117 #define STACK_SIZE 0x00000800 /*2kO*/
114 118
115 119 __attribute__ ((section(".stackarea")))
116 120 /* static */ unsigned long pulStack[STACK_SIZE];
117 121
118 122
119 123 __attribute__ ((section(".isr_vector")))
120 124 void (* const g_pfnVectors[])(void) =
121 125 {
122 126 /* &_estack, // The initial stack pointer */
123 127 (void (*)(void))((unsigned long)pulStack + sizeof(pulStack)), // The initial stack pointer
124 128 Reset_Handler, /* Reset Handler */
125 129 NMI_Handler, /* NMI Handler */
126 130 HardFault_Handler, /* Hard Fault Handler */
127 131 MemManage_Handler, /* MPU Fault Handler */
128 132 BusFault_Handler, /* Bus Fault Handler */
129 133 UsageFault_Handler, /* Usage Fault Handler */
130 134 0, /* Reserved */
131 135 0, /* Reserved */
132 136 0, /* Reserved */
133 137 0, /* Reserved */
134 138 SVC_Handler, /* SVCall Handler */
135 139 DebugMon_Handler, /* Debug Monitor Handler */
136 140 0, /* Reserved */
137 141 PendSV_Handler, /* PendSV Handler */
138 142 SysTick_Handler, /* SysTick Handler */
139 143
140 144 // External Interrupts
141 145 WDT_IRQHandler, /* Watchdog Timer */
142 146 TIMER0_IRQHandler, /* Timer0 */
143 147 TIMER1_IRQHandler, /* Timer1 */
144 148 TIMER2_IRQHandler, /* Timer2 */
145 149 TIMER3_IRQHandler, /* Timer3 */
146 150 UART0_IRQHandler, /* UART0 */
147 151 UART1_IRQHandler, /* UART1 */
148 152 UART2_IRQHandler, /* UART2 */
149 153 UART3_IRQHandler, /* UART3 */
150 154 PWM1_IRQHandler, /* PWM1 */
151 155 I2C0_IRQHandler, /* I2C0 */
152 156 I2C1_IRQHandler, /* I2C1 */
153 157 I2C2_IRQHandler, /* I2C2 */
154 158 SPI_IRQHandler, /* SPI */
155 159 SSP0_IRQHandler, /* SSP0 */
156 160 SSP1_IRQHandler, /* SSP1 */
157 161 PLL0_IRQHandler, /* PLL0 (Main PLL) */
158 162 RTC_IRQHandler, /* Real Time Clock */
159 163 EINT0_IRQHandler, /* External Interrupt 0 */
160 164 EINT1_IRQHandler, /* External Interrupt 1 */
161 165 EINT2_IRQHandler, /* External Interrupt 2 */
162 166 EINT3_IRQHandler, /* External Interrupt 3 */
163 167 ADC_IRQHandler, /* A/D Converter */
164 168 BOD_IRQHandler, /* Brown Out Detect */
165 169 USB_IRQHandler, /* USB */
166 170 CAN_IRQHandler, /* CAN */
167 171 DMA_IRQHandler, /* GP DMA */
168 172 I2S_IRQHandler, /* I2S */
169 173 ENET_IRQHandler, /* Ethernet */
170 174 RIT_IRQHandler, /* Repetitive Interrupt Timer */
171 175 MCPWM_IRQHandler, /* Motor Control PWM */
172 176 QEI_IRQHandler, /* Quadrature Encoder Interface */
173 177 PLL1_IRQHandler, /* PLL1 (USB PLL) */
174 178 };
175 179
176 180 /*******************************************************************************
177 181 * Function Name : Reset_Handler
178 182 * Description : This is the code that gets called when the processor first starts execution
179 183 * following a reset event. Only the absolutely necessary set is performed,
180 184 * after which the application supplied main() routine is called.
181 185 * Input :
182 186 * Output :
183 187 * Return :
184 188 *******************************************************************************/
185 189 void Reset_Handler(void)
186 190 {
187 191 SystemInit();
188 192
189 193 unsigned long *pulDest;
190 194 unsigned long *pulSrc;
191 195
192 196 //
193 197 // Copy the data segment initializers from flash to SRAM in ROM mode
194 198 //
195 199
196 200 if (&_sidata != &_sdata) { // only if needed
197 201 pulSrc = &_sidata;
198 202 for(pulDest = &_sdata; pulDest < &_edata; ) {
199 203 *(pulDest++) = *(pulSrc++);
200 204 }
201 205 }
206 if (&_sitestdata != &_stestdata) { // only if needed
207 pulSrc = &_sitestdata;
208 for(pulDest = &_stestdata; pulDest < &_etestdata; ) {
209 *(pulDest++) = *(pulSrc++);
210 }
211 }
202 212
203 213 // Copy the .fastcode code from ROM to SRAM
204 214
205 215 if (&_sifastcode != &_sfastcode) { // only if needed
206 216 pulSrc = &_sifastcode;
207 217 for(pulDest = &_sfastcode; pulDest < &_efastcode; ) {
208 218 *(pulDest++) = *(pulSrc++);
209 219 }
210 220 }
211 221
212 222 //
213 223 // Zero fill the bss segment.
214 224 //
215 225 for(pulDest = &_sbss; pulDest < &_ebss; )
216 226 {
217 227 *(pulDest++) = 0;
218 228 }
219 229
220 230 //
221 231 // Call the application's entry point.
222 232 //
223 233 main();
224 234 }
225 235
226 236 //*****************************************************************************
227 237 //
228 238 // Provide weak aliases for each Exception handler to the Default_Handler.
229 239 // As they are weak aliases, any function with the same name will override
230 240 // this definition.
231 241 //
232 242 //*****************************************************************************
233 243 #pragma weak MemManage_Handler = Default_Handler /* MPU Fault Handler */
234 244 #pragma weak BusFault_Handler = Default_Handler /* Bus Fault Handler */
235 245 #pragma weak UsageFault_Handler = Default_Handler /* Usage Fault Handler */
236 246 #pragma weak SVC_Handler = Default_Handler /* SVCall Handler */
237 247 #pragma weak DebugMon_Handler = Default_Handler /* Debug Monitor Handler */
238 248 #pragma weak PendSV_Handler = Default_Handler /* PendSV Handler */
239 249 #pragma weak SysTick_Handler = Default_Handler /* SysTick Handler */
240 250
241 251 /* External interrupt vector handler */
242 252 #pragma weak WDT_IRQHandler = Default_Handler /* Watchdog Timer */
243 253 #pragma weak TIMER0_IRQHandler = Default_Handler /* Timer0 */
244 254 #pragma weak TIMER1_IRQHandler = Default_Handler /* Timer1 */
245 255 #pragma weak TIMER2_IRQHandler = Default_Handler /* Timer2 */
246 256 #pragma weak TIMER3_IRQHandler = Default_Handler /* Timer3 */
247 257 #pragma weak UART0_IRQHandler = Default_Handler /* UART0 */
248 258 #pragma weak UART1_IRQHandler = Default_Handler /* UART1 */
249 259 #pragma weak UART2_IRQHandler = Default_Handler /* UART2 */
250 260 #pragma weak UART3_IRQHandler = Default_Handler /* UART3 */
251 261 #pragma weak PWM1_IRQHandler = Default_Handler /* PWM1 */
252 262 #pragma weak I2C0_IRQHandler = Default_Handler /* I2C0 */
253 263 #pragma weak I2C1_IRQHandler = Default_Handler /* I2C1 */
254 264 #pragma weak I2C2_IRQHandler = Default_Handler /* I2C2 */
255 265 #pragma weak SPI_IRQHandler = Default_Handler /* SPI */
256 266 #pragma weak SSP0_IRQHandler = Default_Handler /* SSP0 */
257 267 #pragma weak SSP1_IRQHandler = Default_Handler /* SSP1 */
258 268 #pragma weak PLL0_IRQHandler = Default_Handler /* PLL0 (Main PLL) */
259 269 #pragma weak RTC_IRQHandler = Default_Handler /* Real Time Clock */
260 270 #pragma weak EINT0_IRQHandler = Default_Handler /* External Interrupt 0 */
261 271 #pragma weak EINT1_IRQHandler = Default_Handler /* External Interrupt 1 */
262 272 #pragma weak EINT2_IRQHandler = Default_Handler /* External Interrupt 2 */
263 273 #pragma weak EINT3_IRQHandler = Default_Handler /* External Interrupt 3 */
264 274 #pragma weak ADC_IRQHandler = Default_Handler /* A/D Converter */
265 275 #pragma weak BOD_IRQHandler = Default_Handler /* Brown Out Detect */
266 276 #pragma weak USB_IRQHandler = Default_Handler /* USB */
267 277 #pragma weak CAN_IRQHandler = Default_Handler /* CAN */
268 278 #pragma weak DMA_IRQHandler = Default_Handler /* GP DMA */
269 279 #pragma weak I2S_IRQHandler = Default_Handler /* I2S */
270 280 #pragma weak ENET_IRQHandler = Default_Handler /* Ethernet */
271 281 #pragma weak RIT_IRQHandler = Default_Handler /* Repetitive Interrupt Timer */
272 282 #pragma weak MCPWM_IRQHandler = Default_Handler /* Motor Control PWM */
273 283 #pragma weak QEI_IRQHandler = Default_Handler /* Quadrature Encoder Interface */
274 284 #pragma weak PLL1_IRQHandler = Default_Handler /* PLL1 (USB PLL) */
275 285
276 286 //*****************************************************************************
277 287 //
278 288 // This is the code that gets called when the processor receives an unexpected
279 289 // interrupt. This simply enters an infinite loop, preserving the system state
280 290 // for examination by a debugger.
281 291 //
282 292 //*****************************************************************************
283 293 void Default_Handler(void) {
284 294 // Go into an infinite loop.
285 295 //
286 296 while (1) {
287 297 }
288 298 }
@@ -1,92 +1,156
1 #/*------------------------------------------------------------------------------
2 #-- This file is a part of the libuc, microcontroler library
3 #-- Copyright (C) 2011, Alexis Jeandet
4 #--
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
7 #-- the Free Software Foundation; either version 3 of the License, or
8 #-- (at your option) any later version.
9 #--
10 #-- This program is distributed in the hope that it will be useful,
11 #-- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 #-- GNU General Public License for more details.
14 #--
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
17 #-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 #-------------------------------------------------------------------------------
19 #-- Author : Alexis Jeandet
20 #-- Mail : alexis.jeandet@gmail.com
21 #-------------------------------------------------------------------------------*/
22
23 #---------------------------------------------------------------------------------
24 # GCC EXECUTABLES
25 #---------------------------------------------------------------------------------
26 LIBUC_PREFIX = sparc-elf-
27 LIBUC_CC = $(LIBUC_PREFIX)gcc
28 LIBUC_CXX = $(LIBUC_PREFIX)g++
29 LIBUC_AR = $(LIBUC_PREFIX)ar
30 LIBUC_SIZE = $(LIBUC_PREFIX)size
31 LIBUC_READELF = $(LIBUC_PREFIX)readelf
32 LIBUC_OBJCOPY=$(LIBUC_PREFIX)objcopy
33
34
35
36 #---------------------------------------------------------------------------------
37 # GCC FLAGS
38 #---------------------------------------------------------------------------------
39 LIBUC_FMCU =
40 LIBUC_CFLAGS = $(LIBUC_FMCU)
41 LIBUC_CFLAGS_WARN_ON = -Wall
42 LIBUC_CFLAGS_WARN_OFF = -w
43 LIBUC_CFLAGS_RELEASE = -O2
44 LIBUC_CFLAGS_DEBUG = -g
45 LIBUC_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -g
46 LIBUC_CFLAGS_STATIC_LIB += -fPIC
47 LIBUC_CFLAGS_SOFT_FPU = -msoft-float
48 LIBUC_CFLAGS_HARD_FPU =
49
50 LIBUC_CXXFLAGS = $(LIBUC_FMCU)
51 LIBUC_CXXFLAGS_WARN_ON = -Wall
52 LIBUC_CXXFLAGS_WARN_OFF = -w
53 LIBUC_CXXFLAGS_RELEASE = -O2
54 LIBUC_CXXFLAGS_DEBUG = -g
55 LIBUC_CXXFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -g
56 LIBUC_CXXFLAGS_STATIC_LIB = -fPIC
57 LIBUC_CXXFLAGS_SOFT_FPU = -msoft-float
58 LIBUC_CXXFLAGS_HARD_FPU =
59
60 LIBUC_LIBS =
61 LIBUC_LIBS_UART = -luart
62 LIBUC_LIBS_SPI = -lspi
63 LIBUC_LIBS_IIC = -liic
64 LIBUC_LIBS_ADC = -ladc
65 LIBUC_LIBS_APB = -ladc
66
67 LIBUC_LIBS_DIR = $(LIBUC)/lib/bin/LEON3
68 LIBUC_LIBS_DIR_UART = -L $(LIBUC_LIBS_DIR)/UART
69 LIBUC_LIBS_DIR_SPI = -L $(LIBUC_LIBS_DIR)/SPI
70 LIBUC_LIBS_DIR_IIC = -L $(LIBUC_LIBS_DIR)/IIC
71 LIBUC_LIBS_DIR_ADC = -L $(LIBUC_LIBS_DIR)/ADC
72 LIBUC_LIBS_DIR_APB = -L $(LIBUC_LIBS_DIR)/APB
73
74
75 LIBUC_INC_DIR = $(LIBUC)/lib/includes/LEON
76 LIBUC_INC_DIR_UART = -L $(LIBUC_INC_DIR)/UART
77 LIBUC_INC_DIR_SPI = -L $(LIBUC_INC_DIR)/SPI
78 LIBUC_INC_DIR_IIC = -L $(LIBUC_INC_DIR)/IIC
79 LIBUC_INC_DIR_ADC = -L $(LIBUC_INC_DIR)/ADC
80 LIBUC_INC_DIR_APB = -L $(LIBUC_INC_DIR)/APB
81
82
83
84
85
86
87
88
89
90
91
92
1 #/*------------------------------------------------------------------------------
2 #-- This file is a part of the libuc, microcontroler library
3 #-- Copyright (C) 2011, Alexis Jeandet
4 #--
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
7 #-- the Free Software Foundation; either version 3 of the License, or
8 #-- (at your option) any later version.
9 #--
10 #-- This program is distributed in the hope that it will be useful,
11 #-- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 #-- GNU General Public License for more details.
14 #--
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
17 #-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 #-------------------------------------------------------------------------------
19 #-- Author : Alexis Jeandet
20 #-- Mail : alexis.jeandet@gmail.com
21 #-------------------------------------------------------------------------------*/
22
23 #---------------------------------------------------------------------------------
24 # GCC EXECUTABLES
25 #---------------------------------------------------------------------------------
26 LIBUC_PREFIX = sparc-elf-
27 LIBUC_CC = $(LIBUC_PREFIX)gcc
28 LIBUC_CXX = $(LIBUC_PREFIX)g++
29 LIBUC_AR = $(LIBUC_PREFIX)ar
30 LIBUC_AS = $(LIBUC_PREFIX)as
31 LIBUC_LD = $(LIBUC_PREFIX)ld
32 LIBUC_SIZE = $(LIBUC_PREFIX)size
33 LIBUC_STRIP = $(LIBUC_PREFIX)strip -s
34 LIBUC_READELF = $(LIBUC_PREFIX)readelf
35 LIBUC_OBJCOPY=$(LIBUC_PREFIX)objcopy
36 LIBUC_OBJDUMP=$(LIBUC_PREFIX)objdump
37
38
39
40 #---------------------------------------------------------------------------------
41 # GCC FLAGS
42 #---------------------------------------------------------------------------------
43 LIBUC_FMCU =
44 LIBUC_CFLAGS = $(LIBUC_FMCU)
45 LIBUC_CFLAGS = --std=gnu99 -fgnu89-inline
46 LIBUC_CFLAGS +=
47 LIBUC_LDFLAGS =
48 LIBUC_ODFLAGS = -x --syms
49 LIBUC_CPFLAGS =
50 LIBUC_CFLAGS_WARN_ON = -Wall
51 LIBUC_CFLAGS_WARN_OFF = -w
52 LIBUC_CFLAGS_RELEASE = -O2
53 LIBUC_CFLAGS_DEBUG = -g
54 LIBUC_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -g
55 LIBUC_CFLAGS_STATIC_LIB = -fPIC
56 LIBUC_CFLAGS_SOFT_FPU = -msoft-float
57 LIBUC_CFLAGS_HARD_FPU =
58
59 LIBUC_CXXFLAGS = $(LIBUC_FMCU)
60 LIBUC_CXXFLAGS += -g -gdwarf-2
61 LIBUC_CXXFLAGS += -Wextra -Wundef -Wcast-align -msoft-float
62 LIBUC_CXXFLAGS_WARN_ON = -Wall
63 LIBUC_CXXFLAGS_WARN_OFF = -w
64 LIBUC_CXXFLAGS_RELEASE = -O2
65 LIBUC_CXXFLAGS_DEBUG = -g
66 LIBUC_CXXFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -g
67 LIBUC_CXXFLAGS_STATIC_LIB = -fPIC
68 LIBUC_CXXFLAGS_SOFT_FPU = -msoft-float
69 LIBUC_CXXFLAGS_HARD_FPU =
70
71 #---------------------------------------------------------------------------------
72 # LIBRARY DEFINITIONS
73 #---------------------------------------------------------------------------------
74
75 LIBUC_LIBS_DIR = $(LIBUC)/lib/bin/LEON3
76 LIBUC_INC_DIR = $(LIBUC)/lib/includes/LEON3
77 include $(LIBUC)/rules/common/libsrules.mk
78
79 #---------------------------------------------------------------------------------
80 # BOARD SUPORT PACKAGES
81 #---------------------------------------------------------------------------------
82 LIBUC_BSP_DIR=$(LIBUC)/bsp
83 LIBUC_BSP_BIN_DIR= $(LIBUC_BSP_DIR)/bin
84 LIBUC_BSP_INC_DIR= $(LIBUC_BSP_DIR)/includes
85 LIBUC_BSP = -L $(LIBUC_BSP_BIN_DIR)/$(BSP) -static -lbsp
86 LIBUC_BSP_INC = -I $(LIBUC_BSP_INC_DIR)/$(BSP)
87 #---------------------------------------------------------------------------------
88 # DEVICE SPECIAL FILES
89 #---------------------------------------------------------------------------------
90
91
92
93 #---------------------------------------------------------------------------------
94 # RULES
95 #---------------------------------------------------------------------------------
96
97 all:
98 @echo "sparc-elf-gcc rules"
99
100
101 bin: $(BINDIR)/$(TARGET).bin $(BINDIR)/$(TARGET).hex
102 @echo "compile bin"
103
104
105
106 lib: $(TARGETINSTALLPATH)/$(TARGET).a
107 @echo "compile lib"
108
109 %.a: $(OBJECTFILES)
110 mkdir -p $(TARGETINSTALLPATH)
111 mkdir -p $(HEADERSINSTALLPATH)
112 $(LIBUC_AR) rcs $@ $(OBJECTFILES) #$(LIBUC_AR) rcs $(TARGETINSTALLPATH)/$@ $(OBJECTFILES)
113 cp -f $(HEADERS) $(HEADERSINSTALLPATH)/
114
115
116
117 $(OBJECTFILES) : $(OBJDIR)/%.o : %.c $(INC_LIBS_DEPS) $(HEADERS)
118 mkdir -p $(OBJDIR)
119 $(LIBUC_CC) -O3 -I $(LIBUC_INCLUDES) $(LIBUC_BSP_INC) -c $(LIBUC_CFLAGS) $< -o $@
120
121
122 %.elf: $(OBJECTFILES)
123 mkdir -p $(BINDIR)
124 $(LIBUC_CC) $(LIBUC_LDFLAGS) $^ -o $@ $(LIBUC_BSP) $(LIBUC_LIBRARIES)
125
126
127 %.bin: %.elf $(BIN_LIBS_DEPS)
128 $(LIBUC_OBJCOPY) $(LIBUC_CPFLAGS) -O binary $< $*.bin
129
130
131 %.hex: %.elf
132 $(LIBUC_OBJCOPY) $(LIBUC_CPFLAGS) -O ihex $< $*.hex
133
134
135 clean:
136 rm -f *.o *.d *.bin *.hex *.dump *.map *.a
137 rm -f $(OBJECTFILES)
138 rm -f $(BINDIR)/*.bin
139 rm -f $(BINDIR)/*.hex
140 rm -f $(BINDIR)/*.dump
141 rm -f $(BINDIR)/*.map
142 rm -f $(BINDIR)/*.a
143 rm -f $(DEVSOURCESND)
144
145 distclean:
146 rm -f $(TARGETINSTALLPATH)/*.bin
147 rm -f $(TARGETINSTALLPATH)/*.a
148
149
150
151
152
153
154
155
156
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
This diff has been collapsed as it changes many lines, (530 lines changed) Show them Hide them
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now