Files
rust-based-os-comp2022/user/build.py
2022-06-28 09:25:52 +08:00

24 lines
522 B
Python

import os
base_address = 0x80400000
step = 0x20000
linker = "src/linker.ld"
app_id = 0
apps = os.listdir("build/app")
apps.sort()
chapter = os.getenv("CHAPTER")
for app in apps:
app = app[: app.find(".")]
os.system(
"cargo rustc --bin %s --release -- -Clink-args=-Ttext=%x"
% (app, base_address + step * app_id)
)
print(
"[build.py] application %s start with address %s"
% (app, hex(base_address + step * app_id))
)
if chapter == '3':
app_id = app_id + 1