Skip to content

Commit 6463c68

Browse files
soburikartben
authored andcommitted
doc: extensions: application: Add args for debug related commands
The same as flash-args for flash, we will add commands to debug, debugserver, and attach to specify arguments in the document. Signed-off-by: TOKITA Hiroshi <[email protected]>
1 parent 82c6add commit 6463c68

File tree

2 files changed

+33
-3
lines changed

2 files changed

+33
-3
lines changed

doc/_extensions/zephyr/application.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ class ZephyrAppCommandsDirective(Directive):
4444
'compact': directives.flag,
4545
'west-args': directives.unchanged,
4646
'flash-args': directives.unchanged,
47+
'debug-args': directives.unchanged,
48+
'debugserver-args': directives.unchanged,
49+
'attach-args': directives.unchanged,
4750
}
4851

4952
TOOLS = ['cmake', 'west', 'all']
@@ -76,6 +79,9 @@ def run(self):
7679
compact = 'compact' in self.options
7780
west_args = self.options.get('west-args', None)
7881
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)
7985

8086
if tool not in self.TOOLS:
8187
raise self.error(f'Unknown tool {tool}; choose from: {self.TOOLS}')
@@ -146,6 +152,9 @@ def run(self):
146152
'generator': generator,
147153
'west_args': west_args,
148154
'flash_args': flash_args,
155+
'debug_args': debug_args,
156+
'debugserver_args': debugserver_args,
157+
'attach_args': attach_args,
149158
}
150159

151160
if 'west' in tools:
@@ -199,6 +208,9 @@ def _generate_west(self, **kwargs):
199208
build_args = kwargs["build_args"]
200209
west_args = kwargs['west_args']
201210
flash_args = kwargs['flash_args']
211+
debug_args = kwargs['debug_args']
212+
debugserver_args = kwargs['debugserver_args']
213+
attach_args = kwargs['attach_args']
202214
kwargs['board'] = None
203215
# west always defaults to ninja
204216
gen_arg = ' -G\'Unix Makefiles\'' if generator == 'make' else ''
@@ -207,6 +219,9 @@ def _generate_west(self, **kwargs):
207219
build_args = "".join(f" -o {b}" for b in build_args) if build_args else ""
208220
west_args = f' {west_args}' if west_args else ''
209221
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 ''
210225
snippet_args = ''.join(f' -S {s}' for s in snippets) if snippets else ''
211226
shield_args = ''.join(f' --shield {s}' for s in shield) if shield else ''
212227
# ignore zephyr_app since west needs to run within
@@ -255,11 +270,11 @@ def _generate_west(self, **kwargs):
255270
elif goal == 'flash':
256271
content.append(f'west flash{flash_args}{dst}')
257272
elif goal == 'debug':
258-
content.append(f'west debug{dst}')
273+
content.append(f'west debug{debug_args}{dst}')
259274
elif goal == 'debugserver':
260-
content.append(f'west debugserver{dst}')
275+
content.append(f'west debugserver{debugserver_args}{dst}')
261276
elif goal == 'attach':
262-
content.append(f'west attach{dst}')
277+
content.append(f'west attach{attach_args}{dst}')
263278
else:
264279
content.append(f'west build -t {goal}{dst}')
265280

doc/contribute/documentation/guidelines.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,21 @@ Application build commands
883883
884884
If set, additional arguments to the flash invocation.
885885
886+
.. rst:directive:option:: debug-args
887+
:type: string
888+
889+
If set, additional arguments to the debug invocation.
890+
891+
.. rst:directive:option:: debugserver-args
892+
:type: string
893+
894+
If set, additional arguments to the debugserver invocation.
895+
896+
.. rst:directive:option:: attach-args
897+
:type: string
898+
899+
If set, additional arguments to the attach invocation.
900+
886901
.. rst:directive:option:: snippets
887902
:type: string
888903

0 commit comments

Comments
 (0)