summaryrefslogtreecommitdiff
path: root/src/stm32f4
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2019-02-18 12:59:05 -0800
committerKeith Packard <keithp@keithp.com>2019-02-18 13:08:23 -0800
commit7a89aa1ea7e1b02b5cd310986adf4239ec0ce91d (patch)
tree74e5fe54f95ab21e513a1c9a14b8a02c1c8cffea /src/stm32f4
parent889518aeee080b0f8bb954db86d08105898d8161 (diff)
altos: Move common build definitions to src/Makefile.defs
This cleans up the build process for all architectures, providing a common place to specify vpath, cflags and build rules for various common files. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/stm32f4')
-rw-r--r--src/stm32f4/Makefile-flash.defs5
-rw-r--r--src/stm32f4/Makefile-stm32f4.defs47
-rw-r--r--src/stm32f4/Makefile.defs6
3 files changed, 5 insertions, 53 deletions
diff --git a/src/stm32f4/Makefile-flash.defs b/src/stm32f4/Makefile-flash.defs
index 1a2aa75c..bc5aa1ac 100644
--- a/src/stm32f4/Makefile-flash.defs
+++ b/src/stm32f4/Makefile-flash.defs
@@ -33,7 +33,7 @@ PRODUCT=AltosFlash
PRODUCT_DEF=-DALTOS_FLASH
IDPRODUCT=0x000a
-CFLAGS = $(PRODUCT_DEF) $(STM32F4_CFLAGS) -g -Os
+CFLAGS = $(PRODUCT_DEF) $(STM32F4_CFLAGS)
LDFLAGS=$(CFLAGS) -L$(TOPDIR)/stm32f4 -Wl,-Taltos-loader.ld
@@ -52,9 +52,6 @@ $(PROG): Makefile $(OBJ) altos-loader.ld
$(BIN): $(PROG)
$(MAKEBIN) --output=$@ --base=$(FLASH_ADDR) $(PROG)
-ao_product.h: ao-make-product.5c $(TOPDIR)/Version
- $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@
-
$(OBJ): $(INC)
distclean: clean
diff --git a/src/stm32f4/Makefile-stm32f4.defs b/src/stm32f4/Makefile-stm32f4.defs
index c39633c7..1c87b5b0 100644
--- a/src/stm32f4/Makefile-stm32f4.defs
+++ b/src/stm32f4/Makefile-stm32f4.defs
@@ -2,51 +2,12 @@ ifndef TOPDIR
TOPDIR=..
endif
-include $(TOPDIR)/Makedefs
+include $(TOPDIR)/Makefile.defs
-vpath % $(TOPDIR)/stm32f4:$(TOPDIR)/product:$(TOPDIR)/drivers:$(TOPDIR)/kernel:$(TOPDIR)/util:$(TOPDIR)/kalman:$(TOPDIR)/aes:$(TOPDIR):$(TOPDIR)/math
-vpath make-altitude $(TOPDIR)/util
-vpath make-kalman $(TOPDIR)/util
-vpath kalman.5c $(TOPDIR)/kalman
-vpath kalman_filter.5c $(TOPDIR)/kalman
-vpath load_csv.5c $(TOPDIR)/kalman
-vpath matrix.5c $(TOPDIR)/kalman
-vpath ao-make-product.5c $(TOPDIR)/util
+vpath % $(TOPDIR)/stm32f4:$(AO_VPATH)
-.SUFFIXES: .elf .ihx
-
-.elf.ihx:
- $(ELFTOHEX) --output=$@ $*.elf
-
-ifndef VERSION
-include $(TOPDIR)/Version
-endif
-
-ELFTOHEX=$(TOPDIR)/../ao-tools/ao-elftohex/ao-elftohex
CC=$(ARM_CC)
-
-WARN_FLAGS=-Wall -Wextra -Werror -Wcast-align
-
-AO_CFLAGS=-I. -I$(TOPDIR)/stm32f4 -I$(TOPDIR)/kernel -I$(TOPDIR)/drivers \
- -Os -g \
- -I$(TOPDIR)/product -I$(TOPDIR) -I$(TOPDIR)/math \
- -isystem $(NEWLIB_NANO)/arm-none-eabi/include
-
-STM32F4_CFLAGS=-std=gnu99 -mlittle-endian -mcpu=cortex-m4 -mthumb \
- -mfloat-abi=hard -mfpu=fpv4-sp-d16 \
- -ffreestanding -nostdlib $(AO_CFLAGS) $(WARN_FLAGS)
-
-NICKLE=nickle
-
LIBS=-L$(NEWLIB_NANO)/arm-none-eabi/lib/thumb/v7e-m/fpv4-sp/hard -lc -lm -lgcc
-V=0
-# The user has explicitly enabled quiet compilation.
-ifeq ($(V),0)
-quiet = @printf " $1 $2 $@\n"; $($1)
-endif
-# Otherwise, print the full command line.
-quiet ?= $($1)
-
-.c.o:
- $(call quiet,CC) -c $(CFLAGS) -o $@ $<
+STM32F4_CFLAGS=-mlittle-endian -mcpu=cortex-m4 -mthumb \
+ -I$(TOPDIR)/stm32f4 $(AO_CFLAGS) $(NEWLIB_CFLAGS)
diff --git a/src/stm32f4/Makefile.defs b/src/stm32f4/Makefile.defs
index be185a59..8c0e8842 100644
--- a/src/stm32f4/Makefile.defs
+++ b/src/stm32f4/Makefile.defs
@@ -4,10 +4,4 @@ endif
include $(TOPDIR)/stm32f4/Makefile-stm32f4.defs
-LOADER=flash-loader/$(PROGNAME)-altos-flash-$(VERSION).elf
-MAKEBIN=$(TOPDIR)/../ao-tools/ao-makebin/ao-makebin
-FLASH_ADDR=0x08000000
-
LDFLAGS=$(CFLAGS) -L$(TOPDIR)/stm32f4 -Wl,-Taltos.ld -n
-
-.DEFAULT_GOAL=all