Browse Source

add STM32 gcc version. apply scons build system.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@98 bbd45198-f89e-11dd-88c7-29a3b14d5316
bernard.xiong 16 years ago
parent
commit
3c246ff153

+ 2 - 2
bsp/stm3210/rtc.c

@@ -133,8 +133,6 @@ void rt_hw_rtc_init(void)
 	return;
 }
 
-#ifdef RT_USING_FINSH
-#include <finsh.h>
 #include <time.h>
 time_t time(time_t* t)
 {
@@ -151,6 +149,8 @@ time_t time(time_t* t)
 	return time;
 }
 
+#ifdef RT_USING_FINSH
+#include <finsh.h>
 void set_date(rt_uint32_t year, rt_uint32_t month, rt_uint32_t day)
 {
 	time_t now;

+ 12 - 0
bsp/stm3210/rtconfig.py

@@ -0,0 +1,12 @@
+ARCH='arm'
+CPU='stm32'
+CC='armcc'
+TextBase='0x08000000'
+
+# component configuration
+RT_USING_FINSH = True
+RT_USING_DFS = False
+RT_USING_DFS_YAFFS2 = False
+RT_USING_DFS_EFSL = False
+RT_USING_LWIP = False
+RT_USING_MINILIBC = False

+ 3 - 0
bsp/stm3210/startup.c

@@ -104,12 +104,15 @@ void rtthread_startup(void)
 
 	/* init hardware serial device */
 	rt_hw_usart_init();
+
+#ifdef RT_USINS_DFS
 	/* init sdcard driver */
 #if STM32_USE_SDIO
 	rt_hw_sdcard_init();
 #else
 	rt_hw_msd_init();
 #endif
+#endif
 
 #ifdef RT_USING_LWIP
 	eth_system_device_init();

+ 121 - 0
bsp/stm3210/stm32_rom.ld

@@ -0,0 +1,121 @@
+/*
+ * linker script for STM32F10x with GNU ld
+ * bernard.xiong 2009-10-14
+ */
+
+/* Program Entry, set to mark it as "used" and avoid gc */
+MEMORY
+{
+	CODE (rx) : ORIGIN = 0x08000000, LENGTH = 0x00080000
+	DATA (rw) : ORIGIN = 0x20000000, LENGTH = 0x00010000
+}
+ENTRY(Reset_Handler)
+
+SECTIONS
+{
+	.text :
+	{
+	. = ALIGN(4);
+	KEEP(*(.isr_vector))            /* Startup code */
+	. = ALIGN(4);
+	*(.text)						/* remaining code */
+	*(.text.*)						/* remaining code */
+	*(.rodata)						/* read-only data (constants) */
+	*(.rodata*)
+	*(.glue_7)
+	*(.glue_7t)
+
+	. = ALIGN(4);
+	_etext = .;
+
+	/* This is used by the startup in order to initialize the .data secion */
+	_sidata = _etext;
+	} > CODE = 0
+
+    .FSymTab :
+	{
+	. = ALIGN(4);
+	__fsymtab_start = .;
+	*(.FSymTab)
+	__fsymtab_end = .;
+	. = ALIGN(4);
+	} > CODE
+
+    .VSymTab :
+	{
+	. = ALIGN(4);
+	__vsymtab_start = .;
+	*(.VSymTab)
+	__vsymtab_end = .;
+	. = ALIGN(4);
+	} > CODE
+
+	/* .data section which is used for initialized data */
+
+	.data : AT (_sidata)
+	{
+	. = ALIGN(4);
+	/* This is used by the startup in order to initialize the .data secion */
+	_sdata = . ;
+
+	*(.data)
+	*(.data.*)
+
+	. = ALIGN(4);
+	/* This is used by the startup in order to initialize the .data secion */
+	_edata = . ;
+	} >DATA
+
+	__bss_start = .;
+	.bss :
+	{
+	. = ALIGN(4);
+	/* This is used by the startup in order to initialize the .bss secion */
+	_sbss = .;
+
+	*(.bss)
+	*(COMMON)
+
+	. = ALIGN(4);
+	/* This is used by the startup in order to initialize the .bss secion */
+	_ebss = . ;
+	_estack = .;
+	} > DATA
+	__bss_end = .;
+
+	_end = .;
+
+	/* Stabs debugging sections.  */
+	.stab          0 : { *(.stab) }
+	.stabstr       0 : { *(.stabstr) }
+	.stab.excl     0 : { *(.stab.excl) }
+	.stab.exclstr  0 : { *(.stab.exclstr) }
+	.stab.index    0 : { *(.stab.index) }
+	.stab.indexstr 0 : { *(.stab.indexstr) }
+	.comment       0 : { *(.comment) }
+	/* DWARF debug sections.
+	 * Symbols in the DWARF debugging sections are relative to the beginning
+	 * of the section so we begin them at 0.  */
+	/* DWARF 1 */
+	.debug          0 : { *(.debug) }
+	.line           0 : { *(.line) }
+	/* GNU DWARF 1 extensions */
+	.debug_srcinfo  0 : { *(.debug_srcinfo) }
+	.debug_sfnames  0 : { *(.debug_sfnames) }
+	/* DWARF 1.1 and DWARF 2 */
+	.debug_aranges  0 : { *(.debug_aranges) }
+	.debug_pubnames 0 : { *(.debug_pubnames) }
+	/* DWARF 2 */
+	.debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
+	.debug_abbrev   0 : { *(.debug_abbrev) }
+	.debug_line     0 : { *(.debug_line) }
+	.debug_frame    0 : { *(.debug_frame) }
+	.debug_str      0 : { *(.debug_str) }
+	.debug_loc      0 : { *(.debug_loc) }
+	.debug_macinfo  0 : { *(.debug_macinfo) }
+	/* SGI/MIPS DWARF 2 extensions */
+	.debug_weaknames 0 : { *(.debug_weaknames) }
+	.debug_funcnames 0 : { *(.debug_funcnames) }
+	.debug_typenames 0 : { *(.debug_typenames) }
+	.debug_varnames  0 : { *(.debug_varnames) }
+}

+ 15 - 0
bsp/stm3210/stm32_rom.sct

@@ -0,0 +1,15 @@
+; *************************************************************
+; *** Scatter-Loading Description File generated by uVision ***
+; *************************************************************
+
+LR_IROM1 0x08000000 0x00080000  {    ; load region size_region
+  ER_IROM1 0x08000000 0x00080000  {  ; load address = execution address
+   *.o (RESET, +First)
+   *(InRoot$$Sections)
+   .ANY (+RO)
+  }
+  RW_IRAM1 0x20000000 0x00010000  {  ; RW data
+   .ANY (+RW +ZI)
+  }
+}
+

+ 7 - 0
finsh/SConscript

@@ -0,0 +1,7 @@
+Import('env')
+
+# The set of source files associated with this SConscript file.
+src_local = Glob('*.c')
+
+obj = env.Object(src_local)
+Return('obj')

+ 7 - 0
finsh/shell.c

@@ -47,6 +47,13 @@ extern char rt_serial_getc(void);
     #pragma section="FSymTab"
     #pragma section="VSymTab"
   #endif
+#elif defined(__GCC__)
+  #ifdef FINSH_USING_SYMTAB
+  extern int __fsymtab_start;
+  extern int __fsymtab_end;
+  extern int __vsymtab_start;
+  extern int __vsymtab_end;
+  #endif
 #endif
 
 /* finsh thread */

+ 7 - 0
libc/minilibc/SConscript

@@ -0,0 +1,7 @@
+Import('env')
+
+# The set of source files associated with this SConscript file.
+src_local = Glob('*.c')
+
+obj = env.Object(src_local)
+Return('obj')

+ 33 - 0
libc/minilibc/stdint.h

@@ -0,0 +1,33 @@
+#ifndef __STDINT_H__
+#define __STDINT_H__
+
+#include <rtthread.h>
+
+typedef	rt_int8_t		int8_t;
+typedef	rt_uint8_t		uint8_t;
+typedef	rt_int16_t		int16_t;
+typedef	rt_uint16_t		uint16_t;
+typedef	rt_int32_t		int32_t;
+typedef	rt_uint32_t		uint32_t;
+
+/*
+ * 7.18.2 Limits of specified-width integer types.
+ *
+ * The following object-like macros specify the minimum and maximum limits
+ * of integer types corresponding to the typedef names defined above.
+ */
+
+/* 7.18.2.1 Limits of exact-width integer types */
+#define	INT8_MIN		(-0x7f - 1)
+#define	INT16_MIN		(-0x7fff - 1)
+#define	INT32_MIN		(-0x7fffffff - 1)
+
+#define	INT8_MAX		0x7f
+#define	INT16_MAX		0x7fff
+#define	INT32_MAX		0x7fffffff
+
+#define	UINT8_MAX		0xff
+#define	UINT16_MAX		0xffff
+#define	UINT32_MAX		0xffffffffU
+
+#endif

+ 43 - 0
libc/minilibc/sys/time.h

@@ -0,0 +1,43 @@
+#ifndef _SYS_TIME_H_
+#define _SYS_TIME_H_
+
+#include <sys/types.h>
+
+/*
+ * Structure returned by gettimeofday(2) system call,
+ * and used in other calls.
+ */
+struct timeval {
+	long	tv_sec;		/* seconds */
+	long	tv_usec;	/* and microseconds */
+};
+
+/*
+ * Structure defined by POSIX.1b to be like a timeval.
+ */
+struct timespec {
+	time_t	tv_sec;		/* seconds */
+	long	tv_nsec;	/* and nanoseconds */
+};
+
+struct timezone {
+  int tz_minuteswest;	/* minutes west of Greenwich */
+  int tz_dsttime;	/* type of dst correction */
+};
+
+struct tm {
+  int tm_sec;			/* Seconds.	[0-60] (1 leap second) */
+  int tm_min;			/* Minutes.	[0-59] */
+  int tm_hour;			/* Hours.	[0-23] */
+  int tm_mday;			/* Day.		[1-31] */
+  int tm_mon;			/* Month.	[0-11] */
+  int tm_year;			/* Year - 1900. */
+  int tm_wday;			/* Day of week.	[0-6] */
+  int tm_yday;			/* Days in year.[0-365]	*/
+  int tm_isdst;			/* DST.		[-1/0/1]*/
+
+  long int tm_gmtoff;		/* Seconds east of UTC.  */
+  const char *tm_zone;		/* Timezone abbreviation.  */
+};
+
+#endif

+ 2 - 0
libc/minilibc/sys/types.h

@@ -15,6 +15,8 @@ typedef rt_uint8_t 	u_int8_t;
 typedef rt_uint16_t u_int16_t;
 typedef rt_uint32_t u_int32_t;
 
+typedef rt_time_t time_t;
+
 #ifndef NULL
 #define NULL RT_NULL
 #endif

+ 6 - 0
libc/minilibc/time.h

@@ -0,0 +1,6 @@
+#ifndef __TIME_H__
+#define __TIME_H__
+
+#include <sys/time.h>
+
+#endif

+ 70 - 0
net/lwip/SConscript

@@ -0,0 +1,70 @@
+Import('env')
+Import('rtconfig')
+Import('RTT_ROOT')
+
+src_local = Split("""
+src/api/api_lib.c
+src/api/api_msg.c
+src/api/err.c
+src/api/netbuf.c
+src/api/netdb.c
+src/api/netifapi.c
+src/api/sockets.c
+src/api/tcpip.c
+src/arch/sys_arch.c
+src/arch/sys_arch_init.c
+src/core/dhcp.c
+src/core/dns.c
+src/core/init.c
+src/core/memp_tiny.c
+src/core/netif.c
+src/core/pbuf.c
+src/core/raw.c
+src/core/stats.c
+src/core/sys.c
+src/core/tcp.c
+src/core/tcp_in.c
+src/core/tcp_out.c
+src/core/udp.c
+src/core/ipv4/autoip.c
+src/core/ipv4/icmp.c
+src/core/ipv4/igmp.c
+src/core/ipv4/inet.c
+src/core/ipv4/inet_chksum.c
+src/core/ipv4/ip.c
+src/core/ipv4/ip_addr.c
+src/core/ipv4/ip_frag.c
+src/core/snmp/asn1_dec.c
+src/core/snmp/asn1_enc.c
+src/core/snmp/mib2.c
+src/core/snmp/mib_structs.c
+src/core/snmp/msg_in.c
+src/core/snmp/msg_out.c
+src/netif/etharp.c
+src/netif/ethernetif.c
+src/netif/loopif.c
+src/netif/slipif.c
+src/netif/ppp/auth.c
+src/netif/ppp/chap.c
+src/netif/ppp/chpms.c
+src/netif/ppp/fsm.c
+src/netif/ppp/ipcp.c
+src/netif/ppp/lcp.c
+src/netif/ppp/magic.c
+src/netif/ppp/md5.c
+src/netif/ppp/pap.c
+src/netif/ppp/ppp.c
+src/netif/ppp/ppp_oe.c
+src/netif/ppp/randm.c
+src/netif/ppp/vj.c
+""")
+
+# The set of source files associated with this SConscript file.
+path = [RTT_ROOT + '/net/lwip/src/include', RTT_ROOT + '/net/lwip/src/include/ipv4', RTT_ROOT + '/net/lwip/src/arch/include/arch', RTT_ROOT + '/net/lwip/src/include/netif', RTT_ROOT + '/net/lwip/src/netif/ppp']
+
+lwip_env = env.Clone()
+lwip_env.Append(CPPPATH = path)
+
+obj = lwip_env.Object(src_local)
+
+Return('obj')

+ 7 - 0
src/SConscript

@@ -0,0 +1,7 @@
+Import('env')
+
+# The set of source files associated with this SConscript file.
+src_local = Glob('*.c')
+
+obj = env.Object(src_local)
+Return('obj')