Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
rt-thread
提交
352b31a9
R
rt-thread
项目概览
BaiXuePrincess
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
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,发现更多精彩内容 >>
未验证
提交
352b31a9
编写于
5月 15, 2018
作者:
B
Bernard Xiong
提交者:
GitHub
5月 15, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1434 from RT-Thread/gcc_detection
Add GCC version detection.
上级
ab33cd31
6ac213d6
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
213 addition
and
33 deletion
+213
-33
components/dfs/Kconfig
components/dfs/Kconfig
+0
-14
components/libc/Kconfig
components/libc/Kconfig
+0
-6
components/libc/compilers/armlibc/SConscript
components/libc/compilers/armlibc/SConscript
+6
-0
include/libc/libc_signal.h
include/libc/libc_signal.h
+11
-5
src/signal.c
src/signal.c
+2
-3
tools/building.py
tools/building.py
+29
-5
tools/gcc.py
tools/gcc.py
+165
-0
未找到文件。
components/dfs/Kconfig
浏览文件 @
352b31a9
...
...
@@ -103,20 +103,6 @@ if RT_USING_DFS
help
Let BSD socket operated by file system API, such as read/write and involveed in select/poll POSIX APIs.
if RT_USING_DFS_NET
config HAVE_SYS_SELECT_H
bool "Toolchains/libc have provided sys/select.h"
default n
help
Toolchains/libc have provided sys/select.h file, therefore, disable the sys/select.h in RT-Thread.
config HAVE_SYS_SOCKET_H
bool "Toolchains/libc have provided sys/socket.h"
default n
help
Toolchains/libc have provided sys/socket.h file, therefore, disable the sys/socket.h in RT-Thread.
endif
config RT_USING_DFS_ROMFS
bool "Enable ReadOnly file system on flash"
default n
...
...
components/libc/Kconfig
浏览文件 @
352b31a9
...
...
@@ -35,10 +35,4 @@ if RT_USING_LIBC && RT_USING_DFS
endif
endif
config HAVE_SYS_SIGNALS
bool "Toolchains/libc has sigval/sigevent structure definitions"
default n
help
Toolchains/libc has sigval/sigevent/siginfo_t definitions.
endmenu
components/libc/compilers/armlibc/SConscript
浏览文件 @
352b31a9
...
...
@@ -8,6 +8,12 @@ group = []
CPPPATH
=
[
cwd
]
CPPDEFINES
=
[
'RT_USING_ARM_LIBC'
]
if
GetDepend
(
'RT_USING_DFS'
)
==
False
:
SrcRemove
(
src
,
[
'stdio.c'
])
if
GetDepend
(
'RT_USING_MODULE'
)
==
False
:
SrcRemove
(
src
,
[
'libc_syms.c'
])
if
rtconfig
.
PLATFORM
==
'armcc'
:
group
=
DefineGroup
(
'libc'
,
src
,
depend
=
[
'RT_USING_LIBC'
],
CPPPATH
=
CPPPATH
,
CPPDEFINES
=
CPPDEFINES
)
...
...
include/libc/libc_signal.h
浏览文件 @
352b31a9
...
...
@@ -25,12 +25,15 @@
#ifndef LIBC_SIGNAL_H__
#define LIBC_SIGNAL_H__
#ifdef __cplusplus
extern
"C"
{
#endif
#ifndef HAVE_SYS_SIGNALS
#ifdef HAVE_CCONFIG_H
#include <cconfig.h>
#endif
#ifndef HAVE_SIGVAL
/* Signal Generation and Delivery, P1003.1b-1993, p. 63
NOTE: P1003.1c/D10, p. 34 adds sigev_notify_function and
sigev_notify_attributes to the sigevent structure. */
...
...
@@ -40,7 +43,9 @@ union sigval
int
sival_int
;
/* Integer signal value */
void
*
sival_ptr
;
/* Pointer signal value */
};
#endif
#ifndef HAVE_SIGEVENT
struct
sigevent
{
int
sigev_notify
;
/* Notification type */
...
...
@@ -50,12 +55,13 @@ struct sigevent
/* Notification function */
void
*
sigev_notify_attributes
;
/* Notification Attributes, really pthread_attr_t */
};
#endif
#ifndef HAVE_SIGINFO
struct
siginfo
{
rt_uint8_t
si_signo
;
rt_uint8_t
si_code
;
rt_int16_t
si_errno
;
rt_uint16_t
si_signo
;
rt_uint16_t
si_code
;
union
sigval
si_value
;
};
...
...
src/signal.c
浏览文件 @
352b31a9
...
...
@@ -45,7 +45,7 @@
struct
siginfo_node
{
s
truct
siginfo
si
;
s
iginfo_t
si
;
struct
rt_slist_node
list
;
};
...
...
@@ -339,7 +339,7 @@ void rt_thread_handle_sig(rt_bool_t clean_state)
level
=
rt_hw_interrupt_disable
();
tid
->
sig_pending
&=
~
sig_mask
(
signo
);
error
=
si_node
->
si
.
si_errno
;
error
=
-
RT_EINTR
;
rt_mp_free
(
si_node
);
/* release this siginfo node */
/* set errno in thread tcb */
...
...
@@ -419,7 +419,6 @@ int rt_thread_kill(rt_thread_t tid, int sig)
if
(
!
sig_valid
(
sig
))
return
-
RT_EINVAL
;
dbg_log
(
DBG_INFO
,
"send signal: %d
\n
"
,
sig
);
si
.
si_errno
=
RT_EINTR
;
si
.
si_signo
=
sig
;
si
.
si_code
=
SI_USER
;
si
.
si_value
.
sival_ptr
=
RT_NULL
;
...
...
tools/building.py
浏览文件 @
352b31a9
...
...
@@ -74,7 +74,6 @@ PatchedPreProcessor = SCons.cpp.PreProcessor
PatchedPreProcessor
.
start_handling_includes
=
start_handling_includes
PatchedPreProcessor
.
stop_handling_includes
=
stop_handling_includes
class
Win32Spawn
:
def
spawn
(
self
,
sh
,
escape
,
cmd
,
args
,
env
):
# deal with the cmd build-in commands which cannot be used in
...
...
@@ -141,10 +140,6 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
env
[
'LIBLINKSUFFIX'
]
=
'.lib'
env
[
'LIBDIRPREFIX'
]
=
'--userlibpath '
if
rtconfig
.
PLATFORM
==
'gcc'
:
if
str
(
env
[
'LINKFLAGS'
]).
find
(
'nano.specs'
):
env
.
AppendUnique
(
CPPDEFINES
=
[
'_REENT_SMALL'
])
# patch for win32 spawn
if
env
[
'PLATFORM'
]
==
'win32'
:
win32_spawn
=
Win32Spawn
()
...
...
@@ -174,6 +169,31 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
PreProcessor
.
process_contents
(
contents
)
BuildOptions
=
PreProcessor
.
cpp_namespace
if
rtconfig
.
PLATFORM
==
'gcc'
:
contents
=
''
if
not
os
.
path
.
isfile
(
'cconfig.h'
):
import
gcc
gcc
.
GenerateGCCConfig
(
rtconfig
)
# try again
if
os
.
path
.
isfile
(
'cconfig.h'
):
f
=
file
(
'cconfig.h'
,
'r'
)
if
f
:
contents
=
f
.
read
()
f
.
close
();
prep
=
PatchedPreProcessor
()
prep
.
process_contents
(
contents
)
options
=
prep
.
cpp_namespace
BuildOptions
.
update
(
options
)
# add HAVE_CCONFIG_H definition
env
.
AppendUnique
(
CPPDEFINES
=
[
'HAVE_CCONFIG_H'
])
if
str
(
env
[
'LINKFLAGS'
]).
find
(
'nano.specs'
)
!=
-
1
:
env
.
AppendUnique
(
CPPDEFINES
=
[
'_REENT_SMALL'
])
# add copy option
AddOption
(
'--copy'
,
dest
=
'copy'
,
...
...
@@ -673,6 +693,10 @@ def EndBuilding(target, program = None):
import
rtconfig
Env
.
AddPostAction
(
target
,
rtconfig
.
POST_ACTION
)
# Add addition clean files
Clean
(
target
,
'cconfig.h'
)
Clean
(
target
,
'rtua.py'
)
Clean
(
target
,
'rtua.pyc'
)
if
GetOption
(
'target'
)
==
'mdk'
:
from
keil
import
MDKProject
...
...
tools/gcc.py
0 → 100644
浏览文件 @
352b31a9
import
os
import
re
def
GetGCCRoot
(
rtconfig
):
exec_path
=
rtconfig
.
EXEC_PATH
prefix
=
rtconfig
.
PREFIX
if
prefix
.
endswith
(
'-'
):
prefix
=
prefix
[:
-
1
]
root_path
=
os
.
path
.
join
(
exec_path
,
'..'
,
prefix
)
return
root_path
def
CheckHeader
(
rtconfig
,
filename
):
root
=
GetGCCRoot
(
rtconfig
)
fn
=
os
.
path
.
join
(
root
,
'include'
,
filename
)
if
os
.
path
.
isfile
(
fn
):
return
True
return
False
def
GetNewLibVersion
(
rtconfig
):
version
=
'unknown'
root
=
GetGCCRoot
(
rtconfig
)
if
CheckHeader
(
rtconfig
,
'_newlib_version.h'
):
# get version from _newlib_version.h file
f
=
file
(
os
.
path
.
join
(
root
,
'include'
,
'_newlib_version.h'
))
if
f
:
for
line
in
f
:
if
line
.
find
(
'_NEWLIB_VERSION'
)
!=
-
1
and
line
.
find
(
'"'
)
!=
-
1
:
version
=
re
.
search
(
r
'\"([^"]+)\"'
,
line
).
groups
()[
0
]
elif
CheckHeader
(
rtconfig
,
'newlib.h'
):
# get version from newlib.h
f
=
file
(
os
.
path
.
join
(
root
,
'include'
,
'newlib.h'
))
if
f
:
for
line
in
f
:
if
line
.
find
(
'_NEWLIB_VERSION'
)
!=
-
1
and
line
.
find
(
'"'
)
!=
-
1
:
version
=
re
.
search
(
r
'\"([^"]+)\"'
,
line
).
groups
()[
0
]
return
version
def
GCCResult
(
rtconfig
,
str
):
import
subprocess
result
=
''
def
checkAndGetResult
(
pattern
,
string
):
if
re
.
search
(
pattern
,
string
):
return
re
.
search
(
pattern
,
string
).
group
(
0
)
return
None
gcc_cmd
=
os
.
path
.
join
(
rtconfig
.
EXEC_PATH
,
rtconfig
.
CC
)
# use temp file to get more information
f
=
file
(
'__tmp.c'
,
'w'
)
if
f
:
f
.
write
(
str
)
f
.
close
()
# '-fdirectives-only',
child
=
subprocess
.
Popen
([
gcc_cmd
,
'-E'
,
'-P'
,
'__tmp.c'
],
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
shell
=
True
)
stdout
,
stderr
=
child
.
communicate
()
print
(
stdout
)
if
stderr
!=
''
:
print
(
stderr
)
have_fdset
=
0
have_sigaction
=
0
have_sigevent
=
0
have_siginfo
=
0
have_sigval
=
0
version
=
None
stdc
=
'1989'
posix_thread
=
0
for
line
in
stdout
.
split
(
'
\n
'
):
if
re
.
search
(
'fd_set'
,
line
):
have_fdset
=
1
# check for sigal
if
re
.
search
(
'struct[
\t
]+sigaction'
,
line
):
have_sigaction
=
1
if
re
.
search
(
'struct[
\t
]+sigevent'
,
line
):
have_sigevent
=
1
if
re
.
search
(
'siginfo_t'
,
line
):
have_siginfo
=
1
if
re
.
search
(
'union[
\t
]+sigval'
,
line
):
have_sigval
=
1
if
re
.
search
(
'char\* version'
,
line
):
version
=
re
.
search
(
r
'\"([^"]+)\"'
,
line
).
groups
()[
0
]
if
re
.
findall
(
'iso_c_visible = [\d]+'
,
line
):
stdc
=
re
.
findall
(
'[\d]+'
,
line
)[
0
]
if
re
.
findall
(
'pthread_create'
,
line
):
posix_thread
=
1
if
have_fdset
:
result
+=
'#define HAVE_FDSET 1
\n
'
if
have_sigaction
:
result
+=
'#define HAVE_SIGACTION 1
\n
'
if
have_sigevent
:
result
+=
'#define HAVE_SIGEVENT 1
\n
'
if
have_siginfo
:
result
+=
'#define HAVE_SIGINFO 1
\n
'
if
have_sigval
:
result
+=
'#define HAVE_SIGVAL 1
\n
'
if
version
:
result
+=
'#define GCC_VERSION "%s"
\n
'
%
version
result
+=
'#define STDC "%s"
\n
'
%
stdc
if
posix_thread
:
result
+=
'#define LIBC_POSIX_THREADS 1
\n
'
os
.
remove
(
'__tmp.c'
)
return
result
def
GenerateGCCConfig
(
rtconfig
):
str
=
''
cc_header
=
''
cc_header
+=
'#ifndef CCONFIG_H__
\n
'
cc_header
+=
'#define CCONFIG_H__
\n
'
cc_header
+=
'/* Automatically generated file; DO NOT EDIT. */
\n
'
cc_header
+=
'/* compiler configure file for RT-Thread in GCC*/
\n\n
'
if
CheckHeader
(
rtconfig
,
'newlib.h'
):
str
+=
'#include <newlib.h>
\n
'
cc_header
+=
'#define HAVE_NEWLIB_H 1
\n
'
cc_header
+=
'#define LIBC_VERSION "newlib %s"
\n\n
'
%
GetNewLibVersion
(
rtconfig
)
if
CheckHeader
(
rtconfig
,
'sys/signal.h'
):
str
+=
'#include <sys/signal.h>
\n
'
cc_header
+=
'#define HAVE_SYS_SIGNAL_H 1
\n
'
if
CheckHeader
(
rtconfig
,
'sys/select.h'
):
str
+=
'#include <sys/select.h>
\n
'
cc_header
+=
'#define HAVE_SYS_SELECT_H 1
\n
'
if
CheckHeader
(
rtconfig
,
'pthread.h'
):
str
+=
"#include <pthread.h>
\n
"
cc_header
+=
'#define HAVE_PTHREAD_H 1
\n
'
# if CheckHeader(rtconfig, 'sys/dirent.h'):
# str += '#include <sys/dirent.h>\n'
# add some common features
str
+=
'const char* version = __VERSION__;
\n
'
str
+=
'const int iso_c_visible = __ISO_C_VISIBLE;
\n
'
str
+=
'
\n
#ifdef HAVE_INITFINI_ARRAY
\n
'
str
+=
'const int init_fini_array = HAVE_INITFINI_ARRAY;
\n
'
str
+=
'#endif
\n
'
cc_header
+=
'
\n
'
cc_header
+=
GCCResult
(
rtconfig
,
str
)
cc_header
+=
'
\n
#endif
\n
'
cc_file
=
file
(
'cconfig.h'
,
'w'
)
if
cc_file
:
cc_file
.
write
(
cc_header
)
cc_file
.
close
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录