make: set up test framework

tags/0.1.0
S.J.R. van Schaik 7 years ago
parent e089e2ba4e
commit 82d765bee3
  1. 25
      Makefile
  2. 4
      scripts/Makefile.host
  3. 6
      source/Makefile
  4. 1
      source/core/Makefile
  5. 6
      source/platform/Makefile
  6. 3
      source/platform/stm32f0/Makefile
  7. 3
      source/platform/stm32f1/Makefile

@ -22,14 +22,17 @@ CFLAGS += -std=c99
CFLAGS += -Os -flto
LDFLAGS += -Os -flto
TEST_LIBS += -lcmocka
-include source/Makefile
obj-y += source/bitops.o
obj-y += source/main.o
obj = $(addprefix $(BUILD)/, $(obj-y))
obj-y += source/core/flash.o
tbm-obj = $(addprefix $(BUILD)/, $(tbm-obj-y))
tbm-obj += $(obj)
obj = $(addprefix $(BUILD)/, $(obj-y))
test-obj = $(addprefix $(BUILD)/, $(test-obj-y))
test-obj += $(obj)
# Include the dependencies.
-include $(obj:.o=.d)
@ -52,9 +55,17 @@ $(BUILD)/%.o: %.c
@mkdir -p $(dir $@)
@$(CC) -c $< -o $@ $(CFLAGS) -MT $@ -MMD -MP -MF $(@:.o=.d)
$(BUILD)/tbm: $(obj) $(LDSCRIPT)
$(BUILD)/tbm: $(tbm-obj) $(LDSCRIPT)
@echo "LD $@"
@mkdir -p $(dir $@)
@$(LD) -o $@ $(CFLAGS) $(LDFLAGS) $(obj) $(LIBS)
@$(LD) -o $@ $(CFLAGS) $(LDFLAGS) $(tbm-obj) $(LIBS)
$(BUILD)/test: $(test-obj)
@echo "LD $@"
@mkdir -p $(dir $@)
@$(LD) -o $@ $(CFLAGS) $(LDFLAGS) $(test-obj) -Wl,--wrap=flash_read $(LIBS) $(TEST_LIBS)
test: $(BUILD)/test
@$(BUILD)/test
.PHONY: clean
.PHONY: clean test

@ -1,7 +1,5 @@
CFLAGS += -g
obj-y += source/drivers/sandbox_flash.o
obj-y += source/drivers/stdio_console.o
CFLAGS += -DHAVE_SYS_TYPES_H=1
tools: $(BUILD)/create-image
all: tools

@ -1,4 +1,10 @@
-include source/core/Makefile
-include source/ftl/Makefile
-include source/mufs/Makefile
-include source/platform/Makefile
-include source/shell/Makefile
-include source/tests/Makefile
obj-y += source/bitops.o
tbm-obj-y += source/main.o

@ -0,0 +1 @@
tbm-obj-y += source/core/flash.o

@ -1,7 +1 @@
ifeq ($(TARGET),host)
else
obj-y += source/platform/spi_flash.o
obj-y += source/platform/usart.o
endif
-include source/platform/$(TARGET)/Makefile

@ -1,3 +1,6 @@
obj-y += source/platform/spi_flash.o
obj-y += source/platform/usart.o
obj-y += source/platform/stm32f0/gpio.o
obj-y += source/platform/stm32f0/rcc.o
obj-y += source/platform/stm32f0/rtc.o

@ -1,3 +1,6 @@
obj-y += source/platform/spi_flash.o
obj-y += source/platform/usart.o
obj-y += source/platform/stm32f1/gpio.o
obj-y += source/platform/stm32f1/rcc.o
obj-y += source/platform/stm32f1/rtc.o

Loading…
Cancel
Save