summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorWayne Lin <[email protected]>2022-01-25 18:53:52 +0800
committerWayne Lin <[email protected]>2022-01-25 18:53:52 +0800
commitc95c296e9915a38a666ae1a2575c2a4d0ba1d376 (patch)
treec6e5a1ffe4ceb997e853ba0c3daffc9dc60c8b79 /tools
parentf7ba146a01fcf23a2b06a141d1b1a56cb27b878c (diff)
parent32a5668593c578b85560338c29d76f3a252c8dbc (diff)
Merge branch 'master' of https://github.com/RT-Thread/rt-thread into nuvoton
# Conflicts: # bsp/gd32/gd32107c-eval/rtconfig.h
Diffstat (limited to 'tools')
-rw-r--r--tools/1.txt2
-rw-r--r--tools/buildbot.py18
-rw-r--r--tools/building.py45
-rw-r--r--tools/codelite.py4
-rw-r--r--tools/eclipse.py4
-rw-r--r--tools/iar.py2
-rw-r--r--tools/keil.py10
-rw-r--r--tools/ses.py10
8 files changed, 66 insertions, 29 deletions
diff --git a/tools/1.txt b/tools/1.txt
deleted file mode 100644
index fec83eefd2..0000000000
--- a/tools/1.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-Cannot found RT-Thread root directory, please check RTT_ROOT
-C:\Users\92036\Desktop\rtt\bsp
diff --git a/tools/buildbot.py b/tools/buildbot.py
index 04779071cf..e40abe4a5d 100644
--- a/tools/buildbot.py
+++ b/tools/buildbot.py
@@ -39,15 +39,17 @@ def update_all_project_files(root_path):
if os.path.isdir(root_path):
projects = os.listdir(root_path)
# is a project path?
- if "SConscript" in projects:
+ if "SConstruct" in projects:
try:
- if "win32" in sys.platform:
- retval = os.getcwd()
- os.chdir(root_path)
- os.system("menuconfig --silent")
- os.chdir(retval)
- else:
- os.system('scons --pyconfig-silent -C {0}'.format(root_path)) # update rtconfig.h and .config
+ # update rtconfig.h and .config
+ if "Kconfig" in projects:
+ if "win32" in sys.platform:
+ retval = os.getcwd()
+ os.chdir(root_path)
+ os.system("menuconfig --silent")
+ os.chdir(retval)
+ else:
+ os.system('scons --pyconfig-silent -C {0}'.format(root_path))
update_project_file(root_path)
except Exception as e:
print("error message: {}".format(e))
diff --git a/tools/building.py b/tools/building.py
index 10641c11a9..23fe64e2f6 100644
--- a/tools/building.py
+++ b/tools/building.py
@@ -557,11 +557,21 @@ def AddDepend(option):
def MergeGroup(src_group, group):
src_group['src'] = src_group['src'] + group['src']
+ if 'CFLAGS' in group:
+ if 'CFLAGS' in src_group:
+ src_group['CFLAGS'] = src_group['CFLAGS'] + group['CFLAGS']
+ else:
+ src_group['CFLAGS'] = group['CFLAGS']
if 'CCFLAGS' in group:
if 'CCFLAGS' in src_group:
src_group['CCFLAGS'] = src_group['CCFLAGS'] + group['CCFLAGS']
else:
src_group['CCFLAGS'] = group['CCFLAGS']
+ if 'CXXFLAGS' in group:
+ if 'CXXFLAGS' in src_group:
+ src_group['CXXFLAGS'] = src_group['CXXFLAGS'] + group['CXXFLAGS']
+ else:
+ src_group['CXXFLAGS'] = group['CXXFLAGS']
if 'CPPPATH' in group:
if 'CPPPATH' in src_group:
src_group['CPPPATH'] = src_group['CPPPATH'] + group['CPPPATH']
@@ -579,11 +589,21 @@ def MergeGroup(src_group, group):
src_group['ASFLAGS'] = group['ASFLAGS']
# for local CCFLAGS/CPPPATH/CPPDEFINES
+ if 'LOCAL_CFLAGS' in group:
+ if 'LOCAL_CFLAGS' in src_group:
+ src_group['LOCAL_CFLAGS'] = src_group['LOCAL_CFLAGS'] + group['LOCAL_CFLAGS']
+ else:
+ src_group['LOCAL_CFLAGS'] = group['LOCAL_CFLAGS']
if 'LOCAL_CCFLAGS' in group:
if 'LOCAL_CCFLAGS' in src_group:
src_group['LOCAL_CCFLAGS'] = src_group['LOCAL_CCFLAGS'] + group['LOCAL_CCFLAGS']
else:
src_group['LOCAL_CCFLAGS'] = group['LOCAL_CCFLAGS']
+ if 'LOCAL_CXXFLAGS' in group:
+ if 'LOCAL_CXXFLAGS' in src_group:
+ src_group['LOCAL_CXXFLAGS'] = src_group['LOCAL_CXXFLAGS'] + group['LOCAL_CXXFLAGS']
+ else:
+ src_group['LOCAL_CXXFLAGS'] = group['LOCAL_CXXFLAGS']
if 'LOCAL_CPPPATH' in group:
if 'LOCAL_CPPPATH' in src_group:
src_group['LOCAL_CPPPATH'] = src_group['LOCAL_CPPPATH'] + group['LOCAL_CPPPATH']
@@ -650,10 +670,18 @@ def DefineGroup(name, src, depend, **parameters):
else:
group['src'] = src
+ if 'CFLAGS' in group:
+ target = group['CFLAGS']
+ if len(target) > 0:
+ Env.AppendUnique(CFLAGS = target)
if 'CCFLAGS' in group:
target = group['CCFLAGS']
if len(target) > 0:
Env.AppendUnique(CCFLAGS = target)
+ if 'CXXFLAGS' in group:
+ target = group['CXXFLAGS']
+ if len(target) > 0:
+ Env.AppendUnique(CXXFLAGS = target)
if 'CPPPATH' in group:
target = group['CPPPATH']
if _PretreatListParameters(target) == True:
@@ -682,11 +710,18 @@ def DefineGroup(name, src, depend, **parameters):
import rtconfig
if rtconfig.PLATFORM == 'gcc':
+ if 'CFLAGS' in group:
+ group['CFLAGS'] = utils.GCCC99Patch(group['CFLAGS'])
if 'CCFLAGS' in group:
group['CCFLAGS'] = utils.GCCC99Patch(group['CCFLAGS'])
+ if 'CXXFLAGS' in group:
+ group['CXXFLAGS'] = utils.GCCC99Patch(group['CXXFLAGS'])
if 'LOCAL_CCFLAGS' in group:
group['LOCAL_CCFLAGS'] = utils.GCCC99Patch(group['LOCAL_CCFLAGS'])
-
+ if 'LOCAL_CXXFLAGS' in group:
+ group['LOCAL_CXXFLAGS'] = utils.GCCC99Patch(group['LOCAL_CXXFLAGS'])
+ if 'LOCAL_CFLAGS' in group:
+ group['LOCAL_CFLAGS'] = utils.GCCC99Patch(group['LOCAL_CFLAGS'])
# check whether to clean up library
if GetOption('cleanlib') and os.path.exists(os.path.join(group['path'], GroupLibFullName(name, Env))):
if group['src'] != []:
@@ -785,14 +820,16 @@ def DoBuilding(target, objects):
# handle local group
def local_group(group, objects):
- if 'LOCAL_CCFLAGS' in group or 'LOCAL_CPPPATH' in group or 'LOCAL_CPPDEFINES' in group or 'LOCAL_ASFLAGS' in group:
+ if 'LOCAL_CFLAGS' in group or 'LOCAL_CXXFLAGS' in group or 'LOCAL_CCFLAGS' in group or 'LOCAL_CPPPATH' in group or 'LOCAL_CPPDEFINES' in group or 'LOCAL_ASFLAGS' in group:
+ CFLAGS = Env.get('CFLAGS', '') + group.get('LOCAL_CFLAGS', '')
CCFLAGS = Env.get('CCFLAGS', '') + group.get('LOCAL_CCFLAGS', '')
+ CXXFLAGS = Env.get('CXXFLAGS', '') + group.get('LOCAL_CXXFLAGS', '')
CPPPATH = Env.get('CPPPATH', ['']) + group.get('LOCAL_CPPPATH', [''])
CPPDEFINES = Env.get('CPPDEFINES', ['']) + group.get('LOCAL_CPPDEFINES', [''])
ASFLAGS = Env.get('ASFLAGS', '') + group.get('LOCAL_ASFLAGS', '')
for source in group['src']:
- objects.append(Env.Object(source, CCFLAGS = CCFLAGS, ASFLAGS = ASFLAGS,
+ objects.append(Env.Object(source, CFLAGS = CFLAGS, CCFLAGS = CCFLAGS, CXXFLAGS = CXXFLAGS, ASFLAGS = ASFLAGS,
CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES))
return True
@@ -822,7 +859,7 @@ def DoBuilding(target, objects):
else:
# remove source files with local flags setting
for group in Projects:
- if 'LOCAL_CCFLAGS' in group or 'LOCAL_CPPPATH' in group or 'LOCAL_CPPDEFINES' in group:
+ if 'LOCAL_CFLAGS' in group or 'LOCAL_CXXFLAGS' in group or 'LOCAL_CCFLAGS' in group or 'LOCAL_CPPPATH' in group or 'LOCAL_CPPDEFINES' in group:
for source in group['src']:
for obj in objects:
if source.abspath == obj.abspath or (len(obj.sources) > 0 and source.abspath == obj.sources[0].abspath):
diff --git a/tools/codelite.py b/tools/codelite.py
index 9b2060dfa5..f4e612be61 100644
--- a/tools/codelite.py
+++ b/tools/codelite.py
@@ -194,8 +194,8 @@ def TargetCodelite(script, program):
#print building.Env.get('LIBPATH', [])
#print building.Env.get('LIBS', [])
- CLSetCFlags(root, building.Env.get('CCFLAGS', []))
- CLSetCxxFlags(root, building.Env.get('CCFLAGS', []))
+ CLSetCFlags(root, building.Env.get('CFLAGS', []))
+ CLSetCxxFlags(root, building.Env.get('CFLAGS', []))
asflags = building.Env.get('ASFLAGS', [])
asflags = asflags.replace('-ffunction-sections', '')
diff --git a/tools/eclipse.py b/tools/eclipse.py
index 6498c1c9f6..736fcbc66d 100644
--- a/tools/eclipse.py
+++ b/tools/eclipse.py
@@ -365,7 +365,7 @@ def UpdateProjectStructure(env, prj_name):
out = open('.project', 'w')
out.write('<?xml version="1.0" encoding="UTF-8"?>\n')
xml_indent(root)
- out.write(etree.tostring(root, encoding='utf-8'))
+ out.write(etree.tostring(root, encoding='utf-8').decode('utf-8'))
out.close()
return
@@ -504,7 +504,7 @@ def UpdateCproject(env, project, excluding, reset, prj_name):
out.write('<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n')
out.write('<?fileVersion 4.0.0?>')
xml_indent(root)
- out.write(etree.tostring(root, encoding='utf-8'))
+ out.write(etree.tostring(root, encoding='utf-8').decode('utf-8'))
out.close()
diff --git a/tools/iar.py b/tools/iar.py
index a0028128e3..6b31976d05 100644
--- a/tools/iar.py
+++ b/tools/iar.py
@@ -88,7 +88,7 @@ def IARProject(target, script):
CPPPATH = []
CPPDEFINES = []
LINKFLAGS = ''
- CCFLAGS = ''
+ CFLAGS = ''
Libs = []
lib_prefix = ['lib', '']
lib_suffix = ['.a', '.o', '']
diff --git a/tools/keil.py b/tools/keil.py
index b3643fbe74..b1ce0610c4 100644
--- a/tools/keil.py
+++ b/tools/keil.py
@@ -192,7 +192,7 @@ def MDK45Project(tree, target, script):
CPPPATH = []
CPPDEFINES = []
LINKFLAGS = ''
- CCFLAGS = ''
+ CFLAGS = ''
ProjectFiles = []
# add group
@@ -204,14 +204,14 @@ def MDK45Project(tree, target, script):
group_tree = MDK4AddGroup(ProjectFiles, groups, group['name'], group['src'], project_path)
# for local CPPPATH/CPPDEFINES
- if (group_tree != None) and ('LOCAL_CPPPATH' in group or 'LOCAL_CCFLAGS' in group or 'LOCAL_CPPDEFINES' in group):
+ if (group_tree != None) and ('LOCAL_CPPPATH' in group or 'LOCAL_CFLAGS' in group or 'LOCAL_CPPDEFINES' in group):
GroupOption = SubElement(group_tree, 'GroupOption')
GroupArmAds = SubElement(GroupOption, 'GroupArmAds')
Cads = SubElement(GroupArmAds, 'Cads')
VariousControls = SubElement(Cads, 'VariousControls')
MiscControls = SubElement(VariousControls, 'MiscControls')
- if 'LOCAL_CCFLAGS' in group:
- MiscControls.text = group['LOCAL_CCFLAGS']
+ if 'LOCAL_CFLAGS' in group:
+ MiscControls.text = group['LOCAL_CFLAGS']
else:
MiscControls.text = ' '
Define = SubElement(VariousControls, 'Define')
@@ -329,7 +329,7 @@ def MDKProject(target, script):
CPPPATH = []
CPPDEFINES = []
LINKFLAGS = ''
- CCFLAGS = ''
+ CFLAGS = ''
# number of groups
group_index = 1
diff --git a/tools/ses.py b/tools/ses.py
index cc513f0baa..67ea8b0cbe 100644
--- a/tools/ses.py
+++ b/tools/ses.py
@@ -49,7 +49,7 @@ def SESProject(env) :
CPPPATH = []
CPPDEFINES = []
LINKFLAGS = ''
- CCFLAGS = ''
+ CFLAGS = ''
project_node = tree.find('project')
@@ -59,11 +59,11 @@ def SESProject(env) :
group_tree = SDKAddGroup(project_node, group['name'], group['src'], project_path)
# get each group's cc flags
- if 'CCFLAGS' in group and group['CCFLAGS']:
- if CCFLAGS:
- CCFLAGS += ' ' + group['CCFLAGS']
+ if 'CFLAGS' in group and group['CFLAGS']:
+ if CFLAGS:
+ CFLAGS += ' ' + group['CFLAGS']
else:
- CCFLAGS += group['CCFLAGS']
+ CFLAGS += group['CFLAGS']
# get each group's link flags
if 'LINKFLAGS' in group and group['LINKFLAGS']: