Merge branch 'bugfix/compile_with_no_timers' into 'master'
newlib: fix compilation error when no timers are enabled in menuconfig I have checked that three options (RTC/RTC+FRC1/FRC1) work, but didn't check "None" option. This adds some missing ifdef blocks to remove "unused function/variable" warnings and fixes the use of `__errno_r` in a non-reentrant function. See merge request !174
This commit is contained in:
commit
0dff62051f
1 changed files with 8 additions and 4 deletions
|
@ -55,14 +55,16 @@ static uint64_t get_rtc_time_us()
|
||||||
#endif // WITH_RTC
|
#endif // WITH_RTC
|
||||||
|
|
||||||
|
|
||||||
// time from Epoch to the first boot time
|
// s_boot_time: time from Epoch to the first boot time
|
||||||
#ifdef WITH_RTC
|
#ifdef WITH_RTC
|
||||||
static RTC_DATA_ATTR struct timeval s_boot_time;
|
static RTC_DATA_ATTR struct timeval s_boot_time;
|
||||||
#else
|
#elif defined(WITH_FRC1)
|
||||||
static struct timeval s_boot_time;
|
static struct timeval s_boot_time;
|
||||||
#endif
|
#endif
|
||||||
static _lock_t s_boot_time_lock;
|
|
||||||
|
|
||||||
|
#if defined(WITH_RTC) || defined(WITH_FRC1)
|
||||||
|
static _lock_t s_boot_time_lock;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef WITH_FRC1
|
#ifdef WITH_FRC1
|
||||||
#define FRC1_PRESCALER 16
|
#define FRC1_PRESCALER 16
|
||||||
|
@ -121,6 +123,7 @@ clock_t IRAM_ATTR _times_r(struct _reent *r, struct tms *ptms)
|
||||||
return (clock_t) tv.tv_sec;
|
return (clock_t) tv.tv_sec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined( WITH_FRC1 ) || defined( WITH_RTC )
|
||||||
static uint64_t get_time_since_boot()
|
static uint64_t get_time_since_boot()
|
||||||
{
|
{
|
||||||
uint64_t microseconds = 0;
|
uint64_t microseconds = 0;
|
||||||
|
@ -140,6 +143,7 @@ static uint64_t get_time_since_boot()
|
||||||
#endif
|
#endif
|
||||||
return microseconds;
|
return microseconds;
|
||||||
}
|
}
|
||||||
|
#endif // defined( WITH_FRC1 ) || defined( WITH_RTC )
|
||||||
|
|
||||||
int IRAM_ATTR _gettimeofday_r(struct _reent *r, struct timeval *tv, void *tz)
|
int IRAM_ATTR _gettimeofday_r(struct _reent *r, struct timeval *tv, void *tz)
|
||||||
{
|
{
|
||||||
|
@ -176,7 +180,7 @@ int settimeofday(const struct timeval *tv, const struct timezone *tz)
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
__errno_r(r) = ENOSYS;
|
errno = ENOSYS;
|
||||||
return -1;
|
return -1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue