Skip to content

Commit

Permalink
[devices] Add ARM64 version of hosted targets
Browse files Browse the repository at this point in the history
  • Loading branch information
salkinium committed Jan 21, 2024
1 parent 6dff630 commit c5dc4b1
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 3 deletions.
4 changes: 4 additions & 0 deletions test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@ endef

run-hosted-linux:
$(call compile-test,hosted,run,-D":target=hosted-linux")
run-hosted-linux-arm64:
$(call compile-test,hosted,run,-D":target=hosted-linux-arm64")
run-hosted-darwin:
$(call compile-test,hosted,run,-D":target=hosted-darwin")
run-hosted-darwin-arm64:
$(call compile-test,hosted,run,-D":target=hosted-darwin-arm64")
run-hosted-windows:
$(call compile-test,hosted,run,-D":target=hosted-windows")

Expand Down
13 changes: 13 additions & 0 deletions tools/devices/hosted/darwin-arm64.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE rca SYSTEM "../devicefile.dtd">
<modm version="1.0">
<device platform="hosted" family="darwin" arch="arm64">
<naming-schema>{platform}-{family}-{arch}</naming-schema>

<driver name="can" type="hosted"/>
<driver name="can" type="canusb"/>
<driver name="core" type="hosted-arm64"/>
<driver name="gpio" type="hosted"/>
<driver name="uart" type="hosted"/>
</device>
</modm>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE rca SYSTEM "../devicefile.dtd">
<modm version="1.0">
<device platform="hosted" family="darwin">
<device platform="hosted" family="darwin" arch="x86_64">
<naming-schema>{platform}-{family}</naming-schema>

<driver name="can" type="hosted"/>
Expand Down
14 changes: 14 additions & 0 deletions tools/devices/hosted/linux-arm64.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE rca SYSTEM "../devicefile.dtd">
<modm version="1.0">
<device platform="hosted" family="linux" arch="arm64">
<naming-schema>{platform}-{family}-{arch}</naming-schema>

<driver name="can" type="socketcan"/>
<driver name="can" type="canusb"/>
<driver name="core" type="hosted-arm64"/>
<driver name="graphics" type="hosted"/>
<driver name="gpio" type="hosted"/>
<driver name="uart" type="hosted"/>
</device>
</modm>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE rca SYSTEM "../devicefile.dtd">
<modm version="1.0">
<device platform="hosted" family="linux">
<device platform="hosted" family="linux" arch="x86_64">
<naming-schema>{platform}-{family}</naming-schema>

<driver name="can" type="socketcan"/>
Expand Down
2 changes: 1 addition & 1 deletion tools/devices/hosted/windows.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE rca SYSTEM "../devicefile.dtd">
<modm version="1.0">
<device platform="hosted" family="windows">
<device platform="hosted" family="windows" arch="x86_64">
<naming-schema>{platform}-{family}</naming-schema>

<driver name="core" type="hosted-x86_64"/>
Expand Down
2 changes: 2 additions & 0 deletions tools/scripts/examples_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
os.getenv("TRAVIS") is not None or
os.getenv("GITHUB_ACTIONS") is not None)
is_running_on_windows = "Windows" in platform.platform()
is_running_on_arm64 = "arm64" in platform.machine()
build_dir = (Path(os.path.abspath(__file__)).parents[2] / "build")
cache_dir = build_dir / "cache"
global_options = {}
Expand Down Expand Up @@ -52,6 +53,7 @@ def generate(project):
# Compile Linux examples under macOS with hosted-darwin target
if "hosted-linux" in project.read_text():
options += " -D:target=hosted-{}".format(platform.system().lower())
if is_running_on_arm64: options += "-arm64"
rc, ro = run_command(path, "lbuild {} build".format(options))
print("\n".join(output + [ro]))
return None if rc else project
Expand Down

0 comments on commit c5dc4b1

Please sign in to comment.