Makefile 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. ##############################################################################
  2. # Build global options
  3. # NOTE: Can be overridden externally.
  4. #
  5. # Compiler options here.
  6. ifeq ($(USE_OPT),)
  7. USE_OPT = -O0 -ggdb -fomit-frame-pointer -falign-functions=16
  8. endif
  9. # C specific options here (added to USE_OPT).
  10. ifeq ($(USE_COPT),)
  11. USE_COPT =
  12. endif
  13. # C++ specific options here (added to USE_OPT).
  14. ifeq ($(USE_CPPOPT),)
  15. USE_CPPOPT = -fno-rtti
  16. endif
  17. # Enable this if you want the linker to remove unused code and data
  18. ifeq ($(USE_LINK_GC),)
  19. USE_LINK_GC = yes
  20. endif
  21. # Linker extra options here.
  22. ifeq ($(USE_LDOPT),)
  23. USE_LDOPT =
  24. endif
  25. # Enable this if you want link time optimizations (LTO)
  26. ifeq ($(USE_LTO),)
  27. USE_LTO = yes
  28. endif
  29. # If enabled, this option allows to compile the application in THUMB mode.
  30. ifeq ($(USE_THUMB),)
  31. USE_THUMB = no
  32. endif
  33. # Enable this if you want to see the full log while compiling.
  34. ifeq ($(USE_VERBOSE_COMPILE),)
  35. USE_VERBOSE_COMPILE = no
  36. endif
  37. # If enabled, this option makes the build process faster by not compiling
  38. # modules not used in the current configuration.
  39. ifeq ($(USE_SMART_BUILD),)
  40. USE_SMART_BUILD = yes
  41. endif
  42. #
  43. # Build global options
  44. ##############################################################################
  45. ##############################################################################
  46. # Architecture or project specific options
  47. #
  48. # Stack size to be allocated to the ARM System/User stack. This
  49. # stack is the stack used by the main() thread.
  50. ifeq ($(USE_SYSTEM_STACKSIZE),)
  51. USE_SYSTEM_STACKSIZE = 0x400
  52. endif
  53. # Stack size to the allocated to the ARM IRQ stack. This
  54. # stack is used for processing interrupts and exceptions.
  55. ifeq ($(USE_EXCEPTIONS_STACKSIZE),)
  56. USE_IRQ_STACKSIZE = 0x400
  57. endif
  58. # Stack size to the allocated to the ARM FIQ stack. This
  59. # stack is used for processing interrupts and exceptions.
  60. ifeq ($(USE_FIQ_STACKSIZE),)
  61. USE_FIQ_STACKSIZE = 0x400
  62. endif
  63. # Stack size to the allocated to the ARM Supervisor stack. This
  64. # stack is used for processing interrupts and exceptions.
  65. ifeq ($(USE_SUPERVISOR_STACKSIZE),)
  66. USE_SUPERVISOR_STACKSIZE = 8
  67. endif
  68. # Stack size to the allocated to the ARM Undefined stack. This
  69. # stack is used for processing interrupts and exceptions.
  70. ifeq ($(USE_UND_STACKSIZE),)
  71. USE_UND_STACKSIZE = 8
  72. endif
  73. # Stack size to the allocated to the ARM Abort stack. This
  74. # stack is used for processing interrupts and exceptions.
  75. ifeq ($(USE_ABT_STACKSIZE),)
  76. USE_ABT_STACKSIZE = 8
  77. endif
  78. # Enables the use of FPU.
  79. ifeq ($(USE_FPU),)
  80. USE_FPU = no
  81. endif
  82. #
  83. # Architecture or project specific options
  84. ##############################################################################
  85. ##############################################################################
  86. # Project, sources and paths
  87. #
  88. # Define project name here
  89. PROJECT = ch
  90. # Imported source files and paths
  91. CHIBIOS = ../../..
  92. CONFDIR := ./cfg
  93. BUILDDIR := ./build
  94. DEPDIR := ./.dep
  95. # Licensing files.
  96. include $(CHIBIOS)/os/license/license.mk
  97. # Startup files.
  98. include $(CHIBIOS)/os/common/startup/ARMCAx-TZ/compilers/GCC/mk/startup_sama5d2.mk
  99. # HAL-OSAL files (optional).
  100. include $(CHIBIOS)/os/hal/hal.mk
  101. include $(CHIBIOS)/os/hal/ports/SAMA/SAMA5D2x/platform.mk
  102. include $(CHIBIOS)/os/hal/boards/ATSAMA5D2_XULT/board.mk
  103. include $(CHIBIOS)/os/hal/osal/rt/osal.mk
  104. # RTOS files (optional).
  105. include $(CHIBIOS)/os/rt/rt.mk
  106. include $(CHIBIOS)/os/common/ports/ARMCAx-TZ/compilers/GCC/mk/port_generic.mk
  107. # Other files (optional).
  108. include $(CHIBIOS)/test/lib/test.mk
  109. include $(CHIBIOS)/test/rt/rt_test.mk
  110. include $(CHIBIOS)/test/oslib/oslib_test.mk
  111. # Define linker script file here
  112. #LDSCRIPT= $(STARTUPLD)/SAMA5D2.ld
  113. # Only if SAMA_NO_INIT is TRUE
  114. LDSCRIPT= $(STARTUPLD)/SAMA5D2ddr.ld
  115. # C sources that can be compiled in ARM or THUMB mode depending on the global
  116. # setting.
  117. CSRC = $(ALLCSRC) \
  118. $(TESTSRC) \
  119. main.c
  120. # C++ sources that can be compiled in ARM or THUMB mode depending on the global
  121. # setting.
  122. CPPSRC = $(ALLCPPSRC)
  123. # C sources to be compiled in ARM mode regardless of the global setting.
  124. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
  125. # option that results in lower performance and larger code size.
  126. ACSRC =
  127. # C++ sources to be compiled in ARM mode regardless of the global setting.
  128. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
  129. # option that results in lower performance and larger code size.
  130. ACPPSRC =
  131. # C sources to be compiled in THUMB mode regardless of the global setting.
  132. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
  133. # option that results in lower performance and larger code size.
  134. TCSRC =
  135. # C sources to be compiled in THUMB mode regardless of the global setting.
  136. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
  137. # option that results in lower performance and larger code size.
  138. TCPPSRC =
  139. # List ASM source files here
  140. # List ASM source files here
  141. ASMSRC = $(ALLASMSRC)
  142. ASMXSRC = $(ALLXASMSRC)
  143. INCDIR = $(CONFDIR) $(ALLINC) $(TESTINC)
  144. #
  145. # Project, sources and paths
  146. ##############################################################################
  147. ##############################################################################
  148. # Compiler settings
  149. #
  150. MCU = cortex-a5
  151. #TRGT = arm-elf-
  152. TRGT = arm-none-eabi-
  153. CC = $(TRGT)gcc
  154. CPPC = $(TRGT)g++
  155. # Enable loading with g++ only if you need C++ runtime support.
  156. # NOTE: You can use C++ even without C++ support if you are careful. C++
  157. # runtime support makes code size explode.
  158. LD = $(TRGT)gcc
  159. #LD = $(TRGT)g++
  160. CP = $(TRGT)objcopy
  161. AS = $(TRGT)gcc -x assembler-with-cpp
  162. AR = $(TRGT)ar
  163. OD = $(TRGT)objdump
  164. SZ = $(TRGT)size
  165. HEX = $(CP) -O ihex
  166. BIN = $(CP) -O binary
  167. # ARM-specific options here
  168. AOPT =
  169. # THUMB-specific options here
  170. TOPT = -mthumb -DTHUMB
  171. # Define C warning options here
  172. CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes
  173. # Define C++ warning options here
  174. CPPWARN = -Wall -Wextra -Wundef
  175. #
  176. # Compiler settings
  177. ##############################################################################
  178. ##############################################################################
  179. # Start of user section
  180. #
  181. # List all user C define here, like -D_DEBUG=1
  182. UDEFS =
  183. # Define ASM defines here
  184. UADEFS =
  185. # List all user directories here
  186. UINCDIR =
  187. # List the user directory to look for the libraries here
  188. ULIBDIR =
  189. # List all user libraries here
  190. ULIBS =
  191. #
  192. # End of user defines
  193. ##############################################################################
  194. RULESPATH = $(CHIBIOS)/os/common/startup/ARMCAx-TZ/compilers/GCC
  195. include $(RULESPATH)/rules.mk
  196. ##############################################################################
  197. # MISRA check rule, requires PCLint and the setup files, not provided.
  198. #
  199. misra:
  200. @lint-nt -v -w3 $(DEFS) pclint/co-gcc.lnt pclint/au-misra3.lnt pclint/waivers.lnt $(IINCDIR) $(CSRC) &> misra.txt