diff --git a/components/libc/compilers/armlibc/syscalls.c b/components/libc/compilers/armlibc/syscalls.c index 26ba3796fa4..74097da58f7 100644 --- a/components/libc/compilers/armlibc/syscalls.c +++ b/components/libc/compilers/armlibc/syscalls.c @@ -282,11 +282,18 @@ int _sys_seek(FILEHANDLE fh, long pos) /** * 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) { rt_snprintf(name, maxlength, "tem%03d", fileno); return 1; } +#endif /* __ARMCC_VERSION >= 6190000 */ char *_sys_command_string(char *cmd, int len) { diff --git a/tools/building.py b/tools/building.py index 91c6d05c992..4a238569aa2 100644 --- a/tools/building.py +++ b/tools/building.py @@ -164,8 +164,21 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [ # set RTT_ROOT in ENV Env['RTT_ROOT'] = Rtt_Root + os.environ["RTT_DIR"] = Rtt_Root # set BSP_ROOT in ENV 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')] @@ -291,35 +304,33 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [ env.AppendUnique(CPPDEFINES = ['_REENT_SMALL']) if GetOption('genconfig'): - from genconf import genconfig - genconfig() + menuconfig = utils.ImportModule('menuconfig') + menuconfig.genconfig() exit(0) if GetOption('stackanalysis'): from WCS import ThreadStackStaticAnalysis ThreadStackStaticAnalysis(Env) exit(0) - if platform.system() != 'Windows': - if GetOption('menuconfig'): - from menuconfig import menuconfig - menuconfig(Rtt_Root) - exit(0) - if GetOption('pyconfig_silent'): - from menuconfig import guiconfig_silent + if GetOption('menuconfig'): + menuconfig = utils.ImportModule('menuconfig') + menuconfig.menuconfig(Rtt_Root) + exit(0) - guiconfig_silent(Rtt_Root) + if GetOption('pyconfig_silent'): + menuconfig = utils.ImportModule('menuconfig') + menuconfig.guiconfig_silent(Rtt_Root) exit(0) elif GetOption('pyconfig'): - from menuconfig import guiconfig - - guiconfig(Rtt_Root) + menuconfig = utils.ImportModule('menuconfig') + menuconfig.guiconfig(Rtt_Root) exit(0) configfn = GetOption('useconfig') if configfn: - from menuconfig import mk_rtconfig - mk_rtconfig(configfn) + menuconfig = utils.ImportModule('menuconfig') + menuconfig.mk_rtconfig(configfn) exit(0) @@ -733,8 +744,8 @@ def local_group(group, objects): 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', ['']) + CPPPATH = list(Env.get('CPPPATH', [''])) + group.get('LOCAL_CPPPATH', ['']) + CPPDEFINES = list(Env.get('CPPDEFINES', [''])) + group.get('LOCAL_CPPDEFINES', ['']) ASFLAGS = Env.get('ASFLAGS', '') + group.get('LOCAL_ASFLAGS', '') for source in group['src']: diff --git a/tools/defconfig.py b/tools/defconfig.py deleted file mode 100644 index d1b1e4ea739..00000000000 --- a/tools/defconfig.py +++ /dev/null @@ -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() diff --git a/tools/genconf.py b/tools/genconf.py deleted file mode 100644 index d033c4007d6..00000000000 --- a/tools/genconf.py +++ /dev/null @@ -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.") diff --git a/tools/kconfiglib.py b/tools/kconfiglib.py deleted file mode 100644 index 9a9b2f03f78..00000000000 --- a/tools/kconfiglib.py +++ /dev/null @@ -1,7024 +0,0 @@ -# Copyright (c) 2011-2019, Ulf Magnusson -# SPDX-License-Identifier: ISC - -""" -Overview -======== - -Kconfiglib is a Python 2/3 library for scripting and extracting information -from Kconfig (https://www.kernel.org/doc/Documentation/kbuild/kconfig-language.txt) -configuration systems. - -See the homepage at https://github.com/ulfalizer/Kconfiglib for a longer -overview. - -Since Kconfiglib 12.0.0, the library version is available in -kconfiglib.VERSION, which is a (, , ) tuple, e.g. -(12, 0, 0). - - -Using Kconfiglib on the Linux kernel with the Makefile targets -============================================================== - -For the Linux kernel, a handy interface is provided by the -scripts/kconfig/Makefile patch, which can be applied with either 'git am' or -the 'patch' utility: - - $ wget -qO- https://raw.githubusercontent.com/ulfalizer/Kconfiglib/master/makefile.patch | git am - $ wget -qO- https://raw.githubusercontent.com/ulfalizer/Kconfiglib/master/makefile.patch | patch -p1 - -Warning: Not passing -p1 to patch will cause the wrong file to be patched. - -Please tell me if the patch does not apply. It should be trivial to apply -manually, as it's just a block of text that needs to be inserted near the other -*conf: targets in scripts/kconfig/Makefile. - -Look further down for a motivation for the Makefile patch and for instructions -on how you can use Kconfiglib without it. - -If you do not wish to install Kconfiglib via pip, the Makefile patch is set up -so that you can also just clone Kconfiglib into the kernel root: - - $ git clone git://github.com/ulfalizer/Kconfiglib.git - $ git am Kconfiglib/makefile.patch (or 'patch -p1 < Kconfiglib/makefile.patch') - -Warning: The directory name Kconfiglib/ is significant in this case, because -it's added to PYTHONPATH by the new targets in makefile.patch. - -The targets added by the Makefile patch are described in the following -sections. - - -make kmenuconfig ----------------- - -This target runs the curses menuconfig interface with Python 3. As of -Kconfiglib 12.2.0, both Python 2 and Python 3 are supported (previously, only -Python 3 was supported, so this was a backport). - - -make guiconfig --------------- - -This target runs the Tkinter menuconfig interface. Both Python 2 and Python 3 -are supported. To change the Python interpreter used, pass -PYTHONCMD= to 'make'. The default is 'python'. - - -make [ARCH=] iscriptconfig --------------------------------- - -This target gives an interactive Python prompt where a Kconfig instance has -been preloaded and is available in 'kconf'. To change the Python interpreter -used, pass PYTHONCMD= to 'make'. The default is 'python'. - -To get a feel for the API, try evaluating and printing the symbols in -kconf.defined_syms, and explore the MenuNode menu tree starting at -kconf.top_node by following 'next' and 'list' pointers. - -The item contained in a menu node is found in MenuNode.item (note that this can -be one of the constants kconfiglib.MENU and kconfiglib.COMMENT), and all -symbols and choices have a 'nodes' attribute containing their menu nodes -(usually only one). Printing a menu node will print its item, in Kconfig -format. - -If you want to look up a symbol by name, use the kconf.syms dictionary. - - -make scriptconfig SCRIPT=