Merge pull request #4369 from mysterywolf/removeminilibc

[libc]移除minilibc 并将其职能并入newlibc中
This commit is contained in:
Bernard Xiong
2021-02-27 09:12:45 +08:00
committed by GitHub
39 changed files with 54 additions and 3605 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -80,10 +80,6 @@
/* Using QEMU or SkyEye*/
/* #define RT_USING_EMULATOR */
/* SECTION: a mini libc */
/* Using mini libc library*/
/* #define RT_USING_MINILIBC */
/* SECTION: C++ support */
/* Using C++ support*/
/* #define RT_USING_CPLUSPLUS */

View File

@@ -93,7 +93,6 @@
/* SECTION: a runtime libc library */
/* a runtime libc library*/
/* #define RT_USING_NEWLIB */
#define RT_USING_MINILIBC
/* SECTION: C++ support */
/* Using C++ support*/

View File

@@ -72,10 +72,6 @@
#define FINSH_USING_SYMTAB
#define FINSH_USING_DESCRIPTION
/* SECTION: a mini libc */
/* Using mini libc library*/
/* #define RT_USING_MINILIBC */
/* SECTION: C++ support */
/* Using C++ support*/
/* #define RT_USING_CPLUSPLUS */

View File

@@ -65,10 +65,6 @@
/* Using FinSH as Shell*/
/* #define RT_USING_FINSH */
/* SECTION: a mini libc */
/* Using mini libc library*/
/* #define RT_USING_MINILIBC */
/* SECTION: C++ support */
/* Using C++ support*/
/* #define RT_USING_CPLUSPLUS */

View File

@@ -47,15 +47,7 @@
#include <string.h>
#include <stdint.h>
#ifndef RT_USING_MINILIBC
typedef unsigned int u_int;
typedef unsigned char u_char;
typedef unsigned long u_long;
#else
#include <sys/types.h>
#include <stdint.h>
#endif
typedef long long int64_t;
typedef unsigned long long uint64_t;
@@ -63,14 +55,6 @@ typedef unsigned long long uint64_t;
typedef int bool_t;
typedef int enum_t;
#ifndef RT_USING_NEWLIB
typedef unsigned long dev_t;
#endif
#if !defined(RT_USING_NEWLIB) && !defined(RT_USING_MINILIBC)
typedef rt_int32_t ssize_t;
#endif
/* This needs to be changed to uint32_t in the future */
typedef unsigned long rpcprog_t;
typedef unsigned long rpcvers_t;

View File

@@ -25,4 +25,10 @@ typedef long signed int ssize_t; /* Used for a count of bytes or an error
#endif
typedef unsigned long useconds_t; /* microseconds (unsigned) */
typedef unsigned long dev_t;
typedef unsigned int u_int;
typedef unsigned char u_char;
typedef unsigned long u_long;
#endif

View File

@@ -10,7 +10,7 @@ CPPPATH = [cwd]
if GetDepend('RT_USING_LIBC'):
src += Glob('*.c')
else:
if GetDepend('RT_LIBC_USING_TIME') and not GetDepend('RT_USING_MINILIBC'):
if GetDepend('RT_LIBC_USING_TIME'):
src += ['time.c']
if GetDepend('RT_USING_POSIX') == False:
@@ -21,7 +21,7 @@ if rtconfig.CROSS_TOOL == 'keil':
else:
CPPDEFINES = []
if not GetDepend('RT_USING_MINILIBC') and (GetDepend('RT_USING_LIBC') or GetDepend('RT_LIBC_USING_TIME')):
if GetDepend('RT_USING_LIBC') or GetDepend('RT_LIBC_USING_TIME'):
group = DefineGroup('libc', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)
Return('group')

View File

@@ -24,4 +24,10 @@ typedef long signed int ssize_t; /* Used for a count of bytes or an error
#endif
typedef unsigned long useconds_t; /* microseconds (unsigned) */
typedef unsigned long dev_t;
typedef unsigned int u_int;
typedef unsigned char u_char;
typedef unsigned long u_long;
#endif

View File

@@ -1,15 +0,0 @@
from building import *
Import('rtconfig')
src = Glob('*.c') + Glob('*.cpp')
cwd = GetCurrentDir()
group = []
CPPPATH = [cwd]
CPPDEFINES = ['RT_USING_MINILIBC']
if rtconfig.PLATFORM == 'gcc' and rtconfig.ARCH != 'sim' and not GetDepend('RT_USING_LIBC') and GetDepend('RT_USING_MINILIBC'):
group = DefineGroup('libc', src, depend = [''],
CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)
Return('group')

View File

@@ -1,49 +0,0 @@
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2008-08-14 Bernard the first version
*/
#include <rtthread.h>
#include <sys/types.h>
#if !defined (RT_USING_NEWLIB) && defined (RT_USING_MINILIBC)
#include "ctype.h"
int isprint (int ch)
{
ch&=0x7f;
return (ch>=32 && ch<127);
}
int isalpha(int ch)
{
return (unsigned int)((ch | 0x20) - 'a') < 26u;
}
int isdigit (int ch)
{
return (unsigned int)(ch - '0') < 10u;
}
int isspace(int ch)
{
switch(ch)
{
case ' ':
case '\n':
case '\f':
case '\r':
case '\t':
case '\v':
return 1;
default:
return 0;
}
}
#endif

View File

@@ -1,18 +0,0 @@
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2008-08-14 Bernard the first version
*/
#ifndef __CTYPE_H__
#define __CTYPE_H__
int isprint(int c) __attribute__ ((__const__));
int isalpha (int c) __attribute__ ((__const__));
int isdigit (int ch) __attribute__ ((__const__));
int isspace(int ch) __attribute__ ((__const__));
#endif

View File

@@ -1,16 +0,0 @@
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
*/
#ifndef __ERRNO_H__
#define __ERRNO_H__
#include "libc/libc_errno.h"
/* Others defined in libc/libc_errno.h */
#define ENSRNOTFOUND 163 /* Domain name not found */
#endif

View File

@@ -1,14 +0,0 @@
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
*/
#ifndef __INTTYPES_H__
#define __INTTYPES_H__
#include "stdint.h"
#endif

View File

@@ -1,176 +0,0 @@
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
*/
#include <math.h>
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS CRT
* FILE: lib/crt/math/cos.c
* PURPOSE: Generic C Implementation of cos
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
*/
#define PRECISION 9
static double cos_off_tbl[] = {0.0, -M_PI/2., 0, -M_PI/2.};
static double cos_sign_tbl[] = {1,-1,-1,1};
static double sin_off_tbl[] = {0.0, -M_PI/2., 0, -M_PI/2.};
static double sin_sign_tbl[] = {1,-1,-1,1};
double sin(double x)
{
int quadrant;
double x2, result;
/* Calculate the quadrant */
quadrant = x * (2./M_PI);
/* Get offset inside quadrant */
x = x - quadrant * (M_PI/2.);
/* Normalize quadrant to [0..3] */
quadrant = (quadrant - 1) & 0x3;
/* Fixup value for the generic function */
x += sin_off_tbl[quadrant];
/* Calculate the negative of the square of x */
x2 = - (x * x);
/* This is an unrolled taylor series using <PRECISION> iterations
* Example with 4 iterations:
* result = 1 - x^2/2! + x^4/4! - x^6/6! + x^8/8!
* To save multiplications and to keep the precision high, it's performed
* like this:
* result = 1 - x^2 * (1/2! - x^2 * (1/4! - x^2 * (1/6! - x^2 * (1/8!))))
*/
/* Start with 0, compiler will optimize this away */
result = 0;
#if (PRECISION >= 10)
result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16*17*18*19*20);
result *= x2;
#endif
#if (PRECISION >= 9)
result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16*17*18);
result *= x2;
#endif
#if (PRECISION >= 8)
result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16);
result *= x2;
#endif
#if (PRECISION >= 7)
result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12*13*14);
result *= x2;
#endif
#if (PRECISION >= 6)
result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12);
result *= x2;
#endif
#if (PRECISION >= 5)
result += 1./(1.*2*3*4*5*6*7*8*9*10);
result *= x2;
#endif
result += 1./(1.*2*3*4*5*6*7*8);
result *= x2;
result += 1./(1.*2*3*4*5*6);
result *= x2;
result += 1./(1.*2*3*4);
result *= x2;
result += 1./(1.*2);
result *= x2;
result += 1;
/* Apply correct sign */
result *= sin_sign_tbl[quadrant];
return result;
}
double cos(double x)
{
int quadrant;
double x2, result;
/* Calculate the quadrant */
quadrant = x * (2./M_PI);
/* Get offset inside quadrant */
x = x - quadrant * (M_PI/2.);
/* Normalize quadrant to [0..3] */
quadrant = quadrant & 0x3;
/* Fixup value for the generic function */
x += cos_off_tbl[quadrant];
/* Calculate the negative of the square of x */
x2 = - (x * x);
/* This is an unrolled taylor series using <PRECISION> iterations
* Example with 4 iterations:
* result = 1 - x^2/2! + x^4/4! - x^6/6! + x^8/8!
* To save multiplications and to keep the precision high, it's performed
* like this:
* result = 1 - x^2 * (1/2! - x^2 * (1/4! - x^2 * (1/6! - x^2 * (1/8!))))
*/
/* Start with 0, compiler will optimize this away */
result = 0;
#if (PRECISION >= 10)
result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16*17*18*19*20);
result *= x2;
#endif
#if (PRECISION >= 9)
result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16*17*18);
result *= x2;
#endif
#if (PRECISION >= 8)
result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16);
result *= x2;
#endif
#if (PRECISION >= 7)
result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12*13*14);
result *= x2;
#endif
#if (PRECISION >= 6)
result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12);
result *= x2;
#endif
#if (PRECISION >= 5)
result += 1./(1.*2*3*4*5*6*7*8*9*10);
result *= x2;
#endif
result += 1./(1.*2*3*4*5*6*7*8);
result *= x2;
result += 1./(1.*2*3*4*5*6);
result *= x2;
result += 1./(1.*2*3*4);
result *= x2;
result += 1./(1.*2);
result *= x2;
result += 1;
/* Apply correct sign */
result *= cos_sign_tbl[quadrant];
return result;
}

View File

@@ -1,20 +0,0 @@
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
*/
#ifndef __MATH_H__
#define __MATH_H__
#define M_PI 3.141592653589793238462643
double sin(double x);
double cos(double x);
typedef float float_t;
typedef double double_t;
#endif

View File

@@ -1,52 +0,0 @@
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
*/
#include <sys/types.h>
#include <stdlib.h>
static void exch(char* base,size_t size,size_t a,size_t b) {
char* x=base+a*size;
char* y=base+b*size;
while (size) {
char z=*x;
*x=*y;
*y=z;
--size; ++x; ++y;
}
}
/* Quicksort with 3-way partitioning, ala Sedgewick */
/* Blame him for the scary variable names */
/* http://www.cs.princeton.edu/~rs/talks/QuicksortIsOptimal.pdf */
static void quicksort(char* base,size_t size,ssize_t l,ssize_t r,
int (*compar)(const void*,const void*)) {
ssize_t i=l-1, j=r, p=l-1, q=r, k;
char* v=base+r*size;
if (r<=l) return;
for (;;) {
while (++i != r && compar(base+i*size,v)<0) ;
while (compar(v,base+(--j)*size)<0) if (j == l) break;
if (i >= j) break;
exch(base,size,i,j);
if (compar(base+i*size,v)==0) exch(base,size,++p,i);
if (compar(v,base+j*size)==0) exch(base,size,j,--q);
}
exch(base,size,i,r); j = i-1; ++i;
for (k=l; k<p; k++, j--) exch(base,size,k,j);
for (k=r-1; k>q; k--, i++) exch(base,size,i,k);
quicksort(base,size,l,j,compar);
quicksort(base,size,i,r,compar);
}
void qsort(void* base,size_t nmemb,size_t size,int (*compar)(const void*,const void*)) {
/* check for integer overflows */
if (nmemb >= (((size_t)-1)>>1) ||
size >= (((size_t)-1)>>1)) return;
if (nmemb>1)
quicksort(base,size,0,nmemb-1,compar);
}

View File

@@ -1,43 +0,0 @@
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
*/
#include <stdlib.h>
#include <stdint.h>
#include <sys/types.h>
static unsigned int _seed=1;
/* Knuth's TAOCP section 3.6 */
#define M ((1U<<31) -1)
#define A 48271
#define Q 44488 // M/A
#define R 3399 // M%A; R < Q !!!
int rand_r(unsigned int* seed)
{ int32_t X;
X = *seed;
X = A*(X%Q) - R * (int32_t) (X/Q);
if (X < 0)
X += M;
*seed = X;
return X;
}
int rand(void) {
return rand_r(&_seed);
}
void srand(unsigned int i)
{
_seed=i;
}
int random(void) __attribute__((alias("rand")));
void srandom(unsigned int i) __attribute__((alias("srand")));

View File

@@ -1,20 +0,0 @@
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2017-09-12 Bernard The first version
*/
#ifndef SIGNAL_H__
#define SIGNAL_H__
#include <libc/libc_signal.h>
#define SIG_DFL ((_sig_func_ptr)0) /* Default action */
#define SIG_IGN ((_sig_func_ptr)1) /* Ignore action */
#define SIG_ERR ((_sig_func_ptr)-1) /* Error return */
#endif

View File

@@ -1,15 +0,0 @@
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
*/
#ifndef __STDDEF_H__
#define __STDDEF_H__
#include <sys/types.h>
typedef signed long ptrdiff_t;
#endif

View File

@@ -1,266 +0,0 @@
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
*/
/*
* ISO C Standard: 7.18 Integer types <stdint.h>
*/
#ifndef __STDINT_H__
#define __STDINT_H__
/* 7.8.1.1 Exact-width integer types */
#ifdef __INT8_TYPE__
typedef __INT8_TYPE__ int8_t;
#endif
#ifdef __INT16_TYPE__
typedef __INT16_TYPE__ int16_t;
#endif
#ifdef __INT32_TYPE__
typedef __INT32_TYPE__ int32_t;
#endif
#ifdef __INT64_TYPE__
typedef __INT64_TYPE__ int64_t;
#endif
#ifdef __UINT8_TYPE__
typedef __UINT8_TYPE__ uint8_t;
#endif
#ifdef __UINT16_TYPE__
typedef __UINT16_TYPE__ uint16_t;
#endif
#ifdef __UINT32_TYPE__
typedef __UINT32_TYPE__ uint32_t;
#endif
#ifdef __UINT64_TYPE__
typedef __UINT64_TYPE__ uint64_t;
#endif
/* 7.8.1.2 Minimum-width integer types */
typedef __INT_LEAST8_TYPE__ int_least8_t;
typedef __INT_LEAST16_TYPE__ int_least16_t;
typedef __INT_LEAST32_TYPE__ int_least32_t;
typedef __INT_LEAST64_TYPE__ int_least64_t;
typedef __UINT_LEAST8_TYPE__ uint_least8_t;
typedef __UINT_LEAST16_TYPE__ uint_least16_t;
typedef __UINT_LEAST32_TYPE__ uint_least32_t;
typedef __UINT_LEAST64_TYPE__ uint_least64_t;
/* 7.8.1.3 Fastest minimum-width integer types */
typedef __INT_FAST8_TYPE__ int_fast8_t;
typedef __INT_FAST16_TYPE__ int_fast16_t;
typedef __INT_FAST32_TYPE__ int_fast32_t;
typedef __INT_FAST64_TYPE__ int_fast64_t;
typedef __UINT_FAST8_TYPE__ uint_fast8_t;
typedef __UINT_FAST16_TYPE__ uint_fast16_t;
typedef __UINT_FAST32_TYPE__ uint_fast32_t;
typedef __UINT_FAST64_TYPE__ uint_fast64_t;
/* 7.8.1.4 Integer types capable of holding object pointers */
#ifdef __INTPTR_TYPE__
typedef __INTPTR_TYPE__ intptr_t;
#endif
#ifdef __UINTPTR_TYPE__
typedef __UINTPTR_TYPE__ uintptr_t;
#endif
/* 7.8.1.5 Greatest-width integer types */
typedef __INTMAX_TYPE__ intmax_t;
typedef __UINTMAX_TYPE__ uintmax_t;
#if (!defined __cplusplus || __cplusplus >= 201103L \
|| defined __STDC_LIMIT_MACROS)
/*
* 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 */
#ifdef __INT8_MAX__
# undef INT8_MAX
# define INT8_MAX __INT8_MAX__
# undef INT8_MIN
# define INT8_MIN (-INT8_MAX - 1)
#endif
#ifdef __UINT8_MAX__
# undef UINT8_MAX
# define UINT8_MAX __UINT8_MAX__
#endif
#ifdef __INT16_MAX__
# undef INT16_MAX
# define INT16_MAX __INT16_MAX__
# undef INT16_MIN
# define INT16_MIN (-INT16_MAX - 1)
#endif
#ifdef __UINT16_MAX__
# undef UINT16_MAX
# define UINT16_MAX __UINT16_MAX__
#endif
#ifdef __INT32_MAX__
# undef INT32_MAX
# define INT32_MAX __INT32_MAX__
# undef INT32_MIN
# define INT32_MIN (-INT32_MAX - 1)
#endif
#ifdef __UINT32_MAX__
# undef UINT32_MAX
# define UINT32_MAX __UINT32_MAX__
#endif
#ifdef __INT64_MAX__
# undef INT64_MAX
# define INT64_MAX __INT64_MAX__
# undef INT64_MIN
# define INT64_MIN (-INT64_MAX - 1)
#endif
#ifdef __UINT64_MAX__
# undef UINT64_MAX
# define UINT64_MAX __UINT64_MAX__
#endif
#undef INT_LEAST8_MAX
#define INT_LEAST8_MAX __INT_LEAST8_MAX__
#undef INT_LEAST8_MIN
#define INT_LEAST8_MIN (-INT_LEAST8_MAX - 1)
#undef UINT_LEAST8_MAX
#define UINT_LEAST8_MAX __UINT_LEAST8_MAX__
#undef INT_LEAST16_MAX
#define INT_LEAST16_MAX __INT_LEAST16_MAX__
#undef INT_LEAST16_MIN
#define INT_LEAST16_MIN (-INT_LEAST16_MAX - 1)
#undef UINT_LEAST16_MAX
#define UINT_LEAST16_MAX __UINT_LEAST16_MAX__
#undef INT_LEAST32_MAX
#define INT_LEAST32_MAX __INT_LEAST32_MAX__
#undef INT_LEAST32_MIN
#define INT_LEAST32_MIN (-INT_LEAST32_MAX - 1)
#undef UINT_LEAST32_MAX
#define UINT_LEAST32_MAX __UINT_LEAST32_MAX__
#undef INT_LEAST64_MAX
#define INT_LEAST64_MAX __INT_LEAST64_MAX__
#undef INT_LEAST64_MIN
#define INT_LEAST64_MIN (-INT_LEAST64_MAX - 1)
#undef UINT_LEAST64_MAX
#define UINT_LEAST64_MAX __UINT_LEAST64_MAX__
#undef INT_FAST8_MAX
#define INT_FAST8_MAX __INT_FAST8_MAX__
#undef INT_FAST8_MIN
#define INT_FAST8_MIN (-INT_FAST8_MAX - 1)
#undef UINT_FAST8_MAX
#define UINT_FAST8_MAX __UINT_FAST8_MAX__
#undef INT_FAST16_MAX
#define INT_FAST16_MAX __INT_FAST16_MAX__
#undef INT_FAST16_MIN
#define INT_FAST16_MIN (-INT_FAST16_MAX - 1)
#undef UINT_FAST16_MAX
#define UINT_FAST16_MAX __UINT_FAST16_MAX__
#undef INT_FAST32_MAX
#define INT_FAST32_MAX __INT_FAST32_MAX__
#undef INT_FAST32_MIN
#define INT_FAST32_MIN (-INT_FAST32_MAX - 1)
#undef UINT_FAST32_MAX
#define UINT_FAST32_MAX __UINT_FAST32_MAX__
#undef INT_FAST64_MAX
#define INT_FAST64_MAX __INT_FAST64_MAX__
#undef INT_FAST64_MIN
#define INT_FAST64_MIN (-INT_FAST64_MAX - 1)
#undef UINT_FAST64_MAX
#define UINT_FAST64_MAX __UINT_FAST64_MAX__
#ifdef __INTPTR_MAX__
# undef INTPTR_MAX
# define INTPTR_MAX __INTPTR_MAX__
# undef INTPTR_MIN
# define INTPTR_MIN (-INTPTR_MAX - 1)
#endif
#ifdef __UINTPTR_MAX__
# undef UINTPTR_MAX
# define UINTPTR_MAX __UINTPTR_MAX__
#endif
#undef INTMAX_MAX
#define INTMAX_MAX __INTMAX_MAX__
#undef INTMAX_MIN
#define INTMAX_MIN (-INTMAX_MAX - 1)
#undef UINTMAX_MAX
#define UINTMAX_MAX __UINTMAX_MAX__
/* 7.18.3 Limits of other integer types */
#undef PTRDIFF_MAX
#define PTRDIFF_MAX __PTRDIFF_MAX__
#undef PTRDIFF_MIN
#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)
#undef SIG_ATOMIC_MAX
#define SIG_ATOMIC_MAX __SIG_ATOMIC_MAX__
#undef SIG_ATOMIC_MIN
#define SIG_ATOMIC_MIN __SIG_ATOMIC_MIN__
#undef SIZE_MAX
#define SIZE_MAX __SIZE_MAX__
#undef WCHAR_MAX
#define WCHAR_MAX __WCHAR_MAX__
#undef WCHAR_MIN
#define WCHAR_MIN __WCHAR_MIN__
#undef WINT_MAX
#define WINT_MAX __WINT_MAX__
#undef WINT_MIN
#define WINT_MIN __WINT_MIN__
#endif /* (!defined __cplusplus || __cplusplus >= 201103L
|| defined __STDC_LIMIT_MACROS) */
#if (!defined __cplusplus || __cplusplus >= 201103L \
|| defined __STDC_CONSTANT_MACROS)
#undef INT8_C
#define INT8_C(c) __INT8_C(c)
#undef INT16_C
#define INT16_C(c) __INT16_C(c)
#undef INT32_C
#define INT32_C(c) __INT32_C(c)
#undef INT64_C
#define INT64_C(c) __INT64_C(c)
#undef UINT8_C
#define UINT8_C(c) __UINT8_C(c)
#undef UINT16_C
#define UINT16_C(c) __UINT16_C(c)
#undef UINT32_C
#define UINT32_C(c) __UINT32_C(c)
#undef UINT64_C
#define UINT64_C(c) __UINT64_C(c)
#undef INTMAX_C
#define INTMAX_C(c) __INTMAX_C(c)
#undef UINTMAX_C
#define UINTMAX_C(c) __UINTMAX_C(c)
#endif /* (!defined __cplusplus || __cplusplus >= 201103L
|| defined __STDC_CONSTANT_MACROS) */
#ifndef __INT_MAX__
#define __INT_MAX__ 2147483647
#endif
#define INT_MIN (-1 - INT_MAX)
#define INT_MAX (__INT_MAX__)
#define UINT_MAX (INT_MAX * 2U + 1U)
#define LONG_MAX ((long)(~0UL>>1))
#define LONG_MIN (-LONG_MAX - 1)
#define ULONG_MAX (~0UL)
#endif

View File

@@ -1,26 +0,0 @@
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
*/
#ifndef __STDIO_H__
#define __STDIO_H__
#define BUFSIZ 128
#define EOF (-1)
#ifndef SEEK_SET
#define SEEK_SET 0 /* set file offset to offset */
#endif
#ifndef SEEK_CUR
#define SEEK_CUR 1 /* set file offset to current plus offset */
#endif
#ifndef SEEK_END
#define SEEK_END 2 /* set file offset to EOF plus offset */
#endif
#endif

View File

@@ -1,75 +0,0 @@
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2008-08-14 Bernard the first version
*/
#include <rtthread.h>
#if !defined (RT_USING_NEWLIB) && defined (RT_USING_MINILIBC)
#include "stdlib.h"
int atoi(const char* s)
{
long int v=0;
int sign=1;
while ( *s == ' ' || (unsigned int)(*s - 9) < 5u) s++;
switch (*s)
{
case '-':
sign=-1;
case '+':
++s;
}
while ((unsigned int) (*s - '0') < 10u)
{
v=v*10+*s-'0';
++s;
}
return sign==-1?-v:v;
}
long int atol(const char* s)
{
long int v=0;
int sign=0;
while ( *s == ' ' || (unsigned int)(*s - 9) < 5u) ++s;
switch (*s)
{
case '-': sign=-1;
case '+': ++s;
}
while ((unsigned int) (*s - '0') < 10u)
{
v=v*10+*s-'0'; ++s;
}
return sign?-v:v;
}
#ifdef RT_USING_HEAP
void *malloc(size_t size)
{
return rt_malloc(size);
}
void free(void *ptr)
{
rt_free(ptr);
}
void *realloc(void *ptr, size_t size)
{
return rt_realloc(ptr, size);
}
void *calloc(size_t nelem, size_t elsize)
{
return rt_calloc(nelem, elsize);
}
#endif
#endif

View File

@@ -1,33 +0,0 @@
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2008-08-14 Bernard the first version
*/
#ifndef __STDLIB_H__
#define __STDLIB_H__
#include <sys/types.h>
#if !defined (RT_USING_NEWLIB) && defined (RT_USING_MINILIBC)
int atoi(const char *nptr);
long int atol(const char *nptr);
int rand(void);
int rand_r(unsigned int *seed);
void srand(unsigned int seed);
void qsort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *));
void *malloc(size_t size);
void free(void *ptr);
void *realloc(void *ptr, size_t size);
void *calloc(size_t nelem, size_t elsize);
void abort(void);
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,69 +0,0 @@
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2008-08-14 Bernard the first version
*/
#ifndef __STRING_H__
#define __STRING_H__
#include <rtthread.h>
#include <sys/types.h>
/* replace for standard string library */
#if !defined (RT_USING_NEWLIB) && defined (RT_USING_MINILIBC)
#define ZEROPAD (1 << 0) /* pad with zero */
#define SIGN (1 << 1) /* unsigned/signed long */
#define PLUS (1 << 2) /* show plus */
#define SPACE (1 << 3) /* space if plus */
#define LEFT (1 << 4) /* left justified */
#define SPECIAL (1 << 5) /* 0x */
#define LARGE (1 << 6) /* use 'ABCDEF' instead of 'abcdef' */
#define _U 0x01 /* upper */
#define _L 0x02 /* lower */
#define _D 0x04 /* digit */
#define _C 0x08 /* cntrl */
#define _P 0x10 /* punct */
#define _S 0x20 /* white space (space/lf/tab) */
#define _X 0x40 /* hex digit */
#define _SP 0x80 /* hard space (0x20) */
void* memset(void *s, int c, size_t n);
void* memcpy(void *dest, const void *src, size_t n);
void* memmove(void *dest, const void *src, size_t n);
int memcmp(const void *s1, const void *s2, size_t n);
int tolower(int c);
int toupper(int c);
int strcmp (const char *s1, const char *s2);
int strncmp(const char *cs,const char *ct, size_t count);
int strcasecmp(const char *a, const char *b);
int strncasecmp(const char *cs, const char *ct, size_t count);
int sscanf(const char * buf, const char * fmt, ...);
size_t strlen(const char *s);
char *strstr(const char * s1,const char * s2);
char *strcpy(char *dest, const char *src);
char *strncpy(char *dest, const char *src, size_t n);
size_t strlcpy(char *dst, const char *src, size_t siz);
char *strncat(char *dest, const char *src, size_t count);
char *strcat(char * dest, const char * src);
char *strchr(const char *s1, int i);
char *strrchr(const char *t, int c);
char *strdup(const char *s);
char *strtok(char *s, const char *delim);
char*strtok_r(char*s, const char*delim, char**ptrptr);
size_t strcspn(const char *s, const char *reject);
size_t strspn (const char *s, const char *accept);
long strtol(const char *str, char **endptr, int base);
long long strtoll(const char *str, char **endptr, int base);
#endif
#endif

View File

@@ -1,58 +0,0 @@
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2017/11/30 Bernard The first version.
*/
#ifndef _SYS_MMAN_H
#define _SYS_MMAN_H
#ifdef __cplusplus
extern "C" {
#endif
#define MAP_FAILED ((void *) -1)
#define MAP_SHARED 0x01
#define MAP_PRIVATE 0x02
#define MAP_TYPE 0x0f
#define MAP_FIXED 0x10
#define MAP_ANON 0x20
#define MAP_ANONYMOUS MAP_ANON
#define MAP_NORESERVE 0x4000
#define MAP_GROWSDOWN 0x0100
#define MAP_DENYWRITE 0x0800
#define MAP_EXECUTABLE 0x1000
#define MAP_LOCKED 0x2000
#define MAP_POPULATE 0x8000
#define MAP_NONBLOCK 0x10000
#define MAP_STACK 0x20000
#define MAP_HUGETLB 0x40000
#define MAP_FILE 0
#define PROT_NONE 0
#define PROT_READ 1
#define PROT_WRITE 2
#define PROT_EXEC 4
#define PROT_GROWSDOWN 0x01000000
#define PROT_GROWSUP 0x02000000
#define MS_ASYNC 1
#define MS_INVALIDATE 2
#define MS_SYNC 4
#define MCL_CURRENT 1
#define MCL_FUTURE 2
#define MCL_ONFAULT 4
void *mmap (void *start, size_t len, int prot, int flags, int fd, off_t off);
int munmap (void *start, size_t len);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -1,44 +0,0 @@
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
*/
#ifndef __STAT_H__
#define __STAT_H__
#include <rtthread.h>
#ifdef RT_USING_DFS
#include <dfs_posix.h>
#else
#define _FREAD 0x0001 /* read enabled */
#define _FWRITE 0x0002 /* write enabled */
#define _FAPPEND 0x0008 /* append (writes guaranteed at the end) */
#define _FMARK 0x0010 /* internal; mark during gc() */
#define _FDEFER 0x0020 /* internal; defer for next gc pass */
#define _FASYNC 0x0040 /* signal pgrp when data ready */
#define _FSHLOCK 0x0080 /* BSD flock() shared lock present */
#define _FEXLOCK 0x0100 /* BSD flock() exclusive lock present */
#define _FCREAT 0x0200 /* open with file create */
#define _FTRUNC 0x0400 /* open with truncation */
#define _FEXCL 0x0800 /* error on open if file exists */
#define _FNBIO 0x1000 /* non blocking I/O (sys5 style) */
#define _FSYNC 0x2000 /* do all writes synchronously */
#define _FNONBLOCK 0x4000 /* non blocking I/O (POSIX style) */
#define _FNDELAY _FNONBLOCK /* non blocking I/O (4.2 style) */
#define _FNOCTTY 0x8000 /* don't assign a ctty on this open */
#define O_RDONLY 0 /* +1 == FREAD */
#define O_WRONLY 1 /* +1 == FWRITE */
#define O_RDWR 2 /* +1 == FREAD|FWRITE */
#define O_APPEND _FAPPEND
#define O_CREAT _FCREAT
#define O_TRUNC _FTRUNC
#define O_EXCL _FEXCL
#define O_SYNC _FSYNC
#endif
#endif

View File

@@ -1,54 +0,0 @@
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
*/
#ifndef _SYS_TIME_H_
#define _SYS_TIME_H_
#include <sys/types.h>
typedef long time_t;
/*
* 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. */
};
int gettimeofday(struct timeval *tp, void *ignore);
#endif

View File

@@ -1,50 +0,0 @@
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
*/
#ifndef __TYPES_H__
#define __TYPES_H__
#include <rtconfig.h>
typedef long off_t;
#ifndef ARCH_CPU_64BIT
typedef unsigned int size_t;
typedef signed int ssize_t; /* Used for a count of bytes or an error indication. */
#else
typedef long unsigned int size_t;
typedef long signed int ssize_t; /* Used for a count of bytes or an error indication. */
#endif
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;
typedef unsigned long clockid_t;
typedef int pid_t;
typedef int gid_t;
typedef int uid_t;
typedef int dev_t;
typedef int ino_t;
typedef int mode_t;
typedef int caddr_t;
typedef unsigned int wint_t;
typedef unsigned long useconds_t;
typedef unsigned long clock_t; /* clock() */
#ifndef NULL
#define NULL (0)
#endif
#define __u_char_defined
#endif

View File

@@ -1,287 +0,0 @@
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
*/
#include <time.h>
#include <rtthread.h>
/* days per month -- nonleap! */
const short __spm[13] =
{ 0,
(31),
(31 + 28),
(31 + 28 + 31),
(31 + 28 + 31 + 30),
(31 + 28 + 31 + 30 + 31),
(31 + 28 + 31 + 30 + 31 + 30),
(31 + 28 + 31 + 30 + 31 + 30 + 31),
(31 + 28 + 31 + 30 + 31 + 30 + 31 + 31),
(31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30),
(31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31),
(31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30),
(31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + 31),
};
static long int timezone;
static const char days[] = "Sun Mon Tue Wed Thu Fri Sat ";
static const char months[] = "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ";
/* seconds per day */
#define SPD 24*60*60
int __isleap(int year)
{
/* every fourth year is a leap year except for century years that are
* not divisible by 400. */
/* return (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)); */
return (!(year % 4) && ((year % 100) || !(year % 400)));
}
struct tm *gmtime_r(const time_t *timep, struct tm *r)
{
time_t i;
register time_t work = *timep % (SPD);
r->tm_sec = work % 60;
work /= 60;
r->tm_min = work % 60;
r->tm_hour = work / 60;
work = *timep / (SPD);
r->tm_wday = (4 + work) % 7;
for (i = 1970;; ++i)
{
register time_t k = __isleap(i) ? 366 : 365;
if (work >= k)
work -= k;
else
break;
}
r->tm_year = i - 1900;
r->tm_yday = work;
r->tm_mday = 1;
if (__isleap(i) && (work > 58))
{
if (work == 59)
r->tm_mday = 2; /* 29.2. */
work -= 1;
}
for (i = 11; i && (__spm[i] > work); --i)
;
r->tm_mon = i;
r->tm_mday += work - __spm[i];
return r;
}
struct tm* localtime_r(const time_t* t, struct tm* r)
{
time_t tmp;
struct timezone tz = {0};
gettimeofday(0, &tz);
timezone = tz.tz_minuteswest * 60L;
tmp = *t + timezone;
return gmtime_r(&tmp, r);
}
struct tm* localtime(const time_t* t)
{
static struct tm tmp;
return localtime_r(t, &tmp);
}
time_t mktime(struct tm * const t)
{
register time_t day;
register time_t i;
register time_t years = t->tm_year - 70;
if (t->tm_sec > 60)
{
t->tm_min += t->tm_sec / 60;
t->tm_sec %= 60;
}
if (t->tm_min > 60)
{
t->tm_hour += t->tm_min / 60;
t->tm_min %= 60;
}
if (t->tm_hour > 24)
{
t->tm_mday += t->tm_hour / 24;
t->tm_hour %= 24;
}
if (t->tm_mon > 12)
{
t->tm_year += t->tm_mon / 12;
t->tm_mon %= 12;
}
while (t->tm_mday > __spm[1 + t->tm_mon])
{
if (t->tm_mon == 1 && __isleap(t->tm_year + 1900))
{
--t->tm_mday;
}
t->tm_mday -= __spm[t->tm_mon];
++t->tm_mon;
if (t->tm_mon > 11)
{
t->tm_mon = 0;
++t->tm_year;
}
}
if (t->tm_year < 70)
return (time_t) - 1;
/* Days since 1970 is 365 * number of years + number of leap years since 1970 */
day = years * 365 + (years + 1) / 4;
/* After 2100 we have to substract 3 leap years for every 400 years
This is not intuitive. Most mktime implementations do not support
dates after 2059, anyway, so we might leave this out for it's
bloat. */
if (years >= 131)
{
years -= 131;
years /= 100;
day -= (years >> 2) * 3 + 1;
if ((years &= 3) == 3)
years--;
day -= years;
}
day += t->tm_yday = __spm[t->tm_mon] + t->tm_mday - 1 +
(__isleap(t->tm_year + 1900) & (t->tm_mon > 1));
/* day is now the number of days since 'Jan 1 1970' */
i = 7;
t->tm_wday = (day + 4) % i; /* Sunday=0, Monday=1, ..., Saturday=6 */
i = 24;
day *= i;
i = 60;
return ((day + t->tm_hour) * i + t->tm_min) * i + t->tm_sec;
}
static void num2str(char *c, int i)
{
c[0] = i / 10 + '0';
c[1] = i % 10 + '0';
}
char *asctime_r(const struct tm *t, char *buf)
{
/* "Wed Jun 30 21:49:08 1993\n" */
*(int*) buf = *(int*) (days + (t->tm_wday << 2));
*(int*) (buf + 4) = *(int*) (months + (t->tm_mon << 2));
num2str(buf + 8, t->tm_mday);
if (buf[8] == '0')
buf[8] = ' ';
buf[10] = ' ';
num2str(buf + 11, t->tm_hour);
buf[13] = ':';
num2str(buf + 14, t->tm_min);
buf[16] = ':';
num2str(buf + 17, t->tm_sec);
buf[19] = ' ';
num2str(buf + 20, (t->tm_year + 1900) / 100);
num2str(buf + 22, (t->tm_year + 1900) % 100);
buf[24] = '\n';
return buf;
}
char *asctime(const struct tm *timeptr)
{
static char buf[25];
return asctime_r(timeptr, buf);
}
char *ctime(const time_t *timep)
{
return asctime(localtime(timep));
}
#ifdef RT_USING_DEVICE
int gettimeofday(struct timeval *tp, void *ignore)
{
time_t time;
rt_device_t device;
device = rt_device_find("rtc");
RT_ASSERT(device != RT_NULL);
rt_device_control(device, RT_DEVICE_CTRL_RTC_GET_TIME, &time);
if (tp != RT_NULL)
{
tp->tv_sec = time;
tp->tv_usec = 0;
}
return time;
}
#endif
#ifndef _gettimeofday
/* Dummy function when hardware do not have RTC */
int _gettimeofday( struct timeval *tv, void *ignore)
{
tv->tv_sec = 0; // convert to seconds
tv->tv_usec = 0; // get remaining microseconds
return 0; // return non-zero for error
}
#endif
/**
* Returns the current time.
*
* @param time_t * t the timestamp pointer, if not used, keep NULL.
*
* @return time_t return timestamp current.
*
*/
/* for IAR 6.2 later Compiler */
#if defined (__IAR_SYSTEMS_ICC__) && (__VER__) >= 6020000
#pragma module_name = "?time"
time_t (__time32)(time_t *t) /* Only supports 32-bit timestamp */
#else
time_t time(time_t *t)
#endif
{
time_t time_now = 0;
#ifdef RT_USING_RTC
static rt_device_t device = RT_NULL;
/* optimization: find rtc device only first. */
if (device == RT_NULL)
{
device = rt_device_find("rtc");
}
/* read timestamp from RTC device. */
if (device != RT_NULL)
{
if (rt_device_open(device, 0) == RT_EOK)
{
rt_device_control(device, RT_DEVICE_CTRL_RTC_GET_TIME, &time_now);
rt_device_close(device);
}
}
#endif /* RT_USING_RTC */
/* if t is not NULL, write timestamp to *t */
if (t != RT_NULL)
{
*t = time_now;
}
return time_now;
}
RT_WEAK clock_t clock(void)
{
return rt_tick_get();
}

View File

@@ -1,24 +0,0 @@
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
*/
#ifndef __TIME_H__
#define __TIME_H__
#include <sys/time.h>
time_t mktime(struct tm * const t);
char *asctime(const struct tm *timeptr);
char *ctime(const time_t *timep);
struct tm* localtime(const time_t* t);
char *asctime_r(const struct tm *t, char *buf);
struct tm *gmtime_r(const time_t *timep, struct tm *r);
struct tm* localtime_r(const time_t* t, struct tm* r);
#endif

View File

@@ -1,21 +1,30 @@
from building import *
Import('rtconfig')
src = Glob('*.c')
src = []
cwd = GetCurrentDir()
group = []
CPPPATH = [cwd]
CPPDEFINES = ['RT_USING_NEWLIB']
# link with libc and libm:
# libm is a frequently used lib. Newlib is compiled with -ffunction-sections in
# recent GCC tool chains. The linker would just link in the functions that have
# been referenced. So setting this won't result in bigger text size.
LIBS = ['c', 'm']
if rtconfig.PLATFORM == 'gcc':
group = DefineGroup('libc', src, depend = ['RT_USING_LIBC'],
CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES, LIBS = LIBS)
if GetDepend('RT_USING_LIBC'):
CPPDEFINES = ['RT_USING_NEWLIB']
# link with libc and libm:
# libm is a frequently used lib. Newlib is compiled with -ffunction-sections in
# recent GCC tool chains. The linker would just link in the functions that have
# been referenced. So setting this won't result in bigger text size.
LIBS = ['c', 'm']
src += Glob('*.c')
SrcRemove(src, ['minilib.c'])
if GetDepend('RT_USING_MODULE') == False:
SrcRemove(src, ['libc_syms.c'])
else:
src += ['minilib.c']
CPPDEFINES = []
LIBS = []
group = DefineGroup('libc', src, depend = [], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES, LIBS = LIBS)
Return('group')

View File

@@ -0,0 +1,18 @@
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-02-23 Meco Man first version
*/
#include <reent.h>
#include <rtthread.h>
void * _sbrk_r(struct _reent *ptr, ptrdiff_t incr)
{
/* no use this routine to get memory */
return RT_NULL;
}

View File

@@ -66,7 +66,7 @@ typedef uintptr_t mem_ptr_t;
#endif /* __CC_ARM/__IAR_SYSTEMS_ICC__ */
#endif
#if defined(RT_USING_LIBC) || defined(RT_USING_MINILIBC) || defined(RT_LIBC_USING_TIME) || (defined( __GNUC__ ) && !defined(__ARMCC_VERSION))
#if defined(RT_USING_LIBC) || defined(RT_LIBC_USING_TIME) || (defined( __GNUC__ ) && !defined(__ARMCC_VERSION))
#include <sys/time.h>
#define LWIP_TIMEVAL_PRIVATE 0
#else

View File

@@ -45,7 +45,7 @@
#define S32_F "ld"
#define X32_F "lx"
#if defined(RT_USING_LIBC) || defined(RT_USING_MINILIBC) || defined(RT_LIBC_USING_TIME) || (defined( __GNUC__ ) && !defined(__ARMCC_VERSION))
#if defined(RT_USING_LIBC) || defined(RT_LIBC_USING_TIME) || (defined( __GNUC__ ) && !defined(__ARMCC_VERSION))
#include <sys/time.h>
#define LWIP_TIMEVAL_PRIVATE 0
#else

View File

@@ -59,7 +59,7 @@
#endif /* __CC_ARM/__IAR_SYSTEMS_ICC__ */
#endif /* RT_USING_LIBC */
#if defined(RT_USING_LIBC) || defined(RT_USING_MINILIBC) || defined(RT_LIBC_USING_TIME) || (defined( __GNUC__ ) && !defined(__ARMCC_VERSION))
#if defined(RT_USING_LIBC) || defined(RT_LIBC_USING_TIME) || (defined( __GNUC__ ) && !defined(__ARMCC_VERSION))
#include <sys/time.h>
#define LWIP_TIMEVAL_PRIVATE 0
#else

View File

@@ -1386,26 +1386,4 @@ void rt_assert_handler(const char *ex_string, const char *func, rt_size_t line)
RTM_EXPORT(rt_assert_handler);
#endif /* RT_DEBUG */
#if !defined (RT_USING_NEWLIB) && defined (RT_USING_MINILIBC) && defined (__GNUC__)
#include <sys/types.h>
void *memcpy(void *dest, const void *src, size_t n) __attribute__((weak, alias("rt_memcpy")));
void *memset(void *s, int c, size_t n) __attribute__((weak, alias("rt_memset")));
void *memmove(void *dest, const void *src, size_t n) __attribute__((weak, alias("rt_memmove")));
int memcmp(const void *s1, const void *s2, size_t n) __attribute__((weak, alias("rt_memcmp")));
size_t strlen(const char *s) __attribute__((weak, alias("rt_strlen")));
char *strstr(const char *s1, const char *s2) __attribute__((weak, alias("rt_strstr")));
int strcasecmp(const char *a, const char *b) __attribute__((weak, alias("rt_strcasecmp")));
char *strncpy(char *dest, const char *src, size_t n) __attribute__((weak, alias("rt_strncpy")));
int strncmp(const char *cs, const char *ct, size_t count) __attribute__((weak, alias("rt_strncmp")));
#ifdef RT_USING_HEAP
char *strdup(const char *s) __attribute__((weak, alias("rt_strdup")));
#endif
int sprintf(char *buf, const char *format, ...) __attribute__((weak, alias("rt_sprintf")));
int snprintf(char *buf, rt_size_t size, const char *fmt, ...) __attribute__((weak, alias("rt_snprintf")));
int vsprintf(char *buf, const char *format, va_list arg_ptr) __attribute__((weak, alias("rt_vsprintf")));
#endif
/**@}*/