forked from analogdevicesinc/msdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.ARM
119 lines (96 loc) · 3.81 KB
/
Makefile.ARM
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
###############################################################################
#
# Copyright (C) 2022-2023 Maxim Integrated Products, Inc. (now owned by
# Analog Devices, Inc.),
# Copyright (C) 2023-2024 Analog Devices, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
# This is the name of the build output file
ifeq "$(PROJECT)" ""
PROJECT=mnist-riscv
endif
# Specify the target processor
ifeq "$(TARGET)" ""
TARGET=MAX78000
endif
MAKE=make
# Create Target name variables
TARGET_UC := $(subst m,M,$(subst a,A,$(subst x,X,$(TARGET))))
TARGET_LC := $(subst M,m,$(subst A,a,$(subst X,x,$(TARGET))))
# Select 'GCC' or 'IAR' compiler
COMPILER=GCC
# Specify the board used
ifeq "$(BOARD)" ""
BOARD=EvKit_V1
endif
ifeq "$(MAXIM_PATH)" ""
DEPTH := ../../../../
MAXIM_PATH := $(abspath $(DEPTH))
endif
# This is the path to the CMSIS root directory
ifeq "$(MAXIM_PATH)" ""
LIBS_DIR=../../../../Libraries
else
ifeq ($(OS),Windows_NT)
LIBS_DIR=/$(subst \,/,$(subst :,,$(MAXIM_PATH))/Libraries)
else
LIBS_DIR=/$(subst \,/,$(subst :,,$(MAXIM_PATH))/Libraries)
endif
endif
CMSIS_ROOT=$(LIBS_DIR)/CMSIS
#Use this for other library make files so they are all based off the same as root as the project
export CMSIS_ROOT
# Source files for this test (add path to VPATH below)
SRCS = main.c
# Where to find source files for this test
VPATH = .
VPATH += $(CMSIS_ROOT)/Device/Maxim/$(TARGET_UC)/Source
# Where to find header files for this test
IPATH = .
# Enable all warnings
PROJ_CFLAGS+=-Wall -Wcast-align -DMXC_ASSERT_ENABLE -DARM_MATH_CM4
# Specify the target revision to override default
# "A2" in ASCII
# TARGET_REV=0x4132
# Use this variables to specify and alternate tool path
#TOOL_DIR=/opt/gcc-arm-none-eabi-4_8-2013q4/bin
# Point this variable to a startup file to override the default file
#STARTUPFILE=startup_max78000.S
# Override the default optimization level using this variable
MXC_OPTIMIZE_CFLAGS=-O2
# Point this variable to a linker file to override the default file
LINKERFILE=$(CMSIS_ROOT)/Device/Maxim/$(TARGET_UC)/Source/GCC/$(TARGET_LC)_arm.ld
################################################################################
# Include external library makefiles here
# Include the BSP
BOARD_DIR=$(LIBS_DIR)/Boards/$(TARGET_UC)/$(BOARD)
include $(BOARD_DIR)/board.mk
# Include the peripheral driver
PERIPH_DRIVER_DIR=$(LIBS_DIR)/PeriphDrivers
include $(PERIPH_DRIVER_DIR)/periphdriver.mk
export PERIPH_DRIVER_DIR
################################################################################
# Include the rules for building for this target. All other makefiles should be
# included before this one.
include $(CMSIS_ROOT)/Device/Maxim/$(TARGET_UC)/Source/$(COMPILER)/$(TARGET_LC).mk
# arm-none-eabi-objcopy $(BUILD_DIR)/$(PROJECT).elf -R .sig -O binary $(BUILD_DIR)/$(PROJECT).bin
# $(CA_SIGN_BUILD) $(BUILD_DIR)/$(PROJECT).bin $(TEST_KEY)
# arm-none-eabi-objcopy $(BUILD_DIR)/$(PROJECT).elf --update-section .sig=$(BUILD_DIR)/$(PROJECT).bin.sig
libclean:
$(MAKE) -f ${PERIPH_DRIVER_DIR}/periphdriver.mk clean.periph
# The rule to clean out all the build products.
distclean: clean libclean
# arm-none-eabi-objcopy $(BUILD_DIR)/$(PROJECT).elf -O binary $(BUILD_DIR)/$(PROJECT).sbin
# $(BUILD_SESSION) $(BUILD_DIR)/$(PROJECT).sbin scp_packets $(TEST_KEY)