def execCommand(args, following_args): """Get the current target board and call the corresponding flash function. Args: args (str): Command line arguments. following_args (str): Subcommand line arguments. Returns: None. Raises: sys.stderr. """ current_target = target.get_current_target() if current_target: project_name = project.get_project_name() if not project_name: print >>sys.stderr, 'Error: No module.json file found. Run "kubos init" to create a new project' sys.exit(1) proj_exe_path = os.path.join(os.getcwd(), 'build', current_target, 'source', project_name) kubos_dir = resource_filename(__name__, '') if current_target.startswith('stm32f407') or current_target.startswith('na'): flash_openocd(proj_exe_path, kubos_dir) elif current_target.startswith('pyboard'): flash_dfu_util(proj_exe_path, kubos_dir) elif current_target.startswith('msp430'): flash_mspdebug(proj_exe_path, kubos_dir) else: print >>sys.stderr, 'Error: No target currently selected. Select a target and build before flashing'
def start_server(): current_target = target.get_current_target() flash_dir, lib_dir, exe_dir = get_dirs() project.add_ld_library_path(lib_dir) if not current_target: print >> sys.stderr, 'Set a target hardware device and build your project before debugging' sys.exit(1) if current_target.startswith('stm32') or current_target.startswith('na'): flash_script = os.path.join(flash_dir, 'openocd', 'flash.sh') util_exe = os.path.join(exe_dir, 'openocd') proc = subprocess.Popen( ['/bin/bash', flash_script, util_exe, '', lib_dir], stdout=subprocess.PIPE, stderr=subprocess.PIPE) elif current_target.startswith('msp430'): flash_script = os.path.join(flash_dir, 'mspdebug', 'flash.sh') util_exe = os.path.join(exe_dir, 'mspdebug') proc = subprocess.Popen( ['/bin/bash', flash_script, util_exe, 'gdb 3333'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) #catch failed server starts time.sleep(0.5) status = get_server_status() if status == server_stopped: print >> sys.stderr, 'GDB server failed to start... Ensure your target device is connected' sys.exit(1) elif status == server_running: print 'Server successfully Started'
def get_flash_util(): current_target = target.get_current_target() if not current_target: print >>sys.stderr, 'No Target is currently set. Cannot start the gdb server' sys.exit(1) if current_target.startswith('stm32') or current_target.startswith('na'): flash_util = 'openocd' elif current_target.startswith('msp430'): flash_util = 'mspdebug' return flash_util
def get_flash_util(): current_target = target.get_current_target() if not current_target: print >> sys.stderr, 'No Target is currently set. Cannot start the gdb server' sys.exit(1) if current_target.startswith('stm32') or current_target.startswith('na'): flash_util = 'openocd' elif current_target.startswith('msp430'): flash_util = 'mspdebug' return flash_util
def execCommand(args, following_args): current_target = target.get_current_target() if not current_target: print >> sys.stderr, 'Set a target and build your project before debugging' sys.exit(1) generate_gdb_commands(current_target) if server.get_server_status() == server.server_stopped: print 'Kubos GDB server not running...\nStarting GDB Server...' server.start_server() gdb_file_path = os.path.join(os.getcwd(), gdb_command_file) if current_target.startswith('stm32') or current_target.startswith('na'): command = ['arm-none-eabi-gdb', '-x', gdb_file_path] elif current_target.startswith('msp430'): command = ['msp430-gdb', '-x', gdb_file_path] container.debug(command)
def execCommand(args, following_args): current_target = target.get_current_target() if not current_target: print >>sys.stderr, 'Set a target and build your project before debugging' sys.exit(1) generate_gdb_commands(current_target) if server.get_server_status() == server.server_stopped: print 'Kubos GDB server not running...\nStarting GDB Server...' server.start_server() gdb_file_path = os.path.join(os.getcwd(), gdb_command_file) if current_target.startswith('stm32') or current_target.startswith('na'): command = ['arm-none-eabi-gdb', '-x', gdb_file_path] elif current_target.startswith('msp430'): command = ['msp430-gdb', '-x', gdb_file_path] container.debug(command)
def execCommand(args, following_args): current_target = target.get_current_target() if current_target: project_name = project.get_project_name() if not project_name: print >>sys.stderr, 'Error: No module.json file found. Run "kubos init" to create a new project' sys.exit(1) proj_exe_path = os.path.join(os.getcwd(), 'build', current_target, 'source', project_name) kubos_dir = resource_filename(__name__, '') if current_target.startswith('stm32f407') or current_target.startswith('na'): flash_openocd(proj_exe_path, kubos_dir) elif current_target.startswith('pyboard'): flash_dfu_util(proj_exe_path, kubos_dir) elif current_target.startswith('msp430'): flash_mspdebug(proj_exe_path, kubos_dir) else: print >>sys.stderr, 'Error: No target currently selected. Select a target and build before flashing'
def execCommand(args, following_args): current_target = target.get_current_target() if current_target: project_name = project.get_project_name() if not project_name: print >> sys.stderr, 'Error: No module.json file found. Run "kubos init" to create a new project' sys.exit(1) proj_exe_path = os.path.join(os.getcwd(), 'build', current_target, 'source', project_name) kubos_dir = resource_filename(__name__, '') if current_target.startswith('stm32f407') or current_target.startswith( 'na'): flash_openocd(proj_exe_path, kubos_dir) elif current_target.startswith('pyboard'): flash_dfu_util(proj_exe_path, kubos_dir) elif current_target.startswith('msp430'): flash_mspdebug(proj_exe_path, kubos_dir) else: print >> sys.stderr, 'Error: No target currently selected. Select a target and build before flashing'
def start_server(): current_target = target.get_current_target() flash_dir, lib_dir, exe_dir = get_dirs() project.add_kubos_lib_path(lib_dir) if not current_target: print >>sys.stderr, 'Set a target hardware device and build your project before debugging' sys.exit(1) if current_target.startswith('stm32') or current_target.startswith('na'): flash_script = os.path.join(flash_dir, 'openocd', 'flash.sh') util_exe = os.path.join(exe_dir, 'openocd') proc = subprocess.Popen(['/bin/bash', flash_script, util_exe, '', lib_dir], stdout=subprocess.PIPE, stderr=subprocess.PIPE) elif current_target.startswith('msp430'): flash_script = os.path.join(flash_dir, 'mspdebug', 'flash.sh') util_exe = os.path.join(exe_dir, 'mspdebug') proc = subprocess.Popen(['/bin/bash', flash_script, util_exe, 'gdb 3333'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) #catch failed server starts time.sleep(0.5) status = get_server_status() if status == server_stopped: print >>sys.stderr, 'GDB server failed to start... Ensure your target device is connected' sys.exit(1) elif status == server_running: print 'Server successfully Started'
def execCommand(args, following_args): if not target.get_current_target(): print >> sys.stderr, 'Error: No target currently selected. Select a target before building your project' sys.exit(1) container.pass_through(args.subcommand_name, *following_args)
def execCommand(args, following_args): # Running this command without a target set will prompt the user for their mbed login if not target.get_current_target(): print >> sys.stderr, 'Please set a target device before running this command' sys.exit(1) container.pass_through(args.subcommand_name, *following_args)
def execCommand(args, following_args): if not target.get_current_target(): print >>sys.stderr, 'Error: No target currently selected. Select a target before building your project' sys.exit(1) container.pass_through(args.subcommand_name, *following_args)