@@ -448,6 +448,12 @@ def merge_region_list(region_list, destination, notify, padding=b'\xFF'):
448
448
merged .tofile (destination , format = format .strip ("." ))
449
449
450
450
451
+ UPDATE_WHITELIST = (
452
+ "application" ,
453
+ "header" ,
454
+ )
455
+
456
+
451
457
def build_project (src_paths , build_path , target , toolchain_name ,
452
458
libraries_paths = None , linker_script = None , clean = False ,
453
459
notify = None , name = None , macros = None , inc_dirs = None , jobs = 1 ,
@@ -534,15 +540,28 @@ def build_project(src_paths, build_path, target, toolchain_name,
534
540
535
541
# Link Program
536
542
if toolchain .config .has_regions :
537
- res , _ = toolchain .link_program (resources , build_path , name + "_application" )
543
+ binary , _ = toolchain .link_program (resources , build_path , name + "_application" )
538
544
region_list = list (toolchain .config .regions )
539
- region_list = [r ._replace (filename = res ) if r .active else r
545
+ region_list = [r ._replace (filename = binary ) if r .active else r
540
546
for r in region_list ]
541
547
res = "%s.%s" % (join (build_path , name ),
542
548
getattr (toolchain .target , "OUTPUT_EXT" , "bin" ))
543
549
merge_region_list (region_list , res , notify )
550
+ update_regions = [
551
+ r for r in region_list if r .name in UPDATE_WHITELIST
552
+ ]
553
+ if update_regions :
554
+ update_res = "%s_update.%s" % (
555
+ join (build_path , name ),
556
+ getattr (toolchain .target , "OUTPUT_EXT" , "bin" )
557
+ )
558
+ merge_region_list (update_regions , update_res , notify )
559
+ res = (res , update_res )
560
+ else :
561
+ res = (res , None )
544
562
else :
545
563
res , _ = toolchain .link_program (resources , build_path , name )
564
+ res = (res , None )
546
565
547
566
memap_instance = getattr (toolchain , 'memap_instance' , None )
548
567
memap_table = ''
@@ -570,8 +589,8 @@ def build_project(src_paths, build_path, target, toolchain_name,
570
589
cur_result ["result" ] = "OK"
571
590
cur_result ["memory_usage" ] = (memap_instance .mem_report
572
591
if memap_instance is not None else None )
573
- cur_result ["bin" ] = res
574
- cur_result ["elf" ] = splitext (res )[0 ] + ".elf"
592
+ cur_result ["bin" ] = res [ 0 ]
593
+ cur_result ["elf" ] = splitext (res [ 0 ] )[0 ] + ".elf"
575
594
cur_result .update (toolchain .report )
576
595
577
596
add_result_to_report (report , cur_result )
0 commit comments