From 176369c8d634c2263f828cb6a265aeb391434f1b Mon Sep 17 00:00:00 2001 From: jmiranda Date: Tue, 31 Oct 2023 15:41:37 +0100 Subject: [PATCH 1/2] Compilation fix (#422) * Compilation Fix: we were not exporting properly the ENV variables to sub-makefiles, i.e. to children makefiles, and so the SOURCE was not propagated properly. This led to problems when executing from scratch, i.e. not having still nothing into the CMake cache. This is now fixed. --- Makefile | 6 +++++- sw/Makefile | 7 +++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index fa6e81ef5..8d7c75b84 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,7 @@ MAKE = make # Get the absolute path mkfile_path := $(shell dirname "$(realpath $(firstword $(MAKEFILE_LIST)))") +$(info $$You are executing from: $(mkfile_path)) # Include the self-documenting tool FILE=$(mkfile_path)/Makefile @@ -49,7 +50,7 @@ COMPILER_PREFIX ?= riscv32-unknown- ARCH ?= rv32imc # Path relative from the location of sw/Makefile from which to fetch source files. The directory of that file is the default value. -SOURCE ?= "." +SOURCE ?= $(".") # Simulation engines options are verilator (default) and questasim SIMULATOR ?= verilator @@ -57,6 +58,9 @@ SIMULATOR ?= verilator # Timeout for simulation, default 120 TIMEOUT ?= 120 +# Export variables to sub-makefiles +export + ## @section Conda conda: environment.yml conda env create -f environment.yml diff --git a/sw/Makefile b/sw/Makefile index 3582fb256..745c1c057 100644 --- a/sw/Makefile +++ b/sw/Makefile @@ -38,7 +38,7 @@ COMPILER_PREFIX ?= riscv32-unknown- ARCH ?= rv32imc # Path relative from the location of sw/Makefile from which to fetch source files. The directory of that file is the default value. -SOURCE ?= "." +SOURCE ?= $(".") # riscv toolchain install path RISCV ?= ~/.riscv @@ -56,7 +56,7 @@ source_path := $(realpath $(mkfile_path)/$(SOURCE)) $(info $$You are fetching sources from $(source_path) ) -SOURCE_PATH = $(source_path)/ +SOURCE_PATH = $(source_path)/ ROOT_PROJECT = $(mkfile_path)/ INC_FOLDERS = $(mkfile_path)/device/target/$(TARGET)/ LINK_FOLDER = $(mkfile_path)/linker @@ -70,6 +70,9 @@ else CMAKE=cmake3 endif +# Export variables to sub-makefiles +export + # Let's CMake! include cmake/targets.mak From 0b8d3c63328dab7f09a6ca0e7b3e23ef3426588e Mon Sep 17 00:00:00 2001 From: jmiranda Date: Tue, 31 Oct 2023 15:52:17 +0100 Subject: [PATCH 2/2] Fix run-blinky-freertos command (#424) * Fix run-blinkyfreertos command --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8d7c75b84..0220b7c30 100644 --- a/Makefile +++ b/Makefile @@ -179,7 +179,7 @@ run-helloworld: mcu-gen verilator-sim ## Uses verilator to simulate the HW model and run the FW ## UART Dumping in uart0.log to show recollected results run-blinkyfreertos: mcu-gen verilator-sim - $(MAKE) -C sw PROJECT=blinky_freertos TARGET=$(TARGET) LINKER=$(LINKER) COMPILER=$(COMPILER) COMPILER_PREFIX=$(COMPILER_PREFIX) ARCH=$(ARCH); + $(MAKE) -C sw PROJECT=example_freertos_blinky TARGET=$(TARGET) LINKER=$(LINKER) COMPILER=$(COMPILER) COMPILER_PREFIX=$(COMPILER_PREFIX) ARCH=$(ARCH); cd ./build/openhwgroup.org_systems_core-v-mini-mcu_0/sim-verilator; \ ./Vtestharness +firmware=../../../sw/build/main.hex; \ cat uart0.log; \