Makefile 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. PROJECT_NAME := ext_micro_ecc_nrf51_library_armgcc
  2. TARGETS := micro_ecc_lib
  3. OUTPUT_DIRECTORY := _build
  4. SDK_ROOT := ../../../..
  5. PROJ_DIR := ../..
  6. # Source files common to all targets
  7. SRC_FILES += \
  8. $(PROJ_DIR)/micro-ecc/uECC.c \
  9. # Include folders common to all targets
  10. INC_FOLDERS += \
  11. $(SDK_ROOT)/components/toolchain/cmsis/include \
  12. $(PROJ_DIR)/micro-ecc \
  13. # Libraries common to all targets
  14. LIB_FILES += \
  15. # Optimization flags
  16. OPT = -Os -g3
  17. # Uncomment the line below to enable link time optimization
  18. #OPT += -flto
  19. # C flags common to all targets
  20. CFLAGS += $(OPT)
  21. CFLAGS += -DuECC_ENABLE_VLI_API=0
  22. CFLAGS += -DuECC_OPTIMIZATION_LEVEL=3
  23. CFLAGS += -DuECC_SQUARE_FUNC=0
  24. CFLAGS += -DuECC_SUPPORT_COMPRESSED_POINT=0
  25. CFLAGS += -DuECC_VLI_NATIVE_LITTLE_ENDIAN=1
  26. CFLAGS += -mcpu=cortex-m0
  27. CFLAGS += -mthumb -mabi=aapcs
  28. CFLAGS += -Wall -Werror
  29. CFLAGS += -mfloat-abi=soft
  30. # keep every function in a separate section, this allows linker to discard unused ones
  31. CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing
  32. CFLAGS += -fno-builtin -fshort-enums -Wno-unused-function
  33. # C++ flags common to all targets
  34. CXXFLAGS += $(OPT)
  35. # Assembler flags common to all targets
  36. ASMFLAGS += -g3
  37. ASMFLAGS += -mcpu=cortex-m0
  38. ASMFLAGS += -mthumb -mabi=aapcs
  39. ASMFLAGS += -mfloat-abi=soft
  40. ASMFLAGS += -DuECC_ENABLE_VLI_API=0
  41. ASMFLAGS += -DuECC_OPTIMIZATION_LEVEL=3
  42. ASMFLAGS += -DuECC_SQUARE_FUNC=0
  43. ASMFLAGS += -DuECC_SUPPORT_COMPRESSED_POINT=0
  44. ASMFLAGS += -DuECC_VLI_NATIVE_LITTLE_ENDIAN=1
  45. micro_ecc_lib: CFLAGS += -D__HEAP_SIZE=4096
  46. micro_ecc_lib: CFLAGS += -D__STACK_SIZE=4096
  47. micro_ecc_lib: ASMFLAGS += -D__HEAP_SIZE=4096
  48. micro_ecc_lib: ASMFLAGS += -D__STACK_SIZE=4096
  49. # Add standard libraries at the very end of the linker input, after all objects
  50. # that may need symbols provided by these libraries.
  51. LIB_FILES += -lc -lnosys -lm
  52. .PHONY: default help
  53. # Default target - first one defined
  54. default: micro_ecc_lib
  55. # Print all targets that can be built
  56. help:
  57. @echo following targets are available:
  58. @echo micro_ecc_lib
  59. TEMPLATE_PATH := $(SDK_ROOT)/components/toolchain/gcc
  60. include $(TEMPLATE_PATH)/Makefile.common
  61. $(call define_library, $(TARGETS), $(PROJ_DIR)/nrf51_armgcc/armgcc/micro_ecc_lib_nrf51.a)
  62. define create_library
  63. @echo Creating library: $($@)
  64. $(NO_ECHO)$(AR) $($@) $^
  65. @echo Done
  66. endef
  67. micro_ecc_lib:
  68. $(create_library)
  69. SDK_CONFIG_FILE := ../config/sdk_config.h
  70. CMSIS_CONFIG_TOOL := $(SDK_ROOT)/external_tools/cmsisconfig/CMSIS_Configuration_Wizard.jar
  71. sdk_config:
  72. java -jar $(CMSIS_CONFIG_TOOL) $(SDK_CONFIG_FILE)