-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor makefile with libopencm3 module gcc and configuration depend…
…encies (#35) * libopencm3 nix cleanup Signed-off-by: Thing-han, Lim <[email protected]> * refactor with libopencm3 module gcc Signed-off-by: Thing-han, Lim <[email protected]> * refactor common gcc config for different platform Signed-off-by: Thing-han, Lim <[email protected]> * refactor RNG makefile config Signed-off-by: Thing-han, Lim <[email protected]> * add makefile config dependency Signed-off-by: Thing-han, Lim <[email protected]> * merge ci tests since there is no need for make clean between different configuration Signed-off-by: Thing-han, Lim <[email protected]> * move opencm3 configs inside mk/opencm3.mk Signed-off-by: Thing-han, Lim <[email protected]> * remove obj/libhal.a whenever dependencies changed Signed-off-by: Thing-han, Lim <[email protected]> * add platform as test script argument Signed-off-by: Thing-han, Lim <[email protected]> * add shell completion for the tests script Signed-off-by: Thing-han, Lim <[email protected]> * update ci Signed-off-by: Thing-han, Lim <[email protected]> * fix make nistkat in tests script Signed-off-by: Thing-han, Lim <[email protected]> --------- Signed-off-by: Thing-han, Lim <[email protected]>
- Loading branch information
1 parent
18597f6
commit 48d5029
Showing
11 changed files
with
199 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,35 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
MPS2_DATA_IN_FLASH = 1 | ||
CROSS_PREFIX ?= arm-none-eabi | ||
CC := $(CROSS_PREFIX)-gcc | ||
CPP := $(CROSS_PREFIX)-cpp | ||
AR := $(CROSS_PREFIX)-ar | ||
LD := $(CC) | ||
OBJCOPY := $(CROSS_PREFIX)-objcopy | ||
SIZE := $(CROSS_PREFIX)-size | ||
|
||
LDSCRIPT = obj/ldscript.ld | ||
LDSCRIPT = obj/generated.$(PLATFORM).ld | ||
|
||
ARCH_FLAGS += -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 | ||
|
||
CFLAGS += \ | ||
$(ARCH_FLAGS) \ | ||
--specs=nosys.specs | ||
CFLAGS += $(ARCH_FLAGS) | ||
|
||
CPPFLAGS += \ | ||
-DMPS2_AN386 | ||
|
||
LDFLAGS += \ | ||
--specs=nosys.specs \ | ||
-Wl,--wrap=_sbrk \ | ||
-Wl,--wrap=_open \ | ||
-Wl,--wrap=_close \ | ||
-Wl,--wrap=_isatty \ | ||
-Wl,--wrap=_kill \ | ||
-Wl,--wrap=_lseek \ | ||
-Wl,--wrap=_read \ | ||
-Wl,--wrap=_write \ | ||
-Wl,--wrap=_fstat \ | ||
-Wl,--wrap=_getpid \ | ||
-Wl,--no-warn-rwx-segments \ | ||
-ffreestanding \ | ||
-T$(LDSCRIPT) \ | ||
$(ARCH_FLAGS) | ||
|
||
LIBHAL_SRC := \ | ||
LIBHAL_SRC += \ | ||
hal/mps2/startup_MPS2.S \ | ||
hal/hal-mps2.c | ||
|
||
ifndef KATRNG | ||
LIBHAL_SRC += hal/notrandombytes.c | ||
else | ||
ifeq ($(KATRNG),NIST) | ||
LIBHAL_SRC += \ | ||
test/common/nistkatrng.c \ | ||
test/common/aes.c | ||
CPPFLAGS += -Itest/common | ||
endif | ||
endif | ||
|
||
obj/libpqm4hal.a: $(call objs,$(LIBHAL_SRC)) | ||
obj/libpqm4hal.a: CPPFLAGS += -Ihal/mps2 $(if $(KATRNG)==NIST,-Itest/common) | ||
obj/libhal.a: $(call objs,$(LIBHAL_SRC)) | ||
obj/libhal.a: CPPFLAGS += -Ihal/mps2 $(if $(RNG)==NISTKAT,-Itest/common) | ||
|
||
$(LDSCRIPT): CPPFLAGS += $(if $(MPS2_DATA_IN_FLASH),-DDATA_IN_FLASH) | ||
obj/hal/mps2/startup_MPS2.S.o: CPPFLAGS += $(if $(MPS2_DATA_IN_FLASH),-DDATA_IN_FLASH) | ||
|
||
LDLIBS += -lpqm4hal | ||
LIBDEPS += obj/libpqm4hal.a | ||
|
||
$(LDSCRIPT): hal/mps2/MPS2.ld | ||
@printf " GENLNK $@\n"; \ | ||
[ -d $(@D) ] || $(Q)mkdir -p $(@D); \ | ||
$(CC) -x assembler-with-cpp -E -Wp,-P $(CPPFLAGS) $< -o $@ | ||
|
||
$(LDSCRIPT): CPPFLAGS += -Ihal/mps2 $(if $(KATRNG)==NIST,-Itest/common) | ||
$(LDSCRIPT): CPPFLAGS += -Ihal/mps2 $(if $(RNG)==NISTKAT,-Itest/common) | ||
|
||
LINKDEPS += $(LDSCRIPT) $(LIBDEPS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.