make.mk 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #
  2. # Common make definition for all examples
  3. #
  4. # Compiler
  5. CROSS_COMPILE = arm-none-eabi-
  6. CC = $(CROSS_COMPILE)gcc
  7. CXX = $(CROSS_COMPILE)g++
  8. OBJCOPY = $(CROSS_COMPILE)objcopy
  9. SIZE = $(CROSS_COMPILE)size
  10. MKDIR = mkdir
  11. SED = sed
  12. CP = cp
  13. RM = rm
  14. PYTHON ?= python
  15. # Select the board to build for.
  16. ifeq ($(BOARD),)
  17. $(info You must provide a BOARD parameter with 'BOARD=')
  18. $(info Possible values are:)
  19. $(info $(sort $(subst /.,,$(subst $(TOP)/hw/bsp/,,$(wildcard $(TOP)/hw/bsp/*/.)))))
  20. $(error BOARD not defined)
  21. else
  22. ifeq ($(wildcard $(TOP)/hw/bsp/$(BOARD)/.),)
  23. $(error Invalid BOARD specified)
  24. endif
  25. endif
  26. # Build directory
  27. BUILD = _build/build-$(BOARD)
  28. # Board specific
  29. include $(TOP)/hw/bsp/$(BOARD)/board.mk
  30. # Include all source C in board folder
  31. SRC_C += $(subst $(TOP)/,,$(wildcard $(TOP)/hw/bsp/$(BOARD)/*.c))
  32. # Compiler Flags
  33. CFLAGS += \
  34. -fsingle-precision-constant \
  35. -fno-strict-aliasing \
  36. -Wdouble-promotion \
  37. -Wno-endif-labels \
  38. -Wstrict-prototypes \
  39. -Wall \
  40. -Werror \
  41. -Werror-implicit-function-declaration \
  42. -Wfloat-equal \
  43. -Wundef \
  44. -Wshadow \
  45. -Wwrite-strings \
  46. -Wsign-compare \
  47. -Wmissing-format-attribute \
  48. -Wno-deprecated-declarations \
  49. -Wnested-externs \
  50. -Wunreachable-code \
  51. -Wno-error=lto-type-mismatch \
  52. -ffunction-sections \
  53. -fdata-sections
  54. # This causes lots of warning with nrf5x build due to nrfx code
  55. # CFLAGS += -Wcast-align
  56. # Debugging/Optimization
  57. ifeq ($(DEBUG), 1)
  58. CFLAGS += -O0 -ggdb -DCFG_TUSB_DEBUG=1
  59. else
  60. CFLAGS += -flto -Os
  61. endif