2016-10-29 22:56:07 +02:00
|
|
|
############################################################################
|
2020-12-04 18:35:12 +01:00
|
|
|
# boards/xtensa/esp32/esp32-devkitc/scripts/Make.defs
|
2016-10-29 22:56:07 +02:00
|
|
|
#
|
2021-03-05 10:18:57 +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
|
2016-10-29 22:56:07 +02:00
|
|
|
#
|
2021-03-05 10:18:57 +01:00
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
2016-10-29 22:56:07 +02:00
|
|
|
#
|
2021-03-05 10:18:57 +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.
|
2016-10-29 22:56:07 +02:00
|
|
|
#
|
|
|
|
############################################################################
|
|
|
|
|
2020-05-19 16:25:18 +02:00
|
|
|
include $(TOPDIR)/.config
|
|
|
|
include $(TOPDIR)/tools/Config.mk
|
2021-02-03 15:55:59 +01:00
|
|
|
include $(TOPDIR)/tools/esp32/Config.mk
|
2020-05-19 16:25:18 +02:00
|
|
|
include $(TOPDIR)/arch/xtensa/src/lx6/Toolchain.defs
|
2016-10-29 22:56:07 +02:00
|
|
|
|
2021-07-14 21:07:30 +02:00
|
|
|
# Pick the linker scripts from the board level if they exist, if not
|
|
|
|
# pick the common linker scripts.
|
|
|
|
|
|
|
|
ifneq ($(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld),)
|
|
|
|
LDSCRIPT_ROM = $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld
|
|
|
|
else
|
|
|
|
LDSCRIPT_ROM = $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32.ld),)
|
|
|
|
LDSCRIPT_SECT = $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32.ld
|
|
|
|
else
|
2021-06-23 20:26:33 +02:00
|
|
|
ifeq ($(CONFIG_ESP32_APP_FORMAT_MCUBOOT),y)
|
|
|
|
LDSCRIPT_SECT = $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32_mcuboot.ld
|
|
|
|
else
|
|
|
|
LDSCRIPT_SECT = $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32.ld
|
|
|
|
endif
|
2021-07-14 21:07:30 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32.template.ld),)
|
|
|
|
LDSCRIPT_TEMPLATE = $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32.template.ld
|
|
|
|
else
|
|
|
|
LDSCRIPT_TEMPLATE = $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32.template.ld
|
|
|
|
endif
|
|
|
|
|
|
|
|
# This is the generated memory layout linker script. It will always be
|
|
|
|
# generated at the board level.
|
|
|
|
|
|
|
|
LDSCRIPT_MEMORY = $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_out.ld
|
2016-10-29 22:56:07 +02:00
|
|
|
|
2020-05-18 16:18:15 +02:00
|
|
|
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
|
2021-07-14 21:07:30 +02:00
|
|
|
ARCHSCRIPT = -T "${shell cygpath -w $(LDSCRIPT_MEMORY)}"
|
|
|
|
ARCHSCRIPT += -T "${shell cygpath -w $(LDSCRIPT_SECT)}"
|
|
|
|
ARCHSCRIPT += -T "${shell cygpath -w $(LDSCRIPT_ROM)}"
|
2016-10-29 22:56:07 +02:00
|
|
|
else
|
2021-07-14 21:07:30 +02:00
|
|
|
ARCHSCRIPT = -T$(LDSCRIPT_MEMORY) -T$(LDSCRIPT_SECT) -T$(LDSCRIPT_ROM)
|
2016-10-29 22:56:07 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
|
|
|
ARCHOPTIMIZATION = -g
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(CONFIG_DEBUG_NOOPT),y)
|
|
|
|
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
|
|
|
|
endif
|
|
|
|
|
2020-04-28 19:01:30 +02:00
|
|
|
ARCHCFLAGS = -fno-builtin -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -mlongcalls
|
2016-10-29 22:56:07 +02:00
|
|
|
ARCHCXXFLAGS = $(ARCHCFLAGS) -fno-exceptions -fcheck-new -fno-rtti
|
|
|
|
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
|
|
|
|
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
|
|
|
|
ARCHPICFLAGS = -fpic
|
|
|
|
|
2020-11-06 21:49:48 +01:00
|
|
|
# if SPIRAM/PSRAM is used then we need to include a workaround
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_ESP32_SPIRAM),y)
|
|
|
|
ARCHCFLAGS += -mfix-esp32-psram-cache-issue
|
|
|
|
endif
|
|
|
|
|
2020-09-24 12:46:51 +02:00
|
|
|
CFLAGS := $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
|
2016-10-29 22:56:07 +02:00
|
|
|
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
|
2020-09-24 12:46:51 +02:00
|
|
|
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
|
2016-10-29 22:56:07 +02:00
|
|
|
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
|
2020-09-24 12:46:51 +02:00
|
|
|
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
|
|
|
|
AFLAGS := $(CFLAGS) -D__ASSEMBLY__
|
2016-10-29 22:56:07 +02:00
|
|
|
|
|
|
|
NXFLATLDFLAGS1 = -r -d -warn-common
|
|
|
|
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
|
|
|
|
LDNXFLATFLAGS = -e main -s 2048
|
|
|
|
|
2020-03-05 02:07:57 +01:00
|
|
|
# Loadable module definitions
|
|
|
|
|
2020-03-05 11:14:54 +01:00
|
|
|
CMODULEFLAGS = $(CFLAGS) -mtext-section-literals
|
2020-03-05 02:07:57 +01:00
|
|
|
|
|
|
|
LDMODULEFLAGS = -r -e module_initialize
|
2020-05-18 16:18:15 +02:00
|
|
|
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
|
2020-03-05 02:07:57 +01:00
|
|
|
LDMODULEFLAGS += -T "${shell cygpath -w $(TOPDIR)/libs/libc/modlib/gnu-elf.ld}"
|
|
|
|
else
|
|
|
|
LDMODULEFLAGS += -T $(TOPDIR)/libs/libc/modlib/gnu-elf.ld
|
|
|
|
endif
|
|
|
|
|
|
|
|
# ELF module definitions
|
|
|
|
|
2020-03-05 11:14:54 +01:00
|
|
|
CELFFLAGS = $(CFLAGS) -mtext-section-literals
|
|
|
|
CXXELFFLAGS = $(CXXFLAGS) -mtext-section-literals
|
2020-03-05 02:07:57 +01:00
|
|
|
|
|
|
|
LDELFFLAGS = -r -e main
|
2020-05-18 16:18:15 +02:00
|
|
|
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
|
2021-06-24 14:10:22 +02:00
|
|
|
LDELFFLAGS += -T "${shell cygpath -w $(TOPDIR)$(DELIM)binfmt$(DELIM)libelf$(DELIM)gnu-elf.ld}"
|
2020-03-05 02:07:57 +01:00
|
|
|
else
|
2021-06-24 14:10:22 +02:00
|
|
|
LDELFFLAGS += -T $(TOPDIR)$(DELIM)binfmt$(DELIM)libelf$(DELIM)gnu-elf.ld
|
2020-03-05 02:07:57 +01:00
|
|
|
endif
|
|
|
|
|
2020-09-12 17:18:36 +02:00
|
|
|
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
|
|
|
|
LDFLAGS += -Map="${shell cygpath -w $(TOPDIR)/nuttx.map}" --cref
|
|
|
|
else
|
|
|
|
LDFLAGS += -Map=$(TOPDIR)/nuttx.map --cref
|
|
|
|
endif
|
|
|
|
|
2016-10-29 22:56:07 +02:00
|
|
|
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
|
|
|
LDFLAGS += -g
|
|
|
|
endif
|