def ucube_main(args): for key, value in ARGLIST: aos_global_config.set(key, value) if args.get('COMMAND') == 'upload': print('[INFO]: Scons to upload!args:%s\n' % args) app = args.get('APPLICATION') board = args.get('BOARD') target = app + '@' + board workdir = None bindir = None if 'WORKPATH' in args: workdir = args.get('WORKPATH') if 'BINDIR' in args: bindir = args.get('BINDIR') ret = aos_upload(target, workdir, bindir) return ret if args.get('COMMAND') == 'debug': print('[INFO]: Scons to debug!args:%s\n' % args) app = args.get('APPLICATION') board = args.get('BOARD') target = app + '@' + board workdir = None bindir = None startclient = False gdb_args = None if 'WORKPATH' in args: workdir = args.get('WORKPATH') if 'BINDIR' in args: bindir = args.get('BINDIR') if 'STARTCLIENT' in args: startclient = args.get('STARTCLIENT') if 'GDBARGS' in args: gdb_args = args.get('GDBARGS') ret = aos_debug(target, workdir, bindir, startclient, gdb_args) return ret if args.get('COMPILER') == 'cl': print('>>>MSVS Tool Environment') aos_global_config.aos_env = Environment(ENV=os.environ, CPPPATH=['#include'], TARGET_ARCH='x86') else: aos_global_config.aos_env = Environment(ENV=os.environ, CPPPATH=['#include'], TOOLS=['mingw', 'gcc', 'g++']) #one component support limit source files in windows if sys.platform.startswith('win'): aos_global_config.max_files = 30 do_process(base_process_impl(aos_global_config, args)) do_process(dependency_process_impl(aos_global_config)) do_process(ld_file_process_impl(aos_global_config)) if aos_global_config.ide != '': do_process(ide_transfer_process_impl(aos_global_config)) else: do_process(build_rule_process_impl(aos_global_config)) do_process(link_process_impl(aos_global_config)) do_process(create_bin_process_impl(aos_global_config))
def ucube_main(args): for key, value in ARGLIST: aos_global_config.set(key, value) if args.get('COMMAND') == 'upload': print('[INFO]: Scons to upload!args:%s\n' % args) app = args.get('APPLICATION') board = args.get('BOARD') target = app + '@' + board ret = aos_upload(target) return ret if args.get('COMPILER') == 'cl': print('>>>MSVS Tool Environment') aos_global_config.aos_env = Environment(ENV=os.environ, CPPPATH=['#include'], TARGET_ARCH='x86') else: aos_global_config.aos_env = Environment(ENV=os.environ, CPPPATH=['#include'], TOOLS=['mingw', 'gcc', 'g++']) do_process(base_process_impl(aos_global_config, args)) do_process(dependency_process_impl(aos_global_config)) do_process(ld_file_process_impl(aos_global_config)) if aos_global_config.ide != '': do_process(ide_transfer_process_impl(aos_global_config)) else: do_process(build_rule_process_impl(aos_global_config)) do_process(link_process_impl(aos_global_config)) do_process(create_bin_process_impl(aos_global_config))
def _run_debug_cmd(target, aos_path, cmd_file, program_path=None, bin_dir=None, startclient=False, gdb_args=None): """ Run the command from cmd file """ ret = 0 host_os = get_host_os() if not host_os: error("Unsupported Operating System!") configs = read_json(cmd_file) if not configs: error("Can not read flash configs from %s" % cmd_file) if 'port' not in configs: error("need PORT in debug config file: %s" % cmd_file) # upload firmware first if 'upload' in configs and configs['upload'] == True: if aos_upload(target, aos_path): error("Upload firmware error") # update_launch(aos_path, target, configs['port']) start_server, exec_name = process_cmd(configs['cmd'], host_os, aos_path, target, program_path, bin_dir) info("Running cmd:\n\t'%s', Exec: %s\n" % (' '.join(start_server), exec_name)) taskkill(host_os, aos_path, exec_name) if host_os == 'Win32': ret = subprocess.Popen(start_server, shell=True, stdout=sys.stdout, stderr=sys.stderr, creationflags=subprocess.CREATE_NEW_CONSOLE) else: ret = subprocess.Popen(start_server, stdout=sys.stdout, stderr=sys.stderr, preexec_fn=os.setsid) if ret != 0 and configs['prompt']: info("%s" % configs['prompt']) return ret