Skip to content

Commit 79d9f45

Browse files
joaodulliusmbolivar-nordic
authored andcommitted
scripts: runners: bossac: Enable BOSSAC to run on Windows (native)
Fixes #37538 by correctly detecting WSL and blocking bossac from running on that platform, but allowing it to run on Windows native. Signed-off-by: João Dullius <[email protected]>
1 parent 942e4a3 commit 79d9f45

File tree

3 files changed

+36
-3
lines changed

3 files changed

+36
-3
lines changed

boards/arm/arduino_nano_33_ble/doc/index.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,13 @@ For example
103103
104104
west flash --bossac=$HOME/.arduino15/packages/arduino/tools/bossac/1.9.1-arduino2/bossac
105105
106+
On Windows you need to use the :file:`bossac.exe` from the `Arduino IDE`_
107+
You will also need to specify the COM port using the --bossac-port argument:
108+
109+
.. code-block:: bash
110+
111+
west flash --bossac=%USERPROFILE%\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.9.1-arduino2\bossac.exe --bossac-port="COMx"
112+
106113
Flashing
107114
========
108115

@@ -221,3 +228,6 @@ References
221228

222229
.. _TRACE32 as GDB Front-End:
223230
https://www2.lauterbach.com/pdf/frontend_gdb.pdf
231+
232+
.. _Arduino IDE:
233+
https://www.arduino.cc/en/Main/Software

doc/develop/flash_debug/host-tools.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,22 @@ As a quick reference, see these three board documentation pages:
184184

185185
.. _jlink-debug-host-tools:
186186

187+
Enabling BOSSAC on Windows Native [Experimental]
188+
------------------------------------------------
189+
Zephyr SDK´s bossac is only currenty support on Linux and macOS. Windows support
190+
can be achieved by using the bossac version from `BOSSA oficial releases`_.
191+
After installing using default options, the :file:`bossac.exe` must be added to
192+
Windows PATH. A specific bossac executable can be used by passing the
193+
``--bossac`` option, as follows:
194+
195+
.. code-block:: console
196+
197+
west flash -r bossac --bossac="C:\Program Files (x86)\BOSSA\bossac.exe" --bossac-port="COMx"
198+
199+
.. note::
200+
201+
WSL is not currently supported.
202+
187203
J-Link Debug Host Tools
188204
***********************
189205

@@ -336,3 +352,6 @@ To enable Zephyr RTOS awareness follow the steps described in
336352

337353
.. _Lauterbach TRACE32 Zephyr OS Awareness Manual:
338354
https://www2.lauterbach.com/pdf/rtos_zephyr.pdf
355+
356+
.. _BOSSA oficial releases:
357+
https://github.com/shumatech/BOSSA/releases

scripts/west_commands/runners/bossac.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
'''bossac-specific runner (flash only) for Atmel SAM microcontrollers.'''
77

8+
import os
89
import pathlib
910
import pickle
1011
import platform
@@ -251,9 +252,12 @@ def do_run(self, command, **kwargs):
251252
'could not import edtlib; something may be wrong with the '
252253
'python environment')
253254

254-
if platform.system() == 'Windows':
255-
msg = 'CAUTION: BOSSAC runner not support on Windows!'
256-
raise RuntimeError(msg)
255+
if platform.system() == 'Linux':
256+
if 'microsoft' in platform.uname().release.lower() or \
257+
os.getenv('WSL_DISTRO_NAME') is not None or \
258+
os.getenv('WSL_INTEROP') is not None:
259+
msg = 'CAUTION: BOSSAC runner not supported on WSL!'
260+
raise RuntimeError(msg)
257261
elif platform.system() == 'Darwin' and self.port is None:
258262
self.port = self.get_darwin_user_port_choice()
259263

0 commit comments

Comments
 (0)