#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
|
|
# doit
|
# doit
|
|
|
from sys import executable, argv as sys_argv, exit as sys_exit
|
from sys import executable, argv as sys_argv, exit as sys_exit
|
from os import environ
|
from os import environ
|
from pathlib import Path
|
from pathlib import Path
|
|
|
from doit.action import CmdAction
|
from doit.action import CmdAction
|
from doit.cmd_base import ModuleTaskLoader
|
from doit.cmd_base import ModuleTaskLoader
|
from doit.doit_cmd import DoitMain
|
from doit.doit_cmd import DoitMain
|
|
|
DOIT_CONFIG = {"verbosity": 2, "action_string_formatting": "both"}
|
DOIT_CONFIG = {"verbosity": 2, "action_string_formatting": "both"}
|
|
|
ROOT = Path(__file__).parent
|
ROOT = Path(__file__).parent
|
|
|
|
|
def task_BuildAndInstallSoftwareFrameworkTests():
|
def task_BuildAndInstallSoftwareFrameworkTests():
|
return {
|
return {
|
"actions": [
|
"actions": [
|
# Check toolchain
|
# Check toolchain
|
"make -C sw/example/processor_check check",
|
"make -C sw/example/processor_check check",
|
# Generate executables for all example projects
|
# Generate executables for all example projects
|
"make -C sw/example clean_all exe",
|
"make -C sw/example clean_all exe",
|
# Compile and install bootloader
|
# Compile and install bootloader
|
"make -C sw/bootloader clean_all info bootloader",
|
"make -C sw/bootloader clean_all info bootloader",
|
# Compile and install test application
|
# Compile and install test application
|
# Redirect UART0 TX to text.io simulation output via <UART0_SIM_MODE> user flag
|
# Redirect UART0 TX to text.io simulation output via <UART0_SIM_MODE> user flag
|
"echo 'Compiling and installing CPU (/Processor) test application'",
|
"echo 'Compiling and installing CPU (/Processor) test application'",
|
"make -C sw/example/processor_check clean_all USER_FLAGS+=-DRUN_CHECK USER_FLAGS+=-DUART0_SIM_MODE USER_FLAGS+=-DUART1_SIM_MODE MARCH=-march=rv32imac info all",
|
"make -C sw/example/processor_check clean_all USER_FLAGS+=-DRUN_CHECK USER_FLAGS+=-DUART0_SIM_MODE USER_FLAGS+=-DUART1_SIM_MODE MARCH=rv32imac info all",
|
],
|
],
|
"doc": "Build all sw/example/*; install bootloader and processor check",
|
"doc": "Build all sw/example/*; install bootloader and processor check",
|
}
|
}
|
|
|
|
|
def task_RunRISCVArchitectureTests():
|
def task_RunRISCVArchitectureTests():
|
return {
|
return {
|
"actions": [CmdAction(
|
"actions": [CmdAction(
|
"./run_riscv_arch_test.sh {suite}",
|
"./run_riscv_arch_test.sh {suite}",
|
cwd=ROOT / "sim"
|
cwd=ROOT / "sim"
|
)],
|
)],
|
"doc": "Run RISC-V Architecture Tests",
|
"doc": "Run RISC-V Architecture Tests",
|
"params": [
|
"params": [
|
{
|
{
|
"name": "suite",
|
"name": "suite",
|
"short": "s",
|
"short": "s",
|
"long": "suite",
|
"long": "suite",
|
"default": "M",
|
"default": "M",
|
"choices": ((item, "") for item in [
|
"choices": ((item, "") for item in [
|
"I",
|
"I",
|
"C",
|
"C",
|
"M",
|
"M",
|
"privilege",
|
"privilege",
|
"Zifencei",
|
"Zifencei",
|
"rv32e_C",
|
"rv32e_C",
|
"rv32e_E",
|
"rv32e_E",
|
"rv32e_M"
|
"rv32e_M"
|
]),
|
]),
|
"help": "Test suite to be executed",
|
"help": "Test suite to be executed",
|
}
|
}
|
],
|
],
|
}
|
}
|
|
|
|
|
def task_Documentation():
|
def task_Documentation():
|
return {
|
return {
|
"actions": ["make -C docs {posargs}"],
|
"actions": ["make -C docs {posargs}"],
|
"doc": "Run a target in subdir 'doc'",
|
"doc": "Run a target in subdir 'doc'",
|
"uptodate": [False],
|
"uptodate": [False],
|
"pos_arg": "posargs",
|
"pos_arg": "posargs",
|
}
|
}
|
|
|
|
|
def task_DeployToGitHubPages():
|
def task_DeployToGitHubPages():
|
cwd = str(ROOT / "public")
|
cwd = str(ROOT / "public")
|
return {
|
return {
|
"actions": [
|
"actions": [
|
CmdAction(cmd, cwd=cwd)
|
CmdAction(cmd, cwd=cwd)
|
for cmd in [
|
for cmd in [
|
"git init",
|
"git init",
|
"cp ../.git/config ./.git/config",
|
"cp ../.git/config ./.git/config",
|
"touch .nojekyll",
|
"touch .nojekyll",
|
"git add .",
|
"git add .",
|
'git config --local user.email "push@gha"',
|
'git config --local user.email "push@gha"',
|
'git config --local user.name "GHA"',
|
'git config --local user.name "GHA"',
|
"git commit -am '{posargs}'",
|
"git commit -am '{posargs}'",
|
"git push -u origin +HEAD:gh-pages",
|
"git push -u origin +HEAD:gh-pages",
|
]
|
]
|
],
|
],
|
"doc": "Create a clean branch in subdir 'public' and push to branch 'gh-pages'",
|
"doc": "Create a clean branch in subdir 'public' and push to branch 'gh-pages'",
|
"pos_arg": "posargs",
|
"pos_arg": "posargs",
|
}
|
}
|
|
|
|
|
if __name__ == '__main__':
|
if __name__ == '__main__':
|
sys_exit(DoitMain(ModuleTaskLoader(globals())).run(sys_argv[1:]))
|
sys_exit(DoitMain(ModuleTaskLoader(globals())).run(sys_argv[1:]))
|
|
|