Makefile 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. PROJECT_NAME := ext_micro_ecc_nrf52nf_library_iar
  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 -gdwarf-3
  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 += -gdwarf-3
  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_iar/armgcc/micro_ecc_lib_nrf52.a)
  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)