@@ -44,6 +44,9 @@ class ZephyrAppCommandsDirective(Directive):
44
44
'compact' : directives .flag ,
45
45
'west-args' : directives .unchanged ,
46
46
'flash-args' : directives .unchanged ,
47
+ 'debug-args' : directives .unchanged ,
48
+ 'debugserver-args' : directives .unchanged ,
49
+ 'attach-args' : directives .unchanged ,
47
50
}
48
51
49
52
TOOLS = ['cmake' , 'west' , 'all' ]
@@ -76,6 +79,9 @@ def run(self):
76
79
compact = 'compact' in self .options
77
80
west_args = self .options .get ('west-args' , None )
78
81
flash_args = self .options .get ('flash-args' , None )
82
+ debug_args = self .options .get ('debug-args' , None )
83
+ debugserver_args = self .options .get ('debugserver-args' , None )
84
+ attach_args = self .options .get ('attach-args' , None )
79
85
80
86
if tool not in self .TOOLS :
81
87
raise self .error (f'Unknown tool { tool } ; choose from: { self .TOOLS } ' )
@@ -146,6 +152,9 @@ def run(self):
146
152
'generator' : generator ,
147
153
'west_args' : west_args ,
148
154
'flash_args' : flash_args ,
155
+ 'debug_args' : debug_args ,
156
+ 'debugserver_args' : debugserver_args ,
157
+ 'attach_args' : attach_args ,
149
158
}
150
159
151
160
if 'west' in tools :
@@ -199,6 +208,9 @@ def _generate_west(self, **kwargs):
199
208
build_args = kwargs ["build_args" ]
200
209
west_args = kwargs ['west_args' ]
201
210
flash_args = kwargs ['flash_args' ]
211
+ debug_args = kwargs ['debug_args' ]
212
+ debugserver_args = kwargs ['debugserver_args' ]
213
+ attach_args = kwargs ['attach_args' ]
202
214
kwargs ['board' ] = None
203
215
# west always defaults to ninja
204
216
gen_arg = ' -G\' Unix Makefiles\' ' if generator == 'make' else ''
@@ -207,6 +219,9 @@ def _generate_west(self, **kwargs):
207
219
build_args = "" .join (f" -o { b } " for b in build_args ) if build_args else ""
208
220
west_args = f' { west_args } ' if west_args else ''
209
221
flash_args = f' { flash_args } ' if flash_args else ''
222
+ debug_args = f' { debug_args } ' if debug_args else ''
223
+ debugserver_args = f' { debugserver_args } ' if debugserver_args else ''
224
+ attach_args = f' { attach_args } ' if attach_args else ''
210
225
snippet_args = '' .join (f' -S { s } ' for s in snippets ) if snippets else ''
211
226
shield_args = '' .join (f' --shield { s } ' for s in shield ) if shield else ''
212
227
# ignore zephyr_app since west needs to run within
@@ -255,11 +270,11 @@ def _generate_west(self, **kwargs):
255
270
elif goal == 'flash' :
256
271
content .append (f'west flash{ flash_args } { dst } ' )
257
272
elif goal == 'debug' :
258
- content .append (f'west debug{ dst } ' )
273
+ content .append (f'west debug{ debug_args } { dst } ' )
259
274
elif goal == 'debugserver' :
260
- content .append (f'west debugserver{ dst } ' )
275
+ content .append (f'west debugserver{ debugserver_args } { dst } ' )
261
276
elif goal == 'attach' :
262
- content .append (f'west attach{ dst } ' )
277
+ content .append (f'west attach{ attach_args } { dst } ' )
263
278
else :
264
279
content .append (f'west build -t { goal } { dst } ' )
265
280
0 commit comments