diff options
| author | [email protected] <[email protected]> | 2012-06-30 01:52:48 +0000 |
|---|---|---|
| committer | [email protected] <[email protected]> | 2012-06-30 01:52:48 +0000 |
| commit | d402cfea19d33092606e1166efa83d245e150e29 (patch) | |
| tree | 8e80ca7e42cbe675a8e64948e3e7537e36e136c1 /components/libc | |
| parent | e2f5d345008c9557f9e2ec8452afbae9cc193acf (diff) | |
fixed compiling error in stm32f0x
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2197 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components/libc')
| -rw-r--r-- | components/libc/minilibc/time.c | 2 | ||||
| -rw-r--r-- | components/libc/newlib/syscalls.c | 34 |
2 files changed, 21 insertions, 15 deletions
diff --git a/components/libc/minilibc/time.c b/components/libc/minilibc/time.c index a8595c0fa8..d8093cf211 100644 --- a/components/libc/minilibc/time.c +++ b/components/libc/minilibc/time.c @@ -205,6 +205,7 @@ char *ctime(const time_t *timep) return asctime(localtime(timep));
}
+#ifdef RT_USING_DEVICE
int gettimeofday(struct timeval *tp, void *ignore)
{
time_t time;
@@ -225,3 +226,4 @@ int gettimeofday(struct timeval *tp, void *ignore) return 0;
}
+#endif
diff --git a/components/libc/newlib/syscalls.c b/components/libc/newlib/syscalls.c index 7b918f2eb5..6f670c8ef2 100644 --- a/components/libc/newlib/syscalls.c +++ b/components/libc/newlib/syscalls.c @@ -193,6 +193,7 @@ _wait_r(struct _reent *ptr, int *status) return -1; } +#ifdef RT_USING_DEVICE _ssize_t _write_r(struct _reent *ptr, int fd, const void *buf, size_t nbytes) { @@ -214,6 +215,7 @@ _write_r(struct _reent *ptr, int fd, const void *buf, size_t nbytes) return rc; #endif } +#endif #ifndef RT_USING_PTHREADS @@ -235,26 +237,28 @@ _write_r(struct _reent *ptr, int fd, const void *buf, size_t nbytes) struct timeval _timevalue = {0}; -static void libc_system_time_init() +#ifdef RT_USING_DEVICE +static void libc_system_time_init(void) { - time_t time; - rt_tick_t tick; - rt_device_t device; + time_t time; + rt_tick_t tick; + rt_device_t device; - time = 0; - device = rt_device_find("rtc"); - if (device != RT_NULL) - { + time = 0; + device = rt_device_find("rtc"); + if (device != RT_NULL) + { /* get realtime seconds */ - rt_device_control(device, RT_DEVICE_CTRL_RTC_GET_TIME, &time); - } + rt_device_control(device, RT_DEVICE_CTRL_RTC_GET_TIME, &time); + } /* get tick */ - tick = rt_tick_get(); + tick = rt_tick_get(); - _timevalue.tv_usec = MICROSECOND_PER_SECOND - (tick%RT_TICK_PER_SECOND) * MICROSECOND_PER_TICK; - _timevalue.tv_sec = time - tick/RT_TICK_PER_SECOND - 1; + _timevalue.tv_usec = MICROSECOND_PER_SECOND - (tick%RT_TICK_PER_SECOND) * MICROSECOND_PER_TICK; + _timevalue.tv_sec = time - tick/RT_TICK_PER_SECOND - 1; } +#endif int libc_get_time(struct timespec *time) { @@ -376,7 +380,7 @@ void _exit (int status) { rt_kprintf("thread:%s exit with %d\n", rt_thread_self()->name, status); - RT_ASSERT(0); + RT_ASSERT(0); - while (1); + while (1); } |
