IAR.mk 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. ################################################################################
  2. # \file IAR.mk
  3. # \version 1.0
  4. #
  5. # \brief
  6. # IAR toolchain configuration.
  7. #
  8. ################################################################################
  9. # \copyright
  10. # Copyright 2018-2019 Cypress Semiconductor Corporation
  11. # SPDX-License-Identifier: Apache-2.0
  12. #
  13. # Licensed under the Apache License, Version 2.0 (the "License");
  14. # you may not use this file except in compliance with the License.
  15. # You may obtain a copy of the License at
  16. #
  17. # http://www.apache.org/licenses/LICENSE-2.0
  18. #
  19. # Unless required by applicable law or agreed to in writing, software
  20. # distributed under the License is distributed on an "AS IS" BASIS,
  21. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  22. # See the License for the specific language governing permissions and
  23. # limitations under the License.
  24. ################################################################################
  25. ifeq ($(WHICHFILE),true)
  26. $(info Processing $(lastword $(MAKEFILE_LIST)))
  27. endif
  28. #
  29. # The base path to the IAR cross compilation executables
  30. #
  31. ifeq ($(CY_COMPILER_PATH),)
  32. CY_CROSSPATH=$(CY_COMPILER_IAR_DIR)/bin
  33. else
  34. CY_CROSSPATH=$(CY_COMPILER_PATH)/bin
  35. endif
  36. #
  37. # Build tools
  38. #
  39. CC=$(CY_CROSSPATH)/iccarm.exe
  40. CXX=$(CC)
  41. AS=$(CY_CROSSPATH)/iasmarm.exe
  42. AR=$(CY_CROSSPATH)/iarchive.exe
  43. LD=$(CY_CROSSPATH)/ilinkarm.exe
  44. #
  45. # DEBUG/NDEBUG selection
  46. #
  47. ifeq ($(CONFIG),Debug)
  48. CY_TOOLCHAIN_DEBUG_FLAG=-DDEBUG
  49. CY_TOOLCHAIN_OPTIMIZATION=-Ol
  50. else
  51. ifeq ($(CONFIG),Release)
  52. CY_TOOLCHAIN_DEBUG_FLAG=-DNDEBUG
  53. CY_TOOLCHAIN_OPTIMIZATION=-Ohs
  54. else
  55. CY_TOOLCHAIN_DEBUG_FLAG=
  56. CY_TOOLCHAIN_OPTIMIZATION=
  57. endif
  58. endif
  59. #
  60. # Flags common to compile and link
  61. #
  62. ifneq ($(VERBOSE),)
  63. CY_TOOLCHAIN_SILENT_CFLAGS=
  64. CY_TOOLCHAIN_SILENT_SFLAGS=
  65. else
  66. CY_TOOLCHAIN_SILENT_CFLAGS=--silent
  67. CY_TOOLCHAIN_SILENT_SFLAGS=-S
  68. endif
  69. #
  70. # CPU core specifics
  71. #
  72. ifeq ($(CORE),CM0P)
  73. CY_TOOLCHAIN_FLAGS_CORE=--cpu Cortex-M0+
  74. CY_TOOLCHAIN_VFP_FLAGS=
  75. else
  76. CY_TOOLCHAIN_FLAGS_CORE=--cpu Cortex-M4
  77. CY_TOOLCHAIN_VFP_FLAGS=--fpu FPv4-SP
  78. ifeq ($(VFP_SELECT),hardfp)
  79. CY_TOOLCHAIN_VFP_CFLAGS=$(CY_TOOLCHAIN_VFP_FLAGS) --aapcs vfp
  80. else
  81. CY_TOOLCHAIN_VFP_CFLAGS=$(CY_TOOLCHAIN_VFP_FLAGS) --aapcs std
  82. endif
  83. endif
  84. #
  85. # Command line flags for c-files
  86. #
  87. CY_TOOLCHAIN_CFLAGS=\
  88. -c\
  89. $(CY_TOOLCHAIN_FLAGS_CORE)\
  90. $(CY_TOOLCHAIN_OPTIMIZATION)\
  91. $(CY_TOOLCHAIN_VFP_CFLAGS)\
  92. $(CY_TOOLCHAIN_SILENT_CFLAGS)\
  93. --endian=little\
  94. -e\
  95. --enable_restrict\
  96. --no_wrap_diagnostics
  97. ifeq ($(CONFIG),Debug)
  98. CY_TOOLCHAIN_CFLAGS+=--debug
  99. endif
  100. #
  101. # Command line flags for cpp-files
  102. #
  103. CY_TOOLCHAIN_CXXFLAGS=\
  104. $(CY_TOOLCHAIN_CFLAGS)\
  105. --c++\
  106. --no_rtti\
  107. --no_exceptions
  108. #
  109. # Command line flags for s-files
  110. #
  111. CY_TOOLCHAIN_ASFLAGS=\
  112. -c\
  113. $(CY_TOOLCHAIN_FLAGS_CORE)\
  114. $(CY_TOOLCHAIN_VFP_FLAGS)\
  115. $(CY_TOOLCHAIN_SILENT_SFLAGS)\
  116. -s+\
  117. -w+\
  118. -r
  119. #
  120. # Command line flags for linking
  121. #
  122. CY_TOOLCHAIN_LDFLAGS=\
  123. $(CY_TOOLCHAIN_FLAGS_CORE)\
  124. $(CY_TOOLCHAIN_VFP_FLAGS)\
  125. $(CY_TOOLCHAIN_SILENT_CFLAGS)\
  126. #
  127. # Command line flags for archiving
  128. #
  129. CY_TOOLCHAIN_ARFLAGS=\
  130. --create\
  131. --verbose
  132. #
  133. # Toolchain-specific suffixes
  134. #
  135. CY_TOOLCHAIN_SUFFIX_S=S
  136. CY_TOOLCHAIN_SUFFIX_s=s
  137. CY_TOOLCHAIN_SUFFIX_C=c
  138. CY_TOOLCHAIN_SUFFIX_H=h
  139. CY_TOOLCHAIN_SUFFIX_CPP=cpp
  140. CY_TOOLCHAIN_SUFFIX_HPP=hpp
  141. CY_TOOLCHAIN_SUFFIX_O=o
  142. CY_TOOLCHAIN_SUFFIX_A=a
  143. CY_TOOLCHAIN_SUFFIX_D=d
  144. CY_TOOLCHAIN_SUFFIX_LS=icf
  145. CY_TOOLCHAIN_SUFFIX_MAP=map
  146. CY_TOOLCHAIN_SUFFIX_TARGET=elf
  147. CY_TOOLCHAIN_SUFFIX_ARCHIVE=a
  148. #
  149. # Toolchain specific flags
  150. #
  151. CY_TOOLCHAIN_OUTPUT_OPTION=-o
  152. CY_TOOLCHAIN_MAPFILE=--map=
  153. CY_TOOLCHAIN_LSFLAGS=--config=
  154. CY_TOOLCHAIN_INCRSPFILE=-f
  155. CY_TOOLCHAIN_INCRSPFILE_ASM=-f
  156. CY_TOOLCHAIN_OBJRSPFILE=-f
  157. #
  158. # Produce a makefile dependency rule for each input file
  159. #
  160. CY_TOOLCHAIN_DEPENDENCIES=--dependencies=m "$(subst .$(CY_TOOLCHAIN_SUFFIX_O),.$(CY_TOOLCHAIN_SUFFIX_D),$@)"
  161. #
  162. # Additional includes in the compilation process based on this
  163. # toolchain
  164. #
  165. CY_TOOLCHAIN_INCLUDES=
  166. #
  167. # Additional libraries in the link process based on this toolchain
  168. #
  169. CY_TOOLCHAIN_DEFINES=