@@ -284,26 +284,20 @@ def get_mbed_official_release(version):
284
284
285
285
return mbed_official_release
286
286
287
- def add_regions_to_profile ( profile , config , toolchain_class ):
287
+ def add_regions_to_toolchain ( toolchain ):
288
288
"""Add regions to the build profile, if there are any.
289
289
290
290
Positional Arguments:
291
- profile - the profile to update
292
- config - the configuration object that owns the region
293
- toolchain_class - the class of the toolchain being used
291
+ toolchain - the toolchain to add the region defines to
294
292
"""
295
- if not profile :
296
- return
297
- regions = list (config .regions )
293
+ regions = list (toolchain .config .regions )
298
294
for region in regions :
299
295
for define in [(region .name .upper () + "_ADDR" , region .start ),
300
296
(region .name .upper () + "_SIZE" , region .size )]:
301
- profile ["common" ].append ("-D%s=0x%x" % define )
302
- active_region = [r for r in regions if r .active ][0 ]
303
- for define in [("MBED_APP_START" , active_region .start ),
304
- ("MBED_APP_SIZE" , active_region .size )]:
305
- profile ["ld" ].append (toolchain_class .make_ld_define (* define ))
306
-
297
+ toolchain .cc .append ("-D%s=0x%x" % define )
298
+ toolchain .cppc .append ("-D%s=0x%x" % define )
299
+ if region .active :
300
+ toolchain .ld .append (toolchain .make_ld_define (* define ))
307
301
print ("Using regions in this build:" )
308
302
for region in regions :
309
303
print (" Region %s size 0x%x, offset 0x%x"
@@ -352,9 +346,6 @@ def prepare_toolchain(src_paths, build_dir, target, toolchain_name,
352
346
for key in profile :
353
347
profile [key ].extend (contents [toolchain_name ][key ])
354
348
355
- if config .has_regions :
356
- add_regions_to_profile (profile , config , cur_tc )
357
-
358
349
toolchain = cur_tc (target , notify , macros , silent , build_dir = build_dir ,
359
350
extra_verbose = extra_verbose , build_profile = profile )
360
351
@@ -439,6 +430,9 @@ def scan_resources(src_paths, toolchain, dependencies_paths=None,
439
430
# Set the toolchain's configuration data
440
431
toolchain .set_config_data (toolchain .config .get_config_data ())
441
432
433
+ if toolchain .config .has_regions :
434
+ add_regions_to_toolchain (toolchain )
435
+
442
436
if (hasattr (toolchain .target , "release_versions" ) and
443
437
"5" not in toolchain .target .release_versions and
444
438
"rtos" in toolchain .config .lib_config_data ):
0 commit comments