@@ -22,13 +22,21 @@ def copy_files():
22
22
]
23
23
for src , dest in files :
24
24
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 " )
26
26
27
27
28
28
def 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
+
29
38
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 )
32
40
zip_all_bins ()
33
41
34
42
@@ -47,7 +55,7 @@ def zip_all_bins():
47
55
zipObj .write (
48
56
f'release/esp32nat_Router+_full_v{ version } _0x0.bin' , f'esp32nat_Router+_full_v{ version } _0x0.bin' )
49
57
50
- print ("==========> zip files created successfully" )
58
+ print ("\n ==========> zip files created successfully" )
51
59
52
60
53
61
def after_build_program (source , target , env ):
@@ -57,4 +65,4 @@ def after_build_program(source, target, env):
57
65
convert_single_bin ()
58
66
59
67
60
- env .AddPostAction ("$BUILD_DIR/firmware.bin " , after_build_program )
68
+ env .AddPostAction ("buildprog " , after_build_program )
0 commit comments