Makefile 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. PROJECT_NAME := ext_micro_ecc_nrf52nf_library_keil
  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 -g2
  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 += -DFLOAT_ABI_SOFT
  22. CFLAGS += -DuECC_ENABLE_VLI_API=0
  23. CFLAGS += -DuECC_OPTIMIZATION_LEVEL=3
  24. CFLAGS += -DuECC_SQUARE_FUNC=0
  25. CFLAGS += -DuECC_SUPPORT_COMPRESSED_POINT=0
  26. CFLAGS += -DuECC_VLI_NATIVE_LITTLE_ENDIAN=1
  27. CFLAGS += -mcpu=cortex-m4
  28. CFLAGS += -mthumb -mabi=aapcs
  29. CFLAGS += -Wall -Werror
  30. CFLAGS += -mfloat-abi=soft
  31. # keep every function in a separate section, this allows linker to discard unused ones
  32. CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing
  33. CFLAGS += -fno-builtin -fshort-enums -fshort-wchar -Wno-unused-function
  34. # C++ flags common to all targets
  35. CXXFLAGS += $(OPT)
  36. # Assembler flags common to all targets
  37. ASMFLAGS += -g2
  38. ASMFLAGS += -mcpu=cortex-m4
  39. ASMFLAGS += -mthumb -mabi=aapcs
  40. ASMFLAGS += -mfloat-abi=soft
  41. ASMFLAGS += -DFLOAT_ABI_SOFT
  42. ASMFLAGS += -DuECC_ENABLE_VLI_API=0
  43. ASMFLAGS += -DuECC_OPTIMIZATION_LEVEL=3
  44. ASMFLAGS += -DuECC_SQUARE_FUNC=0
  45. ASMFLAGS += -DuECC_SUPPORT_COMPRESSED_POINT=0
  46. ASMFLAGS += -DuECC_VLI_NATIVE_LITTLE_ENDIAN=1
  47. micro_ecc_lib: CFLAGS += -D__HEAP_SIZE=4096
  48. micro_ecc_lib: CFLAGS += -D__STACK_SIZE=4096
  49. micro_ecc_lib: ASMFLAGS += -D__HEAP_SIZE=4096
  50. micro_ecc_lib: ASMFLAGS += -D__STACK_SIZE=4096
  51. # Add standard libraries at the very end of the linker input, after all objects
  52. # that may need symbols provided by these libraries.
  53. LIB_FILES += -lc -lnosys -lm
  54. .PHONY: default help
  55. # Default target - first one defined
  56. default: micro_ecc_lib
  57. # Print all targets that can be built
  58. help:
  59. @echo following targets are available:
  60. @echo micro_ecc_lib
  61. TEMPLATE_PATH := $(SDK_ROOT)/components/toolchain/gcc
  62. include $(TEMPLATE_PATH)/Makefile.common
  63. $(call define_library, $(TARGETS), $(PROJ_DIR)/nrf52nf_keil/armgcc/micro_ecc_lib_nrf52.lib)
  64. define create_library
  65. @echo Creating library: $($@)
  66. $(NO_ECHO)$(AR) $($@) $^
  67. @echo Done
  68. endef
  69. micro_ecc_lib:
  70. $(create_library)
  71. SDK_CONFIG_FILE := ../config/sdk_config.h
  72. CMSIS_CONFIG_TOOL := $(SDK_ROOT)/external_tools/cmsisconfig/CMSIS_Configuration_Wizard.jar
  73. sdk_config:
  74. java -jar $(CMSIS_CONFIG_TOOL) $(SDK_CONFIG_FILE)