mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
litex_setup: Handle download of PowerPC/OpenRisc GCC toolchains.
This commit is contained in:
parent
71b319eeaf
commit
dab4845c9b
1 changed files with 25 additions and 12 deletions
|
@ -151,12 +151,12 @@ def litex_setup_install_repos(user_mode=False):
|
||||||
def gcc_toolchain_download(url, filename):
|
def gcc_toolchain_download(url, filename):
|
||||||
if not os.path.exists(filename):
|
if not os.path.exists(filename):
|
||||||
full_url = url + filename
|
full_url = url + filename
|
||||||
print(f"Downloading {full_url} to {filename}.")
|
print(f"[Downloading {full_url} to {filename}]...")
|
||||||
urllib.request.urlretrieve(full_url, filename)
|
urllib.request.urlretrieve(full_url, filename)
|
||||||
else:
|
else:
|
||||||
print("Using existing file {filename}.")
|
print("Using existing file {filename}.")
|
||||||
|
|
||||||
print(f"Extracting {filename}")
|
print(f"[Extracting {filename}]...")
|
||||||
shutil.unpack_archive(filename)
|
shutil.unpack_archive(filename)
|
||||||
|
|
||||||
# RISC-V toolchain.
|
# RISC-V toolchain.
|
||||||
|
@ -207,25 +207,35 @@ def lm32_gcc_toolchain_download():
|
||||||
base_url = ""
|
base_url = ""
|
||||||
base_file = ""
|
base_file = ""
|
||||||
|
|
||||||
# TODO
|
raise NotImplementedError
|
||||||
|
|
||||||
# Run ----------------------------------------------------------------------------------------------
|
# Run ----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(description="LiteX Setup utility.")
|
parser = argparse.ArgumentParser(description="LiteX Setup utility.")
|
||||||
|
|
||||||
|
# Git Repositories.
|
||||||
parser.add_argument("--init", action="store_true", help="Initialize Git Repositories.")
|
parser.add_argument("--init", action="store_true", help="Initialize Git Repositories.")
|
||||||
parser.add_argument("--update", action="store_true", help="Update Git Repositories.")
|
parser.add_argument("--update", action="store_true", help="Update Git Repositories.")
|
||||||
parser.add_argument("--install", action="store_true", help="Install Git Repositories.")
|
parser.add_argument("--install", action="store_true", help="Install Git Repositories.")
|
||||||
parser.add_argument("--user", action="store_true", help="Install in User-Mode.")
|
parser.add_argument("--user", action="store_true", help="Install in User-Mode.")
|
||||||
parser.add_argument("--gcc", action="store_true", help="Download/Extract GCC Toolchain.")
|
|
||||||
|
# GCC toolchains.
|
||||||
|
parser.add_argument("--gcc", default=None, help="Download/Extract GCC Toolchain (riscv, powerpc, openrisc or lm32).")
|
||||||
|
|
||||||
|
# Development mode.
|
||||||
parser.add_argument("--dev", action="store_true", help="Development-Mode (no Auto-Update).")
|
parser.add_argument("--dev", action="store_true", help="Development-Mode (no Auto-Update).")
|
||||||
|
|
||||||
|
# Retro-compatibility.
|
||||||
parser.add_argument("compat_args", nargs="+", help="Retro-Compatibility arguments (init, update, install or gcc).")
|
parser.add_argument("compat_args", nargs="+", help="Retro-Compatibility arguments (init, update, install or gcc).")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Handle compat_args.
|
# Handle compat_args.
|
||||||
for arg in args.compat_args:
|
for arg in args.compat_args:
|
||||||
if arg in ["init", "update", "install", "gcc"]:
|
if arg in ["init", "update", "install"]:
|
||||||
setattr(args, arg, True)
|
setattr(args, arg, True)
|
||||||
|
if arg in ["gcc"]:
|
||||||
|
args.gcc = "riscv"
|
||||||
|
|
||||||
# Location/Auto-Update.
|
# Location/Auto-Update.
|
||||||
litex_setup_location_check()
|
litex_setup_location_check()
|
||||||
|
@ -245,12 +255,15 @@ def main():
|
||||||
litex_setup_install_repos(user_mode=args.user)
|
litex_setup_install_repos(user_mode=args.user)
|
||||||
|
|
||||||
# GCC.
|
# GCC.
|
||||||
if args.gcc:
|
|
||||||
os.chdir(os.path.join(current_path))
|
os.chdir(os.path.join(current_path))
|
||||||
|
if args.gcc == "riscv":
|
||||||
riscv_gcc_toolchain_download()
|
riscv_gcc_toolchain_download()
|
||||||
if "riscv64" not in os.environ.get("PATH", ""):
|
if args.gcc == "powerpc":
|
||||||
print("Make sure that the downloaded RISC-V compiler is in your $PATH.")
|
powerpc_gcc_toolchain_download()
|
||||||
print("export PATH=$PATH:$(echo $PWD/riscv64-*/bin/)")
|
if args.gcc == "openrisc":
|
||||||
|
openrisc_gcc_toolchain_download()
|
||||||
|
if args.gcc == "lm32":
|
||||||
|
lm32_gcc_toolchain_download()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in a new issue