3
.gitignore
vendored
3
.gitignore
vendored
@@ -1 +1,4 @@
|
|||||||
*.pyc
|
*.pyc
|
||||||
|
*.o
|
||||||
|
kconfig-frontends/.sconsign.dblite
|
||||||
|
kconfig-frontends/kconfig-mconf
|
||||||
|
18
building.py
18
building.py
@@ -143,13 +143,14 @@ def GenCconfigFile(env, BuildOptions):
|
|||||||
# add HAVE_CCONFIG_H definition
|
# add HAVE_CCONFIG_H definition
|
||||||
env.AppendUnique(CPPDEFINES = ['HAVE_CCONFIG_H'])
|
env.AppendUnique(CPPDEFINES = ['HAVE_CCONFIG_H'])
|
||||||
|
|
||||||
def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [], rtt_cfg = 'rtconfig.h'):
|
def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [], rtt_cfg = 'rtconfig.h', rtt_tools = ''):
|
||||||
import rtconfig
|
import rtconfig
|
||||||
|
|
||||||
global BuildOptions
|
global BuildOptions
|
||||||
global Projects
|
global Projects
|
||||||
global Env
|
global Env
|
||||||
global Rtt_Root
|
global Rtt_Root
|
||||||
|
global Rtt_Tool
|
||||||
|
|
||||||
# ===== Add option to SCons =====
|
# ===== Add option to SCons =====
|
||||||
AddOption('--dist',
|
AddOption('--dist',
|
||||||
@@ -241,7 +242,12 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
|
|||||||
# set BSP_ROOT in ENV
|
# set BSP_ROOT in ENV
|
||||||
Env['BSP_ROOT'] = Dir('#').abspath
|
Env['BSP_ROOT'] = Dir('#').abspath
|
||||||
|
|
||||||
sys.path = sys.path + [os.path.join(Rtt_Root, 'tools')]
|
if rtt_tools == '':
|
||||||
|
Rtt_Tool = os.path.join(Rtt_Root, '..', 'rtt_tools')
|
||||||
|
else:
|
||||||
|
Rtt_Tool = rtt_tools
|
||||||
|
|
||||||
|
sys.path = sys.path + [Rtt_Tool]
|
||||||
|
|
||||||
# {target_name:(CROSS_TOOL, PLATFORM)}
|
# {target_name:(CROSS_TOOL, PLATFORM)}
|
||||||
tgt_dict = {'mdk':('keil', 'armcc'),
|
tgt_dict = {'mdk':('keil', 'armcc'),
|
||||||
@@ -379,7 +385,7 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
|
|||||||
help = 'make menuconfig for RT-Thread BSP')
|
help = 'make menuconfig for RT-Thread BSP')
|
||||||
if GetOption('menuconfig'):
|
if GetOption('menuconfig'):
|
||||||
from menuconfig import menuconfig
|
from menuconfig import menuconfig
|
||||||
menuconfig(Rtt_Root)
|
menuconfig(Rtt_Tool, rtt_cfg)
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
AddOption('--pyconfig',
|
AddOption('--pyconfig',
|
||||||
@@ -396,18 +402,18 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
|
|||||||
if GetOption('pyconfig_silent'):
|
if GetOption('pyconfig_silent'):
|
||||||
from menuconfig import guiconfig_silent
|
from menuconfig import guiconfig_silent
|
||||||
|
|
||||||
guiconfig_silent(Rtt_Root)
|
guiconfig_silent(Rtt_Tool, rtt_cfg)
|
||||||
exit(0)
|
exit(0)
|
||||||
elif GetOption('pyconfig'):
|
elif GetOption('pyconfig'):
|
||||||
from menuconfig import guiconfig
|
from menuconfig import guiconfig
|
||||||
|
|
||||||
guiconfig(Rtt_Root)
|
guiconfig(Rtt_Tool, rtt_cfg)
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
configfn = GetOption('useconfig')
|
configfn = GetOption('useconfig')
|
||||||
if configfn:
|
if configfn:
|
||||||
from menuconfig import mk_rtconfig
|
from menuconfig import mk_rtconfig
|
||||||
mk_rtconfig(configfn)
|
mk_rtconfig(configfn, rtt_cfg)
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -40,14 +40,14 @@ def is_pkg_special_config(config_str):
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def mk_rtconfig(filename):
|
def mk_rtconfig(filename, cfg_head = 'rtconfig.h'):
|
||||||
try:
|
try:
|
||||||
config = open(filename, 'r')
|
config = open(filename, 'r')
|
||||||
except:
|
except:
|
||||||
print('open config:%s failed' % filename)
|
print('open config:%s failed' % filename)
|
||||||
return
|
return
|
||||||
|
|
||||||
rtconfig = open('rtconfig.h', 'w')
|
rtconfig = open(cfg_head, 'w')
|
||||||
rtconfig.write('#ifndef RT_CONFIG_H__\n')
|
rtconfig.write('#ifndef RT_CONFIG_H__\n')
|
||||||
rtconfig.write('#define RT_CONFIG_H__\n\n')
|
rtconfig.write('#define RT_CONFIG_H__\n\n')
|
||||||
|
|
||||||
@@ -233,12 +233,12 @@ def exclude_utestcases(RTT_ROOT):
|
|||||||
f.write(line)
|
f.write(line)
|
||||||
|
|
||||||
# menuconfig for Linux
|
# menuconfig for Linux
|
||||||
def menuconfig(RTT_ROOT):
|
def menuconfig(RTT_TOOLS, cfg_head):
|
||||||
|
|
||||||
# Exclude utestcases
|
# Exclude utestcases
|
||||||
exclude_utestcases(RTT_ROOT)
|
exclude_utestcases(RTT_TOOLS)
|
||||||
|
|
||||||
kconfig_dir = os.path.join(RTT_ROOT, 'tools', 'kconfig-frontends')
|
kconfig_dir = os.path.join(RTT_TOOLS, 'kconfig-frontends')
|
||||||
os.system('scons -C ' + kconfig_dir)
|
os.system('scons -C ' + kconfig_dir)
|
||||||
|
|
||||||
touch_env()
|
touch_env()
|
||||||
@@ -249,7 +249,7 @@ def menuconfig(RTT_ROOT):
|
|||||||
fn = '.config'
|
fn = '.config'
|
||||||
fn_old = '.config.old'
|
fn_old = '.config.old'
|
||||||
|
|
||||||
kconfig_cmd = os.path.join(RTT_ROOT, 'tools', 'kconfig-frontends', 'kconfig-mconf')
|
kconfig_cmd = os.path.join(RTT_TOOLS, 'kconfig-frontends', 'kconfig-mconf')
|
||||||
os.system(kconfig_cmd + ' Kconfig')
|
os.system(kconfig_cmd + ' Kconfig')
|
||||||
|
|
||||||
if os.path.isfile(fn):
|
if os.path.isfile(fn):
|
||||||
@@ -263,14 +263,14 @@ def menuconfig(RTT_ROOT):
|
|||||||
# make rtconfig.h
|
# make rtconfig.h
|
||||||
if diff_eq == False:
|
if diff_eq == False:
|
||||||
shutil.copyfile(fn, fn_old)
|
shutil.copyfile(fn, fn_old)
|
||||||
mk_rtconfig(fn)
|
mk_rtconfig(fn, cfg_head)
|
||||||
|
|
||||||
# guiconfig for windows and linux
|
# guiconfig for windows and linux
|
||||||
def guiconfig(RTT_ROOT):
|
def guiconfig(RTT_TOOLS, cfg_head):
|
||||||
import pyguiconfig
|
import pyguiconfig
|
||||||
|
|
||||||
# Exclude utestcases
|
# Exclude utestcases
|
||||||
exclude_utestcases(RTT_ROOT)
|
exclude_utestcases(RTT_TOOLS)
|
||||||
|
|
||||||
if sys.platform != 'win32':
|
if sys.platform != 'win32':
|
||||||
touch_env()
|
touch_env()
|
||||||
@@ -296,15 +296,15 @@ def guiconfig(RTT_ROOT):
|
|||||||
# make rtconfig.h
|
# make rtconfig.h
|
||||||
if diff_eq == False:
|
if diff_eq == False:
|
||||||
shutil.copyfile(fn, fn_old)
|
shutil.copyfile(fn, fn_old)
|
||||||
mk_rtconfig(fn)
|
mk_rtconfig(fn, cfg_head)
|
||||||
|
|
||||||
|
|
||||||
# guiconfig for windows and linux
|
# guiconfig for windows and linux
|
||||||
def guiconfig_silent(RTT_ROOT):
|
def guiconfig_silent(RTT_TOOLS, cfg_head):
|
||||||
import defconfig
|
import defconfig
|
||||||
|
|
||||||
# Exclude utestcases
|
# Exclude utestcases
|
||||||
exclude_utestcases(RTT_ROOT)
|
exclude_utestcases(RTT_TOOLS)
|
||||||
|
|
||||||
if sys.platform != 'win32':
|
if sys.platform != 'win32':
|
||||||
touch_env()
|
touch_env()
|
||||||
@@ -319,4 +319,4 @@ def guiconfig_silent(RTT_ROOT):
|
|||||||
defconfig.main()
|
defconfig.main()
|
||||||
|
|
||||||
# silent mode, force to make rtconfig.h
|
# silent mode, force to make rtconfig.h
|
||||||
mk_rtconfig(fn)
|
mk_rtconfig(fn, cfg_head)
|
||||||
|
Reference in New Issue
Block a user