@@ -121,7 +121,7 @@ def get_config(src_paths, target, toolchain_name):
121
121
src_paths = [src_paths ]
122
122
123
123
# Pass all params to the unified prepare_resources()
124
- toolchain = prepare_toolchain (src_paths , target , toolchain_name )
124
+ toolchain = prepare_toolchain (src_paths , None , target , toolchain_name )
125
125
126
126
# Scan src_path for config files
127
127
resources = toolchain .scan_resources (src_paths [0 ])
@@ -299,7 +299,7 @@ def add_regions_to_profile(profile, config, toolchain_class):
299
299
% (region .name , region .size , region .start ))
300
300
301
301
302
- def prepare_toolchain (src_paths , target , toolchain_name ,
302
+ def prepare_toolchain (src_paths , build_dir , target , toolchain_name ,
303
303
macros = None , clean = False , jobs = 1 ,
304
304
notify = None , silent = False , verbose = False ,
305
305
extra_verbose = False , config = None ,
@@ -339,7 +339,7 @@ def prepare_toolchain(src_paths, target, toolchain_name,
339
339
add_regions_to_profile (build_profile , config , cur_tc )
340
340
341
341
# Toolchain instance
342
- toolchain = cur_tc (target , notify , macros , silent ,
342
+ toolchain = cur_tc (target , notify , macros , silent , build_dir = build_dir ,
343
343
extra_verbose = extra_verbose , build_profile = build_profile )
344
344
345
345
toolchain .config = config
@@ -475,8 +475,8 @@ def build_project(src_paths, build_path, target, toolchain_name,
475
475
476
476
# Pass all params to the unified prepare_toolchain()
477
477
toolchain = prepare_toolchain (
478
- src_paths , target , toolchain_name , macros = macros , clean = clean ,
479
- jobs = jobs , notify = notify , silent = silent , verbose = verbose ,
478
+ src_paths , build_path , target , toolchain_name , macros = macros ,
479
+ clean = clean , jobs = jobs , notify = notify , silent = silent , verbose = verbose ,
480
480
extra_verbose = extra_verbose , config = config , app_config = app_config ,
481
481
build_profile = build_profile )
482
482
@@ -509,8 +509,7 @@ def build_project(src_paths, build_path, target, toolchain_name,
509
509
resources .linker_script = linker_script
510
510
511
511
# Compile Sources
512
- objects = toolchain .compile_sources (resources , build_path ,
513
- resources .inc_dirs )
512
+ objects = toolchain .compile_sources (resources , resources .inc_dirs )
514
513
resources .objects .extend (objects )
515
514
516
515
# Link Program
@@ -629,9 +628,9 @@ def build_library(src_paths, build_path, target, toolchain_name,
629
628
630
629
# Pass all params to the unified prepare_toolchain()
631
630
toolchain = prepare_toolchain (
632
- src_paths , target , toolchain_name , macros = macros , clean = clean ,
633
- jobs = jobs , notify = notify , silent = silent , verbose = verbose ,
634
- extra_verbose = extra_verbose , app_config = app_config ,
631
+ src_paths , build_path , target , toolchain_name , macros = macros ,
632
+ clean = clean , jobs = jobs , notify = notify , silent = silent ,
633
+ verbose = verbose , extra_verbose = extra_verbose , app_config = app_config ,
635
634
build_profile = build_profile )
636
635
637
636
# The first path will give the name to the library
@@ -687,8 +686,7 @@ def build_library(src_paths, build_path, target, toolchain_name,
687
686
resources = resources )
688
687
689
688
# Compile Sources
690
- objects = toolchain .compile_sources (resources , abspath (tmp_path ),
691
- resources .inc_dirs )
689
+ objects = toolchain .compile_sources (resources , resources .inc_dirs )
692
690
resources .objects .extend (objects )
693
691
694
692
if archive :
@@ -815,6 +813,7 @@ def build_lib(lib_id, target, toolchain_name, verbose=False,
815
813
toolchain .VERBOSE = verbose
816
814
toolchain .jobs = jobs
817
815
toolchain .build_all = clean
816
+ toolchain .build_dir = build_path
818
817
819
818
toolchain .info ("Building library %s (%s, %s)" %
820
819
(name .upper (), target .name , toolchain_name ))
@@ -869,8 +868,7 @@ def build_lib(lib_id, target, toolchain_name, verbose=False,
869
868
# Compile Sources
870
869
objects = []
871
870
for resource in resources :
872
- objects .extend (toolchain .compile_sources (resource , tmp_path ,
873
- dependencies_include_dir ))
871
+ objects .extend (toolchain .compile_sources (resource , dependencies_include_dir ))
874
872
875
873
needed_update = toolchain .build_library (objects , bin_path , name )
876
874
@@ -962,6 +960,11 @@ def build_mbed_libs(target, toolchain_name, verbose=False,
962
960
toolchain .jobs = jobs
963
961
toolchain .build_all = clean
964
962
963
+ tmp_path = join (MBED_LIBRARIES , '.temp' , toolchain .obj_path )
964
+ mkdir (tmp_path )
965
+
966
+ toolchain .build_dir = tmp_path
967
+
965
968
# Take into account the library configuration (MBED_CONFIG_FILE)
966
969
config = Config (target )
967
970
toolchain .config = config
@@ -973,8 +976,6 @@ def build_mbed_libs(target, toolchain_name, verbose=False,
973
976
build_toolchain = join (build_target , "TOOLCHAIN_" + toolchain .name )
974
977
mkdir (build_toolchain )
975
978
976
- tmp_path = join (MBED_LIBRARIES , '.temp' , toolchain .obj_path )
977
- mkdir (tmp_path )
978
979
979
980
# CMSIS
980
981
toolchain .info ("Building library %s (%s, %s)" %
@@ -1015,7 +1016,7 @@ def build_mbed_libs(target, toolchain_name, verbose=False,
1015
1016
toolchain .copy_files (hal_implementation .linker_script , build_toolchain )
1016
1017
toolchain .copy_files (hal_implementation .bin_files , build_toolchain )
1017
1018
incdirs = toolchain .scan_resources (build_target ).inc_dirs
1018
- objects = toolchain .compile_sources (hal_implementation , tmp_path ,
1019
+ objects = toolchain .compile_sources (hal_implementation ,
1019
1020
library_incdirs + incdirs )
1020
1021
toolchain .copy_files (objects , build_toolchain )
1021
1022
@@ -1024,7 +1025,7 @@ def build_mbed_libs(target, toolchain_name, verbose=False,
1024
1025
for dir in [MBED_DRIVERS , MBED_PLATFORM , MBED_HAL ]:
1025
1026
mbed_resources += toolchain .scan_resources (dir )
1026
1027
1027
- objects = toolchain .compile_sources (mbed_resources , tmp_path ,
1028
+ objects = toolchain .compile_sources (mbed_resources ,
1028
1029
library_incdirs + incdirs )
1029
1030
1030
1031
# A number of compiled files need to be copied as objects as opposed to
0 commit comments