Makefile 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. ##############################################################################
  2. # Build global options
  3. # NOTE: Can be overridden externally.
  4. #
  5. # Compiler options here.
  6. ifeq ($(USE_OPT),)
  7. USE_OPT = -O2 -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 = yes
  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 = no
  41. endif
  42. #
  43. # Build global options
  44. ##############################################################################
  45. ##############################################################################
  46. # Architecture or project specific options
  47. #
  48. # Stack size to be allocated to the Cortex-M process stack. This stack is
  49. # the stack used by the main() thread.
  50. ifeq ($(USE_PROCESS_STACKSIZE),)
  51. USE_PROCESS_STACKSIZE = 0x400
  52. endif
  53. # Stack size to the allocated to the Cortex-M main/exceptions stack. This
  54. # stack is used for processing interrupts and exceptions.
  55. ifeq ($(USE_EXCEPTIONS_STACKSIZE),)
  56. USE_EXCEPTIONS_STACKSIZE = 0x400
  57. endif
  58. # Enables the use of FPU on Cortex-M4 (no, softfp, hard).
  59. ifeq ($(USE_FPU),)
  60. USE_FPU = no
  61. endif
  62. #
  63. # Architecture or project specific options
  64. ##############################################################################
  65. ##############################################################################
  66. # Project, sources and paths
  67. #
  68. # Define project name here
  69. PROJECT = ch
  70. # Imported source files and paths
  71. CHIBIOS = ../../..
  72. # Startup files.
  73. include $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32f4xx.mk
  74. # HAL-OSAL files (optional).
  75. include $(CHIBIOS)/os/hal/hal.mk
  76. include $(CHIBIOS)/os/hal/templates/platform.mk
  77. include $(CHIBIOS)/os/hal/templates/board/board.mk
  78. include $(CHIBIOS)/os/hal/templates/osal/osal.mk
  79. # RTOS files (optional).
  80. #include $(CHIBIOS)/os/rt/rt.mk
  81. #include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
  82. # Other files (optional).
  83. #include $(CHIBIOS)/test/lib/test.mk
  84. #include $(CHIBIOS)/test/rt/rt_test.mk
  85. #include $(CHIBIOS)/test/oslib/oslib_test.mk
  86. # Define linker script file here
  87. LDSCRIPT= $(STARTUPLD)/STM32F407xG.ld
  88. # C sources that can be compiled in ARM or THUMB mode depending on the global
  89. # setting.
  90. CSRC = $(STARTUPSRC) \
  91. $(KERNSRC) \
  92. $(PORTSRC) \
  93. $(OSALSRC) \
  94. $(HALSRC) \
  95. $(PLATFORMSRC) \
  96. $(BOARDSRC) \
  97. $(TESTSRC) \
  98. main.c
  99. # C++ sources that can be compiled in ARM or THUMB mode depending on the global
  100. # setting.
  101. CPPSRC =
  102. # C sources to be compiled in ARM mode regardless of the global setting.
  103. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
  104. # option that results in lower performance and larger code size.
  105. ACSRC =
  106. # C++ sources to be compiled in ARM mode regardless of the global setting.
  107. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
  108. # option that results in lower performance and larger code size.
  109. ACPPSRC =
  110. # C sources to be compiled in THUMB mode regardless of the global setting.
  111. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
  112. # option that results in lower performance and larger code size.
  113. TCSRC =
  114. # C sources to be compiled in THUMB mode regardless of the global setting.
  115. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
  116. # option that results in lower performance and larger code size.
  117. TCPPSRC =
  118. # List ASM source files here
  119. ASMSRC =
  120. ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM)
  121. INCDIR = $(CHIBIOS)/os/license \
  122. $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \
  123. $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \
  124. $(CHIBIOS)/os/various
  125. #
  126. # Project, sources and paths
  127. ##############################################################################
  128. ##############################################################################
  129. # Compiler settings
  130. #
  131. MCU = cortex-m4
  132. #TRGT = arm-elf-
  133. TRGT = arm-none-eabi-
  134. CC = $(TRGT)gcc
  135. CPPC = $(TRGT)g++
  136. # Enable loading with g++ only if you need C++ runtime support.
  137. # NOTE: You can use C++ even without C++ support if you are careful. C++
  138. # runtime support makes code size explode.
  139. LD = $(TRGT)gcc
  140. #LD = $(TRGT)g++
  141. CP = $(TRGT)objcopy
  142. AS = $(TRGT)gcc -x assembler-with-cpp
  143. AR = $(TRGT)ar
  144. OD = $(TRGT)objdump
  145. SZ = $(TRGT)size
  146. HEX = $(CP) -O ihex
  147. BIN = $(CP) -O binary
  148. # ARM-specific options here
  149. AOPT =
  150. # THUMB-specific options here
  151. TOPT = -mthumb -DTHUMB
  152. # Define C warning options here
  153. CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes
  154. # Define C++ warning options here
  155. CPPWARN = -Wall -Wextra -Wundef
  156. #
  157. # Compiler settings
  158. ##############################################################################
  159. ##############################################################################
  160. # Start of user section
  161. #
  162. # List all user C define here, like -D_DEBUG=1
  163. UDEFS = -DSTM32F407xx
  164. # Define ASM defines here
  165. UADEFS =
  166. # List all user directories here
  167. UINCDIR =
  168. # List the user directory to look for the libraries here
  169. ULIBDIR =
  170. # List all user libraries here
  171. ULIBS =
  172. #
  173. # End of user defines
  174. ##############################################################################
  175. RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk
  176. include $(RULESPATH)/rules.mk
  177. misra:
  178. @wine lint-nt -w3 $(DEFS) pclint/co-gcc.lnt pclint/au-misra3.lnt pclint/waivers.lnt $(IINCDIR) $(HALSRC) $(OSALSRC) $(PLATFORMSRC) > misra.txt