Makefile 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. # Makefile
  2. #
  3. # Copyright (C) 2006-2021 wolfSSL Inc.
  4. #
  5. # This file is part of wolfSSL. (formerly known as CyaSSL)
  6. #
  7. #
  8. CROSS_COMPILE:=arm-none-eabi-
  9. CC:=$(CROSS_COMPILE)gcc
  10. LD:=$(CROSS_COMPILE)gcc
  11. LSCRIPT:=target.ld
  12. WOLFSSL_ROOT=$(PWD)/../..
  13. WOLFSSL_BUILD=build/wolfssl
  14. OBJCOPY:=$(CROSS_COMPILE)objcopy
  15. CFLAGS:=-mthumb -g -ggdb -Wall -Wextra -Wno-main -fsigned-char -Wstack-usage=65535 -Wno-unused -I$(WOLFSSL_ROOT) -I.
  16. CFLAGS+=-lc -lg -lm -Wno-pointer-sign
  17. #CFLAGS+=-mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -lm
  18. CFLAGS+=-mcpu=cortex-m3
  19. CFLAGS+=-DWOLFSSL_USER_SETTINGS
  20. ASFLAGS+=-mthumb -mlittle-endian -mthumb-interwork -ggdb -ffreestanding -mcpu=cortex-m3
  21. LDFLAGS:=-T $(LSCRIPT) -Wl,-gc-sections -Wl,-Map=image.map -mthumb -mthumb-interwork -mlittle-endian
  22. #LDFLAGS+=-mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -lm
  23. LDFLAGS+=-mcpu=cortex-m3
  24. LDFLAGS+=-lc -lg -lm
  25. LDFLAGS+=--specs=nosys.specs
  26. OBJS:=main.o startup.o devices.o memory-tls.o
  27. WOLFSSL_OBJS += \
  28. $(WOLFSSL_BUILD)/internal.o \
  29. $(WOLFSSL_BUILD)/wolfio.o \
  30. $(WOLFSSL_BUILD)/keys.o \
  31. $(WOLFSSL_BUILD)/crl.o \
  32. $(WOLFSSL_BUILD)/ssl.o \
  33. $(WOLFSSL_BUILD)/tls.o \
  34. $(WOLFSSL_BUILD)/wolfcrypt/aes.o \
  35. $(WOLFSSL_BUILD)/wolfcrypt/asn.o \
  36. $(WOLFSSL_BUILD)/wolfcrypt/chacha.o \
  37. $(WOLFSSL_BUILD)/wolfcrypt/chacha20_poly1305.o \
  38. $(WOLFSSL_BUILD)/wolfcrypt/coding.o \
  39. $(WOLFSSL_BUILD)/wolfcrypt/curve25519.o \
  40. $(WOLFSSL_BUILD)/wolfcrypt/dh.o \
  41. $(WOLFSSL_BUILD)/wolfcrypt/dsa.o \
  42. $(WOLFSSL_BUILD)/wolfcrypt/error.o \
  43. $(WOLFSSL_BUILD)/wolfcrypt/ecc.o \
  44. $(WOLFSSL_BUILD)/wolfcrypt/ed25519.o \
  45. $(WOLFSSL_BUILD)/wolfcrypt/rsa.o \
  46. $(WOLFSSL_BUILD)/wolfcrypt/fe_low_mem.o \
  47. $(WOLFSSL_BUILD)/wolfcrypt/fe_operations.o \
  48. $(WOLFSSL_BUILD)/wolfcrypt/ge_low_mem.o \
  49. $(WOLFSSL_BUILD)/wolfcrypt/ge_operations.o \
  50. $(WOLFSSL_BUILD)/wolfcrypt/hash.o \
  51. $(WOLFSSL_BUILD)/wolfcrypt/hmac.o \
  52. $(WOLFSSL_BUILD)/wolfcrypt/integer.o \
  53. $(WOLFSSL_BUILD)/wolfcrypt/logging.o \
  54. $(WOLFSSL_BUILD)/wolfcrypt/md5.o \
  55. $(WOLFSSL_BUILD)/wolfcrypt/memory.o \
  56. $(WOLFSSL_BUILD)/wolfcrypt/poly1305.o \
  57. $(WOLFSSL_BUILD)/wolfcrypt/pwdbased.o \
  58. $(WOLFSSL_BUILD)/wolfcrypt/random.o \
  59. $(WOLFSSL_BUILD)/wolfcrypt/kdf.o \
  60. $(WOLFSSL_BUILD)/wolfcrypt/sha.o \
  61. $(WOLFSSL_BUILD)/wolfcrypt/sha256.o \
  62. $(WOLFSSL_BUILD)/wolfcrypt/sha512.o \
  63. $(WOLFSSL_BUILD)/wolfcrypt/wc_encrypt.o \
  64. $(WOLFSSL_BUILD)/wolfcrypt/wc_port.o \
  65. $(WOLFSSL_BUILD)/wolfcrypt/wolfmath.o \
  66. $(WOLFSSL_BUILD)/wolfcrypt/iotsafe.o \
  67. $(WOLFSSL_BUILD)/tls13.o
  68. OBJS_SPMATH:= $(WOLFSSL_BUILD)/wolfcrypt/sp_c32.o \
  69. $(WOLFSSL_BUILD)/wolfcrypt/sp_int.o
  70. OBJS+=$(WOLFSSL_OBJS) $(OBJS_SPMATH)
  71. vpath %.c $(dir $(WOLFSSL_ROOT)/src)
  72. vpath %.c $(dir $(WOLFSSL_ROOT)/wolfcrypt/src)
  73. #CFLAGS+=-g -ggdb3
  74. CFLAGS+=-Os
  75. #all: image.bin
  76. image.bin: image.elf
  77. $(OBJCOPY) -O binary $^ $@
  78. image.elf: $(WOLFSSL_BUILD)/wolfcrypt $(OBJS) $(LSCRIPT)
  79. $(LD) $(LDFLAGS) $(OBJS) -o $@
  80. $(WOLFSSL_BUILD)/wolfcrypt:
  81. mkdir -p $(@)
  82. %.o:%.S
  83. $(CC) -c -o $(@) $(CFLAGS) $^
  84. %.o:%.c
  85. $(CC) -c -o $(@) $(CFLAGS) $^
  86. $(WOLFSSL_BUILD)/%.o: $(WOLFSSL_ROOT)/src/%.c
  87. $(CC) -c -o $(@) $(CFLAGS) $^
  88. $(WOLFSSL_BUILD)/wolfcrypt/%.o: $(WOLFSSL_ROOT)/wolfcrypt/src/%.c
  89. $(CC) -c -o $(@) $(CFLAGS) $^
  90. $(WOLFSSL_BUILD)/wolfcrypt/iotsafe.o: $(WOLFSSL_ROOT)/wolfcrypt/src/port/iotsafe/iotsafe.c
  91. $(CC) -c -o $(@) $(CFLAGS) $^
  92. clean:
  93. rm -f image.bin image.elf *.o image.map
  94. rm -rf build