##// 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 PROJECTDIR = `pwd`
2 PROJECTDIR = `pwd`
3 LIBUC = /opt/libuc2
3 LIBUC = /opt/libuc2
4 include $(LIBUC)/rules/common/rules.mk
4 include $(LIBUC)/rules/common/rules.mk
5
5
6 all:subdir
6 all:subdir
7 make -C generic
7 make -C generic
8 make -C LandTiger
8 make -C LandTiger
9 make -C LandTigerdualssp
9 make -C LandTigerdualssp
10 make -C mbed
10 make -C mbed
11 make -C LFR-142200
11 @echo Code compiled
12 @echo Code compiled
12
13
13 clean:
14 clean:
14 make clean -C generic
15 make clean -C generic
15 make clean -C LandTiger
16 make clean -C LandTiger
16 make clean -C LandTigerdualssp
17 make clean -C LandTigerdualssp
17 make clean -C mbed
18 make clean -C mbed
19 make clean -C LFR-142200
18 @echo Code compiled
20 @echo Code compiled
19
21
@@ -1,5 +1,13
1 TEMPLATE = dir
1 TEMPLATE = dir
2 SUBDIRS += generic \
2 SUBDIRS += generic \
3 LandTiger \
3 LandTiger \
4 LandTigerdualssp \
4 LandTigerdualssp \
5 mbed
5 mbed \
6 LFR-142200
7
8
9
10
11
12
13
@@ -1,30 +1,9
1
1
2 PROJECTDIR = `pwd`
2 PROJECTDIR = `pwd`
3 LIBUC = /opt/libuc2
3 LIBUC = /opt/libuc2
4
4
5 HEADERSINSTALLPATH = $(LIBUC_BSP_INC_DIR)/generic
5 all:
6 HEADERS += bsp.h
6 make -f lpc17XX.mk
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
24
7
25 clean:
8 clean:
26 rm -f $(OBJDIR)/*.o
9 make clean -f lpc17XX.mk
27 rm -f $(TARGETINSTALLPATH)/*.a
28 rm -f $(HEADERSINSTALLPATH)/*.h
29 rm -f $(DEVSOURCESND)
30 rm -f *.d
@@ -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 TEMPLATE = lib
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 +=
3 lpc17XX.ARCH = lpc17XX-arm-noabi-gcc
8
4 lpc17XX.TARGET = libbsp
9 SOURCES += bsp.c
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 PROJECTDIR = `pwd`
2 PROJECTDIR = `pwd`
3 LIBUC = /opt/libuc2
3 LIBUC = /opt/libuc2
4 include $(LIBUC)/rules/common/rules.mk
4 include $(LIBUC)/rules/common/rules.mk
5
5
6 all:subdir
6 all:subdir
7 make -C lpc17XX
7 make -C lpc17XX
8 make -C SDCARD
8 make -C SDCARD
9 make -C SDCARD2
9 make -C SDCARD2
10 make -C MP3Player
10 make -C MP3Player
11 make -C LFR
11 @echo Code compiled
12 @echo Code compiled
12
13
13 clean:
14 clean:
14 make clean -C lpc17XX
15 make clean -C lpc17XX
15 make clean -C SDCARD
16 make clean -C SDCARD
16 make clean -C SDCARD2
17 make clean -C SDCARD2
17 make clean -C MP3Player
18 make clean -C MP3Player
19 make clean -C LFR
18 @echo Code compiled
20 @echo Code compiled
19
21
@@ -1,5 +1,12
1 TEMPLATE = dir
1 TEMPLATE = dir
2 SUBDIRS += lpc17XX \
2 SUBDIRS += lpc17XX \
3 SDCARD \
3 SDCARD \
4 SDCARD2 \
4 SDCARD2 \
5 MP3Player
5 MP3Player \
6 LFR
7
8
9
10
11
12
@@ -1,107 +1,117
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 #include "LPC17xx.h"
23 #include "LPC17xx.h"
24 #include "bsp.h"
24 #include "bsp.h"
25 #include "core.h"
25 #include "core.h"
26 #include "uart.h"
26 #include "uart.h"
27 #include "libucstrings.h"
27 #include "libucstrings.h"
28 #define __delay(t) for(volatile int i=0;i<t;i++);
28 #define __delay(t) for(volatile int i=0;i<t;i++);
29 #define ledspos1 LED1_OFF;LED2_ON;LED3_OFF;LED4_ON;LED5_OFF;LED6_ON;LED7_OFF;LED8_ON
29 #define ledspos1 LED1_OFF;LED2_ON;LED3_OFF;LED4_ON;LED5_OFF;LED6_ON;LED7_OFF;LED8_ON
30 #define ledspos2 LED1_ON;LED2_OFF;LED3_ON;LED4_OFF;LED5_ON;LED6_OFF;LED7_ON;LED8_OFF
30 #define ledspos2 LED1_ON;LED2_OFF;LED3_ON;LED4_OFF;LED5_ON;LED6_OFF;LED7_ON;LED8_OFF
31 #define tableSize 256
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 void eepromTest();
37 void eepromTest();
35
38
36 int main (void)
39 int main (void)
37 {
40 {
41 int i=0;
42 volatile int16_t* testptr = 0x2007C000 + (16*1024) - 6;
38 bsp_init();
43 bsp_init();
39 uartsetbaudrate(UART0,38400);
44 uartsetbaudrate(UART0,38400);
40 eepromTest();
45 eepromTest();
41 libucprintf("CPU Freq =%dMHz\n\r",currentCpuFreq/1000000);
46 libucprintf("CPU Freq =%dMHz\n\r",currentCpuFreq/1000000);
42 libucprintf("IIC Freq =%dKHz\n\r",i2cgetdatarate(IIC0)/1000);
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 while(1)
53 while(1)
44 {
54 {
45 ledspos1;
55 ledspos1;
46
56
47 __delay(1024*1024);
57 __delay(1024*1024);
48 ledspos2;
58 ledspos2;
49
59
50 __delay(1024*1024);
60 __delay(1024*1024);
51
61
52 }
62 }
53 return 0;
63 return 0;
54
64
55 }
65 }
56
66
57
67
58
68
59
69
60
70
61 void eepromTest()
71 void eepromTest()
62 {
72 {
63 unsigned char val1,val2;
73 unsigned char val1,val2;
64 unsigned char table1[256];
74 unsigned char table1[256];
65 unsigned char table2[256];
75 unsigned char table2[256];
66 int i=0;
76 int i=0;
67 for(i=0;i<tableSize;i++)table1[i]=i;
77 for(i=0;i<tableSize;i++)table1[i]=i;
68 libucprintf("Writing 0x56 @ 0x10...");
78 libucprintf("Writing 0x56 @ 0x10...");
69 eeprom24lc0xbytewrite(eeprom0,0x10,0x56);
79 eeprom24lc0xbytewrite(eeprom0,0x10,0x56);
70 libucprintf("\tdone\n\r");
80 libucprintf("\tdone\n\r");
71 libucprintf("Writing 0xF1 @ 0x39...");
81 libucprintf("Writing 0xF1 @ 0x39...");
72 eeprom24lc0xbytewrite(eeprom0,0x39,0xF1);
82 eeprom24lc0xbytewrite(eeprom0,0x39,0xF1);
73 libucprintf("\tdone\n\r");
83 libucprintf("\tdone\n\r");
74 libucprintf("Reading @ 0x10 ...");
84 libucprintf("Reading @ 0x10 ...");
75 val1=eeprom24lc0xbyteread(eeprom0,0x10);
85 val1=eeprom24lc0xbyteread(eeprom0,0x10);
76 libucprintf("\tdone result = 0x%X\n\r",val1);
86 libucprintf("\tdone result = 0x%X\n\r",val1);
77 libucprintf("Reading @ 0x39 ...");
87 libucprintf("Reading @ 0x39 ...");
78 val2=eeprom24lc0xbyteread(eeprom0,0x39);
88 val2=eeprom24lc0xbyteread(eeprom0,0x39);
79 libucprintf("\tdone result = 0x%X\n\r",val2);
89 libucprintf("\tdone result = 0x%X\n\r",val2);
80
90
81
91
82 libucprintf("Writing folowing table @ 0x00");
92 libucprintf("Writing folowing table @ 0x00");
83 libucprintchartable(table1,tableSize,"0x%X"," ");
93 libucprintchartable(table1,tableSize,"0x%X"," ");
84 libucprintf("...");
94 libucprintf("...");
85 eeprom24lc0xwriten(eeprom0,0,table1, tableSize);
95 eeprom24lc0xwriten(eeprom0,0,table1, tableSize);
86 libucprintf("\tdone\n\r");
96 libucprintf("\tdone\n\r");
87 libucprintf("Reading table @ 0x00 ...");
97 libucprintf("Reading table @ 0x00 ...");
88 eeprom24lc0xreadn(eeprom0,0,table2, tableSize);
98 eeprom24lc0xreadn(eeprom0,0,table2, tableSize);
89 libucprintf("\tdone\n\r");
99 libucprintf("\tdone\n\r");
90 libucprintf("result = ");
100 libucprintf("result = ");
91 libucprintchartable(table2,tableSize,"0x%X"," ");
101 libucprintchartable(table2,tableSize,"0x%X"," ");
92 libucprintf("\n\r");
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 PROJECTDIR = `pwd`
2 PROJECTDIR = `pwd`
3 LIBUC = /opt/libuc2
3 LIBUC = /opt/libuc2
4 include $(LIBUC)/rules/common/rules.mk
4 include $(LIBUC)/rules/common/rules.mk
5
5
6 all:subdir
6 all:subdir
7 make -C common/UHANDLE
7 make -C common/UHANDLE
8 make -C lpc21XX
8 make -C lpc21XX
9 make -C lpc17XX
9 make -C lpc17XX
10 make -C LEON3
10 make -C common
11 make -C common
11 make -C apps
12 make -C apps
12 @echo Code compiled
13 @echo Code compiled
13
14
14 clean:
15 clean:
15 make clean -C common/UHANDLE
16 make clean -C common/UHANDLE
16 make clean -C lpc21XX
17 make clean -C lpc21XX
17 make clean -C lpc17XX
18 make clean -C lpc17XX
19 make clean -C LEON3
18 make clean -C common
20 make clean -C common
19 make clean -C apps
21 make clean -C apps
20 @echo Code compiled
22 @echo Code compiled
21
23
@@ -1,112 +1,151
1 #---------------------------------------------------------------------------------
1 #---------------------------------------------------------------------------------
2 # LIBRARY DEFINITIONS
2 # LIBRARY DEFINITIONS
3 #---------------------------------------------------------------------------------
3 #---------------------------------------------------------------------------------
4 LIBUC_LIBS =
4 LIBUC_LIBS =
5
5 LIBUC_LIBS_CORE = -static -lcore
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
6 LIBUC_LIBS_UCSTRINGS = -static -lucstrings
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
7 LIBUC_LIBS_UART = -static -luart
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
8 LIBUC_LIBS_SPI = -static -lspi
30 LIBUC_LIBS_SPI = -static -lspi
9 LIBUC_LIBS_SSP = -static -lssp
10 LIBUC_LIBS_IIC = -static -liic
11 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
24
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
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
29 LIBUC_LIBS_DIR_SSP = $(LIBUC_LIBS_DIR)/SSP
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
42 LIBUC_LIBS_IIC = -static -liic
30 LIBUC_LIBS_DIR_IIC = $(LIBUC_LIBS_DIR)/IIC
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
48 LIBUC_LIBS_ADC = -static -ladc
31 LIBUC_LIBS_DIR_ADC = $(LIBUC_LIBS_DIR)/ADC
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)
53
54 LIBUC_LIBS_24LC0X = -static -l24lc0X
32 LIBUC_LIBS_DIR_24LC0X = $(LIBUC_LIBS_DIR)/24LCXX/24LC0X
55 LIBUC_LIBS_DIR_24LC0X = $(LIBUC_LIBS_DIR)/24LCXX/24LC0X
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)
59
60 LIBUC_LIBS_SDCARD = -static -lsdcard
33 LIBUC_LIBS_DIR_SDCARD = $(LIBUC_LIBS_DIR)/SDCARD
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
34 LIBUC_LIBS_DIR_VS10XX = $(LIBUC_LIBS_DIR)/VS10XX
67 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
43
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)
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
54 LIBUC_LIBS_DIR_BLKDEVICE_CMD = -L $(LIBUC_LIBS_DIR_BLKDEVICE)
74 LIBUC_LIBS_DIR_BLKDEVICE_CMD = -L $(LIBUC_LIBS_DIR_BLKDEVICE)
55 LIBUC_LIBS_DIR_FAT32_CMD = -L $(LIBUC_LIBS_DIR_FAT32)
75 LIBUC_INC_DIR_BLKDEVICE = $(LIBUC_INC_DIR)/BLKDEVICE
56 LIBUC_LIBS_DIR_UHANDLE_CMD = -L $(LIBUC_LIBS_DIR_UHANDLE)
76 LIBUC_INC_DIR_BLKDEVICE_CMD = -I $(LIBUC_INC_DIR_BLKDEVICE)
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)
63
77
64 LIBUC_INC_DIR_CORE = $(LIBUC_INC_DIR)/CORE
78 LIBUC_LIBS_FAT32 = -static -lfat32
65 LIBUC_INC_DIR_UCSTRINGS = $(LIBUC_INC_DIR)/STRINGS/$(ARCH)
79 LIBUC_LIBS_DIR_FAT32 = $(LIBUC_LIBS_DIR)/FAT32
66 LIBUC_INC_DIR_UART = $(LIBUC_INC_DIR)/UART
80 LIBUC_LIBS_DIR_FAT32_CMD = -L $(LIBUC_LIBS_DIR_FAT32)
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
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)
76 LIBUC_INC_DIR_UHANDLE = $(LIBUC_INC_DIR)/UHANDLE
87 LIBUC_INC_DIR_UHANDLE = $(LIBUC_INC_DIR)/UHANDLE
88 LIBUC_INC_DIR_UHANDLE_CMD = -I $(LIBUC_INC_DIR_UHANDLE)
89
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)
77 LIBUC_INC_DIR_HEXVIEWER = $(LIBUC_INC_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)
78 LIBUC_INC_DIR_MBR = $(LIBUC_INC_DIR)/MBR
99 LIBUC_INC_DIR_MBR = $(LIBUC_INC_DIR)/MBR
100 LIBUC_INC_DIR_MBR_CMD = -I $(LIBUC_INC_DIR_MBR)
101
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)
79 LIBUC_INC_DIR_UCDIRENT = $(LIBUC_INC_DIR)/UCDIRENT
105 LIBUC_INC_DIR_UCDIRENT = $(LIBUC_INC_DIR)/UCDIRENT
80 LIBUC_INC_DIR_FS = $(LIBUC_INC_DIR)/FS
106 LIBUC_INC_DIR_UCDIRENT_CMD = -I $(LIBUC_INC_DIR_UCDIRENT)
81 LIBUC_INC_DIR_FSEXPLORER = $(LIBUC_INC_DIR)/FSEXPLORER
82
107
83 LIBUC_INC_DIR_CORE_CMD = -I $(LIBUC_INC_DIR_CORE)
108 LIBUC_LIBS_FS = -static -lfs
84 LIBUC_INC_DIR_UCSTRINGS_CMD = -I $(LIBUC_INC_DIR_UCSTRINGS)
109 LIBUC_LIBS_DIR_FS = $(LIBUC_LIBS_DIR)/FS
85 LIBUC_INC_DIR_UART_CMD = -I $(LIBUC_INC_DIR_UART)
110 LIBUC_LIBS_DIR_FS_CMD = -L $(LIBUC_LIBS_DIR_FS)
86 LIBUC_INC_DIR_SPI_CMD = -I $(LIBUC_INC_DIR_SPI)
111 LIBUC_INC_DIR_FS = $(LIBUC_INC_DIR)/FS
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)
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)
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)
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)
101 LIBUC_INC_DIR_FSEXPLORER_CMD = -I $(LIBUC_INC_DIR_FSEXPLORER)
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 /* THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
1 /* THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
2 * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
2 * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
3 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
3 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
4 * THE AUTHORS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
4 * THE AUTHORS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
5 * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. USE IT AT YOUR OWN RISK */
5 * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. USE IT AT YOUR OWN RISK */
6
6
7 MEMORY
7 MEMORY
8 {
8 {
9 /* LPC1768 : 512k ROM + 64k SRAM */
9 /* LPC1768 : 512k ROM + 64k SRAM */
10 /*------------------------------ */
10 /*------------------------------ */
11
11
12 /* On-chip ROM is a readable (r), executable region (x) */
12 /* On-chip ROM is a readable (r), executable region (x) */
13 /* On-chip SRAM is a readable (r), writable (w) and */
13 /* On-chip SRAM is a readable (r), writable (w) and */
14 /* executable region (x) */
14 /* executable region (x) */
15
15
16 /* Main ROM region - 512k for LPC1768 */
16 /* Main ROM region - 512k for LPC1768 */
17 IROM (rx) : ORIGIN = 0x00000000, LENGTH = 512k
17 IROM (rx) : ORIGIN = 0x00000000, LENGTH = 512k
18
18
19 /* local static RAM - 32k for LPC1756 */
19 /* local static RAM - 32k for LPC1756 */
20 IRAM0 (rwx) : ORIGIN = 0x10000000, LENGTH = 32k
20 IRAM0 (rwx) : ORIGIN = 0x10000000, LENGTH = 32k
21
21
22 /* AHB SRAM - 16k for LPC1756 - often used for USB */
22 /* AHB SRAM - 16k for LPC1756 - often used for USB */
23 IRAM1 (rwx) : ORIGIN = 0x2007C000, LENGTH = 16k
23 IRAM1 (rwx) : ORIGIN = 0x2007C000, LENGTH = 16k
24 IRAM2 (rwx) : ORIGIN = 0x20080000, LENGTH = 16k
24 IRAM2 (rwx) : ORIGIN = 0x20080000, LENGTH = 16k
25 }
25 }
26
26
27 /* SECTION command : Define mapping of input sections */
27 /* SECTION command : Define mapping of input sections */
28 /* into output sections. */
28 /* into output sections. */
29
29
30 SECTIONS
30 SECTIONS
31 {
31 {
32 /******************************************/
32 /******************************************/
33 /* code section */
33 /* code section */
34
34
35 /* "normal" code */
35 /* "normal" code */
36
36
37 .text :
37 .text :
38 {
38 {
39 KEEP(*(.isr_vector .isr_vector.*))
39 KEEP(*(.isr_vector .isr_vector.*))
40 *(.text .text.*)
40 *(.text .text.*)
41 *(.gnu.linkonce.t.*)
41 *(.gnu.linkonce.t.*)
42 *(.glue_7)
42 *(.glue_7)
43 *(.glue_7t)
43 *(.glue_7t)
44 *(.gcc_except_table)
44 *(.gcc_except_table)
45 *(.rodata .rodata*)
45 *(.rodata .rodata*)
46 *(.gnu.linkonce.r.*)
46 *(.gnu.linkonce.r.*)
47 } >IROM
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 /* .ctors .dtors are used for c++ constructors/destructors */
59 /* .ctors .dtors are used for c++ constructors/destructors */
51 .ctors :
60 .ctors :
52 {
61 {
53 . = ALIGN(4);
62 . = ALIGN(4);
54 PROVIDE(__ctors_start = .);
63 PROVIDE(__ctors_start = .);
55 KEEP(*(SORT(.ctors.*)))
64 KEEP(*(SORT(.ctors.*)))
56 KEEP(*(.ctors))
65 KEEP(*(.ctors))
57 PROVIDE(__ctors_end = .);
66 PROVIDE(__ctors_end = .);
58 } >IROM
67 } >IROM
59
68
60 .dtors :
69 .dtors :
61 {
70 {
62 . = ALIGN(4);
71 . = ALIGN(4);
63 PROVIDE(__dtors_start = .);
72 PROVIDE(__dtors_start = .);
64 KEEP(*(SORT(.dtors.*)))
73 KEEP(*(SORT(.dtors.*)))
65 KEEP(*(.dtors))
74 KEEP(*(.dtors))
66 PROVIDE(__dtors_end = .);
75 PROVIDE(__dtors_end = .);
67
76
68 . = ALIGN(4);
77 . = ALIGN(4);
69 /* End Of .text section */
78 /* End Of .text section */
70 _etext = .;
79 _etext = .;
71 _sifastcode = .;
80 _sifastcode = .;
72 } >IROM
81 } >IROM
73
82
74 /**************************************************/
83 /**************************************************/
75 /* fastcode - copied at startup & executed in RAM */
84 /* fastcode - copied at startup & executed in RAM */
76
85
77 .fastcode :
86 .fastcode :
78 {
87 {
79 . = ALIGN (4);
88 . = ALIGN (4);
80 _sfastcode = . ;
89 _sfastcode = . ;
81
90
82 *(.glue_7t) *(.glue_7)
91 *(.glue_7t) *(.glue_7)
83 *(.fastcode)
92 *(.fastcode)
84
93
85 /* add other modules here ... */
94 /* add other modules here ... */
86
95
87 . = ALIGN (4);
96 . = ALIGN (4);
88 _efastcode = . ;
97 _efastcode = . ;
89 _sidata = .;
98 _sidata = .;
90 } >IRAM0 AT>IROM
99 } >IRAM0 AT>IROM
91
100
92 /******************************************/
101 /******************************************/
93 /* This used for USB RAM section */
102 /* This used for USB RAM section */
94 .usb_ram (NOLOAD):
103 .usb_ram (NOLOAD):
95 {
104 {
96 *.o (USB_RAM)
105 *.o (USB_RAM)
97 } > IRAM1
106 } > IRAM1
98
107
99 /******************************************/
108 /******************************************/
100 /* data section */
109 /* data section */
101 .data :
110 .data :
102 {
111 {
103 _sidata = LOADADDR (.data);
112 _sidata = LOADADDR (.data);
104 . = ALIGN(4);
113 . = ALIGN(4);
105 _sdata = .;
114 _sdata = .;
106
115
107 *(vtable vtable.*)
116 *(vtable vtable.*)
108 *(.data .data.*)
117 *(.data .data.*)
109 *(.gnu.linkonce.d*)
118 *(.gnu.linkonce.d*)
110
119
111 . = ALIGN(4);
120 . = ALIGN(4);
112 _edata = . ;
121 _edata = . ;
113 } >IRAM0 AT>IROM
122 } >IRAM0 AT>IROM
114
123
115 /******************************************/
124 /******************************************/
116 /* For no-init variables section */
125 /* For no-init variables section */
117 .bss (NOLOAD) :
126 .bss (NOLOAD) :
118 {
127 {
119 . = ALIGN(4);
128 . = ALIGN(4);
120 _sbss = . ;
129 _sbss = . ;
121
130
122 *(.bss .bss.*)
131 *(.bss .bss.*)
123 *(.gnu.linkonce.b*)
132 *(.gnu.linkonce.b*)
124 *(COMMON)
133 *(COMMON)
125
134
126 . = ALIGN(4);
135 . = ALIGN(4);
127 _ebss = . ;
136 _ebss = . ;
128 } >IRAM0
137 } >IRAM0
129
138
130 /******************************************/
139 /******************************************/
131 /* For stack section */
140 /* For stack section */
132 .stackarea (NOLOAD) :
141 .stackarea (NOLOAD) :
133 {
142 {
134 . = ALIGN(8);
143 . = ALIGN(8);
135 _sstack = .;
144 _sstack = .;
136
145
137 *(.stackarea .stackarea.*)
146 *(.stackarea .stackarea.*)
138
147
139 . = ALIGN(8);
148 . = ALIGN(8);
140 _estack = .;
149 _estack = .;
141
150
142 . = ALIGN(4);
151 . = ALIGN(4);
143 _end = . ;
152 _end = . ;
144 PROVIDE (end = .);
153 PROVIDE (end = .);
145
154
146 } > IRAM0
155 } > IRAM0
147
156
148 /******************************************/
157 /******************************************/
149 /* Stabs debugging sections. */
158 /* Stabs debugging sections. */
150 .stab 0 : { *(.stab) }
159 .stab 0 : { *(.stab) }
151 .stabstr 0 : { *(.stabstr) }
160 .stabstr 0 : { *(.stabstr) }
152 .stab.excl 0 : { *(.stab.excl) }
161 .stab.excl 0 : { *(.stab.excl) }
153 .stab.exclstr 0 : { *(.stab.exclstr) }
162 .stab.exclstr 0 : { *(.stab.exclstr) }
154 .stab.index 0 : { *(.stab.index) }
163 .stab.index 0 : { *(.stab.index) }
155 .stab.indexstr 0 : { *(.stab.indexstr) }
164 .stab.indexstr 0 : { *(.stab.indexstr) }
156 /* .comment 0 : { *(.comment) } */
165 /* .comment 0 : { *(.comment) } */
157 /* DWARF debug sections.
166 /* DWARF debug sections.
158 Symbols in the DWARF debugging sections are relative to the beginning
167 Symbols in the DWARF debugging sections are relative to the beginning
159 of the section so we begin them at 0. */
168 of the section so we begin them at 0. */
160 /* DWARF 1 */
169 /* DWARF 1 */
161 .debug 0 : { *(.debug) }
170 .debug 0 : { *(.debug) }
162 .line 0 : { *(.line) }
171 .line 0 : { *(.line) }
163 /* GNU DWARF 1 extensions */
172 /* GNU DWARF 1 extensions */
164 .debug_srcinfo 0 : { *(.debug_srcinfo) }
173 .debug_srcinfo 0 : { *(.debug_srcinfo) }
165 .debug_sfnames 0 : { *(.debug_sfnames) }
174 .debug_sfnames 0 : { *(.debug_sfnames) }
166 /* DWARF 1.1 and DWARF 2 */
175 /* DWARF 1.1 and DWARF 2 */
167 .debug_aranges 0 : { *(.debug_aranges) }
176 .debug_aranges 0 : { *(.debug_aranges) }
168 .debug_pubnames 0 : { *(.debug_pubnames) }
177 .debug_pubnames 0 : { *(.debug_pubnames) }
169 /* DWARF 2 */
178 /* DWARF 2 */
170 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
179 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
171 .debug_abbrev 0 : { *(.debug_abbrev) }
180 .debug_abbrev 0 : { *(.debug_abbrev) }
172 .debug_line 0 : { *(.debug_line) }
181 .debug_line 0 : { *(.debug_line) }
173 .debug_frame 0 : { *(.debug_frame) }
182 .debug_frame 0 : { *(.debug_frame) }
174 .debug_str 0 : { *(.debug_str) }
183 .debug_str 0 : { *(.debug_str) }
175 .debug_loc 0 : { *(.debug_loc) }
184 .debug_loc 0 : { *(.debug_loc) }
176 .debug_macinfo 0 : { *(.debug_macinfo) }
185 .debug_macinfo 0 : { *(.debug_macinfo) }
177 /* SGI/MIPS DWARF 2 extensions */
186 /* SGI/MIPS DWARF 2 extensions */
178 .debug_weaknames 0 : { *(.debug_weaknames) }
187 .debug_weaknames 0 : { *(.debug_weaknames) }
179 .debug_funcnames 0 : { *(.debug_funcnames) }
188 .debug_funcnames 0 : { *(.debug_funcnames) }
180 .debug_typenames 0 : { *(.debug_typenames) }
189 .debug_typenames 0 : { *(.debug_typenames) }
181 .debug_varnames 0 : { *(.debug_varnames) }
190 .debug_varnames 0 : { *(.debug_varnames) }
182 }
191 }
@@ -1,288 +1,298
1 /****************************************************************************//**
1 /****************************************************************************//**
2 * @file : startup_LPC17xx.c
2 * @file : startup_LPC17xx.c
3 * @brief : CMSIS Cortex-M3 Core Device Startup File
3 * @brief : CMSIS Cortex-M3 Core Device Startup File
4 * @version : V1.01
4 * @version : V1.01
5 * @date : 4. Feb. 2009
5 * @date : 4. Feb. 2009
6 *
6 *
7 *----------------------------------------------------------------------------
7 *----------------------------------------------------------------------------
8 *
8 *
9 * Copyright (C) 2009 ARM Limited. All rights reserved.
9 * Copyright (C) 2009 ARM Limited. All rights reserved.
10 *
10 *
11 * ARM Limited (ARM) is supplying this software for use with Cortex-Mx
11 * ARM Limited (ARM) is supplying this software for use with Cortex-Mx
12 * processor based microcontrollers. This file can be freely distributed
12 * processor based microcontrollers. This file can be freely distributed
13 * within development tools that are supporting such ARM based processors.
13 * within development tools that are supporting such ARM based processors.
14 *
14 *
15 * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
15 * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
16 * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
16 * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
17 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
17 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
18 * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
18 * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
19 * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
19 * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
20 *
20 *
21 ******************************************************************************/
21 ******************************************************************************/
22
22
23 // Mod by nio for the .fastcode part
23 // Mod by nio for the .fastcode part
24
24
25 #include "LPC17xx.h"
25 #include "LPC17xx.h"
26
26
27 #define WEAK __attribute__ ((weak))
27 #define WEAK __attribute__ ((weak))
28 //*****************************************************************************
28 //*****************************************************************************
29 //
29 //
30 // Forward declaration of the default fault handlers.
30 // Forward declaration of the default fault handlers.
31 //
31 //
32 //*****************************************************************************
32 //*****************************************************************************
33 /* System exception vector handler */
33 /* System exception vector handler */
34 void WEAK Reset_Handler(void); /* Reset Handler */
34 void WEAK Reset_Handler(void); /* Reset Handler */
35 void WEAK NMI_Handler(void); /* NMI Handler */
35 void WEAK NMI_Handler(void); /* NMI Handler */
36 void WEAK HardFault_Handler(void); /* Hard Fault Handler */
36 void WEAK HardFault_Handler(void); /* Hard Fault Handler */
37 void WEAK MemManage_Handler(void); /* MPU Fault Handler */
37 void WEAK MemManage_Handler(void); /* MPU Fault Handler */
38 void WEAK BusFault_Handler(void); /* Bus Fault Handler */
38 void WEAK BusFault_Handler(void); /* Bus Fault Handler */
39 void WEAK UsageFault_Handler(void); /* Usage Fault Handler */
39 void WEAK UsageFault_Handler(void); /* Usage Fault Handler */
40 void WEAK SVC_Handler(void); /* SVCall Handler */
40 void WEAK SVC_Handler(void); /* SVCall Handler */
41 void WEAK DebugMon_Handler(void); /* Debug Monitor Handler */
41 void WEAK DebugMon_Handler(void); /* Debug Monitor Handler */
42 void WEAK PendSV_Handler(void); /* PendSV Handler */
42 void WEAK PendSV_Handler(void); /* PendSV Handler */
43 void WEAK SysTick_Handler(void); /* SysTick Handler */
43 void WEAK SysTick_Handler(void); /* SysTick Handler */
44
44
45 /* External interrupt vector handler */
45 /* External interrupt vector handler */
46 void WEAK WDT_IRQHandler(void); /* Watchdog Timer */
46 void WEAK WDT_IRQHandler(void); /* Watchdog Timer */
47 void WEAK TIMER0_IRQHandler(void); /* Timer0 */
47 void WEAK TIMER0_IRQHandler(void); /* Timer0 */
48 void WEAK TIMER1_IRQHandler(void); /* Timer1 */
48 void WEAK TIMER1_IRQHandler(void); /* Timer1 */
49 void WEAK TIMER2_IRQHandler(void); /* Timer2 */
49 void WEAK TIMER2_IRQHandler(void); /* Timer2 */
50 void WEAK TIMER3_IRQHandler(void); /* Timer3 */
50 void WEAK TIMER3_IRQHandler(void); /* Timer3 */
51 void WEAK UART0_IRQHandler(void); /* UART0 */
51 void WEAK UART0_IRQHandler(void); /* UART0 */
52 void WEAK UART1_IRQHandler(void); /* UART1 */
52 void WEAK UART1_IRQHandler(void); /* UART1 */
53 void WEAK UART2_IRQHandler(void); /* UART2 */
53 void WEAK UART2_IRQHandler(void); /* UART2 */
54 void WEAK UART3_IRQHandler(void); /* UART3 */
54 void WEAK UART3_IRQHandler(void); /* UART3 */
55 void WEAK PWM1_IRQHandler(void); /* PWM1 */
55 void WEAK PWM1_IRQHandler(void); /* PWM1 */
56 void WEAK I2C0_IRQHandler(void); /* I2C0 */
56 void WEAK I2C0_IRQHandler(void); /* I2C0 */
57 void WEAK I2C1_IRQHandler(void); /* I2C1 */
57 void WEAK I2C1_IRQHandler(void); /* I2C1 */
58 void WEAK I2C2_IRQHandler(void); /* I2C2 */
58 void WEAK I2C2_IRQHandler(void); /* I2C2 */
59 void WEAK SPI_IRQHandler(void); /* SPI */
59 void WEAK SPI_IRQHandler(void); /* SPI */
60 void WEAK SSP0_IRQHandler(void); /* SSP0 */
60 void WEAK SSP0_IRQHandler(void); /* SSP0 */
61 void WEAK SSP1_IRQHandler(void); /* SSP1 */
61 void WEAK SSP1_IRQHandler(void); /* SSP1 */
62 void WEAK PLL0_IRQHandler(void); /* PLL0 (Main PLL) */
62 void WEAK PLL0_IRQHandler(void); /* PLL0 (Main PLL) */
63 void WEAK RTC_IRQHandler(void); /* Real Time Clock */
63 void WEAK RTC_IRQHandler(void); /* Real Time Clock */
64 void WEAK EINT0_IRQHandler(void); /* External Interrupt 0 */
64 void WEAK EINT0_IRQHandler(void); /* External Interrupt 0 */
65 void WEAK EINT1_IRQHandler(void); /* External Interrupt 1 */
65 void WEAK EINT1_IRQHandler(void); /* External Interrupt 1 */
66 void WEAK EINT2_IRQHandler(void); /* External Interrupt 2 */
66 void WEAK EINT2_IRQHandler(void); /* External Interrupt 2 */
67 void WEAK EINT3_IRQHandler(void); /* External Interrupt 3 */
67 void WEAK EINT3_IRQHandler(void); /* External Interrupt 3 */
68 void WEAK ADC_IRQHandler(void); /* A/D Converter */
68 void WEAK ADC_IRQHandler(void); /* A/D Converter */
69 void WEAK BOD_IRQHandler(void); /* Brown Out Detect */
69 void WEAK BOD_IRQHandler(void); /* Brown Out Detect */
70 void WEAK USB_IRQHandler(void); /* USB */
70 void WEAK USB_IRQHandler(void); /* USB */
71 void WEAK CAN_IRQHandler(void); /* CAN */
71 void WEAK CAN_IRQHandler(void); /* CAN */
72 void WEAK DMA_IRQHandler(void); /* GP DMA */
72 void WEAK DMA_IRQHandler(void); /* GP DMA */
73 void WEAK I2S_IRQHandler(void); /* I2S */
73 void WEAK I2S_IRQHandler(void); /* I2S */
74 void WEAK ENET_IRQHandler(void); /* Ethernet */
74 void WEAK ENET_IRQHandler(void); /* Ethernet */
75 void WEAK RIT_IRQHandler(void); /* Repetitive Interrupt Timer */
75 void WEAK RIT_IRQHandler(void); /* Repetitive Interrupt Timer */
76 void WEAK MCPWM_IRQHandler(void); /* Motor Control PWM */
76 void WEAK MCPWM_IRQHandler(void); /* Motor Control PWM */
77 void WEAK QEI_IRQHandler(void); /* Quadrature Encoder Interface */
77 void WEAK QEI_IRQHandler(void); /* Quadrature Encoder Interface */
78 void WEAK PLL1_IRQHandler(void); /* PLL1 (USB PLL) */
78 void WEAK PLL1_IRQHandler(void); /* PLL1 (USB PLL) */
79
79
80
80
81
81
82 /* Exported types --------------------------------------------------------------*/
82 /* Exported types --------------------------------------------------------------*/
83 /* Exported constants --------------------------------------------------------*/
83 /* Exported constants --------------------------------------------------------*/
84 extern unsigned long _etext;
84 extern unsigned long _etext;
85 extern unsigned long _sidata; /* start address for the initialization values of the .data section. defined in linker script */
85 extern unsigned long _sidata; /* start address for the initialization values of the .data section. defined in linker script */
86 extern unsigned long _sdata; /* start address for the .data section. defined in linker script */
86 extern unsigned long _sdata; /* start address for the .data section. defined in linker script */
87 extern unsigned long _edata; /* end address for the .data section. defined in linker script */
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 extern unsigned long _sifastcode; /* start address for the initialization values of the .fastcode section. defined in linker script */
93 extern unsigned long _sifastcode; /* start address for the initialization values of the .fastcode section. defined in linker script */
90 extern unsigned long _sfastcode; /* start address for the .fastcode section. defined in linker script */
94 extern unsigned long _sfastcode; /* start address for the .fastcode section. defined in linker script */
91 extern unsigned long _efastcode; /* end address for the .fastcode section. defined in linker script */
95 extern unsigned long _efastcode; /* end address for the .fastcode section. defined in linker script */
92
96
93 extern unsigned long _sbss; /* start address for the .bss section. defined in linker script */
97 extern unsigned long _sbss; /* start address for the .bss section. defined in linker script */
94 extern unsigned long _ebss; /* end address for the .bss section. defined in linker script */
98 extern unsigned long _ebss; /* end address for the .bss section. defined in linker script */
95
99
96 extern void _estack; /* init value for the stack pointer. defined in linker script */
100 extern void _estack; /* init value for the stack pointer. defined in linker script */
97
101
98
102
99
103
100 /* Private typedef -----------------------------------------------------------*/
104 /* Private typedef -----------------------------------------------------------*/
101 /* function prototypes ------------------------------------------------------*/
105 /* function prototypes ------------------------------------------------------*/
102 void Reset_Handler(void) __attribute__((__interrupt__));
106 void Reset_Handler(void) __attribute__((__interrupt__));
103 extern int main(void);
107 extern int main(void);
104
108
105
109
106 /******************************************************************************
110 /******************************************************************************
107 *
111 *
108 * The minimal vector table for a Cortex M3. Note that the proper constructs
112 * The minimal vector table for a Cortex M3. Note that the proper constructs
109 * must be placed on this to ensure that it ends up at physical address
113 * must be placed on this to ensure that it ends up at physical address
110 * 0x0000.0000.
114 * 0x0000.0000.
111 *
115 *
112 ******************************************************************************/
116 ******************************************************************************/
113 #define STACK_SIZE 0x00000800 /*2kO*/
117 #define STACK_SIZE 0x00000800 /*2kO*/
114
118
115 __attribute__ ((section(".stackarea")))
119 __attribute__ ((section(".stackarea")))
116 /* static */ unsigned long pulStack[STACK_SIZE];
120 /* static */ unsigned long pulStack[STACK_SIZE];
117
121
118
122
119 __attribute__ ((section(".isr_vector")))
123 __attribute__ ((section(".isr_vector")))
120 void (* const g_pfnVectors[])(void) =
124 void (* const g_pfnVectors[])(void) =
121 {
125 {
122 /* &_estack, // The initial stack pointer */
126 /* &_estack, // The initial stack pointer */
123 (void (*)(void))((unsigned long)pulStack + sizeof(pulStack)), // The initial stack pointer
127 (void (*)(void))((unsigned long)pulStack + sizeof(pulStack)), // The initial stack pointer
124 Reset_Handler, /* Reset Handler */
128 Reset_Handler, /* Reset Handler */
125 NMI_Handler, /* NMI Handler */
129 NMI_Handler, /* NMI Handler */
126 HardFault_Handler, /* Hard Fault Handler */
130 HardFault_Handler, /* Hard Fault Handler */
127 MemManage_Handler, /* MPU Fault Handler */
131 MemManage_Handler, /* MPU Fault Handler */
128 BusFault_Handler, /* Bus Fault Handler */
132 BusFault_Handler, /* Bus Fault Handler */
129 UsageFault_Handler, /* Usage Fault Handler */
133 UsageFault_Handler, /* Usage Fault Handler */
130 0, /* Reserved */
134 0, /* Reserved */
131 0, /* Reserved */
135 0, /* Reserved */
132 0, /* Reserved */
136 0, /* Reserved */
133 0, /* Reserved */
137 0, /* Reserved */
134 SVC_Handler, /* SVCall Handler */
138 SVC_Handler, /* SVCall Handler */
135 DebugMon_Handler, /* Debug Monitor Handler */
139 DebugMon_Handler, /* Debug Monitor Handler */
136 0, /* Reserved */
140 0, /* Reserved */
137 PendSV_Handler, /* PendSV Handler */
141 PendSV_Handler, /* PendSV Handler */
138 SysTick_Handler, /* SysTick Handler */
142 SysTick_Handler, /* SysTick Handler */
139
143
140 // External Interrupts
144 // External Interrupts
141 WDT_IRQHandler, /* Watchdog Timer */
145 WDT_IRQHandler, /* Watchdog Timer */
142 TIMER0_IRQHandler, /* Timer0 */
146 TIMER0_IRQHandler, /* Timer0 */
143 TIMER1_IRQHandler, /* Timer1 */
147 TIMER1_IRQHandler, /* Timer1 */
144 TIMER2_IRQHandler, /* Timer2 */
148 TIMER2_IRQHandler, /* Timer2 */
145 TIMER3_IRQHandler, /* Timer3 */
149 TIMER3_IRQHandler, /* Timer3 */
146 UART0_IRQHandler, /* UART0 */
150 UART0_IRQHandler, /* UART0 */
147 UART1_IRQHandler, /* UART1 */
151 UART1_IRQHandler, /* UART1 */
148 UART2_IRQHandler, /* UART2 */
152 UART2_IRQHandler, /* UART2 */
149 UART3_IRQHandler, /* UART3 */
153 UART3_IRQHandler, /* UART3 */
150 PWM1_IRQHandler, /* PWM1 */
154 PWM1_IRQHandler, /* PWM1 */
151 I2C0_IRQHandler, /* I2C0 */
155 I2C0_IRQHandler, /* I2C0 */
152 I2C1_IRQHandler, /* I2C1 */
156 I2C1_IRQHandler, /* I2C1 */
153 I2C2_IRQHandler, /* I2C2 */
157 I2C2_IRQHandler, /* I2C2 */
154 SPI_IRQHandler, /* SPI */
158 SPI_IRQHandler, /* SPI */
155 SSP0_IRQHandler, /* SSP0 */
159 SSP0_IRQHandler, /* SSP0 */
156 SSP1_IRQHandler, /* SSP1 */
160 SSP1_IRQHandler, /* SSP1 */
157 PLL0_IRQHandler, /* PLL0 (Main PLL) */
161 PLL0_IRQHandler, /* PLL0 (Main PLL) */
158 RTC_IRQHandler, /* Real Time Clock */
162 RTC_IRQHandler, /* Real Time Clock */
159 EINT0_IRQHandler, /* External Interrupt 0 */
163 EINT0_IRQHandler, /* External Interrupt 0 */
160 EINT1_IRQHandler, /* External Interrupt 1 */
164 EINT1_IRQHandler, /* External Interrupt 1 */
161 EINT2_IRQHandler, /* External Interrupt 2 */
165 EINT2_IRQHandler, /* External Interrupt 2 */
162 EINT3_IRQHandler, /* External Interrupt 3 */
166 EINT3_IRQHandler, /* External Interrupt 3 */
163 ADC_IRQHandler, /* A/D Converter */
167 ADC_IRQHandler, /* A/D Converter */
164 BOD_IRQHandler, /* Brown Out Detect */
168 BOD_IRQHandler, /* Brown Out Detect */
165 USB_IRQHandler, /* USB */
169 USB_IRQHandler, /* USB */
166 CAN_IRQHandler, /* CAN */
170 CAN_IRQHandler, /* CAN */
167 DMA_IRQHandler, /* GP DMA */
171 DMA_IRQHandler, /* GP DMA */
168 I2S_IRQHandler, /* I2S */
172 I2S_IRQHandler, /* I2S */
169 ENET_IRQHandler, /* Ethernet */
173 ENET_IRQHandler, /* Ethernet */
170 RIT_IRQHandler, /* Repetitive Interrupt Timer */
174 RIT_IRQHandler, /* Repetitive Interrupt Timer */
171 MCPWM_IRQHandler, /* Motor Control PWM */
175 MCPWM_IRQHandler, /* Motor Control PWM */
172 QEI_IRQHandler, /* Quadrature Encoder Interface */
176 QEI_IRQHandler, /* Quadrature Encoder Interface */
173 PLL1_IRQHandler, /* PLL1 (USB PLL) */
177 PLL1_IRQHandler, /* PLL1 (USB PLL) */
174 };
178 };
175
179
176 /*******************************************************************************
180 /*******************************************************************************
177 * Function Name : Reset_Handler
181 * Function Name : Reset_Handler
178 * Description : This is the code that gets called when the processor first starts execution
182 * Description : This is the code that gets called when the processor first starts execution
179 * following a reset event. Only the absolutely necessary set is performed,
183 * following a reset event. Only the absolutely necessary set is performed,
180 * after which the application supplied main() routine is called.
184 * after which the application supplied main() routine is called.
181 * Input :
185 * Input :
182 * Output :
186 * Output :
183 * Return :
187 * Return :
184 *******************************************************************************/
188 *******************************************************************************/
185 void Reset_Handler(void)
189 void Reset_Handler(void)
186 {
190 {
187 SystemInit();
191 SystemInit();
188
192
189 unsigned long *pulDest;
193 unsigned long *pulDest;
190 unsigned long *pulSrc;
194 unsigned long *pulSrc;
191
195
192 //
196 //
193 // Copy the data segment initializers from flash to SRAM in ROM mode
197 // Copy the data segment initializers from flash to SRAM in ROM mode
194 //
198 //
195
199
196 if (&_sidata != &_sdata) { // only if needed
200 if (&_sidata != &_sdata) { // only if needed
197 pulSrc = &_sidata;
201 pulSrc = &_sidata;
198 for(pulDest = &_sdata; pulDest < &_edata; ) {
202 for(pulDest = &_sdata; pulDest < &_edata; ) {
199 *(pulDest++) = *(pulSrc++);
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 // Copy the .fastcode code from ROM to SRAM
213 // Copy the .fastcode code from ROM to SRAM
204
214
205 if (&_sifastcode != &_sfastcode) { // only if needed
215 if (&_sifastcode != &_sfastcode) { // only if needed
206 pulSrc = &_sifastcode;
216 pulSrc = &_sifastcode;
207 for(pulDest = &_sfastcode; pulDest < &_efastcode; ) {
217 for(pulDest = &_sfastcode; pulDest < &_efastcode; ) {
208 *(pulDest++) = *(pulSrc++);
218 *(pulDest++) = *(pulSrc++);
209 }
219 }
210 }
220 }
211
221
212 //
222 //
213 // Zero fill the bss segment.
223 // Zero fill the bss segment.
214 //
224 //
215 for(pulDest = &_sbss; pulDest < &_ebss; )
225 for(pulDest = &_sbss; pulDest < &_ebss; )
216 {
226 {
217 *(pulDest++) = 0;
227 *(pulDest++) = 0;
218 }
228 }
219
229
220 //
230 //
221 // Call the application's entry point.
231 // Call the application's entry point.
222 //
232 //
223 main();
233 main();
224 }
234 }
225
235
226 //*****************************************************************************
236 //*****************************************************************************
227 //
237 //
228 // Provide weak aliases for each Exception handler to the Default_Handler.
238 // Provide weak aliases for each Exception handler to the Default_Handler.
229 // As they are weak aliases, any function with the same name will override
239 // As they are weak aliases, any function with the same name will override
230 // this definition.
240 // this definition.
231 //
241 //
232 //*****************************************************************************
242 //*****************************************************************************
233 #pragma weak MemManage_Handler = Default_Handler /* MPU Fault Handler */
243 #pragma weak MemManage_Handler = Default_Handler /* MPU Fault Handler */
234 #pragma weak BusFault_Handler = Default_Handler /* Bus Fault Handler */
244 #pragma weak BusFault_Handler = Default_Handler /* Bus Fault Handler */
235 #pragma weak UsageFault_Handler = Default_Handler /* Usage Fault Handler */
245 #pragma weak UsageFault_Handler = Default_Handler /* Usage Fault Handler */
236 #pragma weak SVC_Handler = Default_Handler /* SVCall Handler */
246 #pragma weak SVC_Handler = Default_Handler /* SVCall Handler */
237 #pragma weak DebugMon_Handler = Default_Handler /* Debug Monitor Handler */
247 #pragma weak DebugMon_Handler = Default_Handler /* Debug Monitor Handler */
238 #pragma weak PendSV_Handler = Default_Handler /* PendSV Handler */
248 #pragma weak PendSV_Handler = Default_Handler /* PendSV Handler */
239 #pragma weak SysTick_Handler = Default_Handler /* SysTick Handler */
249 #pragma weak SysTick_Handler = Default_Handler /* SysTick Handler */
240
250
241 /* External interrupt vector handler */
251 /* External interrupt vector handler */
242 #pragma weak WDT_IRQHandler = Default_Handler /* Watchdog Timer */
252 #pragma weak WDT_IRQHandler = Default_Handler /* Watchdog Timer */
243 #pragma weak TIMER0_IRQHandler = Default_Handler /* Timer0 */
253 #pragma weak TIMER0_IRQHandler = Default_Handler /* Timer0 */
244 #pragma weak TIMER1_IRQHandler = Default_Handler /* Timer1 */
254 #pragma weak TIMER1_IRQHandler = Default_Handler /* Timer1 */
245 #pragma weak TIMER2_IRQHandler = Default_Handler /* Timer2 */
255 #pragma weak TIMER2_IRQHandler = Default_Handler /* Timer2 */
246 #pragma weak TIMER3_IRQHandler = Default_Handler /* Timer3 */
256 #pragma weak TIMER3_IRQHandler = Default_Handler /* Timer3 */
247 #pragma weak UART0_IRQHandler = Default_Handler /* UART0 */
257 #pragma weak UART0_IRQHandler = Default_Handler /* UART0 */
248 #pragma weak UART1_IRQHandler = Default_Handler /* UART1 */
258 #pragma weak UART1_IRQHandler = Default_Handler /* UART1 */
249 #pragma weak UART2_IRQHandler = Default_Handler /* UART2 */
259 #pragma weak UART2_IRQHandler = Default_Handler /* UART2 */
250 #pragma weak UART3_IRQHandler = Default_Handler /* UART3 */
260 #pragma weak UART3_IRQHandler = Default_Handler /* UART3 */
251 #pragma weak PWM1_IRQHandler = Default_Handler /* PWM1 */
261 #pragma weak PWM1_IRQHandler = Default_Handler /* PWM1 */
252 #pragma weak I2C0_IRQHandler = Default_Handler /* I2C0 */
262 #pragma weak I2C0_IRQHandler = Default_Handler /* I2C0 */
253 #pragma weak I2C1_IRQHandler = Default_Handler /* I2C1 */
263 #pragma weak I2C1_IRQHandler = Default_Handler /* I2C1 */
254 #pragma weak I2C2_IRQHandler = Default_Handler /* I2C2 */
264 #pragma weak I2C2_IRQHandler = Default_Handler /* I2C2 */
255 #pragma weak SPI_IRQHandler = Default_Handler /* SPI */
265 #pragma weak SPI_IRQHandler = Default_Handler /* SPI */
256 #pragma weak SSP0_IRQHandler = Default_Handler /* SSP0 */
266 #pragma weak SSP0_IRQHandler = Default_Handler /* SSP0 */
257 #pragma weak SSP1_IRQHandler = Default_Handler /* SSP1 */
267 #pragma weak SSP1_IRQHandler = Default_Handler /* SSP1 */
258 #pragma weak PLL0_IRQHandler = Default_Handler /* PLL0 (Main PLL) */
268 #pragma weak PLL0_IRQHandler = Default_Handler /* PLL0 (Main PLL) */
259 #pragma weak RTC_IRQHandler = Default_Handler /* Real Time Clock */
269 #pragma weak RTC_IRQHandler = Default_Handler /* Real Time Clock */
260 #pragma weak EINT0_IRQHandler = Default_Handler /* External Interrupt 0 */
270 #pragma weak EINT0_IRQHandler = Default_Handler /* External Interrupt 0 */
261 #pragma weak EINT1_IRQHandler = Default_Handler /* External Interrupt 1 */
271 #pragma weak EINT1_IRQHandler = Default_Handler /* External Interrupt 1 */
262 #pragma weak EINT2_IRQHandler = Default_Handler /* External Interrupt 2 */
272 #pragma weak EINT2_IRQHandler = Default_Handler /* External Interrupt 2 */
263 #pragma weak EINT3_IRQHandler = Default_Handler /* External Interrupt 3 */
273 #pragma weak EINT3_IRQHandler = Default_Handler /* External Interrupt 3 */
264 #pragma weak ADC_IRQHandler = Default_Handler /* A/D Converter */
274 #pragma weak ADC_IRQHandler = Default_Handler /* A/D Converter */
265 #pragma weak BOD_IRQHandler = Default_Handler /* Brown Out Detect */
275 #pragma weak BOD_IRQHandler = Default_Handler /* Brown Out Detect */
266 #pragma weak USB_IRQHandler = Default_Handler /* USB */
276 #pragma weak USB_IRQHandler = Default_Handler /* USB */
267 #pragma weak CAN_IRQHandler = Default_Handler /* CAN */
277 #pragma weak CAN_IRQHandler = Default_Handler /* CAN */
268 #pragma weak DMA_IRQHandler = Default_Handler /* GP DMA */
278 #pragma weak DMA_IRQHandler = Default_Handler /* GP DMA */
269 #pragma weak I2S_IRQHandler = Default_Handler /* I2S */
279 #pragma weak I2S_IRQHandler = Default_Handler /* I2S */
270 #pragma weak ENET_IRQHandler = Default_Handler /* Ethernet */
280 #pragma weak ENET_IRQHandler = Default_Handler /* Ethernet */
271 #pragma weak RIT_IRQHandler = Default_Handler /* Repetitive Interrupt Timer */
281 #pragma weak RIT_IRQHandler = Default_Handler /* Repetitive Interrupt Timer */
272 #pragma weak MCPWM_IRQHandler = Default_Handler /* Motor Control PWM */
282 #pragma weak MCPWM_IRQHandler = Default_Handler /* Motor Control PWM */
273 #pragma weak QEI_IRQHandler = Default_Handler /* Quadrature Encoder Interface */
283 #pragma weak QEI_IRQHandler = Default_Handler /* Quadrature Encoder Interface */
274 #pragma weak PLL1_IRQHandler = Default_Handler /* PLL1 (USB PLL) */
284 #pragma weak PLL1_IRQHandler = Default_Handler /* PLL1 (USB PLL) */
275
285
276 //*****************************************************************************
286 //*****************************************************************************
277 //
287 //
278 // This is the code that gets called when the processor receives an unexpected
288 // This is the code that gets called when the processor receives an unexpected
279 // interrupt. This simply enters an infinite loop, preserving the system state
289 // interrupt. This simply enters an infinite loop, preserving the system state
280 // for examination by a debugger.
290 // for examination by a debugger.
281 //
291 //
282 //*****************************************************************************
292 //*****************************************************************************
283 void Default_Handler(void) {
293 void Default_Handler(void) {
284 // Go into an infinite loop.
294 // Go into an infinite loop.
285 //
295 //
286 while (1) {
296 while (1) {
287 }
297 }
288 }
298 }
@@ -1,92 +1,156
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 = sparc-elf-
26 LIBUC_PREFIX = sparc-elf-
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
31 LIBUC_LD = $(LIBUC_PREFIX)ld
30 LIBUC_SIZE = $(LIBUC_PREFIX)size
32 LIBUC_SIZE = $(LIBUC_PREFIX)size
33 LIBUC_STRIP = $(LIBUC_PREFIX)strip -s
31 LIBUC_READELF = $(LIBUC_PREFIX)readelf
34 LIBUC_READELF = $(LIBUC_PREFIX)readelf
32 LIBUC_OBJCOPY=$(LIBUC_PREFIX)objcopy
35 LIBUC_OBJCOPY=$(LIBUC_PREFIX)objcopy
36 LIBUC_OBJDUMP=$(LIBUC_PREFIX)objdump
33
37
34
38
35
39
36 #---------------------------------------------------------------------------------
40 #---------------------------------------------------------------------------------
37 # GCC FLAGS
41 # GCC FLAGS
38 #---------------------------------------------------------------------------------
42 #---------------------------------------------------------------------------------
39 LIBUC_FMCU =
43 LIBUC_FMCU =
40 LIBUC_CFLAGS = $(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 =
41 LIBUC_CFLAGS_WARN_ON = -Wall
50 LIBUC_CFLAGS_WARN_ON = -Wall
42 LIBUC_CFLAGS_WARN_OFF = -w
51 LIBUC_CFLAGS_WARN_OFF = -w
43 LIBUC_CFLAGS_RELEASE = -O2
52 LIBUC_CFLAGS_RELEASE = -O2
44 LIBUC_CFLAGS_DEBUG = -g
53 LIBUC_CFLAGS_DEBUG = -g
45 LIBUC_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -g
54 LIBUC_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -g
46 LIBUC_CFLAGS_STATIC_LIB += -fPIC
55 LIBUC_CFLAGS_STATIC_LIB = -fPIC
47 LIBUC_CFLAGS_SOFT_FPU = -msoft-float
56 LIBUC_CFLAGS_SOFT_FPU = -msoft-float
48 LIBUC_CFLAGS_HARD_FPU =
57 LIBUC_CFLAGS_HARD_FPU =
49
58
50 LIBUC_CXXFLAGS = $(LIBUC_FMCU)
59 LIBUC_CXXFLAGS = $(LIBUC_FMCU)
60 LIBUC_CXXFLAGS += -g -gdwarf-2
61 LIBUC_CXXFLAGS += -Wextra -Wundef -Wcast-align -msoft-float
51 LIBUC_CXXFLAGS_WARN_ON = -Wall
62 LIBUC_CXXFLAGS_WARN_ON = -Wall
52 LIBUC_CXXFLAGS_WARN_OFF = -w
63 LIBUC_CXXFLAGS_WARN_OFF = -w
53 LIBUC_CXXFLAGS_RELEASE = -O2
64 LIBUC_CXXFLAGS_RELEASE = -O2
54 LIBUC_CXXFLAGS_DEBUG = -g
65 LIBUC_CXXFLAGS_DEBUG = -g
55 LIBUC_CXXFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -g
66 LIBUC_CXXFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -g
56 LIBUC_CXXFLAGS_STATIC_LIB = -fPIC
67 LIBUC_CXXFLAGS_STATIC_LIB = -fPIC
57 LIBUC_CXXFLAGS_SOFT_FPU = -msoft-float
68 LIBUC_CXXFLAGS_SOFT_FPU = -msoft-float
58 LIBUC_CXXFLAGS_HARD_FPU =
69 LIBUC_CXXFLAGS_HARD_FPU =
59
70
60 LIBUC_LIBS =
71 #---------------------------------------------------------------------------------
61 LIBUC_LIBS_UART = -luart
72 # LIBRARY DEFINITIONS
62 LIBUC_LIBS_SPI = -lspi
73 #---------------------------------------------------------------------------------
63 LIBUC_LIBS_IIC = -liic
64 LIBUC_LIBS_ADC = -ladc
65 LIBUC_LIBS_APB = -ladc
66
74
67 LIBUC_LIBS_DIR = $(LIBUC)/lib/bin/LEON3
75 LIBUC_LIBS_DIR = $(LIBUC)/lib/bin/LEON3
68 LIBUC_LIBS_DIR_UART = -L $(LIBUC_LIBS_DIR)/UART
76 LIBUC_INC_DIR = $(LIBUC)/lib/includes/LEON3
69 LIBUC_LIBS_DIR_SPI = -L $(LIBUC_LIBS_DIR)/SPI
77 include $(LIBUC)/rules/common/libsrules.mk
70 LIBUC_LIBS_DIR_IIC = -L $(LIBUC_LIBS_DIR)/IIC
78
71 LIBUC_LIBS_DIR_ADC = -L $(LIBUC_LIBS_DIR)/ADC
79 #---------------------------------------------------------------------------------
72 LIBUC_LIBS_DIR_APB = -L $(LIBUC_LIBS_DIR)/APB
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
73
104
74
105
75 LIBUC_INC_DIR = $(LIBUC)/lib/includes/LEON
106 lib: $(TARGETINSTALLPATH)/$(TARGET).a
76 LIBUC_INC_DIR_UART = -L $(LIBUC_INC_DIR)/UART
107 @echo "compile lib"
77 LIBUC_INC_DIR_SPI = -L $(LIBUC_INC_DIR)/SPI
108
78 LIBUC_INC_DIR_IIC = -L $(LIBUC_INC_DIR)/IIC
109 %.a: $(OBJECTFILES)
79 LIBUC_INC_DIR_ADC = -L $(LIBUC_INC_DIR)/ADC
110 mkdir -p $(TARGETINSTALLPATH)
80 LIBUC_INC_DIR_APB = -L $(LIBUC_INC_DIR)/APB
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
81
148
82
149
83
150
84
151
85
152
86
153
87
154
88
155
89
156
90
91
92
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
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
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now