Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
rt-thread
提交
a2a09166
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,发现更多精彩内容 >>
提交
a2a09166
编写于
10月 31, 2019
作者:
armink_ztl
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[tools] add eclipse project for support --specs=nano.specs
上级
75ae3435
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
137 addition
and
108 deletion
+137
-108
tools/eclipse.py
tools/eclipse.py
+137
-108
未找到文件。
tools/eclipse.py
浏览文件 @
a2a09166
...
@@ -142,37 +142,68 @@ def HandleToolOption(tools, env, project, reset):
...
@@ -142,37 +142,68 @@ def HandleToolOption(tools, env, project, reset):
CPPDEFINES
=
project
[
'CPPDEFINES'
]
CPPDEFINES
=
project
[
'CPPDEFINES'
]
paths
=
[
ConverToRttEclipsePathFormat
(
RelativeProjectPath
(
env
,
os
.
path
.
normpath
(
i
)).
replace
(
'
\\
'
,
'/'
))
for
i
in
project
[
'CPPPATH'
]]
paths
=
[
ConverToRttEclipsePathFormat
(
RelativeProjectPath
(
env
,
os
.
path
.
normpath
(
i
)).
replace
(
'
\\
'
,
'/'
))
for
i
in
project
[
'CPPPATH'
]]
compile_include_paths_option
=
None
compile_include_files_option
=
None
compile_defs_option
=
None
linker_scriptfile_option
=
None
linker_script_option
=
None
linker_nostart_option
=
None
linker_libs_option
=
None
linker_paths_option
=
None
linker_newlib_nano_option
=
None
for
tool
in
tools
:
for
tool
in
tools
:
if
tool
.
get
(
'id'
).
find
(
'c.compile'
)
!=
1
:
if
tool
.
get
(
'id'
).
find
(
'c.compile'
)
!=
1
:
options
=
tool
.
findall
(
'option'
)
options
=
tool
.
findall
(
'option'
)
include_paths_option
=
None
include_files_option
=
None
defs_option
=
None
# find all compile options
# find all compile options
for
option
in
options
:
for
option
in
options
:
if
option
.
get
(
'id'
).
find
(
'c.compiler.include.paths'
)
!=
-
1
or
option
.
get
(
'id'
).
find
(
'c.compiler.option.includepaths'
)
!=
-
1
:
if
option
.
get
(
'id'
).
find
(
'c.compiler.include.paths'
)
!=
-
1
or
option
.
get
(
'id'
).
find
(
'c.compiler.option.includepaths'
)
!=
-
1
:
include_paths_option
=
option
compile_
include_paths_option
=
option
elif
option
.
get
(
'id'
).
find
(
'c.compiler.include.files'
)
!=
-
1
or
option
.
get
(
'id'
).
find
(
'c.compiler.option.includefiles'
)
!=
-
1
:
elif
option
.
get
(
'id'
).
find
(
'c.compiler.include.files'
)
!=
-
1
or
option
.
get
(
'id'
).
find
(
'c.compiler.option.includefiles'
)
!=
-
1
:
include_files_option
=
option
compile_
include_files_option
=
option
elif
option
.
get
(
'id'
).
find
(
'c.compiler.defs'
)
!=
-
1
or
option
.
get
(
'id'
).
find
(
'c.compiler.option.definedsymbols'
)
!=
-
1
:
elif
option
.
get
(
'id'
).
find
(
'c.compiler.defs'
)
!=
-
1
or
option
.
get
(
'id'
).
find
(
'c.compiler.option.definedsymbols'
)
!=
-
1
:
defs_option
=
option
compile_defs_option
=
option
# change the inclue path
if
include_paths_option
is
not
None
:
if
tool
.
get
(
'id'
).
find
(
'c.linker'
)
!=
-
1
:
option
=
include_paths_option
options
=
tool
.
findall
(
'option'
)
# find all of paths in this project
# find all linker options
include_paths
=
option
.
findall
(
'listOptionValue'
)
for
option
in
options
:
for
item
in
include_paths
:
if
option
.
get
(
'id'
).
find
(
'c.linker.scriptfile'
)
!=
-
1
:
if
reset
is
True
or
IsRttEclipsePathFormat
(
item
.
get
(
'value'
))
:
linker_scriptfile_option
=
option
# clean old configuration
elif
option
.
get
(
'id'
).
find
(
'c.linker.option.script'
)
!=
-
1
:
option
.
remove
(
item
)
linker_script_option
=
option
# print('c.compiler.include.paths')
elif
option
.
get
(
'id'
).
find
(
'c.linker.nostart'
)
!=
-
1
:
paths
=
sorted
(
paths
)
linker_nostart_option
=
option
for
item
in
paths
:
elif
option
.
get
(
'id'
).
find
(
'c.linker.libs'
)
!=
-
1
and
env
.
has_key
(
'LIBS'
):
SubElement
(
option
,
'listOptionValue'
,
{
'builtIn'
:
'false'
,
'value'
:
item
})
linker_libs_option
=
option
# change the inclue files (default) or definitions
elif
option
.
get
(
'id'
).
find
(
'c.linker.paths'
)
!=
-
1
and
env
.
has_key
(
'LIBPATH'
):
if
include_files_option
is
not
None
:
linker_paths_option
=
option
option
=
include_files_option
elif
option
.
get
(
'id'
).
find
(
'c.linker.usenewlibnano'
)
!=
-
1
:
file_header
=
'''
linker_newlib_nano_option
=
option
# change the inclue path
if
compile_include_paths_option
is
not
None
:
option
=
compile_include_paths_option
# find all of paths in this project
include_paths
=
option
.
findall
(
'listOptionValue'
)
for
item
in
include_paths
:
if
reset
is
True
or
IsRttEclipsePathFormat
(
item
.
get
(
'value'
))
:
# clean old configuration
option
.
remove
(
item
)
# print('c.compiler.include.paths')
paths
=
sorted
(
paths
)
for
item
in
paths
:
SubElement
(
option
,
'listOptionValue'
,
{
'builtIn'
:
'false'
,
'value'
:
item
})
# change the inclue files (default) or definitions
if
compile_include_files_option
is
not
None
:
option
=
compile_include_files_option
# add '_REENT_SMALL' to CPPDEFINES when --specs=nano.specs has select
if
linker_newlib_nano_option
is
not
None
and
linker_newlib_nano_option
.
get
(
'value'
)
==
'true'
and
'_REENT_SMALL'
not
in
CPPDEFINES
:
CPPDEFINES
+=
[
'_REENT_SMALL'
]
print
(
linker_newlib_nano_option
.
get
(
'value'
))
file_header
=
'''
#ifndef RTCONFIG_PREINC_H__
#ifndef RTCONFIG_PREINC_H__
#define RTCONFIG_PREINC_H__
#define RTCONFIG_PREINC_H__
...
@@ -180,91 +211,89 @@ def HandleToolOption(tools, env, project, reset):
...
@@ -180,91 +211,89 @@ def HandleToolOption(tools, env, project, reset):
/* RT-Thread pre-include file */
/* RT-Thread pre-include file */
'''
'''
file_tail
=
'
\n
#endif /*RTCONFIG_PREINC_H__*/
\n
'
file_tail
=
'
\n
#endif /*RTCONFIG_PREINC_H__*/
\n
'
rtt_pre_inc_item
=
'"${workspace_loc:/${ProjName}/rtconfig_preinc.h}"'
rtt_pre_inc_item
=
'"${workspace_loc:/${ProjName}/rtconfig_preinc.h}"'
# save the CPPDEFINES in to rtconfig_preinc.h
# save the CPPDEFINES in to rtconfig_preinc.h
with
open
(
'rtconfig_preinc.h'
,
mode
=
'w+'
)
as
f
:
with
open
(
'rtconfig_preinc.h'
,
mode
=
'w+'
)
as
f
:
f
.
write
(
file_header
)
f
.
write
(
file_header
)
for
cppdef
in
CPPDEFINES
:
for
cppdef
in
CPPDEFINES
:
f
.
write
(
"#define "
+
cppdef
+
'
\n
'
)
f
.
write
(
"#define "
+
cppdef
+
'
\n
'
)
f
.
write
(
file_tail
)
f
.
write
(
file_tail
)
# change the c.compiler.include.files
# change the c.compiler.include.files
files
=
option
.
findall
(
'listOptionValue'
)
files
=
option
.
findall
(
'listOptionValue'
)
find_ok
=
False
find_ok
=
False
for
item
in
files
:
for
item
in
files
:
if
item
.
get
(
'value'
)
==
rtt_pre_inc_item
:
if
item
.
get
(
'value'
)
==
rtt_pre_inc_item
:
find_ok
=
True
find_ok
=
True
break
break
if
find_ok
is
False
:
if
find_ok
is
False
:
SubElement
(
option
,
'listOptionValue'
,
{
'builtIn'
:
'false'
,
'value'
:
rtt_pre_inc_item
})
SubElement
(
option
,
'listOptionValue'
,
{
'builtIn'
:
'false'
,
'value'
:
rtt_pre_inc_item
})
elif
defs_option
is
not
None
:
elif
compile_defs_option
is
not
None
:
option
=
defs_option
option
=
compile_defs_option
defs
=
option
.
findall
(
'listOptionValue'
)
defs
=
option
.
findall
(
'listOptionValue'
)
project_defs
=
[]
project_defs
=
[]
for
item
in
defs
:
for
item
in
defs
:
if
reset
is
True
:
if
reset
is
True
:
# clean all old configuration
# clean all old configuration
option
.
remove
(
item
)
option
.
remove
(
item
)
else
:
else
:
project_defs
+=
[
item
.
get
(
'value'
)]
project_defs
+=
[
item
.
get
(
'value'
)]
if
len
(
project_defs
)
>
0
:
if
len
(
project_defs
)
>
0
:
cproject_defs
=
set
(
CPPDEFINES
)
-
set
(
project_defs
)
cproject_defs
=
set
(
CPPDEFINES
)
-
set
(
project_defs
)
else
:
else
:
cproject_defs
=
CPPDEFINES
cproject_defs
=
CPPDEFINES
# print('c.compiler.defs')
# print('c.compiler.defs')
cproject_defs
=
sorted
(
cproject_defs
)
cproject_defs
=
sorted
(
cproject_defs
)
for
item
in
cproject_defs
:
for
item
in
cproject_defs
:
SubElement
(
option
,
'listOptionValue'
,
{
'builtIn'
:
'false'
,
'value'
:
item
})
SubElement
(
option
,
'listOptionValue'
,
{
'builtIn'
:
'false'
,
'value'
:
item
})
if
tool
.
get
(
'id'
).
find
(
'c.linker'
)
!=
-
1
:
# update linker script config
options
=
tool
.
findall
(
'option'
)
if
linker_scriptfile_option
is
not
None
:
for
option
in
options
:
option
=
linker_scriptfile_option
# update linker script config
linker_script
=
'link.lds'
if
option
.
get
(
'id'
).
find
(
'c.linker.scriptfile'
)
!=
-
1
:
items
=
env
[
'LINKFLAGS'
].
split
(
' '
)
linker_script
=
'link.lds'
if
'-T'
in
items
:
items
=
env
[
'LINKFLAGS'
].
split
(
' '
)
linker_script
=
items
[
items
.
index
(
'-T'
)
+
1
]
if
'-T'
in
items
:
linker_script
=
ConverToRttEclipsePathFormat
(
linker_script
)
linker_script
=
items
[
items
.
index
(
'-T'
)
+
1
]
linker_script
=
ConverToRttEclipsePathFormat
(
linker_script
)
listOptionValue
=
option
.
find
(
'listOptionValue'
)
if
listOptionValue
!=
None
:
listOptionValue
=
option
.
find
(
'listOptionValue'
)
listOptionValue
.
set
(
'value'
,
linker_script
)
if
listOptionValue
!=
None
:
else
:
listOptionValue
.
set
(
'value'
,
linker_script
)
SubElement
(
option
,
'listOptionValue'
,
{
'builtIn'
:
'false'
,
'value'
:
linker_script
})
else
:
# scriptfile in stm32cubeIDE
SubElement
(
option
,
'listOptionValue'
,
{
'builtIn'
:
'false'
,
'value'
:
linker_script
})
if
linker_script_option
is
not
None
:
option
=
linker_script_option
# scriptfile in stm32cubeIDE
items
=
env
[
'LINKFLAGS'
].
split
(
' '
)
if
option
.
get
(
'id'
).
find
(
'c.linker.option.script'
)
!=
-
1
:
if
'-T'
in
items
:
items
=
env
[
'LINKFLAGS'
].
split
(
' '
)
linker_script
=
ConverToRttEclipsePathFormat
(
items
[
items
.
index
(
'-T'
)
+
1
]).
strip
(
'"'
)
if
'-T'
in
items
:
option
.
set
(
'value'
,
linker_script
)
linker_script
=
ConverToRttEclipsePathFormat
(
items
[
items
.
index
(
'-T'
)
+
1
]).
strip
(
'"'
)
# update nostartfiles config
option
.
set
(
'value'
,
linker_script
)
if
linker_nostart_option
is
not
None
:
option
=
linker_nostart_option
# update nostartfiles config
if
env
[
'LINKFLAGS'
].
find
(
'-nostartfiles'
)
!=
-
1
:
if
option
.
get
(
'id'
).
find
(
'c.linker.nostart'
)
!=
-
1
:
option
.
set
(
'value'
,
'true'
)
if
env
[
'LINKFLAGS'
].
find
(
'-nostartfiles'
)
!=
-
1
:
else
:
option
.
set
(
'value'
,
'true'
)
option
.
set
(
'value'
,
'false'
)
else
:
# update libs
option
.
set
(
'value'
,
'false'
)
if
linker_libs_option
is
not
None
:
option
=
linker_libs_option
# update libs
# remove old libs
if
option
.
get
(
'id'
).
find
(
'c.linker.libs'
)
!=
-
1
and
env
.
has_key
(
'LIBS'
):
for
item
in
option
.
findall
(
'listOptionValue'
):
# remove old libs
option
.
remove
(
item
)
for
item
in
option
.
findall
(
'listOptionValue'
):
# add new libs
option
.
remove
(
item
)
for
lib
in
env
[
'LIBS'
]:
# add new libs
SubElement
(
option
,
'listOptionValue'
,
{
'builtIn'
:
'false'
,
'value'
:
lib
})
for
lib
in
env
[
'LIBS'
]:
# update lib paths
SubElement
(
option
,
'listOptionValue'
,
{
'builtIn'
:
'false'
,
'value'
:
lib
})
if
linker_paths_option
is
not
None
:
option
=
linker_paths_option
# update lib paths
# remove old lib paths
if
option
.
get
(
'id'
).
find
(
'c.linker.paths'
)
!=
-
1
and
env
.
has_key
(
'LIBPATH'
):
for
item
in
option
.
findall
(
'listOptionValue'
):
# remove old lib paths
option
.
remove
(
item
)
for
item
in
option
.
findall
(
'listOptionValue'
):
# add new old lib paths
option
.
remove
(
item
)
for
path
in
env
[
'LIBPATH'
]:
# add new old lib paths
SubElement
(
option
,
'listOptionValue'
,
{
'builtIn'
:
'false'
,
'value'
:
path
})
for
path
in
env
[
'LIBPATH'
]:
SubElement
(
option
,
'listOptionValue'
,
{
'builtIn'
:
'false'
,
'value'
:
path
})
return
return
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录