@@ -47,25 +47,32 @@ template("generate_rps_file") {
47
47
}
48
48
49
49
template (" silabs_executable" ) {
50
+ # output_dir is optional and will default to root_out_dir
50
51
if (! defined (invoker .output_dir )) {
51
52
invoker .output_dir = root_out_dir
52
53
}
54
+
55
+ # output_name is optional and will default to "$target_name.bin"
53
56
if (! defined (invoker .output_name )) {
54
57
invoker .output_name = target_name + " .bin"
55
58
}
59
+
56
60
output_base_name = get_path_info (invoker .output_name , " name" )
57
61
objcopy_image_name = output_base_name + " .s37"
58
62
objcopy_image_format = " srec"
59
63
objcopy = " arm-none-eabi-objcopy"
60
64
65
+ if (use_rps_extension ) {
66
+ flashing_image_name = output_base_name + " .rps"
67
+ }
68
+
69
+ # flashable_executable calls a generator script to do the following:
70
+ # Create a flash.py script with the name of the binary hardcoded in it.
61
71
# Copy flashing dependencies to the output directory so that the output
62
72
# is collectively self-contained; this allows flashing to work reliably
63
73
# even if the build and flashing steps take place on different machines
64
74
# or in different containers.
65
-
66
- if (use_rps_extension ) {
67
- flashing_image_name = output_base_name + " .rps"
68
- }
75
+ # Create *.flashbundle.txt with a list of all files needed for flashing
69
76
70
77
flashing_script_generator =
71
78
" ${ chip_root } /scripts/flashing/gen_flashing_script.py"
@@ -94,14 +101,15 @@ template("silabs_executable") {
94
101
_platform_firmware_utils ,
95
102
_firmware_utils ,
96
103
]
104
+ flashbundle_name = " " # Stop flashable_executable from making flashbundle.
97
105
106
+ # Target to generate the s37 file, flashing script, and flashbundle.
98
107
flash_target_name = target_name + " .flash_executable"
99
- flashbundle_name = " " # Stop flashable_executable from making flashbundle.
100
108
flashable_executable (flash_target_name ) {
101
109
forward_variables_from (invoker , " *" )
102
110
}
103
111
104
- # Add a target which generates the hex file in addition to s37 .
112
+ # Target to generate the hex file.
105
113
executable_target = " $flash_target_name .executable"
106
114
hex_image_name = output_base_name + " .hex"
107
115
hex_target_name = target_name + " .hex"
@@ -112,6 +120,7 @@ template("silabs_executable") {
112
120
deps = [ " :$executable_target " ]
113
121
}
114
122
123
+ # Target to generate the rps file.
115
124
if (use_rps_extension ) {
116
125
rps_target_name = target_name + " .rps"
117
126
generate_rps_file (rps_target_name ) {
@@ -123,6 +132,8 @@ template("silabs_executable") {
123
132
]
124
133
}
125
134
}
135
+
136
+ # Main target that deps the targets defined above.
126
137
group (target_name ) {
127
138
deps = [
128
139
" :$flash_target_name " ,
0 commit comments