chibios_board.mk 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. ##############################################################################
  2. # Build global options
  3. # NOTE: Can be overridden externally.
  4. #
  5. # Compiler options here.
  6. ifeq ($(USE_OPT),)
  7. USE_OPT = -g -fomit-frame-pointer -falign-functions=16
  8. endif
  9. # C specific options here (added to USE_OPT).
  10. ifeq ($(USE_COPT),)
  11. USE_COPT = -Os
  12. endif
  13. # C++ specific options here (added to USE_OPT).
  14. ifeq ($(USE_CPPOPT),)
  15. USE_CPPOPT = -fno-rtti -std=gnu++11
  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 = no
  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. include $(CHIBIOS)/os/various/cpp_wrappers/chcpp.mk
  43. ifeq ($(USE_FATFS),yes)
  44. include $(CHIBIOS)/os/various/fatfs_bindings/fatfs.mk
  45. endif
  46. #
  47. # Build global options
  48. ##############################################################################
  49. ##############################################################################
  50. # Architecture or project specific options
  51. #
  52. HWDEF = $(AP_HAL)/hwdef
  53. # Stack size to be allocated to the Cortex-M process stack. This stack is
  54. # the stack used by the main() thread.
  55. ifeq ($(USE_PROCESS_STACKSIZE),)
  56. USE_PROCESS_STACKSIZE = 0x400
  57. endif
  58. # Stack size to the allocated to the Cortex-M main/exceptions stack. This
  59. # stack is used for processing interrupts and exceptions.
  60. ifeq ($(USE_EXCEPTIONS_STACKSIZE),)
  61. USE_EXCEPTIONS_STACKSIZE = 0x400
  62. endif
  63. # Enables the use of FPU (no, softfp, hard).
  64. ifeq ($(USE_FPU),)
  65. USE_FPU = hard
  66. endif
  67. #
  68. # Architecture or project specific options
  69. ##############################################################################
  70. ##############################################################################
  71. # Project, sources and paths
  72. #
  73. # Define project name here
  74. PROJECT = ch
  75. # Imported source files and paths
  76. # Startup files.
  77. include $(CHIBIOS)/$(CHIBIOS_STARTUP_MK)
  78. # HAL-OSAL files (optional).
  79. include $(CHIBIOS)/os/hal/hal.mk
  80. include $(CHIBIOS)/$(CHIBIOS_PLATFORM_MK)
  81. include $(CHIBIOS)/os/hal/osal/rt/osal.mk
  82. # RTOS files (optional).
  83. include $(CHIBIOS)/os/rt/rt.mk
  84. include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
  85. # Other files (optional).
  86. #include $(CHIBIOS)/test/rt/test.mk
  87. include $(CHIBIOS)/os/hal/lib/streams/streams.mk
  88. ifeq ($(USE_FATFS),yes)
  89. include $(CHIBIOS)/os/various/cpp_wrappers/chcpp.mk
  90. include $(CHIBIOS)/os/various/fatfs_bindings/fatfs.mk
  91. endif
  92. # C sources that can be compiled in ARM or THUMB mode depending on the global
  93. # setting.
  94. CSRC = $(sort $(ALLCSRC))
  95. CSRC += $(HWDEF)/common/stubs.c \
  96. $(HWDEF)/common/board.c \
  97. $(HWDEF)/common/usbcfg.c \
  98. $(HWDEF)/common/usbcfg_dualcdc.c \
  99. $(HWDEF)/common/usbcfg_common.c \
  100. $(HWDEF)/common/flash.c \
  101. $(HWDEF)/common/malloc.c \
  102. $(HWDEF)/common/hrt.c \
  103. $(HWDEF)/common/stm32_util.c \
  104. $(HWDEF)/common/bouncebuffer.c \
  105. $(HWDEF)/common/watchdog.c
  106. # $(TESTSRC) \
  107. # test.c
  108. # C++ sources that can be compiled in ARM or THUMB mode depending on the global
  109. # setting.
  110. CPPSRC = $(sort $(ALLCPPSRC))
  111. # C sources to be compiled in ARM mode regardless of the global setting.
  112. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
  113. # option that results in lower performance and larger code size.
  114. ACSRC =
  115. # C++ sources to be compiled in ARM mode regardless of the global setting.
  116. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
  117. # option that results in lower performance and larger code size.
  118. ACPPSRC =
  119. # C sources to be compiled in THUMB mode regardless of the global setting.
  120. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
  121. # option that results in lower performance and larger code size.
  122. TCSRC =
  123. # C sources to be compiled in THUMB 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. TCPPSRC =
  127. # List ASM source files here
  128. ASMSRC = $(ALLASMSRC)
  129. ASMXSRC = $(ALLXASMSRC)
  130. INCDIR = $(CHIBIOS)/os/license \
  131. $(ALLINC) $(HWDEF)/common
  132. #
  133. # Project, sources and paths
  134. ##############################################################################
  135. ##############################################################################
  136. # Compiler settings
  137. #
  138. #TRGT = arm-elf-
  139. TRGT = arm-none-eabi-
  140. CC = $(TRGT)gcc
  141. CPPC = $(TRGT)g++
  142. # Enable loading with g++ only if you need C++ runtime support.
  143. # NOTE: You can use C++ even without C++ support if you are careful. C++
  144. # runtime support makes code size explode.
  145. LD = $(TRGT)gcc
  146. #LD = $(TRGT)g++
  147. CP = $(TRGT)objcopy
  148. AS = $(TRGT)gcc -x assembler-with-cpp
  149. AR = $(TRGT)ar
  150. OD = $(TRGT)objdump
  151. SZ = $(TRGT)size
  152. HEX = $(CP) -O ihex
  153. BIN = $(CP) -O binary
  154. # ARM-specific options here
  155. AOPT =
  156. # THUMB-specific options here
  157. TOPT = -mthumb -DTHUMB
  158. # Define C warning options here
  159. CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes
  160. # Define C++ warning options here
  161. CPPWARN = -Wall -Wextra -Wundef
  162. #
  163. # Compiler settings
  164. ##############################################################################
  165. ##############################################################################
  166. # Start of user section
  167. #
  168. # List all user C define here, like -D_DEBUG=1
  169. UDEFS = $(ENV_UDEFS) $(FATFS_FLAGS) -DHAL_BOARD_NAME=\"$(HAL_BOARD_NAME)\"
  170. ifeq ($(ENABLE_ASSERTS),yes)
  171. UDEFS += -DHAL_CHIBIOS_ENABLE_ASSERTS
  172. ASXFLAGS += -DHAL_CHIBIOS_ENABLE_ASSERTS
  173. endif
  174. # Define ASM defines here
  175. UADEFS =
  176. # List all user directories here
  177. UINCDIR =
  178. # List the user directory to look for the libraries here
  179. ULIBDIR =
  180. # List all user libraries here
  181. ULIBS =
  182. #
  183. # End of user defines
  184. ##############################################################################
  185. include $(HWDEF)/common/chibios_common.mk