mirror of
https://github.com/retroSoC/retroSoC.git
synced 2026-11-04 22:32:36 +00:00
feat: modify app setup and sys setup python script
This commit is contained in:
3 files changed
+41
-10
No files matched your search
@@ -14,7 +14,7 @@ jobs:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download and extract RISC-V toolchain
|
||||
- name: Download and Extract RISC-V Toolchain
|
||||
run: |
|
||||
wget https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2025.05.01/riscv32-elf-ubuntu-22.04-gcc-nightly-2025.05.01-nightly.tar.xz
|
||||
tar -xvf riscv32-elf-ubuntu-22.04-gcc-nightly-2025.05.01-nightly.tar.xz -C /tmp
|
||||
@@ -22,14 +22,17 @@ jobs:
|
||||
echo "RISCV_TOOLCHAIN_BIN=$toolchain_bin" >> $GITHUB_ENV
|
||||
echo "$toolchain_bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Use the toolchain in a subsequent step
|
||||
- name: Test RISC-V Toolchain
|
||||
run: |
|
||||
echo "The toolchain path is $RISCV_TOOLCHAIN_BIN"
|
||||
riscv32-unknown-elf-gcc --version
|
||||
|
||||
- name: Setup Environment
|
||||
- name: Setup Verilator and MPW Repo
|
||||
run: python3 setup.py
|
||||
|
||||
- name: Config FatFs and Coremark Repo
|
||||
run: python3 app/setup.py
|
||||
|
||||
- name: Compile Firmware
|
||||
run: make CORE=MDD IP=MDD SIMU=VERILATOR HAVE_SRAM_IF=NO HAVE_SRAM_MACRO=NO HAVE_PLL=NO ISA=RV32IM EXEC_TYPE=ld2_psram firmware
|
||||
|
||||
|
||||
+34
-5
@@ -5,13 +5,42 @@ import os
|
||||
# Always use the script directory as the base to avoid failures in different working directories
|
||||
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
APP_DIR = SCRIPT_DIR
|
||||
SRC_DIR = os.path.join(APP_DIR, 'src')
|
||||
FATFS_DIR = os.path.join(SRC_DIR, 'fatfs')
|
||||
LVGL_DIR = os.path.join(SRC_DIR, 'lvgl')
|
||||
FATFS_DIR = os.path.join(APP_DIR, 'fatfs')
|
||||
COREMARK_DIR = os.path.join(APP_DIR, 'coremark')
|
||||
LVGL_DIR = os.path.join(APP_DIR, 'lvgl')
|
||||
LVGL_NAME = 'v9.4.0.tar.gz'
|
||||
|
||||
print(APP_DIR)
|
||||
print(FATFS_DIR)
|
||||
print(COREMARK_DIR)
|
||||
|
||||
|
||||
def prepend_line(filename, line):
|
||||
with open(filename, 'r') as f:
|
||||
content = f.read()
|
||||
with open(filename, 'w') as f:
|
||||
f.write(line + '\n' + content)
|
||||
|
||||
def replace_line(filename, old, new):
|
||||
with open(filename, 'r', encoding='utf-8') as fp:
|
||||
for v in fp:
|
||||
if old in v:
|
||||
lines += v.replace(old, new)
|
||||
else:
|
||||
lines += v
|
||||
|
||||
with open(filename, 'w', encoding='utf-8') as fp:
|
||||
fp.writelines(lines)
|
||||
|
||||
lvgl_name = 'v9.4.0.tar.gz'
|
||||
|
||||
os.system(f'mkdir -p "{FATFS_DIR}"/ff16 && cd "{FATFS_DIR}"/ff16 && if [ -d source ]; then echo "[fatfs] already exists, skip"; else wget https://elm-chan.org/fsw/ff/arc/ff16.zip && unzip -q ff16.zip && echo "[fatfs] downloaded and extracted"; fi')
|
||||
os.system(f'cd "{FATFS_DIR}" && cp -rf ffconf.h diskio.c ff16/source/')
|
||||
|
||||
os.system(f'cd "{LVGL_DIR}" && if ls -1d lvgl-* >/dev/null 2>&1; then echo "[lvgl] already exists, skip"; else wget https://github.com/lvgl/lvgl/archive/refs/tags/{lvgl_name} && tar -xf {lvgl_name} && echo "[lvgl] downloaded and extracted"; fi')
|
||||
os.system(f'git clone https://github.com/eembc/coremark.git {COREMARK_DIR}/coremark-main')
|
||||
os.system(f'cd {COREMARK_DIR}/coremark-main && git checkout 1f483d5b8316753a742cbf5590caf5bd0a4e4777')
|
||||
os.chdir(f'{COREMARK_DIR}/coremark-main')
|
||||
prepend_line('coremark.h', '#include <tinyprintf.h>')
|
||||
replace_line('core_main.c', 'main', 'core_main')
|
||||
|
||||
|
||||
# os.system(f'cd "{LVGL_DIR}" && if ls -1d lvgl-* >/dev/null 2>&1; then echo "[lvgl] already exists, skip"; else wget https://github.com/lvgl/lvgl/archive/refs/tags/{LVGL_NAME} && tar -xf {LVGL_NAME} && echo "[lvgl] downloaded and extracted"; fi')
|
||||
@@ -328,10 +328,9 @@ def main():
|
||||
|
||||
# check_software_toolchain_installed()
|
||||
|
||||
# TODO: git clone mpw
|
||||
# TODO: git clone mpw, add some stdout output
|
||||
os.chdir(project_path)
|
||||
run_command("git clone https://github.com/retroSoC/mini-ver-mpw.git rtl/mini/mpw")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in new issue
Block a user