@@ -2608,6 +2608,7 @@ def compile_(toolchain=None, target=None, profile=False, compile_library=False,
26082608 program .check_requirements (True )
26092609 # Remember the original path. this is needed for compiling only the libraries and tests for the current folder.
26102610 orig_path = getcwd ()
2611+ orig_target = target
26112612
26122613 with cd (program .path ):
26132614 tools_dir = os .path .abspath (program .get_tools ())
@@ -2714,7 +2715,7 @@ def compile_(toolchain=None, target=None, profile=False, compile_library=False,
27142715 if not connected :
27152716 error ("The target board you compiled for is not connected to your system.\n Please reconnect it and retry the last command." , 1 )
27162717
2717- program .set_defaults (target = target , toolchain = tchain )
2718+ program .set_defaults (target = orig_target , toolchain = tchain )
27182719
27192720
27202721# Test command
@@ -2778,6 +2779,7 @@ def test_(toolchain=None, target=None, compile_list=False, run_list=False,
27782779
27792780 # Save original working directory
27802781 orig_path = getcwd ()
2782+ orig_target = target
27812783
27822784 macros = program .get_macros ()
27832785 tools_dir = program .get_tools ()
@@ -2932,7 +2934,7 @@ def test_(toolchain=None, target=None, compile_list=False, run_list=False,
29322934 if run_only or build_and_run_tests :
29332935 popen (icetea_command )
29342936
2935- program .set_defaults (target = target , toolchain = tchain )
2937+ program .set_defaults (target = orig_target , toolchain = tchain )
29362938
29372939
29382940# device management commands
@@ -3008,6 +3010,7 @@ def export(ide=None, target=None, source=False, clean=False, supported=False, ap
30083010 program .check_requirements (True )
30093011 # Remember the original path. this is needed for compiling only the libraries and tests for the current folder.
30103012 orig_path = getcwd ()
3013+ orig_target = target
30113014 # Change directories to the program root to use mbed OS tools
30123015 with cd (program .path ):
30133016 tools_dir = program .get_tools ()
@@ -3042,7 +3045,7 @@ def export(ide=None, target=None, source=False, clean=False, supported=False, ap
30423045 + args ,
30433046 env = env )
30443047
3045- program .set_defaults (target = target )
3048+ program .set_defaults (target = orig_target )
30463049
30473050
30483051# Detect command
0 commit comments