add RT_KERVICE_USING_STDLIB
This commit is contained in:
parent
8932ffdb96
commit
00cebaacac
|
@ -14,6 +14,7 @@
|
||||||
* 2013-06-24 Bernard add rt_kprintf re-define when not use RT_USING_CONSOLE.
|
* 2013-06-24 Bernard add rt_kprintf re-define when not use RT_USING_CONSOLE.
|
||||||
* 2016-08-09 ArdaFu add new thread and interrupt hook.
|
* 2016-08-09 ArdaFu add new thread and interrupt hook.
|
||||||
* 2018-11-22 Jesven add all cpu's lock and ipi handler
|
* 2018-11-22 Jesven add all cpu's lock and ipi handler
|
||||||
|
* 2021-02-28 Meco Man add RT_KERVICE_USING_STDLIB
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __RT_THREAD_H__
|
#ifndef __RT_THREAD_H__
|
||||||
|
@ -516,7 +517,9 @@ void rt_components_board_init(void);
|
||||||
#else
|
#else
|
||||||
void rt_kprintf(const char *fmt, ...);
|
void rt_kprintf(const char *fmt, ...);
|
||||||
void rt_kputs(const char *str);
|
void rt_kputs(const char *str);
|
||||||
|
rt_int32_t rt_sscanf(const char *buf, const char *fmt, ...);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
rt_int32_t rt_vsprintf(char *dest, const char *format, va_list arg_ptr);
|
rt_int32_t rt_vsprintf(char *dest, const char *format, va_list arg_ptr);
|
||||||
rt_int32_t rt_vsnprintf(char *buf, rt_size_t size, const char *fmt, va_list args);
|
rt_int32_t rt_vsnprintf(char *buf, rt_size_t size, const char *fmt, va_list args);
|
||||||
rt_int32_t rt_sprintf(char *buf, const char *format, ...);
|
rt_int32_t rt_sprintf(char *buf, const char *format, ...);
|
||||||
|
@ -541,22 +544,34 @@ int __rt_ffs(int value);
|
||||||
void *rt_memset(void *src, int c, rt_ubase_t n);
|
void *rt_memset(void *src, int c, rt_ubase_t n);
|
||||||
void *rt_memcpy(void *dest, const void *src, rt_ubase_t n);
|
void *rt_memcpy(void *dest, const void *src, rt_ubase_t n);
|
||||||
|
|
||||||
rt_int32_t rt_strncmp(const char *cs, const char *ct, rt_ubase_t count);
|
#ifndef RT_KERVICE_USING_STDLIB
|
||||||
rt_int32_t rt_strcmp(const char *cs, const char *ct);
|
|
||||||
rt_size_t rt_strlen(const char *src);
|
|
||||||
rt_size_t rt_strnlen(const char *s, rt_ubase_t maxlen);
|
|
||||||
char *rt_strdup(const char *s);
|
|
||||||
#if defined(__CC_ARM) || defined(__CLANG_ARM)
|
|
||||||
/* leak strdup interface */
|
|
||||||
char* strdup(const char* str);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
char *rt_strstr(const char *str1, const char *str2);
|
|
||||||
rt_int32_t rt_sscanf(const char *buf, const char *fmt, ...);
|
|
||||||
char *rt_strncpy(char *dest, const char *src, rt_ubase_t n);
|
|
||||||
void *rt_memmove(void *dest, const void *src, rt_ubase_t n);
|
void *rt_memmove(void *dest, const void *src, rt_ubase_t n);
|
||||||
rt_int32_t rt_memcmp(const void *cs, const void *ct, rt_ubase_t count);
|
rt_int32_t rt_memcmp(const void *cs, const void *ct, rt_ubase_t count);
|
||||||
|
char *rt_strstr(const char *str1, const char *str2);
|
||||||
rt_int32_t rt_strcasecmp(const char *a, const char *b);
|
rt_int32_t rt_strcasecmp(const char *a, const char *b);
|
||||||
|
char *rt_strncpy(char *dest, const char *src, rt_ubase_t n);
|
||||||
|
rt_int32_t rt_strncmp(const char *cs, const char *ct, rt_ubase_t count);
|
||||||
|
rt_int32_t rt_strcmp(const char *cs, const char *ct);
|
||||||
|
rt_size_t rt_strnlen(const char *s, rt_ubase_t maxlen);
|
||||||
|
rt_size_t rt_strlen(const char *src);
|
||||||
|
#else
|
||||||
|
#include <string.h>
|
||||||
|
#define rt_memmove(dest, src, n) memmove(dest, src, n)
|
||||||
|
#define rt_memcmp(cs, ct, count) memcmp(cs, ct, count)
|
||||||
|
#define rt_strstr(str1, str2) strstr(str1, str2)
|
||||||
|
#define rt_strcasecmp(a, b) strcasecmp(a, b)
|
||||||
|
#define rt_strncpy(dest, src, n) strncpy(dest, src, n)
|
||||||
|
#define rt_strncmp(cs, ct, count) strncmp(cs, ct, count)
|
||||||
|
#define rt_strcmp(cs, ct) strcmp(cs, ct)
|
||||||
|
#define rt_strnlen(s, maxlen) strnlen(s, maxlen)
|
||||||
|
#define rt_strlen(src) strlen(src)
|
||||||
|
#endif /*RT_KERVICE_USING_STDLIB*/
|
||||||
|
|
||||||
|
char *rt_strdup(const char *s);
|
||||||
|
#if defined(__CC_ARM) || defined(__CLANG_ARM)
|
||||||
|
/* lack strdup interface */
|
||||||
|
char* strdup(const char* str);
|
||||||
|
#endif
|
||||||
|
|
||||||
void rt_show_version(void);
|
void rt_show_version(void);
|
||||||
|
|
||||||
|
|
|
@ -116,6 +116,10 @@ config RT_TIMER_THREAD_STACK_SIZE
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
config RT_KERVICE_USING_STDLIB
|
||||||
|
bool "Enable kservice to use standard C library"
|
||||||
|
default n
|
||||||
|
|
||||||
menuconfig RT_DEBUG
|
menuconfig RT_DEBUG
|
||||||
bool "Enable debugging features"
|
bool "Enable debugging features"
|
||||||
default y
|
default y
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
* 2013-06-24 Bernard remove rt_kprintf if RT_USING_CONSOLE is not defined.
|
* 2013-06-24 Bernard remove rt_kprintf if RT_USING_CONSOLE is not defined.
|
||||||
* 2013-09-24 aozima make sure the device is in STREAM mode when used by rt_kprintf.
|
* 2013-09-24 aozima make sure the device is in STREAM mode when used by rt_kprintf.
|
||||||
* 2015-07-06 Bernard Add rt_assert_handler routine.
|
* 2015-07-06 Bernard Add rt_assert_handler routine.
|
||||||
|
* 2021-02-28 Meco Man add RT_KERVICE_USING_STDLIB
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <rtthread.h>
|
#include <rtthread.h>
|
||||||
|
@ -280,6 +281,8 @@ RT_WEAK void *rt_memcpy(void *dst, const void *src, rt_ubase_t count)
|
||||||
}
|
}
|
||||||
RTM_EXPORT(rt_memcpy);
|
RTM_EXPORT(rt_memcpy);
|
||||||
|
|
||||||
|
#ifndef RT_KERVICE_USING_STDLIB
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function will move memory content from source address to destination
|
* This function will move memory content from source address to destination
|
||||||
* address.
|
* address.
|
||||||
|
@ -506,6 +509,8 @@ rt_size_t rt_strlen(const char *s)
|
||||||
}
|
}
|
||||||
RTM_EXPORT(rt_strlen);
|
RTM_EXPORT(rt_strlen);
|
||||||
|
|
||||||
|
#endif /*RT_KERVICE_USING_STDLIB*/
|
||||||
|
|
||||||
#ifdef RT_USING_HEAP
|
#ifdef RT_USING_HEAP
|
||||||
/**
|
/**
|
||||||
* This function will duplicate a string.
|
* This function will duplicate a string.
|
||||||
|
|
Loading…
Reference in New Issue