Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
RT-Thread
rt-thread
提交
9c78680f
R
rt-thread
项目概览
RT-Thread
/
rt-thread
8 个月 前同步成功
通知
750
Star
8909
Fork
4735
代码
文件
提交
分支
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,体验更适合开发者的 AI 搜索 >>
未验证
提交
9c78680f
编写于
11月 29, 2021
作者:
B
Bernard Xiong
提交者:
GitHub
11月 29, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5310 from mysterywolf/printf2
[kservice] 优化RT_PRINTF_LONGLONG,减少重复代码
上级
f4c3b833
2d505d8f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
124 addition
and
142 deletion
+124
-142
src/Kconfig
src/Kconfig
+111
-111
src/kservice.c
src/kservice.c
+13
-31
未找到文件。
src/Kconfig
浏览文件 @
9c78680f
...
...
@@ -115,37 +115,40 @@ config RT_USING_TIMER_SOFT
thread.
if RT_USING_TIMER_SOFT
config RT_TIMER_THREAD_PRIO
int "The priority level value of timer thread"
default 4
config RT_TIMER_THREAD_STACK_SIZE
int "The stack size of timer thread"
default 512
config RT_TIMER_THREAD_PRIO
int "The priority level value of timer thread"
default 4
config RT_TIMER_THREAD_STACK_SIZE
int "The stack size of timer thread"
default 512
endif
menu "kservice optimization"
config RT_KSERVICE_USING_STDLIB
bool "Enable kservice to use standard C library"
default n
config RT_KSERVICE_USING_STDLIB
bool "Enable kservice to use standard C library"
default n
config RT_KSERVICE_USING_TINY_SIZE
bool "Enable kservice to use tiny size"
default n
config RT_KSERVICE_USING_TINY_SIZE
bool "Enable kservice to use tiny size"
default n
config RT_USING_ASM_MEMCPY
bool
default n
config RT_USING_ASM_MEMCPY
bool
default n
config RT_USING_ASM_MEMSET
bool
default n
config RT_USING_ASM_MEMSET
bool
default n
config RT_USING_TINY_FFS
bool "Enable kservice to use tiny ffs"
default n
config RT_USING_TINY_FFS
bool "Enable kservice to use tiny finding first bit set method"
default n
config RT_PRINTF_LONGLONG
bool "Enable rt_printf-family functions to support long long format"
default n
endmenu
...
...
@@ -155,121 +158,122 @@ menuconfig RT_DEBUG
if RT_DEBUG
config RT_DEBUG_COLOR
bool "Enable color debugging log"
default n
config RT_DEBUG_COLOR
bool "Enable color debugging log"
default n
config RT_DEBUG_INIT_CONFIG
bool "Enable debugging of components initialization"
default n
config RT_DEBUG_INIT_CONFIG
bool "Enable debugging of components initialization"
default n
config RT_DEBUG_INIT
int
default 1 if RT_DEBUG_INIT_CONFIG
config RT_DEBUG_INIT
int
default 1 if RT_DEBUG_INIT_CONFIG
config RT_DEBUG_THREAD_CONFIG
bool "Enable debugging of Thread State Changes"
default n
config RT_DEBUG_THREAD_CONFIG
bool "Enable debugging of Thread State Changes"
default n
config RT_DEBUG_THREAD
int
default 1 if RT_DEBUG_THREAD_CONFIG
config RT_DEBUG_THREAD
int
default 1 if RT_DEBUG_THREAD_CONFIG
config RT_DEBUG_SCHEDULER_CONFIG
bool "Enable debugging of Scheduler"
default n
config RT_DEBUG_SCHEDULER_CONFIG
bool "Enable debugging of Scheduler"
default n
config RT_DEBUG_SCHEDULER
int
default 1 if RT_DEBUG_SCHEDULER_CONFIG
config RT_DEBUG_SCHEDULER
int
default 1 if RT_DEBUG_SCHEDULER_CONFIG
config RT_DEBUG_IPC_CONFIG
bool "Enable debugging of IPC"
default n
config RT_DEBUG_IPC_CONFIG
bool "Enable debugging of IPC"
default n
config RT_DEBUG_IPC
int
default 1 if RT_DEBUG_IPC_CONFIG
config RT_DEBUG_IPC
int
default 1 if RT_DEBUG_IPC_CONFIG
config RT_DEBUG_TIMER_CONFIG
bool "Enable debugging of Timer"
default n
config RT_DEBUG_TIMER_CONFIG
bool "Enable debugging of Timer"
default n
config RT_DEBUG_TIMER
int
default 1 if RT_DEBUG_TIMER_CONFIG
config RT_DEBUG_TIMER
int
default 1 if RT_DEBUG_TIMER_CONFIG
config RT_DEBUG_IRQ_CONFIG
bool "Enable debugging of IRQ(Interrupt Request)"
default n
config RT_DEBUG_IRQ_CONFIG
bool "Enable debugging of IRQ(Interrupt Request)"
default n
config RT_DEBUG_IRQ
int
default 1 if RT_DEBUG_IRQ_CONFIG
config RT_DEBUG_IRQ
int
default 1 if RT_DEBUG_IRQ_CONFIG
config RT_DEBUG_MEM_CONFIG
bool "Enable debugging of Small Memory Algorithm"
default n
config RT_DEBUG_MEM_CONFIG
bool "Enable debugging of Small Memory Algorithm"
default n
config RT_DEBUG_MEM
int
default 1 if RT_DEBUG_MEM_CONFIG
config RT_DEBUG_MEM
int
default 1 if RT_DEBUG_MEM_CONFIG
config RT_DEBUG_SLAB_CONFIG
bool "Enable debugging of SLAB Memory Algorithm"
default n
config RT_DEBUG_SLAB_CONFIG
bool "Enable debugging of SLAB Memory Algorithm"
default n
config RT_DEBUG_SLAB
int
default 1 if RT_DEBUG_SLAB_CONFIG
config RT_DEBUG_SLAB
int
default 1 if RT_DEBUG_SLAB_CONFIG
config RT_DEBUG_MEMHEAP_CONFIG
bool "Enable debugging of Memory Heap Algorithm"
default n
config RT_DEBUG_MEMHEAP_CONFIG
bool "Enable debugging of Memory Heap Algorithm"
default n
config RT_DEBUG_MEMHEAP
int
default 1 if RT_DEBUG_MEMHEAP_CONFIG
config RT_DEBUG_MEMHEAP
int
default 1 if RT_DEBUG_MEMHEAP_CONFIG
config RT_DEBUG_MODULE_CONFIG
bool "Enable debugging of Application Module"
default n
config RT_DEBUG_MODULE_CONFIG
bool "Enable debugging of Application Module"
default n
config RT_DEBUG_MODULE
int
default 1 if RT_DEBUG_MODULE_CONFIG
config RT_DEBUG_MODULE
int
default 1 if RT_DEBUG_MODULE_CONFIG
endif
menu "Inter-Thread communication"
config RT_USING_SEMAPHORE
bool "Enable semaphore"
default y
config RT_USING_SEMAPHORE
bool "Enable semaphore"
default y
config RT_USING_MUTEX
bool "Enable mutex"
default y
config RT_USING_MUTEX
bool "Enable mutex"
default y
config RT_USING_EVENT
bool "Enable event flag"
default y
config RT_USING_EVENT
bool "Enable event flag"
default y
config RT_USING_MAILBOX
bool "Enable mailbox"
default y
config RT_USING_MAILBOX
bool "Enable mailbox"
default y
config RT_USING_MESSAGEQUEUE
bool "Enable message queue"
default y
config RT_USING_MESSAGEQUEUE
bool "Enable message queue"
default y
config RT_USING_SIGNALS
bool "Enable signals"
select RT_USING_MEMPOOL
default n
help
A signal is an asynchronous notification sent to a specific thread
in order to notify it of an event that occurred.
config RT_USING_SIGNALS
bool "Enable signals"
select RT_USING_MEMPOOL
default n
help
A signal is an asynchronous notification sent to a specific thread
in order to notify it of an event that occurred.
endmenu
menu "Memory Management"
...
...
@@ -375,10 +379,6 @@ menu "Kernel Device Object"
config RT_CONSOLE_DEVICE_NAME
string "the device name for console"
default "uart"
config RT_PRINTF_LONGLONG
bool "rt_kprintf support long long"
default n
endif
endmenu
...
...
src/kservice.c
浏览文件 @
9c78680f
...
...
@@ -593,7 +593,6 @@ RTM_EXPORT(rt_show_version);
/* private function */
#define _ISDIGIT(c) ((unsigned)((c) - '0') < 10)
#ifdef RT_PRINTF_LONGLONG
/**
* This function will duplicate a string.
*
...
...
@@ -603,44 +602,38 @@ RTM_EXPORT(rt_show_version);
*
* @return the duplicated string pointer.
*/
#ifdef RT_PRINTF_LONGLONG
rt_inline
int
divide
(
long
long
*
n
,
int
base
)
#else
rt_inline
int
divide
(
long
*
n
,
int
base
)
#endif
/* RT_PRINTF_LONGLONG */
{
int
res
;
/* optimized for processor which does not support divide instructions. */
if
(
base
==
10
)
{
#ifdef RT_PRINTF_LONGLONG
res
=
(
int
)(((
unsigned
long
long
)
*
n
)
%
10U
);
*
n
=
(
long
long
)(((
unsigned
long
long
)
*
n
)
/
10U
);
}
else
{
res
=
(
int
)(((
unsigned
long
long
)
*
n
)
%
16U
);
*
n
=
(
long
long
)(((
unsigned
long
long
)
*
n
)
/
16U
);
}
return
res
;
}
#else
rt_inline
int
divide
(
long
*
n
,
int
base
)
{
int
res
;
/* optimized for processor which does not support divide instructions. */
if
(
base
==
10
)
{
res
=
(
int
)(((
unsigned
long
)
*
n
)
%
10U
);
*
n
=
(
long
)(((
unsigned
long
)
*
n
)
/
10U
);
#endif
}
else
{
#ifdef RT_PRINTF_LONGLONG
res
=
(
int
)(((
unsigned
long
long
)
*
n
)
%
16U
);
*
n
=
(
long
long
)(((
unsigned
long
long
)
*
n
)
/
16U
);
#else
res
=
(
int
)(((
unsigned
long
)
*
n
)
%
16U
);
*
n
=
(
long
)(((
unsigned
long
)
*
n
)
/
16U
);
#endif
}
return
res
;
}
#endif
/* RT_PRINTF_LONGLONG */
rt_inline
int
skip_atoi
(
const
char
**
s
)
{
...
...
@@ -659,7 +652,6 @@ rt_inline int skip_atoi(const char **s)
#define SPECIAL (1 << 5)
/* 0x */
#define LARGE (1 << 6)
/* use 'ABCDEF' instead of 'abcdef' */
#ifdef RT_PRINTF_PRECISION
static
char
*
print_number
(
char
*
buf
,
char
*
end
,
#ifdef RT_PRINTF_LONGLONG
...
...
@@ -669,20 +661,10 @@ static char *print_number(char *buf,
#endif
/* RT_PRINTF_LONGLONG */
int
base
,
int
s
,
#ifdef RT_PRINTF_PRECISION
int
precision
,
int
type
)
#else
static
char
*
print_number
(
char
*
buf
,
char
*
end
,
#ifdef RT_PRINTF_LONGLONG
long
long
num
,
#else
long
num
,
#endif
/* RT_PRINTF_LONGLONG */
int
base
,
int
s
,
int
type
)
#endif
/* RT_PRINTF_PRECISION */
int
type
)
{
char
c
,
sign
;
#ifdef RT_PRINTF_LONGLONG
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录