mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-11-16 12:34:33 +00:00
Compare commits
4 Commits
92377190ba
...
lts-v4.1.x
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7aa109ced8 | ||
|
|
9376074b15 | ||
|
|
5cf711488c | ||
|
|
bc30ca4743 |
@@ -282,11 +282,18 @@ int _sys_seek(FILEHANDLE fh, long pos)
|
|||||||
/**
|
/**
|
||||||
* used by tmpnam() or tmpfile()
|
* used by tmpnam() or tmpfile()
|
||||||
*/
|
*/
|
||||||
|
#if __ARMCC_VERSION >= 6190000
|
||||||
|
void _sys_tmpnam(char *name, int fileno, unsigned maxlength)
|
||||||
|
{
|
||||||
|
rt_snprintf(name, maxlength, "tem%03d", fileno);
|
||||||
|
}
|
||||||
|
#else
|
||||||
int _sys_tmpnam(char *name, int fileno, unsigned maxlength)
|
int _sys_tmpnam(char *name, int fileno, unsigned maxlength)
|
||||||
{
|
{
|
||||||
rt_snprintf(name, maxlength, "tem%03d", fileno);
|
rt_snprintf(name, maxlength, "tem%03d", fileno);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
#endif /* __ARMCC_VERSION >= 6190000 */
|
||||||
|
|
||||||
char *_sys_command_string(char *cmd, int len)
|
char *_sys_command_string(char *cmd, int len)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -164,8 +164,21 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
|
|||||||
|
|
||||||
# set RTT_ROOT in ENV
|
# set RTT_ROOT in ENV
|
||||||
Env['RTT_ROOT'] = Rtt_Root
|
Env['RTT_ROOT'] = Rtt_Root
|
||||||
|
os.environ["RTT_DIR"] = Rtt_Root
|
||||||
# set BSP_ROOT in ENV
|
# set BSP_ROOT in ENV
|
||||||
Env['BSP_ROOT'] = Dir('#').abspath
|
Env['BSP_ROOT'] = Dir('#').abspath
|
||||||
|
os.environ["BSP_DIR"] = Dir('#').abspath
|
||||||
|
# set PKGS_ROOT in ENV
|
||||||
|
if "PKGS_DIR" in os.environ:
|
||||||
|
pass
|
||||||
|
elif "PKGS_ROOT" in os.environ:
|
||||||
|
os.environ["PKGS_DIR"] = os.environ["PKGS_ROOT"]
|
||||||
|
elif "ENV_ROOT" in os.environ:
|
||||||
|
os.environ["PKGS_DIR"] = os.path.join(os.environ["ENV_ROOT"], "packages")
|
||||||
|
elif sys.platform == "win32":
|
||||||
|
os.environ["PKGS_DIR"] = os.path.join(os.environ["USERPROFILE"], ".env", "packages")
|
||||||
|
else:
|
||||||
|
os.environ["PKGS_DIR"] = os.path.join(os.environ["HOME"], ".env", "packages")
|
||||||
|
|
||||||
sys.path = sys.path + [os.path.join(Rtt_Root, 'tools')]
|
sys.path = sys.path + [os.path.join(Rtt_Root, 'tools')]
|
||||||
|
|
||||||
@@ -291,35 +304,33 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
|
|||||||
env.AppendUnique(CPPDEFINES = ['_REENT_SMALL'])
|
env.AppendUnique(CPPDEFINES = ['_REENT_SMALL'])
|
||||||
|
|
||||||
if GetOption('genconfig'):
|
if GetOption('genconfig'):
|
||||||
from genconf import genconfig
|
menuconfig = utils.ImportModule('menuconfig')
|
||||||
genconfig()
|
menuconfig.genconfig()
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
if GetOption('stackanalysis'):
|
if GetOption('stackanalysis'):
|
||||||
from WCS import ThreadStackStaticAnalysis
|
from WCS import ThreadStackStaticAnalysis
|
||||||
ThreadStackStaticAnalysis(Env)
|
ThreadStackStaticAnalysis(Env)
|
||||||
exit(0)
|
exit(0)
|
||||||
if platform.system() != 'Windows':
|
|
||||||
if GetOption('menuconfig'):
|
if GetOption('menuconfig'):
|
||||||
from menuconfig import menuconfig
|
menuconfig = utils.ImportModule('menuconfig')
|
||||||
menuconfig(Rtt_Root)
|
menuconfig.menuconfig(Rtt_Root)
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
if GetOption('pyconfig_silent'):
|
if GetOption('pyconfig_silent'):
|
||||||
from menuconfig import guiconfig_silent
|
menuconfig = utils.ImportModule('menuconfig')
|
||||||
|
menuconfig.guiconfig_silent(Rtt_Root)
|
||||||
guiconfig_silent(Rtt_Root)
|
|
||||||
exit(0)
|
exit(0)
|
||||||
elif GetOption('pyconfig'):
|
elif GetOption('pyconfig'):
|
||||||
from menuconfig import guiconfig
|
menuconfig = utils.ImportModule('menuconfig')
|
||||||
|
menuconfig.guiconfig(Rtt_Root)
|
||||||
guiconfig(Rtt_Root)
|
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
configfn = GetOption('useconfig')
|
configfn = GetOption('useconfig')
|
||||||
if configfn:
|
if configfn:
|
||||||
from menuconfig import mk_rtconfig
|
menuconfig = utils.ImportModule('menuconfig')
|
||||||
mk_rtconfig(configfn)
|
menuconfig.mk_rtconfig(configfn)
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
|
|
||||||
@@ -733,8 +744,8 @@ def DoBuilding(target, objects):
|
|||||||
CFLAGS = Env.get('CFLAGS', '') + group.get('LOCAL_CFLAGS', '')
|
CFLAGS = Env.get('CFLAGS', '') + group.get('LOCAL_CFLAGS', '')
|
||||||
CCFLAGS = Env.get('CCFLAGS', '') + group.get('LOCAL_CCFLAGS', '')
|
CCFLAGS = Env.get('CCFLAGS', '') + group.get('LOCAL_CCFLAGS', '')
|
||||||
CXXFLAGS = Env.get('CXXFLAGS', '') + group.get('LOCAL_CXXFLAGS', '')
|
CXXFLAGS = Env.get('CXXFLAGS', '') + group.get('LOCAL_CXXFLAGS', '')
|
||||||
CPPPATH = Env.get('CPPPATH', ['']) + group.get('LOCAL_CPPPATH', [''])
|
CPPPATH = list(Env.get('CPPPATH', [''])) + group.get('LOCAL_CPPPATH', [''])
|
||||||
CPPDEFINES = Env.get('CPPDEFINES', ['']) + group.get('LOCAL_CPPDEFINES', [''])
|
CPPDEFINES = list(Env.get('CPPDEFINES', [''])) + group.get('LOCAL_CPPDEFINES', [''])
|
||||||
ASFLAGS = Env.get('ASFLAGS', '') + group.get('LOCAL_ASFLAGS', '')
|
ASFLAGS = Env.get('ASFLAGS', '') + group.get('LOCAL_ASFLAGS', '')
|
||||||
|
|
||||||
for source in group['src']:
|
for source in group['src']:
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
# Copyright (c) 2019, Ulf Magnusson
|
|
||||||
# SPDX-License-Identifier: ISC
|
|
||||||
|
|
||||||
"""
|
|
||||||
Reads a specified configuration file, then writes a new configuration file.
|
|
||||||
This can be used to initialize the configuration from e.g. an arch-specific
|
|
||||||
configuration file. This input configuration file would usually be a minimal
|
|
||||||
configuration file, as generated by e.g. savedefconfig.
|
|
||||||
|
|
||||||
The default output filename is '.config'. A different filename can be passed in
|
|
||||||
the KCONFIG_CONFIG environment variable.
|
|
||||||
"""
|
|
||||||
import argparse
|
|
||||||
|
|
||||||
import kconfiglib
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
parser = argparse.ArgumentParser(
|
|
||||||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
||||||
description=__doc__)
|
|
||||||
|
|
||||||
parser.add_argument(
|
|
||||||
"--kconfig",
|
|
||||||
default="Kconfig",
|
|
||||||
help="Base Kconfig file (default: Kconfig)")
|
|
||||||
|
|
||||||
parser.add_argument(
|
|
||||||
"config",
|
|
||||||
metavar="CONFIGURATION",
|
|
||||||
help="Input configuration file")
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
|
||||||
|
|
||||||
kconf = kconfiglib.Kconfig(args.kconfig)
|
|
||||||
print(kconf.load_config(args.config))
|
|
||||||
print(kconf.write_config())
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
import os
|
|
||||||
|
|
||||||
def genconfig() :
|
|
||||||
from SCons.Script import SCons
|
|
||||||
|
|
||||||
PreProcessor = SCons.cpp.PreProcessor()
|
|
||||||
|
|
||||||
try:
|
|
||||||
f = open('rtconfig.h', 'r')
|
|
||||||
contents = f.read()
|
|
||||||
f.close()
|
|
||||||
except :
|
|
||||||
print("Open rtconfig.h file failed.")
|
|
||||||
|
|
||||||
PreProcessor.process_contents(contents)
|
|
||||||
options = PreProcessor.cpp_namespace
|
|
||||||
|
|
||||||
try:
|
|
||||||
f = open('.config', 'w')
|
|
||||||
for (opt, value) in options.items():
|
|
||||||
if type(value) == type(1):
|
|
||||||
f.write("CONFIG_%s=%d\n" % (opt, value))
|
|
||||||
|
|
||||||
if type(value) == type('') and value == '':
|
|
||||||
f.write("CONFIG_%s=y\n" % opt)
|
|
||||||
elif type(value) == type('str'):
|
|
||||||
f.write("CONFIG_%s=%s\n" % (opt, value))
|
|
||||||
|
|
||||||
print("Generate .config done!")
|
|
||||||
f.close()
|
|
||||||
except:
|
|
||||||
print("Generate .config file failed.")
|
|
||||||
7024
tools/kconfiglib.py
7024
tools/kconfiglib.py
File diff suppressed because it is too large
Load Diff
@@ -238,25 +238,21 @@ def exclude_utestcases(RTT_ROOT):
|
|||||||
if line.find('examples/utest/testcases/Kconfig') == -1:
|
if line.find('examples/utest/testcases/Kconfig') == -1:
|
||||||
f.write(line)
|
f.write(line)
|
||||||
|
|
||||||
# menuconfig for Linux
|
# guiconfig for windows and linux
|
||||||
def menuconfig(RTT_ROOT):
|
def menuconfig(RTT_ROOT):
|
||||||
|
import menuconfig
|
||||||
|
|
||||||
# Exclude utestcases
|
# Exclude utestcases
|
||||||
exclude_utestcases(RTT_ROOT)
|
exclude_utestcases(RTT_ROOT)
|
||||||
|
|
||||||
kconfig_dir = os.path.join(RTT_ROOT, 'tools', 'kconfig-frontends')
|
if sys.platform != 'win32':
|
||||||
os.system('scons -C ' + kconfig_dir)
|
touch_env()
|
||||||
|
|
||||||
touch_env()
|
|
||||||
env_dir = get_env_dir()
|
|
||||||
|
|
||||||
os.environ['PKGS_ROOT'] = os.path.join(env_dir, 'packages')
|
|
||||||
|
|
||||||
fn = '.config'
|
fn = '.config'
|
||||||
fn_old = '.config.old'
|
fn_old = '.config.old'
|
||||||
|
|
||||||
kconfig_cmd = os.path.join(RTT_ROOT, 'tools', 'kconfig-frontends', 'kconfig-mconf')
|
sys.argv = ['menuconfig', 'Kconfig']
|
||||||
os.system(kconfig_cmd + ' Kconfig')
|
menuconfig._main()
|
||||||
|
|
||||||
if os.path.isfile(fn):
|
if os.path.isfile(fn):
|
||||||
if os.path.isfile(fn_old):
|
if os.path.isfile(fn_old):
|
||||||
@@ -273,7 +269,7 @@ def menuconfig(RTT_ROOT):
|
|||||||
|
|
||||||
# guiconfig for windows and linux
|
# guiconfig for windows and linux
|
||||||
def guiconfig(RTT_ROOT):
|
def guiconfig(RTT_ROOT):
|
||||||
import pyguiconfig
|
import guiconfig
|
||||||
|
|
||||||
# Exclude utestcases
|
# Exclude utestcases
|
||||||
exclude_utestcases(RTT_ROOT)
|
exclude_utestcases(RTT_ROOT)
|
||||||
@@ -289,7 +285,7 @@ def guiconfig(RTT_ROOT):
|
|||||||
fn_old = '.config.old'
|
fn_old = '.config.old'
|
||||||
|
|
||||||
sys.argv = ['guiconfig', 'Kconfig']
|
sys.argv = ['guiconfig', 'Kconfig']
|
||||||
pyguiconfig._main()
|
guiconfig._main()
|
||||||
|
|
||||||
if os.path.isfile(fn):
|
if os.path.isfile(fn):
|
||||||
if os.path.isfile(fn_old):
|
if os.path.isfile(fn_old):
|
||||||
@@ -326,3 +322,34 @@ def guiconfig_silent(RTT_ROOT):
|
|||||||
|
|
||||||
# silent mode, force to make rtconfig.h
|
# silent mode, force to make rtconfig.h
|
||||||
mk_rtconfig(fn)
|
mk_rtconfig(fn)
|
||||||
|
|
||||||
|
def genconfig() :
|
||||||
|
from SCons.Script import SCons
|
||||||
|
|
||||||
|
PreProcessor = SCons.cpp.PreProcessor()
|
||||||
|
|
||||||
|
try:
|
||||||
|
f = open('rtconfig.h', 'r')
|
||||||
|
contents = f.read()
|
||||||
|
f.close()
|
||||||
|
except :
|
||||||
|
print("Open rtconfig.h file failed.")
|
||||||
|
|
||||||
|
PreProcessor.process_contents(contents)
|
||||||
|
options = PreProcessor.cpp_namespace
|
||||||
|
|
||||||
|
try:
|
||||||
|
f = open('.config', 'w')
|
||||||
|
for (opt, value) in options.items():
|
||||||
|
if type(value) == type(1):
|
||||||
|
f.write("CONFIG_%s=%d\n" % (opt, value))
|
||||||
|
|
||||||
|
if type(value) == type('') and value == '':
|
||||||
|
f.write("CONFIG_%s=y\n" % opt)
|
||||||
|
elif type(value) == type('str'):
|
||||||
|
f.write("CONFIG_%s=%s\n" % (opt, value))
|
||||||
|
|
||||||
|
print("Generate .config done!")
|
||||||
|
f.close()
|
||||||
|
except:
|
||||||
|
print("Generate .config file failed.")
|
||||||
|
|||||||
@@ -104,19 +104,18 @@ def AddOptions():
|
|||||||
action = 'store_true',
|
action = 'store_true',
|
||||||
default = False,
|
default = False,
|
||||||
help = 'print verbose information during build')
|
help = 'print verbose information during build')
|
||||||
AddOption('--pyconfig',
|
AddOption('--pyconfig', '--guiconfig',
|
||||||
dest = 'pyconfig',
|
dest = 'pyconfig',
|
||||||
action = 'store_true',
|
action = 'store_true',
|
||||||
default = False,
|
default = False,
|
||||||
help = 'Python GUI menuconfig for RT-Thread BSP')
|
help = 'Python GUI menuconfig for RT-Thread BSP')
|
||||||
AddOption('--pyconfig-silent',
|
AddOption('--pyconfig-silent', '--defconfig',
|
||||||
dest = 'pyconfig_silent',
|
dest = 'pyconfig_silent',
|
||||||
action = 'store_true',
|
action = 'store_true',
|
||||||
default = False,
|
default = False,
|
||||||
help = 'Don`t show pyconfig window')
|
help = 'Don`t show pyconfig window')
|
||||||
if platform.system() != 'Windows':
|
AddOption('--menuconfig',
|
||||||
AddOption('--menuconfig',
|
dest = 'menuconfig',
|
||||||
dest = 'menuconfig',
|
action = 'store_true',
|
||||||
action = 'store_true',
|
default = False,
|
||||||
default = False,
|
help = 'make menuconfig for RT-Thread BSP')
|
||||||
help = 'make menuconfig for RT-Thread BSP')
|
|
||||||
|
|||||||
2314
tools/pyguiconfig.py
2314
tools/pyguiconfig.py
File diff suppressed because it is too large
Load Diff
@@ -293,3 +293,15 @@ def ReloadModule(module):
|
|||||||
reload(module)
|
reload(module)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
def ImportModule(module):
|
||||||
|
import sys
|
||||||
|
if sys.version_info.major >= 3:
|
||||||
|
import importlib.util
|
||||||
|
path = os.path.dirname(__file__)
|
||||||
|
spec = importlib.util.spec_from_file_location(module, os.path.join(path, module+".py"))
|
||||||
|
module = importlib.util.module_from_spec(spec)
|
||||||
|
spec.loader.exec_module(module)
|
||||||
|
return module
|
||||||
|
else:
|
||||||
|
return __import__(module, fromlist=[module])
|
||||||
Reference in New Issue
Block a user