-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
126 lines (103 loc) · 5.06 KB
/
Makefile
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
SRC_DIR = ${TS_REPO_ROOT}/src
FIT_DIR = ${TS_REPO_ROOT}/fit
BUILD_DIR_MPW1 = ${TS_REPO_ROOT}/build_mpw1
BUILD_DIR = ${TS_REPO_ROOT}/build
RELEASE_DIR = ${TS_REPO_ROOT}/release
MPW1_BOOT_DIR = ${TS_REPO_ROOT}/build_mpw1_boot
COMPILER = spect_compiler
ISS = spect_iss
MEM_GEN = ${TS_REPO_ROOT}/scripts/gen_mem_files.py
OPS_GEN = ${TS_REPO_ROOT}/scripts/gen_spect_ops_constants.py
ISA_VERSION=2
FW_PARITY = 2 # even
FW_BASE_ADDR = 0x8000
MAIN=main.s
FW_VERSION=`git describe --dirty`
############################################################################################################
# Environment check
############################################################################################################
check_env:
printenv TS_REPO_ROOT
############################################################################################################
# Clear
############################################################################################################
clear: check_env
rm -rf ${BUILD_DIR_MPW1}
rm -rf ${BUILD_DIR}
rm -rf ${MPW1_BOOT_DIR}
rm -rf ${RELEASE_DIR}
rm -f ${TS_REPO_ROOT}/data/*.hex
rm -f ${SRC_DIR}/mem_layouts/constants_layout.s
rm -f ${SRC_DIR}/constants/spect_ops_constants.s
############################################################################################################
# Generating necessary files
############################################################################################################
const_rom:
${MEM_GEN} ${TS_REPO_ROOT}/data/const_rom_config.yml
mv ${TS_REPO_ROOT}/data/constants_layout.s ${SRC_DIR}/mem_layouts/constants_layout.s
data_ram_in_const:
${MEM_GEN} ${TS_REPO_ROOT}/data/data_ram_in_const_config.yml
mv ${TS_REPO_ROOT}/data/constants_data_in_layout.s ${SRC_DIR}/mem_layouts/constants_data_in_layout.s
data_ram_in_const_boot:
${MEM_GEN} ${TS_REPO_ROOT}/data/data_ram_in_const_boot_config.yml
mv ${TS_REPO_ROOT}/data/constants_data_in_boot_layout.s ${SRC_DIR}/mem_layouts/constants_layout.s
ops_constants:
${OPS_GEN} ${TS_REPO_ROOT}/spect_ops_config.yml
############################################################################################################
# Compile APP FW to build directory
############################################################################################################
compile: check_env const_rom ops_constants
rm -rf ${BUILD_DIR}
mkdir ${BUILD_DIR}
mv ${TS_REPO_ROOT}/data/constants.hex ${BUILD_DIR}/constants.hex
${COMPILER} --isa-version=${ISA_VERSION} --hex-format=1 --hex-file=${BUILD_DIR}/main.hex \
--first-address=${FW_BASE_ADDR} \
--parity=${FW_PARITY} \
--dump-program=${BUILD_DIR}/program_dump.s \
--dump-symbols=${BUILD_DIR}/symbols_dump.s \
${SRC_DIR}/${MAIN} > ${BUILD_DIR}/compile.log
############################################################################################################
# Final APP+BOOT FW Release
############################################################################################################
release: check_env const_rom ops_constants
rm -rf ${RELEASE_DIR}
mkdir ${RELEASE_DIR}
mkdir ${RELEASE_DIR}/dump
mkdir ${RELEASE_DIR}/log
mv ${TS_REPO_ROOT}/data/constants.hex ${RELEASE_DIR}/spect_const_rom_code-${FW_VERSION}.hex
${COMPILER} --isa-version=2 --hex-format=1 --hex-file=${RELEASE_DIR}/spect_app-${FW_VERSION}.hex \
--first-address=${FW_BASE_ADDR} \
--parity=${FW_PARITY} \
--dump-program=${RELEASE_DIR}/dump/program_dump_app.s \
--dump-symbols=${RELEASE_DIR}/dump/symbols_dump_app.s \
${SRC_DIR}/${MAIN} > ${RELEASE_DIR}/log/compile_app.log
${COMPILER} --isa-version=2 --hex-format=1 --hex-file=${RELEASE_DIR}/spect_boot-${FW_VERSION}.hex \
--first-address=${FW_BASE_ADDR} \
--parity=${FW_PARITY} \
--dump-program=${RELEASE_DIR}/dump/program_dump_boot.s \
--dump-symbols=${RELEASE_DIR}/dump/symbols_dump_boot.s \
${SRC_DIR}/boot_main.s > ${RELEASE_DIR}/log/compile_boot.log
############################################################################################################
# MPW1 FW (APP+BOOT)
############################################################################################################
compile_mpw1: check_env data_ram_in_const
rm -rf ${BUILD_DIR_MPW1}
mkdir ${BUILD_DIR_MPW1}
mv ${TS_REPO_ROOT}/data/constants_data_in.hex ${BUILD_DIR_MPW1}/constants.hex
${COMPILER} --hex-format=1 --hex-file=${BUILD_DIR_MPW1}/main_mpw1.hex \
--isa-version=1 \
--first-address=${FW_BASE_ADDR} \
--dump-program=${BUILD_DIR_MPW1}/program_dump.s \
--dump-symbols=${BUILD_DIR_MPW1}/symbols_dump.s \
${SRC_DIR}/mpw1/main_mpw1.s > ${BUILD_DIR_MPW1}/compile.log
compile_boot_mpw1: check_env data_ram_in_const_boot ops_constants
rm -rf ${MPW1_BOOT_DIR}
mkdir ${MPW1_BOOT_DIR}
mkdir ${MPW1_BOOT_DIR}/dump
mv ${TS_REPO_ROOT}/data/constants_data_in_boot.hex ${MPW1_BOOT_DIR}/constants.hex
${COMPILER} --isa-version=1 --hex-format=1 --hex-file=${MPW1_BOOT_DIR}/spect_boot_mpw1.hex \
--first-address=${FW_BASE_ADDR} \
--parity=${FW_PARITY} \
--dump-program=${MPW1_BOOT_DIR}/dump/program_dump.s \
--dump-symbols=${MPW1_BOOT_DIR}/dump/symbols_dump.s \
${SRC_DIR}/boot_main.s > ${MPW1_BOOT_DIR}/compile.log