Skip to content

Commit c3a8405

Browse files
authored
Added support for mac os (Darwin) (ExpressLRS#365)
* Removed os checks in runpython.py and added addition print statment to stlink.py * Fix print statement in stlink.py * Updating print statement in bootloader stlink.py * Updating stlink to check for dawin (Mac OS)
1 parent 2637e4d commit c3a8405

3 files changed

Lines changed: 16 additions & 38 deletions

File tree

src/bootloader/src/python/stlink.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,18 @@ def get_commands(env, firmware):
4444
if bootloader is not None:
4545
BL_CMD = [TOOL, "write", bootloader, hex(flash_start)]
4646
APP_CMD = [TOOL, "--reset", "write", firmware, hex(app_start)]
47+
elif "darwin" in platform_name:
48+
TOOL = os.path.join(
49+
env_dir,
50+
"tool-stm32duino", "stlink", "st-flash")
51+
if bootloader is not None:
52+
BL_CMD = [TOOL, "write", bootloader, hex(flash_start)]
53+
APP_CMD = [TOOL, "--reset", "write", firmware, hex(app_start)]
4754
elif "os x" in platform_name:
4855
print("OS X not supported at the moment\n")
4956
raise OSError
5057
else:
51-
print("Unknown operating system...\n")
58+
print("Operating system: "+ platform_name + " is not supported.\n")
5259
raise OSError
5360

5461
return " ".join(BL_CMD), " ".join(APP_CMD)

src/python/runpython.py

Lines changed: 0 additions & 36 deletions
This file was deleted.

src/python/stlink.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,18 @@ def get_commands(env, firmware):
4343
if bootloader is not None:
4444
BL_CMD = [TOOL, "write", bootloader, hex(flash_start)]
4545
APP_CMD = [TOOL, "--reset", "write", firmware, hex(app_start)]
46+
elif "darwin" in platform_name:
47+
TOOL = os.path.join(
48+
env_dir,
49+
"tool-stm32duino", "stlink", "st-flash")
50+
if bootloader is not None:
51+
BL_CMD = [TOOL, "write", bootloader, hex(flash_start)]
52+
APP_CMD = [TOOL, "--reset", "write", firmware, hex(app_start)]
4653
elif "os x" in platform_name:
4754
print("OS X not supported at the moment\n")
4855
raise OSError
4956
else:
50-
print("Unknown operating system...\n")
57+
print("Operating system: "+ platform_name + " is not supported.\n")
5158
raise OSError
5259

5360
return " ".join(BL_CMD), " ".join(APP_CMD)

0 commit comments

Comments
 (0)