2019-12-31 16:06:20 +01:00
|
|
|
############################################################################
|
2021-03-08 22:29:12 +01:00
|
|
|
# boards/risc-v/k210/maix-bit/scripts/Make.defs
|
2019-12-31 16:06:20 +01:00
|
|
|
#
|
2021-03-12 05:04:15 +01:00
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
# contributor license agreements. See the NOTICE file distributed with
|
|
|
|
# this work for additional information regarding copyright ownership. The
|
|
|
|
# ASF licenses this file to you 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
|
2019-12-31 16:06:20 +01:00
|
|
|
#
|
2021-03-12 05:04:15 +01:00
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
2019-12-31 16:06:20 +01:00
|
|
|
#
|
2021-03-12 05:04:15 +01:00
|
|
|
# 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.
|
2019-12-31 16:06:20 +01:00
|
|
|
#
|
|
|
|
############################################################################
|
|
|
|
|
2020-05-19 16:25:18 +02:00
|
|
|
include $(TOPDIR)/.config
|
|
|
|
include $(TOPDIR)/tools/Config.mk
|
2021-12-26 17:18:22 +01:00
|
|
|
include $(TOPDIR)/arch/risc-v/src/common/Toolchain.defs
|
2019-12-31 16:06:20 +01:00
|
|
|
|
|
|
|
LDSCRIPT = ld.script
|
|
|
|
|
2022-02-14 22:29:40 +01:00
|
|
|
ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)
|
2019-12-31 16:06:20 +01:00
|
|
|
|
|
|
|
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
|
|
|
ARCHOPTIMIZATION = -g
|
|
|
|
ASARCHCPUFLAGS += -Wa,-g
|
|
|
|
endif
|
|
|
|
|
|
|
|
MAXOPTIMIZATION = -Os
|
|
|
|
|
|
|
|
ifneq ($(CONFIG_DEBUG_NOOPT),y)
|
2022-01-17 19:26:25 +01:00
|
|
|
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing
|
2019-12-31 16:06:20 +01:00
|
|
|
endif
|
|
|
|
|
2022-02-13 15:59:35 +01:00
|
|
|
ARCHCPUFLAGS += -mcmodel=medany -mstrict-align
|
2022-02-12 23:14:22 +01:00
|
|
|
ARCHCFLAGS = -fno-common -ffunction-sections -fdata-sections
|
|
|
|
ARCHCXXFLAGS = -fno-common -fno-exceptions -fcheck-new -fno-rtti
|
2019-12-31 16:06:20 +01:00
|
|
|
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
|
|
|
|
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
|
|
|
|
|
2020-09-24 12:46:51 +02:00
|
|
|
CFLAGS := $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
|
2019-12-31 16:06:20 +01:00
|
|
|
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
|
2020-09-24 12:46:51 +02:00
|
|
|
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
|
2019-12-31 16:06:20 +01:00
|
|
|
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
|
2020-09-24 12:46:51 +02:00
|
|
|
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
|
2019-12-31 16:06:20 +01:00
|
|
|
AFLAGS += $(CFLAGS) -D__ASSEMBLY__ $(ASARCHCPUFLAGS)
|
|
|
|
|
2020-02-08 00:10:23 +01:00
|
|
|
# Loadable module definitions
|
|
|
|
|
|
|
|
CMODULEFLAGS = $(CFLAGS)
|
|
|
|
|
|
|
|
LDMODULEFLAGS = -r -e module_initialize
|
2022-02-20 03:34:50 +01:00
|
|
|
LDMODULEFLAGS += -T $(call CONVERT_PATH,$(TOPDIR)/libs/libc/modlib/gnu-elf.ld)
|
2020-02-08 00:10:23 +01:00
|
|
|
|
|
|
|
# ELF module definitions
|
|
|
|
|
|
|
|
CELFFLAGS = $(CFLAGS)
|
|
|
|
CXXELFFLAGS = $(CXXFLAGS)
|
|
|
|
|
|
|
|
LDELFFLAGS = -r -e main
|
2022-02-20 03:34:50 +01:00
|
|
|
LDELFFLAGS += -T $(call CONVERT_PATH,$(BOARD_DIR)$(DELIM)scripts$(DELIM)gnu-elf.ld)
|
2020-02-08 00:10:23 +01:00
|
|
|
|
|
|
|
# File extensions
|
|
|
|
|
2019-12-31 16:06:20 +01:00
|
|
|
LDFLAGS += --gc-sections -melf64lriscv
|