@@ -22,13 +22,21 @@ def copy_files():
2222 ]
2323 for src , dest in files :
2424 shutil .copyfile (src , f'release/{ dest } ' )
25- print ("==========> Bin files are copied to the /release folder." )
25+ print ("==========> Bin files are copied to the /release folder.\n " )
2626
2727
2828def convert_single_bin ():
29+ build_dir = env .subst ("$BUILD_DIR" )
30+ binary_path = os .path .join (build_dir , "firmware.bin" )
31+ bootloader_path = os .path .join (build_dir , "bootloader.bin" )
32+ partitions_path = os .path .join (build_dir , "partitions.bin" )
33+ release_path = os .path .join (env .subst ("$PROJECT_DIR" ), "release" )
34+ merged_file = os .path .join (release_path , f"esp32nat_Router+_full_v{ version } _0x0.bin" )
35+ esptool_dir = env .PioPlatform ().get_package_dir ("tool-esptoolpy" )
36+ esptool_command = f'python { str (esptool_dir )} \\ esptool.py --chip esp32 merge_bin -o { merged_file } --flash_freq 40m --flash_size 4MB 0x1000 { bootloader_path } 0x8000 { partitions_path } 0x10000 { binary_path } '
37+
2938 os .makedirs ("release" , exist_ok = True )
30- os .system (
31- f'esptool.py --chip esp32 merge_bin -o release/esp32nat_Router+_full_v{ version } _0x0.bin --flash_freq 40m --flash_size 4MB 0x1000 release/bootloader.bin 0x10000 release/esp32nat_Router+_v{ version } .bin 0x8000 release/partitions.bin' )
39+ env .Execute (esptool_command )
3240 zip_all_bins ()
3341
3442
@@ -47,7 +55,7 @@ def zip_all_bins():
4755 zipObj .write (
4856 f'release/esp32nat_Router+_full_v{ version } _0x0.bin' , f'esp32nat_Router+_full_v{ version } _0x0.bin' )
4957
50- print ("==========> zip files created successfully" )
58+ print ("\n ==========> zip files created successfully" )
5159
5260
5361def after_build_program (source , target , env ):
@@ -57,4 +65,4 @@ def after_build_program(source, target, env):
5765 convert_single_bin ()
5866
5967
60- env .AddPostAction ("$BUILD_DIR/firmware.bin " , after_build_program )
68+ env .AddPostAction ("buildprog " , after_build_program )
0 commit comments