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/sha.o \
  60. $(WOLFSSL_BUILD)/wolfcrypt/sha256.o \
  61. $(WOLFSSL_BUILD)/wolfcrypt/sha512.o \
  62. $(WOLFSSL_BUILD)/wolfcrypt/wc_encrypt.o \
  63. $(WOLFSSL_BUILD)/wolfcrypt/wc_port.o \
  64. $(WOLFSSL_BUILD)/wolfcrypt/wolfmath.o \
  65. $(WOLFSSL_BUILD)/wolfcrypt/iotsafe.o \
  66. $(WOLFSSL_BUILD)/tls13.o
  67. OBJS_SPMATH:= $(WOLFSSL_BUILD)/wolfcrypt/sp_c32.o \
  68. $(WOLFSSL_BUILD)/wolfcrypt/sp_int.o
  69. OBJS+=$(WOLFSSL_OBJS) $(OBJS_SPMATH)
  70. vpath %.c $(dir $(WOLFSSL_ROOT)/src)
  71. vpath %.c $(dir $(WOLFSSL_ROOT)/wolfcrypt/src)
  72. CFLAGS+=-g -ggdb3
  73. #CFLAGS+=-O2
  74. #all: image.bin
  75. image.bin: image.elf
  76. $(OBJCOPY) -O binary $^ $@
  77. image.elf: $(WOLFSSL_BUILD)/wolfcrypt $(OBJS) $(LSCRIPT)
  78. $(LD) $(LDFLAGS) $(OBJS) -o $@
  79. $(WOLFSSL_BUILD)/wolfcrypt:
  80. mkdir -p $(@)
  81. %.o:%.S
  82. $(CC) -c -o $(@) $(CFLAGS) $^
  83. %.o:%.c
  84. $(CC) -c -o $(@) $(CFLAGS) $^
  85. $(WOLFSSL_BUILD)/%.o: $(WOLFSSL_ROOT)/src/%.c
  86. $(CC) -c -o $(@) $(CFLAGS) $^
  87. $(WOLFSSL_BUILD)/wolfcrypt/%.o: $(WOLFSSL_ROOT)/wolfcrypt/src/%.c
  88. $(CC) -c -o $(@) $(CFLAGS) $^
  89. $(WOLFSSL_BUILD)/wolfcrypt/iotsafe.o: $(WOLFSSL_ROOT)/wolfcrypt/src/port/iotsafe/iotsafe.c
  90. $(CC) -c -o $(@) $(CFLAGS) $^
  91. clean:
  92. rm -f image.bin image.elf *.o image.map
  93. rm -rf build