Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
rt-thread
提交
fdc350b7
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看板
未验证
提交
fdc350b7
编写于
6月 23, 2018
作者:
B
Bernard Xiong
提交者:
GitHub
6月 23, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1558 from armink/fix_scons
Fix scons
上级
27d7eff8
b7f7d6e6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
62 addition
and
20 deletion
+62
-20
tools/building.py
tools/building.py
+59
-17
tools/iar.py
tools/iar.py
+3
-3
未找到文件。
tools/building.py
浏览文件 @
fdc350b7
...
...
@@ -112,6 +112,35 @@ class Win32Spawn:
return
proc
.
wait
()
# auto fix the 'RTT_CC' and 'RTT_EXEC_PATH'
# when using 'scons --target=cc' the 'RTT_CC' will set to 'cc'
# it will fix the the 'rtconfig.EXEC_PATH' when get it failed.
# NOTE: this function will changed your env. Please backup the env before used it.
def
AutoFixRttCCAndExecPath
():
import
rtconfig
target_option
=
None
# get --target=cc option
if
len
(
sys
.
argv
)
>
1
:
option
=
sys
.
argv
[
1
].
split
(
'='
)
if
len
(
option
)
>
1
and
option
[
0
]
==
'--target'
:
target_option
=
option
[
1
]
# force change the 'RTT_CC' when using 'scons --target=cc'
if
target_option
:
if
target_option
==
'mdk'
or
target_option
==
'mdk4'
or
target_option
==
'mdk5'
:
os
.
environ
[
'RTT_CC'
]
=
'keil'
elif
target_option
==
'iar'
:
os
.
environ
[
'RTT_CC'
]
=
'iar'
# auto change the 'RTT_EXEC_PATH' when 'rtconfig.EXEC_PATH' get failed
reload
(
rtconfig
)
if
not
os
.
path
.
exists
(
rtconfig
.
EXEC_PATH
):
if
os
.
environ
[
'RTT_EXEC_PATH'
]:
# del the 'RTT_EXEC_PATH' and using the 'EXEC_PATH' setting on rtconfig.py
del
os
.
environ
[
'RTT_EXEC_PATH'
]
reload
(
rtconfig
)
def
PrepareBuilding
(
env
,
root_directory
,
has_libcpu
=
False
,
remove_components
=
[]):
import
SCons.cpp
import
rtconfig
...
...
@@ -130,6 +159,9 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
sys
.
path
=
sys
.
path
+
[
os
.
path
.
join
(
Rtt_Root
,
'tools'
)]
# auto fix the 'RTT_CC' and 'RTT_EXEC_PATH'
AutoFixRttCCAndExecPath
()
# add compability with Keil MDK 4.6 which changes the directory of armcc.exe
if
rtconfig
.
PLATFORM
==
'armcc'
:
if
not
os
.
path
.
isfile
(
os
.
path
.
join
(
rtconfig
.
EXEC_PATH
,
'armcc.exe'
)):
...
...
@@ -709,18 +741,8 @@ def DoBuilding(target, objects):
program
=
Env
.
Program
(
target
,
objects
)
EndBuilding
(
target
,
program
)
def
EndBuilding
(
target
,
program
=
None
):
import
rtconfig
Env
[
'target'
]
=
program
Env
[
'project'
]
=
Projects
Env
.
AddPostAction
(
target
,
rtconfig
.
POST_ACTION
)
# Add addition clean files
Clean
(
target
,
'cconfig.h'
)
Clean
(
target
,
'rtua.py'
)
Clean
(
target
,
'rtua.pyc'
)
def
GenTargetProject
(
program
=
None
):
if
GetOption
(
'target'
)
==
'mdk'
:
from
keil
import
MDKProject
...
...
@@ -777,27 +799,47 @@ def EndBuilding(target, program = None):
from
cdk
import
CDKProject
CDKProject
(
'project.cdkproj'
,
Projects
)
def
EndBuilding
(
target
,
program
=
None
):
import
rtconfig
need_exit
=
False
Env
[
'target'
]
=
program
Env
[
'project'
]
=
Projects
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'
):
GenTargetProject
(
program
)
BSP_ROOT
=
Dir
(
'#'
).
abspath
if
GetOption
(
'copy'
)
and
program
!=
None
:
from
mkdist
import
MakeCopy
MakeCopy
(
program
,
BSP_ROOT
,
Rtt_Root
,
Env
)
exit
(
0
)
need_exit
=
True
if
GetOption
(
'copy-header'
)
and
program
!=
None
:
from
mkdist
import
MakeCopyHeader
MakeCopyHeader
(
program
,
BSP_ROOT
,
Rtt_Root
,
Env
)
exit
(
0
)
need_exit
=
True
if
GetOption
(
'make-dist'
)
and
program
!=
None
:
from
mkdist
import
MkDist
MkDist
(
program
,
BSP_ROOT
,
Rtt_Root
,
Env
)
exit
(
0
)
need_exit
=
True
if
GetOption
(
'cscope'
):
from
cscope
import
CscopeDatabase
CscopeDatabase
(
Projects
)
if
not
GetOption
(
'help'
)
and
not
GetOption
(
'target'
):
if
not
os
.
path
.
exists
(
rtconfig
.
EXEC_PATH
):
print
"Error: Toolchain path (%s) is not exist, please check 'EXEC_PATH' in path or rtconfig.py."
%
rtconfig
.
EXEC_PATH
sys
.
exit
(
1
)
print
"Error: the toolchain path (%s) is not exist, please check 'EXEC_PATH' in path or rtconfig.py."
%
rtconfig
.
EXEC_PATH
need_exit
=
True
if
need_exit
:
exit
(
0
)
def
SrcRemove
(
src
,
remove
):
if
not
src
:
...
...
tools/iar.py
浏览文件 @
fdc350b7
...
...
@@ -164,7 +164,7 @@ def IARVersion():
def
IARPath
():
import
rtconfig
#
set
environ
#
backup
environ
old_environ
=
os
.
environ
os
.
environ
[
'RTT_CC'
]
=
'iar'
reload
(
rtconfig
)
...
...
@@ -183,11 +183,11 @@ def IARVersion():
if
os
.
path
.
exists
(
path
):
cmd
=
os
.
path
.
join
(
path
,
'iccarm.exe'
)
else
:
print
(
'
Get IAR version error. Please update IAR installation path in rtconfig.h
!'
)
print
(
'
Error: get IAR version failed. Please update the IAR installation path in rtconfig.py
!'
)
return
"0.0"
child
=
subprocess
.
Popen
([
cmd
,
'--version'
],
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
shell
=
True
)
stdout
,
stderr
=
child
.
communicate
()
# example stdout: IAR ANSI C/C++ Compiler V8.20.1.14183/W32 for ARM
return
re
.
search
(
'[\d\.]+'
,
stdout
).
group
(
0
)
\ No newline at end of file
return
re
.
search
(
'[\d\.]+'
,
stdout
).
group
(
0
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录