diff --git a/.gitignore b/.gitignore index ccd5e19..6ab7f77 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ firmware/build/ firmware/csr.json firmware/litex_json2dts_zephyr.py firmware/overlay.config +firmware/overlay.cmake firmware/overlay.dts firmware/pin_io.h misc/ diff --git a/firmware/Makefile b/firmware/Makefile index 895a3f9..167ceb1 100644 --- a/firmware/Makefile +++ b/firmware/Makefile @@ -2,7 +2,7 @@ DEVICETREE_GEN_DIR=. -all: rtl_codegen build/digilent_arty/digilent_arty.bit overlay.dts overlay.config pin_io.h +all: rtl_codegen build/digilent_arty/digilent_arty.bit overlay.dts overlay.cmake pin_io.h rtl_codegen: cd rtl && make @@ -10,9 +10,9 @@ build/digilent_arty/digilent_arty.bit: rtl_codegen soc.py python3 soc.py clean: rm -rf build csr.json overlay.config overlay.dts pin_io.h -overlay.dts overlay.config: csr.json litex_json2dts_zephyr.py +overlay.dts overlay.cmake: csr.json litex_json2dts_zephyr.py # NOTE: Broken in LiteX 2022.4. - $(DEVICETREE_GEN_DIR)/litex_json2dts_zephyr.py --dts overlay.dts --config overlay.config csr.json + $(DEVICETREE_GEN_DIR)/litex_json2dts_zephyr.py --dts overlay.dts --config overlay.cmake csr.json pin_io.h: csr.json generate_csr_locations.py python3 generate_csr_locations.py > pin_io.h diff --git a/software/CMakeLists.txt b/software/CMakeLists.txt index ae3e92f..bead348 100644 --- a/software/CMakeLists.txt +++ b/software/CMakeLists.txt @@ -1,5 +1,11 @@ cmake_minimum_required(VERSION 3.20.0) +# These must come BEFORE the zephyr package declaration. +set(DTC_OVERLAY_FILE "../firmware/overlay.dts") +set(BOARD "litex_vexriscv") +set(EXTRA_CFLAGS "-Wfatal-errors -Werror -Wno-error=unused-const-variable -Wno-error=unused-variable -Wno-error=unused-function") +include("../firmware/overlay.cmake") + find_package(Zephyr) project(upsilon) include_directories("../firmware") @@ -7,4 +13,5 @@ include_directories("src/") include_directories("../creole") include_directories("../firmware/rtl/control_loop") +# Add all source files here. target_sources(app PRIVATE src/access.c src/buf.c src/main.c src/sock.c ../creole/creole.c) diff --git a/software/Makefile b/software/Makefile index 98e1870..fc88d57 100644 --- a/software/Makefile +++ b/software/Makefile @@ -1,5 +1,12 @@ -build/zephyr/zephyr.bin: src/*.c ../firmware/overlay.dts ../firmware/pin_io.h +unexport CXXFLAGS +unexport CFLAGS +unexport CPPFLAGS +unexport LDFLAGS + +build/zephyr/zephyr.bin: build/Makefile + cd build && make -j7 +build/Makefile: ../creole/creole.c src/*.c ../firmware/overlay.dts ../firmware/pin_io.h mkdir -p build - cd build && CMAKE_BINARY_DIR=$$(pwd) cmake $$(cat ../../firmware/overlay.config) -DDTC_OVERLAY_FILE=../firmware/overlay.dts -DBOARD=litex_vexriscv -DEXTRA_CFLAGS=-Wfatal-errors .. && make + cd build && cmake .. clean: rm -rf build