@@ -25,18 +25,54 @@ template("asr_executable") {
25
25
26
26
if (asr_ic_family == " asr595x" ) {
27
27
objcopy = " ${ asr_toolchain_root } riscv-asr-elf-objcopy"
28
- } else if (asr_ic_family == " asr582x" ) {
29
- objcopy = " ${ asr_toolchain_root } arm-none-eabi-objcopy"
30
28
} else {
31
- objcopy = " objcopy"
29
+ objcopy = " ${ asr_toolchain_root } arm-none-eabi- objcopy"
32
30
}
33
31
34
- # Copy flashing dependencies to the output directory so that the output
35
- # is collectively self-contained; this allows flashing to work reliably
36
- # even if the build and flashing steps take place on different machines
37
- # or in different containers.
38
-
39
- flashable_executable (target_name ) {
32
+ flash_target_name = target_name + " .flash_executable"
33
+ flashbundle_name = " ${ target_name } .flashbundle.txt"
34
+ flashable_executable (flash_target_name ) {
40
35
forward_variables_from (invoker , " *" )
41
36
}
37
+
38
+ action (" generate_ota_image" ) {
39
+ script = " ${ build_root } /gn_run_binary.py"
40
+
41
+ outputs = [ " ${ root_out_dir } /${ output_base_name } _ota.bin" ]
42
+
43
+ if (asr_ic_family == " asr595x" ) {
44
+ gen_ota_tool = " ${ asr_sdk_build_root } /asr_sdk/tools/image_gen_header/image_gen_header"
45
+ } else {
46
+ gen_ota_tool =
47
+ " ${ asr_sdk_build_root } /asr_sdk/tools/otaImage/image_gen_header"
48
+ }
49
+
50
+ _ota_tool_path = rebase_path (gen_ota_tool , root_build_dir )
51
+
52
+ if (asr_ic_family == " asr595x" ) {
53
+ args = [
54
+ _ota_tool_path ,
55
+ " ${ root_out_dir } /${ objcopy_image_name } " ,
56
+ " -d" ,
57
+ " LEGA_A0V2" ,
58
+ " -b" ,
59
+ " REMAPPING" ,
60
+ ]
61
+ } else {
62
+ args = [
63
+ _ota_tool_path ,
64
+ " ${ root_out_dir } /${ objcopy_image_name } " ,
65
+ " flash_remapping" ,
66
+ ]
67
+ }
68
+
69
+ deps = [ " :$flash_target_name " ]
70
+ }
71
+
72
+ group (target_name ) {
73
+ deps = [
74
+ " :$flash_target_name " ,
75
+ " :generate_ota_image" ,
76
+ ]
77
+ }
42
78
}
0 commit comments