2007-04-28 21:39:18 +02:00
|
|
|
############################################################################
|
2008-01-08 01:19:24 +01:00
|
|
|
# arch/arm/src/Makefile
|
2007-04-28 21:39:18 +02:00
|
|
|
#
|
2021-03-13 11:24:50 +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
|
2007-04-28 21:39:18 +02:00
|
|
|
#
|
2021-03-13 11:24:50 +01:00
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
2007-04-28 21:39:18 +02:00
|
|
|
#
|
2021-03-13 11:24:50 +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.
|
2007-04-28 21:39:18 +02:00
|
|
|
#
|
|
|
|
############################################################################
|
|
|
|
|
2020-05-18 21:42:11 +02:00
|
|
|
include $(TOPDIR)/Make.defs
|
2020-09-23 13:48:02 +02:00
|
|
|
-include chip/Make.defs
|
2007-04-28 21:39:18 +02:00
|
|
|
|
2019-03-19 18:51:29 +01:00
|
|
|
ifeq ($(CONFIG_ARCH_ARMV7A),y) # ARMv7-A
|
2013-08-27 16:46:37 +02:00
|
|
|
ARCH_SUBDIR = armv7-a
|
2019-03-19 18:51:29 +01:00
|
|
|
else ifeq ($(CONFIG_ARCH_ARMV7R),y) # ARMv7-R
|
2015-12-16 00:15:37 +01:00
|
|
|
ARCH_SUBDIR = armv7-r
|
2019-03-19 18:51:29 +01:00
|
|
|
else ifeq ($(CONFIG_ARCH_ARMV7M),y) # ARMv7-M
|
2015-03-05 18:25:27 +01:00
|
|
|
ARCH_SUBDIR = armv7-m
|
2020-04-22 04:09:50 +02:00
|
|
|
else ifeq ($(CONFIG_ARCH_ARMV8M),y) # ARMv8-M
|
|
|
|
ARCH_SUBDIR = armv8-m
|
2020-09-20 06:38:25 +02:00
|
|
|
else ifeq ($(CONFIG_ARCH_ARMV6M),y) # ARMv6-M
|
2013-02-16 13:46:09 +01:00
|
|
|
ARCH_SUBDIR = armv6-m
|
2019-03-19 18:51:29 +01:00
|
|
|
else # ARM9, ARM7TDMI, etc.
|
2012-11-03 00:22:48 +01:00
|
|
|
ARCH_SUBDIR = arm
|
2009-05-19 19:16:17 +02:00
|
|
|
endif
|
|
|
|
|
2020-05-19 11:43:29 +02:00
|
|
|
ARCH_SRCDIR = $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src
|
|
|
|
|
|
|
|
INCLUDES += ${shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)chip}
|
|
|
|
INCLUDES += ${shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)common}
|
|
|
|
INCLUDES += ${shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)$(ARCH_SUBDIR)}
|
|
|
|
INCLUDES += ${shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)sched}
|
|
|
|
|
2020-09-14 00:14:28 +02:00
|
|
|
CPPFLAGS += $(INCLUDES)
|
|
|
|
CFLAGS += $(INCLUDES)
|
|
|
|
CXXFLAGS += $(INCLUDES)
|
|
|
|
AFLAGS += $(INCLUDES)
|
2020-05-19 11:43:29 +02:00
|
|
|
|
2020-05-18 16:18:15 +02:00
|
|
|
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
|
2020-05-19 11:43:29 +02:00
|
|
|
NUTTX = "${shell cygpath -w $(TOPDIR)$(DELIM)nuttx$(EXEEXT)}"
|
2009-06-10 04:05:05 +02:00
|
|
|
else
|
2020-05-19 11:43:29 +02:00
|
|
|
NUTTX = "$(TOPDIR)$(DELIM)nuttx$(EXEEXT)"
|
2009-06-10 04:05:05 +02:00
|
|
|
endif
|
2007-04-28 21:39:18 +02:00
|
|
|
|
2020-07-22 15:21:42 +02:00
|
|
|
# Additional rules for system call wrapper
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_SCHED_INSTRUMENTATION_SYSCALL),y)
|
|
|
|
EXTRALINKCMDS += @$(TOPDIR)/syscall/syscall_wraps.ldcmd
|
|
|
|
endif
|
|
|
|
|
2013-03-23 15:46:02 +01:00
|
|
|
# The "head" object
|
|
|
|
|
2012-11-03 00:22:48 +01:00
|
|
|
HEAD_OBJ = $(HEAD_ASRC:.S=$(OBJEXT))
|
2014-09-04 21:31:34 +02:00
|
|
|
STARTUP_OBJS ?= $(HEAD_OBJ)
|
2007-04-28 21:39:18 +02:00
|
|
|
|
2013-03-23 15:46:02 +01:00
|
|
|
# Flat build or kernel-mode objects
|
|
|
|
|
2012-11-03 00:22:48 +01:00
|
|
|
ASRCS = $(CHIP_ASRCS) $(CMN_ASRCS)
|
|
|
|
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
2007-04-28 21:39:18 +02:00
|
|
|
|
2012-11-03 00:22:48 +01:00
|
|
|
CSRCS = $(CHIP_CSRCS) $(CMN_CSRCS)
|
|
|
|
COBJS = $(CSRCS:.c=$(OBJEXT))
|
2007-04-28 21:39:18 +02:00
|
|
|
|
2012-11-03 00:22:48 +01:00
|
|
|
SRCS = $(ASRCS) $(CSRCS)
|
|
|
|
OBJS = $(AOBJS) $(COBJS)
|
2007-04-28 21:39:18 +02:00
|
|
|
|
2013-03-23 15:46:02 +01:00
|
|
|
# User-mode objects
|
|
|
|
|
|
|
|
UASRCS = $(CHIP_UASRCS) $(CMN_UASRCS)
|
|
|
|
UAOBJS = $(UASRCS:.S=$(OBJEXT))
|
|
|
|
|
|
|
|
UCSRCS = $(CHIP_UCSRCS) $(CMN_UCSRCS)
|
|
|
|
UCOBJS = $(UCSRCS:.c=$(OBJEXT))
|
|
|
|
|
|
|
|
USRCS = $(UASRCS) $(UCSRCS)
|
|
|
|
UOBJS = $(UAOBJS) $(UCOBJS)
|
|
|
|
|
|
|
|
KBIN = libkarch$(LIBEXT)
|
|
|
|
BIN = libarch$(LIBEXT)
|
|
|
|
|
2020-07-22 15:21:42 +02:00
|
|
|
LDFLAGS += $(ARCHSCRIPT) $(EXTRALINKCMDS)
|
2007-04-28 21:39:18 +02:00
|
|
|
|
2016-05-17 18:43:15 +02:00
|
|
|
# Override in Make.defs if linker is not 'ld'
|
|
|
|
|
|
|
|
LDSTARTGROUP ?= --start-group
|
|
|
|
LDENDGROUP ?= --end-group
|
|
|
|
|
2020-05-19 11:43:29 +02:00
|
|
|
BOARDMAKE = $(if $(wildcard board$(DELIM)Makefile),y,)
|
2012-11-11 15:36:01 +01:00
|
|
|
|
2020-05-18 16:18:15 +02:00
|
|
|
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
|
2020-05-19 11:43:29 +02:00
|
|
|
LIBPATHS += -L"${shell cygpath -w "$(TOPDIR)$(DELIM)staging"}"
|
2012-11-12 02:54:54 +01:00
|
|
|
ifeq ($(BOARDMAKE),y)
|
2020-05-19 11:43:29 +02:00
|
|
|
LIBPATHS += -L"${shell cygpath -w "$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board"}"
|
2012-11-11 15:36:01 +01:00
|
|
|
endif
|
|
|
|
|
2009-06-10 04:05:05 +02:00
|
|
|
else
|
2020-05-19 11:43:29 +02:00
|
|
|
LIBPATHS += -L"$(TOPDIR)$(DELIM)staging"
|
2012-11-12 02:54:54 +01:00
|
|
|
ifeq ($(BOARDMAKE),y)
|
2020-05-19 11:43:29 +02:00
|
|
|
LIBPATHS += -L"$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board"
|
2012-11-11 15:36:01 +01:00
|
|
|
endif
|
2020-05-19 11:43:29 +02:00
|
|
|
|
2012-11-11 15:36:01 +01:00
|
|
|
endif
|
2012-11-11 14:52:31 +01:00
|
|
|
|
|
|
|
LDLIBS = $(patsubst %.a,%,$(patsubst lib%,-l%,$(LINKLIBS)))
|
2012-11-12 02:54:54 +01:00
|
|
|
ifeq ($(BOARDMAKE),y)
|
|
|
|
LDLIBS += -lboard
|
|
|
|
endif
|
2007-04-28 21:39:18 +02:00
|
|
|
|
2014-01-23 14:41:00 +01:00
|
|
|
VPATH += chip
|
|
|
|
VPATH += common
|
|
|
|
VPATH += $(ARCH_SUBDIR)
|
2007-04-28 21:39:18 +02:00
|
|
|
|
2017-05-14 00:01:38 +02:00
|
|
|
ifeq ($(CONFIG_ARCH_TOOLCHAIN_IAR),y)
|
2016-04-02 15:53:52 +02:00
|
|
|
VPATH += $(ARCH_SUBDIR)$(DELIM)iar
|
2017-05-13 21:28:15 +02:00
|
|
|
else # ifeq ($(CONFIG_ARCH_TOOLCHAIN_GNU),y)
|
2016-04-02 15:53:52 +02:00
|
|
|
VPATH += $(ARCH_SUBDIR)$(DELIM)gnu
|
|
|
|
endif
|
|
|
|
|
2013-03-23 15:46:02 +01:00
|
|
|
all: $(HEAD_OBJ) $(BIN)
|
2007-04-28 21:39:18 +02:00
|
|
|
|
2016-04-02 15:53:52 +02:00
|
|
|
.PHONY: board$(DELIM)libboard$(LIBEXT)
|
2012-01-29 21:07:16 +01:00
|
|
|
|
2013-03-23 15:46:02 +01:00
|
|
|
$(AOBJS) $(UAOBJS) $(HEAD_OBJ): %$(OBJEXT): %.S
|
2008-01-08 18:06:21 +01:00
|
|
|
$(call ASSEMBLE, $<, $@)
|
2007-04-28 21:39:18 +02:00
|
|
|
|
2013-03-23 15:46:02 +01:00
|
|
|
$(COBJS) $(UCOBJS): %$(OBJEXT): %.c
|
2008-01-08 18:06:21 +01:00
|
|
|
$(call COMPILE, $<, $@)
|
2007-04-28 21:39:18 +02:00
|
|
|
|
2020-05-01 21:23:04 +02:00
|
|
|
ifeq ($(CONFIG_BUILD_FLAT),y)
|
|
|
|
$(BIN): $(OBJS)
|
2012-11-15 18:43:29 +01:00
|
|
|
$(call ARCHIVE, $@, $(OBJS))
|
2020-05-01 21:23:04 +02:00
|
|
|
else
|
|
|
|
$(BIN): $(UOBJS)
|
2013-03-23 15:46:02 +01:00
|
|
|
$(call ARCHIVE, $@, $(UOBJS))
|
2020-05-01 21:23:04 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
$(KBIN): $(OBJS)
|
|
|
|
$(call ARCHIVE, $@, $(OBJS))
|
2013-03-23 15:46:02 +01:00
|
|
|
|
2016-04-02 15:53:52 +02:00
|
|
|
board$(DELIM)libboard$(LIBEXT):
|
2020-09-14 18:53:37 +02:00
|
|
|
$(Q) $(MAKE) -C board libboard$(LIBEXT) EXTRAFLAGS="$(EXTRAFLAGS)"
|
2007-04-28 21:39:18 +02:00
|
|
|
|
2016-04-02 15:53:52 +02:00
|
|
|
nuttx$(EXEEXT): $(HEAD_OBJ) board$(DELIM)libboard$(LIBEXT)
|
2012-11-02 01:22:52 +01:00
|
|
|
$(Q) echo "LD: nuttx"
|
2016-11-03 15:57:55 +01:00
|
|
|
$(Q) $(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) $(EXTRA_LIBPATHS) \
|
2013-04-07 16:43:44 +02:00
|
|
|
-o $(NUTTX) $(HEAD_OBJ) $(EXTRA_OBJS) \
|
2020-07-15 14:51:26 +02:00
|
|
|
$(LDSTARTGROUP) $(LDLIBS) $(EXTRA_LIBS) $(LDENDGROUP)
|
2012-11-14 21:59:36 +01:00
|
|
|
ifneq ($(CONFIG_WINDOWS_NATIVE),y)
|
2013-04-07 16:43:44 +02:00
|
|
|
$(Q) $(NM) $(NUTTX) | \
|
2007-04-28 21:39:18 +02:00
|
|
|
grep -v '\(compiled\)\|\(\$(OBJEXT)$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
|
2016-04-02 15:53:52 +02:00
|
|
|
sort > $(TOPDIR)$(DELIM)System.map
|
2012-11-14 21:59:36 +01:00
|
|
|
endif
|
2007-04-28 21:39:18 +02:00
|
|
|
|
2011-07-12 00:52:51 +02:00
|
|
|
# This is part of the top-level export target
|
2012-05-21 15:34:09 +02:00
|
|
|
# Note that there may not be a head object if layout is handled
|
|
|
|
# by the linker configuration.
|
2011-07-12 00:52:51 +02:00
|
|
|
|
2016-04-02 15:53:52 +02:00
|
|
|
export_startup: board$(DELIM)libboard$(LIBEXT) $(STARTUP_OBJS)
|
2014-09-04 21:31:34 +02:00
|
|
|
ifneq ($(STARTUP_OBJS),)
|
2016-04-02 15:53:52 +02:00
|
|
|
$(Q) if [ -d "$(EXPORT_DIR)$(DELIM)startup" ]; then \
|
|
|
|
cp -f $(STARTUP_OBJS) "$(EXPORT_DIR)$(DELIM)startup$(DELIM)."; \
|
2011-07-12 00:52:51 +02:00
|
|
|
else \
|
2016-04-02 15:53:52 +02:00
|
|
|
echo "$(EXPORT_DIR)$(DELIM)startup does not exist"; \
|
2012-11-03 00:22:48 +01:00
|
|
|
exit 1; \
|
2012-11-16 15:13:04 +01:00
|
|
|
fi
|
2012-05-21 15:34:09 +02:00
|
|
|
endif
|
2011-07-12 00:52:51 +02:00
|
|
|
|
|
|
|
# Dependencies
|
|
|
|
|
2020-12-15 14:52:41 +01:00
|
|
|
makedepfile: $(CSRCS:.c=.ddc) $(ASRCS:.S=.dds) $(HEAD_ASRC:.S=.dds)
|
2020-11-18 17:44:58 +01:00
|
|
|
$(call CATFILE, Make.dep, $^)
|
|
|
|
$(call DELFILE, $^)
|
|
|
|
|
2020-07-22 09:54:29 +02:00
|
|
|
.depend: Makefile chip$(DELIM)Make.defs $(SRCS) $(TOPDIR)$(DELIM).config
|
2012-11-12 02:54:54 +01:00
|
|
|
ifeq ($(BOARDMAKE),y)
|
2020-09-14 18:53:37 +02:00
|
|
|
$(Q) $(MAKE) -C board depend
|
2012-11-11 15:36:01 +01:00
|
|
|
endif
|
2020-11-18 17:44:58 +01:00
|
|
|
$(Q) $(MAKE) makedepfile DEPPATH="$(patsubst %,--dep-path %,$(subst :, ,$(VPATH)))"
|
2020-03-23 03:44:03 +01:00
|
|
|
$(Q) touch $@
|
2007-04-28 21:39:18 +02:00
|
|
|
|
2020-03-23 03:44:03 +01:00
|
|
|
depend: .depend
|
2007-04-28 21:39:18 +02:00
|
|
|
|
2020-09-23 13:48:02 +02:00
|
|
|
context::
|
|
|
|
|
|
|
|
clean_context::
|
|
|
|
|
2007-04-28 21:39:18 +02:00
|
|
|
clean:
|
2012-11-12 02:54:54 +01:00
|
|
|
ifeq ($(BOARDMAKE),y)
|
2020-09-14 18:53:37 +02:00
|
|
|
$(Q) $(MAKE) -C board clean
|
2012-11-11 15:36:01 +01:00
|
|
|
endif
|
2013-03-23 15:46:02 +01:00
|
|
|
$(call DELFILE, $(KBIN))
|
|
|
|
$(call DELFILE, $(BIN))
|
2021-02-19 15:40:03 +01:00
|
|
|
ifneq ($(EXTRADELFILE),)
|
|
|
|
$(call DELFILE, $(EXTRADELFILE))
|
|
|
|
endif
|
2008-01-10 14:38:13 +01:00
|
|
|
$(call CLEAN)
|
2007-04-28 21:39:18 +02:00
|
|
|
|
|
|
|
distclean: clean
|
2012-11-12 02:54:54 +01:00
|
|
|
ifeq ($(BOARDMAKE),y)
|
2020-09-14 18:53:37 +02:00
|
|
|
$(Q) $(MAKE) -C board distclean
|
2012-11-11 15:36:01 +01:00
|
|
|
endif
|
2012-11-20 16:47:41 +01:00
|
|
|
$(call DELFILE, Make.dep)
|
2020-03-23 03:44:03 +01:00
|
|
|
$(call DELFILE, .depend)
|
2007-04-28 21:39:18 +02:00
|
|
|
|
|
|
|
-include Make.dep
|