gcc.mk 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #
  2. # Copyright (c) 2011 Arduino. All right reserved.
  3. #
  4. # This library is free software; you can redistribute it and/or
  5. # modify it under the terms of the GNU Lesser General Public
  6. # License as published by the Free Software Foundation; either
  7. # version 2.1 of the License, or (at your option) any later version.
  8. #
  9. # This library is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. # See the GNU Lesser General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU Lesser General Public
  15. # License along with this library; if not, write to the Free Software
  16. # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  17. #
  18. # Tool suffix when cross-compiling
  19. CROSS_COMPILE = $(ARM_GCC_TOOLCHAIN)/arm-none-eabi-
  20. # Compilation tools
  21. AR = $(CROSS_COMPILE)ar
  22. CC = $(CROSS_COMPILE)gcc
  23. CXX = $(CROSS_COMPILE)g++
  24. AS = $(CROSS_COMPILE)as
  25. NM = $(CROSS_COMPILE)nm
  26. ifeq ($(OS),Windows_NT)
  27. RM=cs-rm -Rf
  28. else
  29. RM=rm -Rf
  30. endif
  31. SEP=\\
  32. # ---------------------------------------------------------------------------------------
  33. # C Flags
  34. CFLAGS += -Wall -Wchar-subscripts -Wcomment -Wformat=2 -Wimplicit-int
  35. CFLAGS += -Werror-implicit-function-declaration -Wmain -Wparentheses
  36. CFLAGS += -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs -Wunused
  37. CFLAGS += -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef
  38. CFLAGS += -Wshadow -Wpointer-arith -Wbad-function-cast -Wwrite-strings
  39. CFLAGS += -Wsign-compare -Waggregate-return -Wstrict-prototypes
  40. CFLAGS += -Wmissing-prototypes -Wmissing-declarations
  41. CFLAGS += -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations
  42. CFLAGS += -Wpacked -Wredundant-decls -Wnested-externs -Winline -Wlong-long
  43. CFLAGS += -Wunreachable-code
  44. CFLAGS += -Wcast-align
  45. #CFLAGS += -Wmissing-noreturn
  46. #CFLAGS += -Wconversion
  47. CFLAGS += --param max-inline-insns-single=500 -mcpu=cortex-m3 -mthumb -mlong-calls -ffunction-sections -fdata-sections -nostdlib -std=c99
  48. CFLAGS += $(OPTIMIZATION) $(INCLUDES) -D$(CHIP) -D$(VARIANT)
  49. # To reduce application size use only integer printf function.
  50. CFLAGS += -Dprintf=iprintf
  51. # ---------------------------------------------------------------------------------------
  52. # CPP Flags
  53. CPPFLAGS += -Wall -Wchar-subscripts -Wcomment -Wformat=2
  54. CPPFLAGS += -Wmain -Wparentheses -Wcast-align -Wunreachable-code
  55. CPPFLAGS += -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs -Wunused
  56. CPPFLAGS += -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef
  57. CPPFLAGS += -Wshadow -Wpointer-arith -Wwrite-strings
  58. CPPFLAGS += -Wsign-compare -Waggregate-return -Wmissing-declarations
  59. CPPFLAGS += -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations
  60. CPPFLAGS += -Wpacked -Wredundant-decls -Winline -Wlong-long
  61. #CPPFLAGS += -Wmissing-noreturn
  62. #CPPFLAGS += -Wconversion
  63. CPPFLAGS += --param max-inline-insns-single=500 -mcpu=cortex-m3 -mthumb -mlong-calls -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -std=c++98
  64. CPPFLAGS += $(OPTIMIZATION) $(INCLUDES) -D$(CHIP)
  65. # To reduce application size use only integer printf function.
  66. CPPFLAGS += -Dprintf=iprintf
  67. # ---------------------------------------------------------------------------------------
  68. # ASM Flags
  69. ASFLAGS = -mcpu=cortex-m3 -mthumb -Wall -g $(OPTIMIZATION) $(INCLUDES)