forked from byu-cpe/ecen330_student
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
85 lines (67 loc) · 3.33 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
cmake_minimum_required (VERSION 3.14.5)
project(ecen330)
include_directories(.)
include_directories(include)
include_directories(drivers)
# add_compile_options(-Wall -Wextra -pedantic)
# add_compile_options(-Wall -Wextra -pedantic -Werror)
if (NOT EMU)
# These are the options used to compile and run on the physical Zybo board
# You will need to compile using "cmake -DBOARD=1"
# This sets up options for the ARM compiler
include(platforms/zybo/xil_arm_toolchain/toolchain.cmake)
# Places to search for .h header files
include_directories(platforms/zybo/xil_arm_toolchain/bsp/ps7_cortexa9_0/include)
# link_directories instructs the compiler where it should look for libraries.
link_directories(platforms/zybo)
link_directories(platforms/zybo/xil_arm_toolchain)
# Set this variable to the name of libraries that board executables needs to link to
set(330_LIBS c gcc zybo xil c)
# Pass the BOARD variable to the compiler, so it can be used in #ifdef statements
add_compile_definitions(ZYBO_BOARD=1)
else()
# These options are required if you want to use the Zybo board emulator
# This sets up options for the compiler
include (platforms/emulator/emu.cmake)
# Places to search for .h header files
include_directories(platforms/emulator/include)
# link_directories instructs the compiler where it should look for libraries.
link_directories(platforms/emulator)
# Set this variable to the name of libraries that the emulator needs to link to
set(330_LIBS emu Qt5Widgets Qt5Gui Qt5Core pthread)
# Include this header file with all emulator builds
add_definitions(-include emulator.h)
endif()
# Subdirectories to look for other CMakeLists.txt files
#add_subdirectory(lab1)
#add_subdirectory(lab2)
#add_subdirectory(lab3)
#add_subdirectory(lab4)
#add_subdirectory(lab5)
#add_subdirectory(lab6)
add_subdirectory(lab7)
add_subdirectory(drivers)
# The rest of this file is to add custom targets to the Makefile that is generated by CMake.
set(XIL_VIVADO_PATH /tools/Xilinx/Vivado/2019.2)
# make BOOT.bin ELF_PATH=...
# This target is used to create SD card images (ECEN 390 only).
add_custom_target(BOOT.bin)
if (SDCARD)
add_custom_command(TARGET BOOT.bin
COMMAND if [ -z \${ELF_PATH} ]\; then echo '\\033[0;31mYou need to specify an ELF_PATH. For example: make BOOT.bin ELF_PATH=lab1/lab1.elf\\033[0m'\;exit 1\; fi
COMMAND if [ ! -f \${ELF_PATH} ]\; then echo '\\033[0;31mThe file \${ELF_PATH} does not exist.\\033[0m'\;exit 1\; fi
# COMMAND ${XIL_VITIS_PATH}/bin/sdcard_gen --xpfm ../hw/platform/330_platform.xpfm --sys_config 330_platform --bif ../hw/platform/sw/330_platform/boot/330_platform.bif --bitstream ../hw/330_hw_system.bit --elf \${ELF_PATH},ps7_cortexa9_0
COMMAND echo '//arch = zynq; split = false; format = BIN' > 330.bif
COMMAND echo 'the_ROM_image:' >> 330.bif
COMMAND echo '{' >> 330.bif
COMMAND echo ' [bootloader]../hw/fsbl.elf' >> 330.bif
COMMAND echo ' ../hw/330_hw_system.bit' >> 330.bif
COMMAND echo ' \${ELF_PATH}' >> 330.bif
COMMAND echo '}' >> 330.bif
COMMAND ${XIL_VIVADO_PATH}/bin/bootgen -image 330.bif -arch zynq -o BOOT.bin -w on
)
else()
add_custom_command(TARGET BOOT.bin
COMMAND echo '\\033[0;31mYou cannot create an SD card boot file. cmake was not run with -DSDCARD=1\\033[0m'\;exit 1\;
)
endif()