Makefile 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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. # Enable this if you want to see the full log while compiling.
  30. ifeq ($(USE_VERBOSE_COMPILE),)
  31. USE_VERBOSE_COMPILE = no
  32. endif
  33. # If enabled, this option makes the build process faster by not compiling
  34. # modules not used in the current configuration.
  35. ifeq ($(USE_SMART_BUILD),)
  36. USE_SMART_BUILD = yes
  37. endif
  38. #
  39. # Build global options
  40. ##############################################################################
  41. ##############################################################################
  42. # Architecture or project specific options
  43. #
  44. # Stack size to be allocated to the Cortex-M process stack. This stack is
  45. # the stack used by the main() thread.
  46. ifeq ($(USE_PROCESS_STACKSIZE),)
  47. USE_PROCESS_STACKSIZE = 0x100
  48. endif
  49. # Stack size to the allocated to the Cortex-M main/exceptions stack. This
  50. # stack is used for processing interrupts and exceptions.
  51. ifeq ($(USE_EXCEPTIONS_STACKSIZE),)
  52. USE_EXCEPTIONS_STACKSIZE = 0x400
  53. endif
  54. # Enables the use of FPU (no, softfp, hard).
  55. ifeq ($(USE_FPU),)
  56. USE_FPU = no
  57. endif
  58. #
  59. # Architecture or project specific options
  60. ##############################################################################
  61. ##############################################################################
  62. # Project, target, sources and paths
  63. #
  64. # Define project name here
  65. PROJECT = ch
  66. # Target settings.
  67. MCU = cortex-m4
  68. # Imported source files and paths.
  69. CHIBIOS = ../../..
  70. CONFDIR := .
  71. BUILDDIR := ./build
  72. DEPDIR := ./.dep
  73. # Licensing files.
  74. include $(CHIBIOS)/os/license/license.mk
  75. # Startup files.
  76. include $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32f3xx.mk
  77. # HAL-OSAL files (optional).
  78. #include $(CHIBIOS)/os/hal/hal.mk
  79. #include $(CHIBIOS)/os/hal/ports/STM32/STM32F3xx/platform.mk
  80. #include $(CHIBIOS)/os/hal/boards/ST_STM32F3_DISCOVERY/board.mk
  81. #include $(CHIBIOS)/os/hal/osal/nil/osal.mk
  82. # RTOS files (optional).
  83. include $(CHIBIOS)/os/nil/nil.mk
  84. include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
  85. # Auto-build files in ./source recursively.
  86. include $(CHIBIOS)/tools/mk/autobuild.mk
  87. # Other files (optional).
  88. #include $(CHIBIOS)/test/lib/test.mk
  89. #include $(CHIBIOS)/test/nil/nil_test.mk
  90. #include $(CHIBIOS)/test/oslib/oslib_test.mk
  91. # Define linker script file here
  92. LDSCRIPT= $(STARTUPLD)/STM32F303xC.ld
  93. # C sources that can be compiled in ARM or THUMB mode depending on the global
  94. # setting.
  95. CSRC = $(ALLCSRC) \
  96. $(TESTSRC) \
  97. main.c
  98. # C++ sources that can be compiled in ARM or THUMB mode depending on the global
  99. # setting.
  100. CPPSRC = $(ALLCPPSRC)
  101. # List ASM source files here.
  102. ASMSRC = $(ALLASMSRC)
  103. # List ASM with preprocessor source files here.
  104. ASMXSRC = $(ALLXASMSRC)
  105. # Inclusion directories.
  106. INCDIR = $(CONFDIR) $(ALLINC) $(TESTINC)
  107. # Define C warning options here.
  108. CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes
  109. # Define C++ warning options here.
  110. CPPWARN = -Wall -Wextra -Wundef
  111. #
  112. # Project, target, sources and paths
  113. ##############################################################################
  114. ##############################################################################
  115. # Start of user section
  116. #
  117. # List all user C define here, like -D_DEBUG=1
  118. UDEFS = -DSTM32F303xC -D__ARM_ARCH_7EM__=1
  119. # Define ASM defines here
  120. UADEFS = -DSTM32F303xC
  121. # List all user directories here
  122. UINCDIR =
  123. # List the user directory to look for the libraries here
  124. ULIBDIR =
  125. # List all user libraries here
  126. ULIBS =
  127. #
  128. # End of user section
  129. ##############################################################################
  130. ##############################################################################
  131. # Common rules
  132. #
  133. RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk
  134. include $(RULESPATH)/arm-none-eabi.mk
  135. include $(RULESPATH)/rules.mk
  136. #
  137. # Common rules
  138. ##############################################################################
  139. ##############################################################################
  140. # Custom rules
  141. #
  142. misra:
  143. @wine lint-nt -w3 $(DEFS) pclint/co-gcc.lnt pclint/au-misra3.lnt pclint/waivers.lnt $(IINCDIR) $(CSRC) > misra.txt
  144. winmisra:
  145. @lint-nt -w3 $(DEFS) pclint/co-gcc.lnt pclint/au-misra3.lnt pclint/waivers.lnt $(IINCDIR) $(CSRC) > misra.txt
  146. #
  147. # Custom rules
  148. ##############################################################################