@@ -397,7 +397,7 @@ def _fill_header(region_list, current_region):
397
397
start += Config .header_member_size (member )
398
398
return header
399
399
400
- def merge_region_list (region_list , destination , padding = b'\xFF ' ):
400
+ def merge_region_list (region_list , destination , notify , padding = b'\xFF ' ):
401
401
"""Merge the region_list into a single image
402
402
403
403
Positional Arguments:
@@ -408,7 +408,7 @@ def merge_region_list(region_list, destination, padding=b'\xFF'):
408
408
merged = IntelHex ()
409
409
_ , format = splitext (destination )
410
410
411
- print ("Merging Regions: " )
411
+ notify . info ("Merging Regions" )
412
412
413
413
for region in region_list :
414
414
if region .active and not region .filename :
@@ -419,7 +419,7 @@ def merge_region_list(region_list, destination, padding=b'\xFF'):
419
419
_fill_header (region_list , region ).tofile (header_filename , format = 'hex' )
420
420
region = region ._replace (filename = header_filename )
421
421
if region .filename :
422
- print (" Filling region %s with %s" % (region .name , region .filename ))
422
+ notify . info (" Filling region %s with %s" % (region .name , region .filename ))
423
423
part = intelhex_offset (region .filename , offset = region .start )
424
424
part_size = (part .maxaddr () - part .minaddr ()) + 1
425
425
if part_size > region .size :
@@ -428,7 +428,8 @@ def merge_region_list(region_list, destination, padding=b'\xFF'):
428
428
merged .merge (part )
429
429
pad_size = region .size - part_size
430
430
if pad_size > 0 and region != region_list [- 1 ]:
431
- print (" Padding region %s with 0x%x bytes" % (region .name , pad_size ))
431
+ notify .info (" Padding region %s with 0x%x bytes" %
432
+ (region .name , pad_size ))
432
433
if format is ".hex" :
433
434
"""The offset will be in the hex file generated when we're done,
434
435
so we can skip padding here"""
@@ -437,8 +438,8 @@ def merge_region_list(region_list, destination, padding=b'\xFF'):
437
438
438
439
if not exists (dirname (destination )):
439
440
makedirs (dirname (destination ))
440
- print ("Space used after regions merged: 0x%x" %
441
- (merged .maxaddr () - merged .minaddr () + 1 ))
441
+ notify . info ("Space used after regions merged: 0x%x" %
442
+ (merged .maxaddr () - merged .minaddr () + 1 ))
442
443
with open (destination , "wb+" ) as output :
443
444
merged .tofile (output , format = format .strip ("." ))
444
445
@@ -574,7 +575,7 @@ def build_project(src_paths, build_path, target, toolchain_name,
574
575
for r in region_list ]
575
576
res = "%s.%s" % (join (build_path , name ),
576
577
getattr (toolchain .target , "OUTPUT_EXT" , "bin" ))
577
- merge_region_list (region_list , res )
578
+ merge_region_list (region_list , res , notify )
578
579
else :
579
580
res , _ = toolchain .link_program (resources , build_path , name )
580
581
0 commit comments