diff --git a/bsp/stm3210/rtc.c b/bsp/stm3210/rtc.c index 453f8dd1394a261174d9eebd39ec18c2d348aeba..05e7a9c1326a0795b0677b9cf80ac2c83090e279 100644 --- a/bsp/stm3210/rtc.c +++ b/bsp/stm3210/rtc.c @@ -133,8 +133,6 @@ void rt_hw_rtc_init(void) return; } -#ifdef RT_USING_FINSH -#include #include time_t time(time_t* t) { @@ -151,6 +149,8 @@ time_t time(time_t* t) return time; } +#ifdef RT_USING_FINSH +#include void set_date(rt_uint32_t year, rt_uint32_t month, rt_uint32_t day) { time_t now; diff --git a/bsp/stm3210/rtconfig.py b/bsp/stm3210/rtconfig.py new file mode 100644 index 0000000000000000000000000000000000000000..8b7413c820b0b99e7cd1c564e7e80f60371d0ef1 --- /dev/null +++ b/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 diff --git a/bsp/stm3210/startup.c b/bsp/stm3210/startup.c index e880f858049cd979ba6f0fe0cd6501ceb4dd399b..9a4f9a0fddbc9533b01491b1c0c3ea519d7f4f38 100644 --- a/bsp/stm3210/startup.c +++ b/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(); diff --git a/bsp/stm3210/stm32_rom.ld b/bsp/stm3210/stm32_rom.ld new file mode 100644 index 0000000000000000000000000000000000000000..ea4e23e4279f54b08e8d765ca64ae1142d5bd2ea --- /dev/null +++ b/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) } +} diff --git a/bsp/stm3210/stm32_rom.sct b/bsp/stm3210/stm32_rom.sct new file mode 100644 index 0000000000000000000000000000000000000000..0835abf43e781cddf45207f6fad946f12221105a --- /dev/null +++ b/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) + } +} + diff --git a/finsh/SConscript b/finsh/SConscript new file mode 100644 index 0000000000000000000000000000000000000000..6e71c13fc3fee7082324e45f9b18add43e7fd55b --- /dev/null +++ b/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') diff --git a/finsh/shell.c b/finsh/shell.c index f4009b45e8ed1c136042cd1d29f1598ef4a23842..dbeef89cfabf06247308ad7e496c3fd21ac292e8 100644 --- a/finsh/shell.c +++ b/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 */ diff --git a/libc/minilibc/SConscript b/libc/minilibc/SConscript new file mode 100644 index 0000000000000000000000000000000000000000..6e71c13fc3fee7082324e45f9b18add43e7fd55b --- /dev/null +++ b/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') diff --git a/libc/minilibc/stdint.h b/libc/minilibc/stdint.h new file mode 100644 index 0000000000000000000000000000000000000000..ce9c500867ec6567ad08de753ba685fad4a6ae3f --- /dev/null +++ b/libc/minilibc/stdint.h @@ -0,0 +1,33 @@ +#ifndef __STDINT_H__ +#define __STDINT_H__ + +#include + +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 diff --git a/libc/minilibc/sys/time.h b/libc/minilibc/sys/time.h new file mode 100644 index 0000000000000000000000000000000000000000..4cd5cb8ba8108fa72de95c51bdda33b76a2f232a --- /dev/null +++ b/libc/minilibc/sys/time.h @@ -0,0 +1,43 @@ +#ifndef _SYS_TIME_H_ +#define _SYS_TIME_H_ + +#include + +/* + * 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 diff --git a/libc/minilibc/sys/types.h b/libc/minilibc/sys/types.h index 035250c076dda399ea5c83f8af9732e494443cd3..a9a1dafa2e205235530f4c61638d4782645e73a7 100644 --- a/libc/minilibc/sys/types.h +++ b/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 diff --git a/libc/minilibc/time.h b/libc/minilibc/time.h new file mode 100644 index 0000000000000000000000000000000000000000..0b2aabbed171926d165fe16b50c8aa4f7ea5dd79 --- /dev/null +++ b/libc/minilibc/time.h @@ -0,0 +1,6 @@ +#ifndef __TIME_H__ +#define __TIME_H__ + +#include + +#endif diff --git a/net/lwip/SConscript b/net/lwip/SConscript new file mode 100644 index 0000000000000000000000000000000000000000..92dff9559e4751d800143336f36ec1eb718fbcca --- /dev/null +++ b/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') diff --git a/src/SConscript b/src/SConscript new file mode 100644 index 0000000000000000000000000000000000000000..6e71c13fc3fee7082324e45f9b18add43e7fd55b --- /dev/null +++ b/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')