@@ -2608,6 +2608,7 @@ def compile_(toolchain=None, target=None, profile=False, compile_library=False,
2608
2608
program .check_requirements (True )
2609
2609
# Remember the original path. this is needed for compiling only the libraries and tests for the current folder.
2610
2610
orig_path = getcwd ()
2611
+ orig_target = target
2611
2612
2612
2613
with cd (program .path ):
2613
2614
tools_dir = os .path .abspath (program .get_tools ())
@@ -2714,7 +2715,7 @@ def compile_(toolchain=None, target=None, profile=False, compile_library=False,
2714
2715
if not connected :
2715
2716
error ("The target board you compiled for is not connected to your system.\n Please reconnect it and retry the last command." , 1 )
2716
2717
2717
- program .set_defaults (target = target , toolchain = tchain )
2718
+ program .set_defaults (target = orig_target , toolchain = tchain )
2718
2719
2719
2720
2720
2721
# Test command
@@ -2778,6 +2779,7 @@ def test_(toolchain=None, target=None, compile_list=False, run_list=False,
2778
2779
2779
2780
# Save original working directory
2780
2781
orig_path = getcwd ()
2782
+ orig_target = target
2781
2783
2782
2784
macros = program .get_macros ()
2783
2785
tools_dir = program .get_tools ()
@@ -2932,7 +2934,7 @@ def test_(toolchain=None, target=None, compile_list=False, run_list=False,
2932
2934
if run_only or build_and_run_tests :
2933
2935
popen (icetea_command )
2934
2936
2935
- program .set_defaults (target = target , toolchain = tchain )
2937
+ program .set_defaults (target = orig_target , toolchain = tchain )
2936
2938
2937
2939
2938
2940
# device management commands
@@ -3008,6 +3010,7 @@ def export(ide=None, target=None, source=False, clean=False, supported=False, ap
3008
3010
program .check_requirements (True )
3009
3011
# Remember the original path. this is needed for compiling only the libraries and tests for the current folder.
3010
3012
orig_path = getcwd ()
3013
+ orig_target = target
3011
3014
# Change directories to the program root to use mbed OS tools
3012
3015
with cd (program .path ):
3013
3016
tools_dir = program .get_tools ()
@@ -3042,7 +3045,7 @@ def export(ide=None, target=None, source=False, clean=False, supported=False, ap
3042
3045
+ args ,
3043
3046
env = env )
3044
3047
3045
- program .set_defaults (target = target )
3048
+ program .set_defaults (target = orig_target )
3046
3049
3047
3050
3048
3051
# Detect command
0 commit comments