aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitmodules4
-rw-r--r--Drivers/Makefile14
-rw-r--r--Makefile92
m---------libraries/libhal (renamed from libhal)0
m---------libraries/thirdparty/libtfm (renamed from thirdparty/libtfm)0
-rw-r--r--projects/board-test/Makefile18
-rw-r--r--projects/board-test/fmc-perf.c (renamed from self-test/fmc-perf.c)0
-rw-r--r--projects/board-test/fmc-test.c (renamed from self-test/fmc-test.c)0
-rw-r--r--projects/board-test/led-test.c (renamed from self-test/led-test.c)0
-rw-r--r--projects/board-test/short-test.c (renamed from self-test/short-test.c)0
-rw-r--r--projects/board-test/uart-test.c (renamed from self-test/uart-test.c)0
-rw-r--r--projects/libhal-test/Makefile33
-rw-r--r--projects/libhal-test/gettimeofday.c (renamed from gettimeofday.c)0
-rw-r--r--projects/libhal-test/main.c (renamed from main.c)0
-rw-r--r--projects/libhal-test/printf.c (renamed from printf.c)0
15 files changed, 88 insertions, 73 deletions
diff --git a/.gitmodules b/.gitmodules
index 20b8eb8..5960557 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,7 +1,7 @@
[submodule "libhal"]
- path = libhal
+ path = libraries/libhal
url = git@git.cryptech.is:sw/libhal.git
branch = rpc
[submodule "thirdparty/libtfm"]
- path = thirdparty/libtfm
+ path = libraries/thirdparty/libtfm
url = git@git.cryptech.is:sw/thirdparty/libtfm.git
diff --git a/Drivers/Makefile b/Drivers/Makefile
index 29aae70..b179341 100644
--- a/Drivers/Makefile
+++ b/Drivers/Makefile
@@ -5,15 +5,6 @@ AR=arm-none-eabi-ar
vpath %.c STM32F4xx_HAL_Driver/Src
-# Default STDPERIPH_SETTINGS to settings suitable for STM32F429BIT6 (dev-bridge rev01)
-#STDPERIPH_SETTINGS ?= -DUSE_STDPERIPH_DRIVER -DSTM32F4XX -DSTM32F429xx
-
-#CFLAGS += -ggdb -O2 -Wall -Wextra -Warray-bounds
-#CFLAGS += -mcpu=cortex-m4 -mthumb -mlittle-endian -mthumb-interwork
-#CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
-#CFLAGS += -ICMSIS/Include -ICMSIS/Device/ST/STM32F4xx/Include -ISTM32F4xx_HAL_Driver/Inc
-#CFLAGS += $(STDPERIPH_SETTINGS)
-
SRCS = stm32f4xx_hal.c stm32f4xx_hal_msp_template.c \
stm32f4xx_hal_adc.c stm32f4xx_hal_nand.c \
stm32f4xx_hal_adc_ex.c stm32f4xx_hal_nor.c \
@@ -50,13 +41,8 @@ SRCS = stm32f4xx_hal.c stm32f4xx_hal_msp_template.c \
OBJS = $(SRCS:.c=.o)
-.PHONY: libstmf4.a
-
all: libstmf4.a
-%.o : %.c
- $(CC) $(CFLAGS) -c -o $@ $^
-
libstmf4.a: $(OBJS)
$(AR) -r $@ $(OBJS)
diff --git a/Makefile b/Makefile
index f4185bf..c653a4d 100644
--- a/Makefile
+++ b/Makefile
@@ -27,33 +27,25 @@
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-# "stm32-native" projects
-SELF-TESTS = fmc-test led-test short-test uart-test fmc-perf
-vpath %.c self-test
-
-# apps originally written for unix-like environment
-#LIBHAL-TESTS = cores test-bus test-trng test-hash test-aes-key-wrap test-pbkdf2 test-ecdsa test-rsa
-#LIBHAL-TESTS = cores test-hash test-rpc_hash
-LIBHAL-TESTS = test-rpc_server
-vpath %.c libhal/tests libhal/utils
-
# absolute path, because we're going to be passing -I cflags to sub-makes
-TOPLEVEL = $(shell pwd)
+export TOPLEVEL = $(shell pwd)
# Location of the Libraries folder from the STM32F0xx Standard Peripheral Library
STD_PERIPH_LIB = $(TOPLEVEL)/Drivers
+export LIBS = $(STD_PERIPH_LIB)/libstmf4.a
# linker script
-LDSCRIPT = $(TOPLEVEL)/Device/ldscripts/stm32f429bitx.ld
+export LDSCRIPT = $(TOPLEVEL)/Device/ldscripts/stm32f429bitx.ld
# board-specific objects, to link into every project
-BOARD_OBJS = stm32f4xx_hal_msp.o stm32f4xx_it.o stm-fmc.o stm-init.o stm-uart.o \
- Device/startup_stm32f429xx.o Device/system_stm32f4xx.o
-
-# a few objects for libhal/test projects
-LIBC_OBJS = syscalls.o printf.o gettimeofday.o
-
-LIBS = $(STD_PERIPH_LIB)/libstmf4.a libhal/libhal.a thirdparty/libtfm/libtfm.a
+export BOARD_OBJS = $(TOPLEVEL)/stm32f4xx_hal_msp.o \
+ $(TOPLEVEL)/stm32f4xx_it.o \
+ $(TOPLEVEL)/stm-fmc.o \
+ $(TOPLEVEL)/stm-init.o \
+ $(TOPLEVEL)/stm-uart.o \
+ $(TOPLEVEL)/syscalls.o \
+ $(TOPLEVEL)/Device/startup_stm32f429xx.o \
+ $(TOPLEVEL)/Device/system_stm32f4xx.o
# cross-building tools
PREFIX=arm-none-eabi-
@@ -69,68 +61,54 @@ CFLAGS = -ggdb -O2 -Wall -Warray-bounds #-Wextra
CFLAGS += -mcpu=cortex-m4 -mthumb -mlittle-endian -mthumb-interwork
CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
CFLAGS += -DUSE_STDPERIPH_DRIVER -DSTM32F4XX -DSTM32F429xx
+CFLAGS += -D__CORTEX_M4 -DTARGET_STM -DTARGET_STM32F4 -DTARGET_STM32F429ZI -DTOOLCHAIN_GCC -D__FPU_PRESENT=1
CFLAGS += -ffunction-sections -fdata-sections -Wl,--gc-sections
CFLAGS += -std=c99
-CFLAGS += -I $(TOPLEVEL) -I $(STD_PERIPH_LIB)
+CFLAGS += -I $(TOPLEVEL)
+CFLAGS += -I $(STD_PERIPH_LIB)
CFLAGS += -I $(STD_PERIPH_LIB)/CMSIS/Device/ST/STM32F4xx/Include
CFLAGS += -I $(STD_PERIPH_LIB)/CMSIS/Include
CFLAGS += -I $(STD_PERIPH_LIB)/STM32F4xx_HAL_Driver/Inc
-CFLAGS += -I libhal
export CFLAGS
-#all: lib self-test libhal-tests
-all: lib libhal-tests
+all: board-test libhal-test
init:
git submodule update --init --recursive
-lib: $(LIBS)
-
$(STD_PERIPH_LIB)/libstmf4.a:
$(MAKE) -C $(STD_PERIPH_LIB)
-thirdparty/libtfm/libtfm.a:
- $(MAKE) -C thirdparty/libtfm PREFIX=$(PREFIX)
+board-test: $(BOARD_OBJS) $(LIBS)
+ $(MAKE) -C projects/board-test
-libhal/libhal.a: thirdparty/libtfm/libtfm.a
- $(MAKE) -C libhal IO_BUS=fmc RPC_SERVER=yes RPC_TRANSPORT=serial KS=volatile libhal.a
-# $(MAKE) -C libhal RPC_CLIENT=local IO_BUS=fmc KS=volatile libhal.a
+LIBS_DIR = $(TOPLEVEL)/libraries
-self-test: $(SELF-TESTS:=.elf)
+export LIBTFM_DIR = $(LIBS_DIR)/thirdparty/libtfm
-%.elf: %.o $(BOARD_OBJS) $(STD_PERIPH_LIB)/libstmf4.a
- $(CC) $(CFLAGS) $^ -o $@ -T$(LDSCRIPT) -g -Wl,-Map=$*.map
- $(OBJCOPY) -O ihex $*.elf $*.hex
- $(OBJCOPY) -O binary $*.elf $*.bin
- $(OBJDUMP) -St $*.elf >$*.lst
- $(SIZE) $*.elf
+$(LIBTFM_DIR)/libtfm.a:
+ $(MAKE) -C $(LIBTFM_DIR) PREFIX=$(PREFIX)
-libhal-tests: $(LIBHAL-TESTS:=.bin)
+export LIBHAL_DIR = $(LIBS_DIR)/libhal
-# .mo extension for files with main() that need to be wrapped as __main()
-%.mo: %.c
- $(CC) -c $(CFLAGS) -Dmain=__main -o $@ $<
+$(LIBHAL_DIR)/libhal.a: $(LIBTFM_DIR)/libtfm.a
+# $(MAKE) -C $(LIBHAL_DIR) RPC_CLIENT=local IO_BUS=fmc KS=volatile libhal.a
+ $(MAKE) -C $(LIBHAL_DIR) IO_BUS=fmc RPC_SERVER=yes RPC_TRANSPORT=serial KS=volatile libhal.a
-%.bin: %.mo main.o $(BOARD_OBJS) $(LIBC_OBJS) $(LIBS)
- $(CC) $(CFLAGS) $^ -o $*.elf -T$(LDSCRIPT) -g -Wl,-Map=$*.map
- $(OBJCOPY) -O ihex $*.elf $*.hex
- $(OBJCOPY) -O binary $*.elf $*.bin
- $(OBJDUMP) -St $*.elf >$*.lst
- $(SIZE) $*.elf
+libhal-test: $(BOARD_OBJS) $(LIBS) $(LIBHAL_DIR)/libhal.a
+ $(MAKE) -C projects/libhal-test
# don't automatically delete objects, to avoid a lot of unnecessary rebuilding
-.SECONDARY: $(BOARD_OBJS) $(LIBC_OBJS)
+.SECONDARY: $(BOARD_OBJS)
+
+.PHONY: board-test libhal-test
clean:
- find ./ -name '*~' | xargs rm -f
- rm -f $(BOARD_OBJS) $(LIBC_OBJS) *.o *.mo
- rm -f *.elf
- rm -f *.hex
- rm -f *.bin
- rm -f *.map
- rm -f *.lst
+ rm -f $(BOARD_OBJS)
+ $(MAKE) -C projects/board-test clean
+ $(MAKE) -C projects/libhal-test clean
distclean: clean
$(MAKE) -C $(STD_PERIPH_LIB) clean
- $(MAKE) -C thirdparty/libtfm clean
- $(MAKE) -C libhal clean
+ $(MAKE) -C $(LIBHAL_DIR) clean
+ $(MAKE) -C $(LIBTFM_DIR) clean
diff --git a/libhal b/libraries/libhal
-Subproject 60cce0124f2fc3eddca03ed3950da9238247a61
+Subproject 60cce0124f2fc3eddca03ed3950da9238247a61
diff --git a/thirdparty/libtfm b/libraries/thirdparty/libtfm
-Subproject e2eab1093a134e5a655d1ccad23a31b2b8252c6
+Subproject e2eab1093a134e5a655d1ccad23a31b2b8252c6
diff --git a/projects/board-test/Makefile b/projects/board-test/Makefile
new file mode 100644
index 0000000..21f24c9
--- /dev/null
+++ b/projects/board-test/Makefile
@@ -0,0 +1,18 @@
+TEST = led-test short-test uart-test fmc-test fmc-perf
+
+all: $(TEST:=.elf)
+
+%.elf: %.o $(BOARD_OBJS) $(LIBS)
+ $(CC) $(CFLAGS) $^ -o $@ -T$(LDSCRIPT) -g -Wl,-Map=$*.map
+ $(OBJCOPY) -O ihex $*.elf $*.hex
+ $(OBJCOPY) -O binary $*.elf $*.bin
+ $(OBJDUMP) -St $*.elf >$*.lst
+ $(SIZE) $*.elf
+
+clean:
+ rm -f *.o
+ rm -f *.elf
+ rm -f *.hex
+ rm -f *.bin
+ rm -f *.map
+ rm -f *.lst
diff --git a/self-test/fmc-perf.c b/projects/board-test/fmc-perf.c
index 0c753a7..0c753a7 100644
--- a/self-test/fmc-perf.c
+++ b/projects/board-test/fmc-perf.c
diff --git a/self-test/fmc-test.c b/projects/board-test/fmc-test.c
index cf17087..cf17087 100644
--- a/self-test/fmc-test.c
+++ b/projects/board-test/fmc-test.c
diff --git a/self-test/led-test.c b/projects/board-test/led-test.c
index 5e4401f..5e4401f 100644
--- a/self-test/led-test.c
+++ b/projects/board-test/led-test.c
diff --git a/self-test/short-test.c b/projects/board-test/short-test.c
index 27b8e7a..27b8e7a 100644
--- a/self-test/short-test.c
+++ b/projects/board-test/short-test.c
diff --git a/self-test/uart-test.c b/projects/board-test/uart-test.c
index 8fe7795..8fe7795 100644
--- a/self-test/uart-test.c
+++ b/projects/board-test/uart-test.c
diff --git a/projects/libhal-test/Makefile b/projects/libhal-test/Makefile
new file mode 100644
index 0000000..b0def35
--- /dev/null
+++ b/projects/libhal-test/Makefile
@@ -0,0 +1,33 @@
+TEST = cores test-bus test-trng test-hash test-aes-key-wrap test-pbkdf2 test-ecdsa test-rsa
+#TEST += test-rpc_hash test-rpc_pkey test-rpc_get_version test-rpc_get_random
+TEST += test-rpc_server
+
+CFLAGS += -I $(LIBHAL_DIR)
+LIBC_OBJS = printf.o gettimeofday.o
+LIBS += $(LIBHAL_DIR)/libhal.a $(LIBTFM_DIR)/libtfm.a
+
+all: $(TEST:=.elf)
+
+vpath %.c $(LIBHAL_DIR)/tests $(LIBHAL_DIR)/utils
+
+# .mo extension for files with main() that need to be wrapped as __main()
+%.mo: %.c
+ $(CC) -c $(CFLAGS) -Dmain=__main -o $@ $<
+
+%.elf: %.mo main.o $(BOARD_OBJS) $(LIBC_OBJS) $(LIBS)
+ $(CC) $(CFLAGS) $^ -o $*.elf -T$(LDSCRIPT) -g -Wl,-Map=$*.map
+ $(OBJCOPY) -O ihex $*.elf $*.hex
+ $(OBJCOPY) -O binary $*.elf $*.bin
+ $(OBJDUMP) -St $*.elf >$*.lst
+ $(SIZE) $*.elf
+
+# don't automatically delete objects, to avoid a lot of unnecessary rebuilding
+.SECONDARY: $(BOARD_OBJS) $(LIBC_OBJS)
+
+clean:
+ rm -f *.o *.mo
+ rm -f *.elf
+ rm -f *.hex
+ rm -f *.bin
+ rm -f *.map
+ rm -f *.lst
diff --git a/gettimeofday.c b/projects/libhal-test/gettimeofday.c
index b13485d..b13485d 100644
--- a/gettimeofday.c
+++ b/projects/libhal-test/gettimeofday.c
diff --git a/main.c b/projects/libhal-test/main.c
index 2776750..2776750 100644
--- a/main.c
+++ b/projects/libhal-test/main.c
diff --git a/printf.c b/projects/libhal-test/printf.c
index 5a15d12..5a15d12 100644
--- a/printf.c
+++ b/projects/libhal-test/printf.c