From d3d3fea9163ee761e374b69e714afcd0735de289 Mon Sep 17 00:00:00 2001 From: Byron Lathi Date: Sat, 30 Sep 2023 04:16:52 +0000 Subject: [PATCH 1/2] Resolve "Use dependencies instead of makefile chaining" --- .gitlab-ci.yml | 45 ++++++++++++++++--- .gitmodules | 3 ++ .../simulation/src/verilog-sd-emulator | 1 + sw/Makefile | 8 ++-- 4 files changed, 48 insertions(+), 9 deletions(-) create mode 160000 hw/efinix_fpga/simulation/src/verilog-sd-emulator diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f55824e..5b77088 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -20,9 +20,23 @@ variables: GIT_SUBMODULE_STRATEGY: recursive stages: # List of stages for jobs, and their order of execution + - toolchain - build -build-fpga: # This job runs in the build stage, which runs first. +build toolchain: + tags: + - linux + stage: toolchain + script: + - source init_env.sh + - cd sw/cc65 + - make -j + artifacts: + paths: + - sw/cc65/bin + - sw/cc65/lib + +build fpga: # This job runs in the build stage, which runs first. tags: - efinity - linux @@ -32,15 +46,36 @@ build-fpga: # This job runs in the build stage, which runs first. - cd hw/efinix_fpga - make -build-sim: +build sim: tags: - iverilog - linux stage: build script: - source init_env.sh - - cd sw/cc65 - - make -j - - cd ../.. - cd hw/efinix_fpga/simulation - make + dependencies: + - build toolchain + +build bios: + tags: + - linux + stage: build + script: + - source init_env.sh + - cd sw/ + - make bios + dependencies: + - build toolchain + +build kernel: + tags: + - linux + stage: build + script: + - source init_env.sh + - cd sw/ + - make kernel + dependencies: + - build toolchain \ No newline at end of file diff --git a/.gitmodules b/.gitmodules index 0a0a7e3..da7e628 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "hw/efinix_fpga/simulation/src/verilog-6502"] path = hw/efinix_fpga/simulation/src/verilog-6502 url = https://git.byronlathi.com/bslathi19/verilog-6502 +[submodule "hw/efinix_fpga/simulation/src/verilog-sd-emulator"] + path = hw/efinix_fpga/simulation/src/verilog-sd-emulator + url = https://git.byronlathi.com/bslathi19/verilog-sd-emulator diff --git a/hw/efinix_fpga/simulation/src/verilog-sd-emulator b/hw/efinix_fpga/simulation/src/verilog-sd-emulator new file mode 160000 index 0000000..7fb88c9 --- /dev/null +++ b/hw/efinix_fpga/simulation/src/verilog-sd-emulator @@ -0,0 +1 @@ +Subproject commit 7fb88c9ee1ca65dd5bfd10b2e0f6331e958abdd7 diff --git a/sw/Makefile b/sw/Makefile index c379713..a47ed42 100644 --- a/sw/Makefile +++ b/sw/Makefile @@ -1,6 +1,6 @@ -.PHONY: all install bootloader kernel clean +.PHONY: all install bios kernel clean -all: toolchain bootloader kernel +all: toolchain bios kernel install: all sh script/format_disk.sh @@ -9,8 +9,8 @@ install: all toolchain: @$(MAKE) -j4 -C cc65 -bootloader: - @$(MAKE) -C bootloader +bios: + @$(MAKE) -C bios kernel: @$(MAKE) -C kernel From f8bdbfbb2bccf70d14bec9655c9ace4a1d4fac31 Mon Sep 17 00:00:00 2001 From: Byron Lathi Date: Sat, 30 Sep 2023 05:05:12 +0000 Subject: [PATCH 2/2] Resolve "Run simulation as part of ci" --- .gitlab-ci.yml | 19 ++++++++++++++++++- init_env.sh | 9 +++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5b77088..f66e279 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,6 +22,7 @@ variables: stages: # List of stages for jobs, and their order of execution - toolchain - build + - simulate build toolchain: tags: @@ -51,6 +52,10 @@ build sim: - iverilog - linux stage: build + artifacts: + paths: + - hw/efinix_fpga/simulation/sim_top + - hw/efinix_fpga/simulation/init_hex.mem script: - source init_env.sh - cd hw/efinix_fpga/simulation @@ -78,4 +83,16 @@ build kernel: - cd sw/ - make kernel dependencies: - - build toolchain \ No newline at end of file + - build toolchain + +run sim: + tags: + - linux + - iverilog + stage: simulate + script: + - source init_env.sh + - cd hw/efinix_fpga/simulation + - vvp sim_top + dependencies: + - build sim diff --git a/init_env.sh b/init_env.sh index 46419d9..443f828 100644 --- a/init_env.sh +++ b/init_env.sh @@ -3,6 +3,8 @@ # ENV=".env/$HOSTNAME" +export REPO_TOP=$(git rev-parse --show-toplevel) + # if [ ! -d "$ENV" ]; then # mkdir -p "$ENV" # fi @@ -19,8 +21,11 @@ # source "$ENV/efinity/2023.1/bin/setup.sh" # export PATH=$PATH:"$EFXPT_HOME/bin" -source $EFX_SETUP -export REPO_TOP=$(git rev-parse --show-toplevel) +if [ -n "$EFX_SETUP" ]; then + source $EFX_SETUP +else + echo "EFX_SETUP not defined!" +fi # python -m venv .user_venv --system-site-packages