Make.defs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. ############################################################################
  2. # configs/lc823450-xgevk/scripts/Make.defs
  3. #
  4. # Copyright (C) 2017 Sony Corporation. All rights reserved.
  5. # Author: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
  6. #
  7. # Redistribution and use in source and binary forms, with or without
  8. # modification, are permitted provided that the following conditions
  9. # are met:
  10. #
  11. # 1. Redistributions of source code must retain the above copyright
  12. # notice, this list of conditions and the following disclaimer.
  13. # 2. Redistributions in binary form must reproduce the above copyright
  14. # notice, this list of conditions and the following disclaimer in
  15. # the documentation and/or other materials provided with the
  16. # distribution.
  17. # 3. Neither the name NuttX nor the names of its contributors may be
  18. # used to endorse or promote products derived from this software
  19. # without specific prior written permission.
  20. #
  21. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  24. # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  25. # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  26. # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  27. # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  28. # OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  29. # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  30. # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  31. # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  32. # POSSIBILITY OF SUCH DAMAGE.
  33. #
  34. ############################################################################
  35. include ${TOPDIR}/.config
  36. include ${TOPDIR}/tools/Config.mk
  37. include ${TOPDIR}/arch/arm/src/armv7-m/Toolchain.defs
  38. ifeq ($(WINTOOL),y)
  39. # Windows-native toolchains
  40. DIRLINK = $(TOPDIR)/tools/copydir.sh
  41. DIRUNLINK = $(TOPDIR)/tools/unlink.sh
  42. MKDEP = $(TOPDIR)/tools/mkwindeps.sh
  43. ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
  44. ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
  45. ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script}"
  46. else
  47. # Linux/Cygwin-native toolchain
  48. MKDEP = $(TOPDIR)/tools/mkdeps$(HOSTEXEEXT)
  49. ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
  50. ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
  51. ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script
  52. endif
  53. CC = $(CROSSDEV)gcc
  54. CXX = $(CROSSDEV)g++
  55. CPP = $(CROSSDEV)gcc -E
  56. LD = $(CROSSDEV)ld
  57. AR = $(CROSSDEV)ar rcs
  58. NM = $(CROSSDEV)nm
  59. OBJCOPY = $(CROSSDEV)objcopy
  60. OBJDUMP = $(CROSSDEV)objdump
  61. 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'}
  62. ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
  63. ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
  64. ARCHOPTIMIZATION = -g
  65. endif
  66. ifneq ($(CONFIG_DEBUG_NOOPT),y)
  67. ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
  68. endif
  69. ARCHCFLAGS = -fno-builtin -ffunction-sections -fdata-sections -nostdinc
  70. ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new -fno-rtti -nostdinc++
  71. ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
  72. ARCHWARNINGSXX = -Wall -Wshadow -Wundef
  73. ARCHDEFINES =
  74. ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
  75. CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
  76. CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
  77. CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
  78. CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
  79. CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
  80. AFLAGS = $(CFLAGS) -D__ASSEMBLY__
  81. NXFLATLDFLAGS1 = -r -d -warn-common
  82. NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
  83. LDNXFLATFLAGS = -e main -s 2048
  84. ASMEXT = .S
  85. OBJEXT = .o
  86. LIBEXT = .a
  87. EXEEXT =
  88. ifneq ($(CROSSDEV),arm-nuttx-elf-)
  89. LDFLAGS += -nostartfiles -nodefaultlibs
  90. endif
  91. ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
  92. LDFLAGS += -g
  93. endif
  94. LDFLAGS += --gc-sections
  95. HOSTCC = gcc
  96. HOSTINCLUDES = -I.
  97. HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -g -pipe
  98. HOSTLDFLAGS =
  99. ifeq ($(CONFIG_MTD_LC823450),y)
  100. ARCH_LIBS += -lSdDr_patch_es2
  101. ARCH_LIBPATHS += -L"$(TOPDIR)/arch/arm/src/lc823450"
  102. ARCH_LIBS += $(ARCH_LIBS_OPT)--just-symbols=$(TOPDIR)/arch/arm/src/lc823450/rom_symbols.txt
  103. LDFLAGS +=--no-wchar-size-warning
  104. endif
  105. # NEVER use 'override' variables
  106. # NUTTX_EXTRA_LIBS and NUTTX_EXTRA_LIBPATHS are defined by out-of-repository
  107. EXTRA_LIBS := $(NUTTX_EXTRA_LIBS) $(ARCH_LIBS)
  108. EXTRA_LIBPATHS := $(NUTTX_EXTRA_LIBPATHS) $(ARCH_LIBPATHS)