summaryrefslogtreecommitdiff
path: root/src/stm
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/stm
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/stm')
-rw-r--r--src/stm/Makefile-flash.defs45
-rw-r--r--src/stm/Makefile-stm.defs13
-rw-r--r--src/stm/Makefile.defs53
3 files changed, 19 insertions, 92 deletions
diff --git a/src/stm/Makefile-flash.defs b/src/stm/Makefile-flash.defs
index 66ad1637..08a4b177 100644
--- a/src/stm/Makefile-flash.defs
+++ b/src/stm/Makefile-flash.defs
@@ -1,40 +1,4 @@
-vpath % $(TOPDIR)/stm:$(TOPDIR)/product:$(TOPDIR)/drivers:$(TOPDIR)/kernel:$(TOPDIR)/util:$(TOPDIR)
-vpath ao-make-product.5c $(TOPDIR)/util
-
-.SUFFIXES: .elf .ihx
-
-.elf.ihx:
- objcopy -O ihex $*.elf $@
-
-ifndef VERSION
-include $(TOPDIR)/Version
-endif
-include $(TOPDIR)/Makedefs
-
-CC=$(ARM_CC)
-LIBS=-L$(NEWLIB_NANO)/arm-none-eabi/lib/thumb/v7-m -lc -lm -lgcc
-
-AO_CFLAGS=-I. -I$(TOPDIR)/stm -I$(TOPDIR)/kernel -I$(TOPDIR)/drivers \
- -DNEWLIB_INTEGER_PRINTF_SCANF \
- -I$(TOPDIR)/product -I$(TOPDIR) -isystem $(NEWLIB_NANO)/arm-none-eabi/include
-
-STM_CFLAGS=-std=gnu99 -mlittle-endian -mcpu=cortex-m3 -mthumb \
- -ffreestanding -nostdlib $(AO_CFLAGS) $(SAT_CFLAGS)
-
-LDFLAGS=-L$(TOPDIR)/stm -Wl,-Taltos-loader.ld
-
-NICKLE=nickle
-
-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 $@ $<
+include $(TOPDIR)/stm/Makefile-stm.defs
INC = \
ao.h \
@@ -69,7 +33,9 @@ PRODUCT=AltosFlash
PRODUCT_DEF=-DALTOS_FLASH
IDPRODUCT=0x000a
-CFLAGS = $(PRODUCT_DEF) $(STM_CFLAGS) -g -Os
+CFLAGS = $(PRODUCT_DEF) $(STM_CFLAGS)
+
+LDFLAGS=$(CFLAGS) -L$(TOPDIR)/stm -Wl,-Taltos-loader.ld -n
PROGNAME=altos-flash
PROG=$(HARDWARE)-$(PROGNAME)-$(VERSION).elf
@@ -77,9 +43,6 @@ PROG=$(HARDWARE)-$(PROGNAME)-$(VERSION).elf
$(PROG): Makefile $(OBJ) altos-loader.ld
$(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) $(LIBS)
-ao_product.h: ao-make-product.5c $(TOPDIR)/Version
- $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@
-
$(OBJ): $(INC)
all: $(PROG)
diff --git a/src/stm/Makefile-stm.defs b/src/stm/Makefile-stm.defs
new file mode 100644
index 00000000..cce28f00
--- /dev/null
+++ b/src/stm/Makefile-stm.defs
@@ -0,0 +1,13 @@
+ifndef TOPDIR
+TOPDIR=..
+endif
+
+include $(TOPDIR)/Makefile.defs
+
+vpath % $(TOPDIR)/stm:$(AO_VPATH)
+
+CC=$(ARM_CC)
+LIBS=-L$(NEWLIB_NANO)/arm-none-eabi/lib/thumb/v7-m -lm -lc -lgcc
+
+STM_CFLAGS=-mlittle-endian -mcpu=cortex-m3 -mthumb \
+ -I$(TOPDIR)/stm $(AO_CFLAGS) $(NEWLIB_CFLAGS)
diff --git a/src/stm/Makefile.defs b/src/stm/Makefile.defs
index 2db534c2..26ba5824 100644
--- a/src/stm/Makefile.defs
+++ b/src/stm/Makefile.defs
@@ -1,56 +1,7 @@
-vpath % ../stm:../product:../drivers:../kernel:../util:../kalman:../aes:../math:../draw:../scheme:..
-vpath make-altitude ../util
-vpath make-kalman ../util
-vpath kalman.5c ../kalman
-vpath kalman_filter.5c ../kalman
-vpath load_csv.5c ../kalman
-vpath matrix.5c ../kalman
-vpath ao-make-product.5c ../util
-
-.SUFFIXES: .elf .ihx
-
-.elf.ihx:
- $(ELFTOHEX) --output=$@ $*.elf
-
ifndef TOPDIR
TOPDIR=..
endif
-ifndef VERSION
-include $(TOPDIR)/Version
-endif
-include $(TOPDIR)/Makedefs
-
-CC=$(ARM_CC)
-LIBS=-L$(NEWLIB_NANO)/arm-none-eabi/lib/thumb/v7-m -lm -lc -lgcc
-
-WARN_FLAGS=-Wall -Wextra -Werror -Wcast-align \
- -Wpointer-arith \
- -Wstrict-prototypes \
- -Wmissing-prototypes \
- -Wmissing-declarations \
- -Wnested-externs \
- -Wshadow
-
-AO_CFLAGS=-I. -I../stm -I../kernel -I../drivers -I../math -I../draw \
- -DNEWLIB_INTEGER_PRINTF_SCANF \
- -I../lisp -I.. -isystem $(NEWLIB_NANO)/arm-none-eabi/include
-
-STM_CFLAGS=-std=gnu99 -mlittle-endian -mcpu=cortex-m3 -mthumb -Wcast-align \
- -ffreestanding -nostdlib $(AO_CFLAGS) $(WARN_FLAGS)
-
-LDFLAGS=-L../stm -Wl,-Taltos.ld -nostartfiles -Wl,-Map=$(PROGNAME).map
-
-NICKLE=nickle
-ELFTOHEX=$(TOPDIR)/../ao-tools/ao-elftohex/ao-elftohex
-
-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)
+include $(TOPDIR)/stm/Makefile-stm.defs
-.c.o:
- $(call quiet,CC) -c $(CFLAGS) -o $@ $<
+LDFLAGS=$(CFLAGS) -L$(TOPDIR)/stm -Wl,-Taltos.ld -n