make software build system cleaner

This commit is contained in:
Peter McGoron 2023-04-04 12:24:10 -04:00
parent 551f535513
commit b7ca97695a
4 changed files with 20 additions and 5 deletions

1
.gitignore vendored
View File

@ -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/

View File

@ -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

View File

@ -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)

View File

@ -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