mirror of
https://github.com/EyeTrackVR/OpenIris.git
synced 2025-11-04 15:39:42 +08:00
42 lines
1.1 KiB
Python
42 lines
1.1 KiB
Python
#!/usr/bin/env python3
|
|
# https://docs.wokwi.com/vscode/getting-started
|
|
|
|
# TODO: Add generation of diagram.json file per board environment
|
|
|
|
Import("env")
|
|
try:
|
|
|
|
def createTOML(source, target, env):
|
|
try:
|
|
firmware_name = env.subst("$BUILD_DIR\${PROGNAME}")
|
|
firmware_name = firmware_name.split(".pio")[1]
|
|
|
|
firmware_name = firmware_name.replace("\\", "/")
|
|
|
|
print("Creating wokwi.toml for %s" % firmware_name)
|
|
|
|
wokwi_string = """\
|
|
[wokwi]
|
|
version = 1
|
|
elf = ".pio{name}.elf"
|
|
firmware = ".pio{name}.bin"
|
|
[[net.forward]]
|
|
from = "localhost:8180"
|
|
to = "target:80"
|
|
"""
|
|
toml_string = wokwi_string.format(name=firmware_name)
|
|
print(toml_string)
|
|
with open("wokwi.toml", "w") as f:
|
|
f.write(toml_string)
|
|
f.close()
|
|
|
|
print("wokwi.toml created \n")
|
|
|
|
except Exception as e:
|
|
print("Error creating wokwi.toml: %s" % e)
|
|
|
|
env.AddPostAction("$BUILD_DIR\${PROGNAME}.bin", createTOML)
|
|
|
|
except Exception as e:
|
|
print("Error creating wokwi.toml: %s" % e)
|