Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Mozi
rt-thread
提交
a714c65c
R
rt-thread
项目概览
Mozi
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a714c65c
编写于
6月 29, 2022
作者:
mysterywolf
提交者:
guo
7月 01, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[kernel] 统一kernel内置rt_xxx的libc和标准libc库,防止割裂越来越大
上级
584d06bd
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
83 addition
and
82 deletion
+83
-82
include/rtdef.h
include/rtdef.h
+83
-82
未找到文件。
include/rtdef.h
浏览文件 @
a714c65c
/*
* Copyright (c) 2006-202
1
, RT-Thread Development Team
* Copyright (c) 2006-202
2
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
@@ -42,13 +42,18 @@
* 2022-01-07 Gabriel move some __on_rt_xxxxx_hook to dedicated c source files
* 2022-01-12 Meco Man remove RT_THREAD_BLOCK
* 2022-04-20 Meco Man change version number to v4.1.1
* 2022-06-29 Meco Man add RT_USING_LIBC and standard libc headers
*/
#ifndef __RT_DEF_H__
#define __RT_DEF_H__
/* include rtconfig header to import configuration */
#include <rtconfig.h>
#ifdef RT_USING_LIBC
#include <stdint.h>
#include <stddef.h>
#include <stdarg.h>
#endif
/* RT_USING_LIBC */
#ifdef __cplusplus
extern
"C"
{
...
...
@@ -72,8 +77,6 @@ extern "C" {
/* RT-Thread basic data type definitions */
#ifndef RT_USING_ARCH_DATA_TYPE
#ifdef RT_USING_LIBC
#include <stdint.h>
#include <stddef.h>
typedef
int8_t
rt_int8_t
;
/**< 8bit integer type */
typedef
int16_t
rt_int16_t
;
/**< 16bit integer type */
typedef
int32_t
rt_int32_t
;
/**< 32bit integer type */
...
...
@@ -119,12 +122,26 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
#define RT_TRUE 1
/**< boolean true */
#define RT_FALSE 0
/**< boolean fails */
/* null pointer definition */
#ifdef RT_USING_LIBC
#define RT_NULL NULL
/**< null pointer */
#else
#define RT_NULL (0)
/**< null pointer */
#endif
/* RT_USING_LIBC */
/**@}*/
/* maximum value of base type */
#ifdef RT_USING_LIBC
#define RT_UINT8_MAX UINT8_MAX
/**< Maximum number of UINT8 */
#define RT_UINT16_MAX UINT16_MAX
/**< Maximum number of UINT16 */
#define RT_UINT32_MAX UINT32_MAX
/**< Maximum number of UINT32 */
#else
#define RT_UINT8_MAX 0xff
/**< Maximum number of UINT8 */
#define RT_UINT16_MAX 0xffff
/**< Maximum number of UINT16 */
#define RT_UINT32_MAX 0xffffffff
/**< Maximum number of UINT32 */
#endif
/* RT_USING_LIBC */
#define RT_TICK_MAX RT_UINT32_MAX
/**< Maximum number of tick */
/* maximum value of ipc type */
...
...
@@ -138,84 +155,76 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
/* Compiler Related Definitions */
#if defined(__ARMCC_VERSION)
/* ARM Compiler */
#include <stdarg.h>
#define RT_SECTION(x) __attribute__((section(x)))
#define RT_USED __attribute__((used))
#define ALIGN(n) __attribute__((aligned(n)))
#define RT_WEAK __attribute__((weak))
#define rt_inline static __inline
/* module compiling */
#ifdef RT_USING_MODULE
#define RTT_API __declspec(dllimport)
#else
#define RTT_API __declspec(dllexport)
#endif
/* RT_USING_MODULE */
#define RT_SECTION(x) __attribute__((section(x)))
#define RT_USED __attribute__((used))
#define ALIGN(n) __attribute__((aligned(n)))
#define RT_WEAK __attribute__((weak))
#define rt_inline static __inline
/* module compiling */
#ifdef RT_USING_MODULE
#define RTT_API __declspec(dllimport)
#else
#define RTT_API __declspec(dllexport)
#endif
/* RT_USING_MODULE */
#elif defined (__IAR_SYSTEMS_ICC__)
/* for IAR Compiler */
#include <stdarg.h>
#define RT_SECTION(x) @ x
#define RT_USED __root
#define PRAGMA(x) _Pragma(#x)
#define ALIGN(n) PRAGMA(data_alignment=n)
#define RT_WEAK __weak
#define rt_inline static inline
#define RTT_API
#define RT_SECTION(x) @ x
#define RT_USED __root
#define PRAGMA(x) _Pragma(#x)
#define ALIGN(n) PRAGMA(data_alignment=n)
#define RT_WEAK __weak
#define rt_inline static inline
#define RTT_API
#elif defined (__GNUC__)
/* GNU GCC Compiler */
#ifdef RT_USING_NEWLIB
#include <stdarg.h>
#else
/* the version of GNU GCC must be greater than 4.x */
typedef
__builtin_va_list
__gnuc_va_list
;
typedef
__gnuc_va_list
va_list
;
#define va_start(v,l) __builtin_va_start(v,l)
#define va_end(v) __builtin_va_end(v)
#define va_arg(v,l) __builtin_va_arg(v,l)
#endif
/* RT_USING_NEWLIB */
#define RT_SECTION(x) __attribute__((section(x)))
#define RT_USED __attribute__((used))
#define ALIGN(n) __attribute__((aligned(n)))
#define RT_WEAK __attribute__((weak))
#define rt_inline static __inline
#define RTT_API
#ifndef RT_USING_LIBC
/* the version of GNU GCC must be greater than 4.x */
typedef
__builtin_va_list
__gnuc_va_list
;
typedef
__gnuc_va_list
va_list
;
#define va_start(v,l) __builtin_va_start(v,l)
#define va_end(v) __builtin_va_end(v)
#define va_arg(v,l) __builtin_va_arg(v,l)
#endif
/* RT_USING_LIBC */
#define RT_SECTION(x) __attribute__((section(x)))
#define RT_USED __attribute__((used))
#define ALIGN(n) __attribute__((aligned(n)))
#define RT_WEAK __attribute__((weak))
#define rt_inline static __inline
#define RTT_API
#elif defined (__ADSPBLACKFIN__)
/* for VisualDSP++ Compiler */
#include <stdarg.h>
#define RT_SECTION(x) __attribute__((section(x)))
#define RT_USED __attribute__((used))
#define ALIGN(n) __attribute__((aligned(n)))
#define RT_WEAK __attribute__((weak))
#define rt_inline static inline
#define RTT_API
#define RT_SECTION(x) __attribute__((section(x)))
#define RT_USED __attribute__((used))
#define ALIGN(n) __attribute__((aligned(n)))
#define RT_WEAK __attribute__((weak))
#define rt_inline static inline
#define RTT_API
#elif defined (_MSC_VER)
#include <stdarg.h>
#define RT_SECTION(x)
#define RT_USED
#define ALIGN(n) __declspec(align(n))
#define RT_WEAK
#define rt_inline static __inline
#define RTT_API
#define RT_SECTION(x)
#define RT_USED
#define ALIGN(n) __declspec(align(n))
#define RT_WEAK
#define rt_inline static __inline
#define RTT_API
#elif defined (__TI_COMPILER_VERSION__)
#include <stdarg.h>
/* The way that TI compiler set section is different from other(at least
* GCC and MDK) compilers. See ARM Optimizing C/C++ Compiler 5.9.3 for more
* details. */
#define RT_SECTION(x)
#define RT_USED
#define PRAGMA(x) _Pragma(#x)
#define ALIGN(n)
#define RT_WEAK
#define rt_inline static inline
#define RTT_API
/* The way that TI compiler set section is different from other(at least
* GCC and MDK) compilers. See ARM Optimizing C/C++ Compiler 5.9.3 for more
* details. */
#define RT_SECTION(x)
#define RT_USED
#define PRAGMA(x) _Pragma(#x)
#define ALIGN(n)
#define RT_WEAK
#define rt_inline static inline
#define RTT_API
#elif defined (__TASKING__)
#include <stdarg.h>
#define RT_SECTION(x) __attribute__((section(x)))
#define RT_USED __attribute__((used, protect))
#define PRAGMA(x) _Pragma(#x)
#define ALIGN(n) __attribute__((__align(n)))
#define RT_WEAK __attribute__((weak))
#define rt_inline static inline
#define RTT_API
#define RT_SECTION(x) __attribute__((section(x)))
#define RT_USED __attribute__((used, protect))
#define PRAGMA(x) _Pragma(#x)
#define ALIGN(n) __attribute__((__align(n)))
#define RT_WEAK __attribute__((weak))
#define rt_inline static inline
#define RTT_API
#else
#error not supported tool chain
#endif
#endif
/* __ARMCC_VERSION */
/* initialization export */
#ifdef RT_USING_COMPONENTS_INIT
...
...
@@ -353,14 +362,6 @@ typedef int (*init_fn_t)(void);
*/
#define RT_ALIGN_DOWN(size, align) ((size) & ~((align) - 1))
/**
* @ingroup BasicDef
*
* @def RT_NULL
* Similar as the \c NULL in C library.
*/
#define RT_NULL (0)
/**
* Double List structure
*/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录