Build System: It is no longer necessary to have a unique Make.defs file for each configuration. A board may share a common Make.defs file in the scripts directory.
This commit is contained in:
parent
7671befcb2
commit
316fde135c
@ -754,6 +754,9 @@
|
||||
| |-- Make.defs
|
||||
| `-- defconfig
|
||||
| ...
|
||||
|-- scripts/
|
||||
| |-- <i>(linker script files)</i>
|
||||
| `-- Make.defs <i>(optional</i>
|
||||
`-- <i>(other board-specific configuration sub-directories)</i>/
|
||||
</pre></ul>
|
||||
|
||||
@ -788,7 +791,14 @@
|
||||
Each board configuration is described by two files: <code>Make.defs</code> and <code>defconfig</code>.
|
||||
Typically, each set of configuration files is retained in a separate configuration sub-directory
|
||||
(<i><config1-dir></i>, <i><config2-dir></i>, .. in the above diagram).
|
||||
|
||||
</p>
|
||||
<p>
|
||||
NOTE: That the <code>Make.defs</code> file may reside in one of two locations:
|
||||
There may be a unique Make.defs file for each configuration in the configuration directory <i>OR</i>
|
||||
if that file is absent, there may be a common board <code>Make.defs</code> file in the <code>/scripts</code> directory.
|
||||
The <code>Make.defs</code> file in the configuration takes precedence if it is present.
|
||||
</p>
|
||||
<p>
|
||||
The procedure for configuring NuttX is described <a href="#configuringnuttx">below</a>,
|
||||
This paragraph will describe the contents of these configuration files.
|
||||
</p>
|
||||
|
@ -606,10 +606,15 @@ Instantiating "Canned" Configurations
|
||||
<config-dir> to the directory where you installed NuttX (TOPDIR):
|
||||
|
||||
Copy configs/<board-name>/<config-dir>/Make.def to{TOPDIR}/Make.defs
|
||||
OR
|
||||
Copy configs/<board-name>/scripts/Make.def to{TOPDIR}/Make.defs
|
||||
|
||||
Make.defs describes the rules needed by you tool chain to compile
|
||||
and link code. You may need to modify this file to match the
|
||||
specific needs of your toolchain.
|
||||
specific needs of your toolchain. NOTE that a configuration may
|
||||
have its own unique Make.defs file in its configuration directory or
|
||||
it may use a common Make.defs file for the board in the scripts/
|
||||
directory. The first takes precedence.
|
||||
|
||||
Copy configs/<board-name>/<config-dir>/defconfig to{TOPDIR}/.config
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
############################################################################
|
||||
# configs/b-l475e-iot01a/nsh/Make.defs
|
||||
# configs/b-l475e-iot01a/scripts/Make.defs
|
||||
#
|
||||
# Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||
#
|
||||
@ -115,4 +115,4 @@ HOSTLDFLAGS =
|
||||
define DOWNLOAD
|
||||
$(Q) echo "Download firmware $(1).bin"
|
||||
$(Q) st-flash write $(1).bin 0x08000000
|
||||
endef
|
||||
endef
|
@ -1,128 +0,0 @@
|
||||
############################################################################
|
||||
# configs/same70-xplained/nsh/Make.defs
|
||||
#
|
||||
# Copyright (C) 2015, 2017 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include ${TOPDIR}/.config
|
||||
include ${TOPDIR}/tools/Config.mk
|
||||
include ${TOPDIR}/arch/arm/src/armv7-m/Toolchain.defs
|
||||
|
||||
ifeq ($(CONFIG_ARMV7M_DTCM),y)
|
||||
LDSCRIPT = flash-dtcm.ld
|
||||
else
|
||||
LDSCRIPT = flash-sram.ld
|
||||
endif
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
# Windows-native toolchains
|
||||
DIRLINK = $(TOPDIR)/tools/copydir.sh
|
||||
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
|
||||
MKDEP = $(TOPDIR)/tools/mkwindeps.sh
|
||||
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
|
||||
ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
|
||||
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
|
||||
else
|
||||
# Linux/Cygwin-native toolchain
|
||||
MKDEP = $(TOPDIR)/tools/mkdeps$(HOSTEXEEXT)
|
||||
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
|
||||
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
|
||||
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
|
||||
endif
|
||||
|
||||
CC = $(CROSSDEV)gcc
|
||||
CXX = $(CROSSDEV)g++
|
||||
CPP = $(CROSSDEV)gcc -E
|
||||
LD = $(CROSSDEV)ld
|
||||
AR = $(CROSSDEV)ar rcs
|
||||
NM = $(CROSSDEV)nm
|
||||
OBJCOPY = $(CROSSDEV)objcopy
|
||||
OBJDUMP = $(CROSSDEV)objdump
|
||||
|
||||
ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
|
||||
ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
ARCHOPTIMIZATION = -g
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_DEBUG_NOOPT),y)
|
||||
ARCHOPTIMIZATION += $(MAXOPTIMIZATION)
|
||||
endif
|
||||
|
||||
ARCHCFLAGS = -fno-builtin
|
||||
ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new -fno-rtti
|
||||
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -fno-strict-aliasing
|
||||
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
|
||||
ARCHDEFINES =
|
||||
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
|
||||
|
||||
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
|
||||
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
|
||||
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
|
||||
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
|
||||
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
|
||||
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
|
||||
|
||||
NXFLATLDFLAGS1 = -r -d -warn-common
|
||||
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
|
||||
LDNXFLATFLAGS = -e main -s 2048
|
||||
|
||||
# Loadable module definitions
|
||||
|
||||
CMODULEFLAGS = $(CFLAGS) -mlong-calls # --target1-abs
|
||||
|
||||
LDMODULEFLAGS = -r -e module_initialize
|
||||
ifeq ($(WINTOOL),y)
|
||||
LDMODULEFLAGS += -T "${shell cygpath -w $(TOPDIR)/libc/modlib/gnu-elf.ld}"
|
||||
else
|
||||
LDMODULEFLAGS += -T $(TOPDIR)/libc/modlib/gnu-elf.ld
|
||||
endif
|
||||
|
||||
ASMEXT = .S
|
||||
OBJEXT = .o
|
||||
LIBEXT = .a
|
||||
EXEEXT =
|
||||
|
||||
ifneq ($(CROSSDEV),arm-nuttx-elf-)
|
||||
LDFLAGS += -nostartfiles -nodefaultlibs
|
||||
endif
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
LDFLAGS += -g
|
||||
endif
|
||||
|
||||
|
||||
HOSTCC = gcc
|
||||
HOSTINCLUDES = -I.
|
||||
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -g -pipe
|
||||
HOSTLDFLAGS =
|
||||
|
@ -1,5 +1,5 @@
|
||||
############################################################################
|
||||
# configs/same70-xplained/netnsh/Make.defs
|
||||
# configs/same70-xplained/scripts/Make.defs
|
||||
#
|
||||
# Copyright (C) 2015, 2017 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
@ -92,6 +92,7 @@ static char *g_topdir = NULL; /* Full path to top-level NuttX buil
|
||||
static char *g_apppath = NULL; /* Full path to the application directory */
|
||||
static char *g_configtop = NULL; /* Full path to the top-level configuration directory */
|
||||
static char *g_configpath = NULL; /* Full path to the configuration sub-directory */
|
||||
static char *g_scriptspath = NULL; /* Full path to the scripts sub-directory */
|
||||
static char *g_verstring = "0.0"; /* Version String */
|
||||
|
||||
static char *g_srcdefconfig = NULL; /* Source defconfig file */
|
||||
@ -555,6 +556,16 @@ static void check_configdir(void)
|
||||
}
|
||||
|
||||
g_configpath = strdup(g_buffer);
|
||||
|
||||
snprintf(g_buffer, BUFFER_SIZE, "%s%cconfigs%c%s%cscripts",
|
||||
g_topdir, g_delim, g_delim, g_boarddir, g_delim);
|
||||
debug("check_configdir: Checking scriptspath=%s\n", g_buffer);
|
||||
|
||||
g_scriptspath = NULL;
|
||||
if (verify_optiondir(g_buffer))
|
||||
{
|
||||
g_scriptspath = strdup(g_buffer);
|
||||
}
|
||||
}
|
||||
|
||||
static void read_configfile(void)
|
||||
@ -724,14 +735,32 @@ static void check_configuration(void)
|
||||
|
||||
g_srcdefconfig = strdup(g_buffer);
|
||||
|
||||
/* Try the Make.defs file */
|
||||
|
||||
snprintf(g_buffer, BUFFER_SIZE, "%s%cMake.defs", g_configpath, g_delim);
|
||||
debug("check_configuration: Checking %s\n", g_buffer);
|
||||
if (!verify_file(g_buffer))
|
||||
{
|
||||
fprintf(stderr, "ERROR: Configuration corrupted in %s\n", g_configpath);
|
||||
fprintf(stderr, " No Make.defs file found.\n");
|
||||
enumerate_configs();
|
||||
exit(EXIT_FAILURE);
|
||||
/* An alternative location is the scripts/ directory */
|
||||
|
||||
if (g_scriptspath != NULL)
|
||||
{
|
||||
snprintf(g_buffer, BUFFER_SIZE, "%s%cMake.defs", g_scriptspath, g_delim);
|
||||
debug("check_configuration: Checking %s\n", g_buffer);
|
||||
if (!verify_file(g_buffer))
|
||||
{
|
||||
fprintf(stderr, "ERROR: No Make.defs file in %s\n", g_configpath);
|
||||
fprintf(stderr, " No Make.defs file in %s\n", g_scriptspath);
|
||||
enumerate_configs();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "ERROR: No Make.defs file in %s\n", g_configpath);
|
||||
enumerate_configs();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
g_srcmakedefs = strdup(g_buffer);
|
||||
|
@ -140,8 +140,13 @@ src_makedefs="${configpath}/Make.defs"
|
||||
dest_makedefs="${TOPDIR}/Make.defs"
|
||||
|
||||
if [ ! -r "${src_makedefs}" ]; then
|
||||
echo "File \"${src_makedefs}\" does not exist"
|
||||
exit 4
|
||||
boardpath=`dirname $configpath`
|
||||
src_makedefs="${boardpath}/scripts/Make.defs"
|
||||
|
||||
if [ ! -r "${src_makedefs}" ]; then
|
||||
echo "File Make.defs could not be found"
|
||||
exit 4
|
||||
fi
|
||||
fi
|
||||
|
||||
src_config="${configpath}/defconfig"
|
||||
|
Loading…
Reference in New Issue
Block a user