X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=src%2FMakefile;h=e4b110390c2cb5b6e4221136d3dc8ac60da23654;hp=3928136976259daf9bf8cce48de76183106d3a46;hb=a04c4f7b07e97d568f8f6f56dd363329817fb52c;hpb=17d2432a8b9c15963cd3b821f025ad33972ef477 diff --git a/src/Makefile b/src/Makefile index 39281369..e4b11039 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,262 +1,93 @@ # # AltOS build # -# -CC=sdcc -VERSION=$(shell git describe) +vpath make-altitude util +vpath make-altitude-pa util +vpath make-kalman util +vpath make-whiten util +vpath kalman.5c kalman +vpath kalman_filter.5c kalman +vpath kalman_micro.5c kalman +vpath load_csv.5c kalman +vpath matrix.5c kalman -CFLAGS=--model-small --debug --opt-code-speed +include Version -LDFLAGS=--out-fmt-ihx --code-loc 0x0000 --code-size 0x8000 \ - --xram-loc 0xf000 --xram-size 0xda2 --iram-size 0xff +SDCCDIRS=\ + telemetrum-v1.2 telemetrum-v1.1 telemetrum-v1.0 \ + teledongle-v0.2 teledongle-v0.1 \ + telemini-v1.0 telenano-v0.1 \ + telebt-v0.0 telebt-v0.1 \ + telemetrum-v0.1-sky telemetrum-v0.1-sirf \ + telelaunch-v0.1 tidongle test \ + teleterra-v0.2 teleshield-v0.1 \ + telefire-v0.1 \ + spiradio-v0.1 telescience-v0.2 -INC = \ - ao.h \ - cc1111.h \ - altitude.h \ - 25lc1024.h +AVRDIRS=\ + telescience-v0.1 telescience-pwm telepyro-v0.1 micropeak -# -# Common AltOS sources -# -ALTOS_SRC = \ - ao_cmd.c \ - ao_dbg.c \ - ao_dma.c \ - ao_mutex.c \ - ao_panic.c \ - ao_task.c \ - ao_timer.c \ - _bp.c +ARMDIRS=\ + megametrum-v0.1 megadongle-v0.1 stm-bringup stm-demo telelco-v0.1 -# -# Shared AltOS drivers -# -ALTOS_DRIVER_SRC = \ - ao_beep.c \ - ao_config.c \ - ao_led.c \ - ao_radio.c \ - ao_stdio.c \ - ao_usb.c +ifneq ($(shell which sdcc),) + SUBDIRS += $(SDCCDIRS) +endif -TELE_COMMON_SRC = \ - ao_gps_print.c \ - ao_state.c +ifneq ($(shell which avr-gcc),) + SUBDIRS += $(AVRDIRS) +endif -# -# Receiver code -# -TELE_RECEIVER_SRC =\ - ao_monitor.c \ - ao_rssi.c +ifneq ($(shell which arm-none-eabi-gcc),) + SUBDIRS += $(ARMDIRS) +endif -# -# Shared Tele drivers (on TeleMetrum, TeleTerra, TeleDongle) -# +ALLDIRS=$(SDCCDIRS) $(AVRDIRS) $(ARMDIRS) -TELE_DRIVER_SRC = \ - ao_convert.c \ - ao_gps.c \ - ao_serial.c +all: all-local all-recursive -# -# Drivers for partially-flled boards (TT, TD and TI) -# -TELE_FAKE_SRC = \ - ao_adc_fake.c \ - ao_ee_fake.c +RECURSIVE_TARGETS = all-recursive install-recursive -# -# Drivers only on TeleMetrum -# -TM_DRIVER_SRC = \ - ao_adc.c \ - ao_ee.c \ - ao_gps_report.c \ - ao_ignite.c +$(RECURSIVE_TARGETS): + @target=`echo $@ | sed 's/-recursive//'`; \ + for subdir in $(SUBDIRS); do \ + echo "Making $$target in $$subdir"; \ + (cd $$subdir && $(MAKE) $$target) || exit 1; \ + done -# -# Tasks run on TeleMetrum -# -TM_TASK_SRC = \ - ao_flight.c \ - ao_log.c \ - ao_report.c \ - ao_telemetry.c - -TM_MAIN_SRC = \ - ao_telemetrum.c - -# -# All sources for TeleMetrum -# -TM_SRC = \ - $(ALTOS_SRC) \ - $(ALTOS_DRIVER_SRC) \ - $(TELE_DRIVER_SRC) \ - $(TELE_COMMON_SRC) \ - $(TM_DRIVER_SRC) \ - $(TM_TASK_SRC) \ - $(TM_MAIN_SRC) +ALL_RECURSIVE_TARGETS = clean-recursive -TI_MAIN_SRC = \ - ao_tidongle.c +$(ALL_RECURSIVE_TARGETS): + @target=`echo $@ | sed 's/-recursive//'`; \ + for subdir in $(ALLDIRS); do \ + echo "Making $$target in $$subdir"; \ + (cd $$subdir && $(MAKE) $$target) || exit 1; \ + done -# -# All sources for the TI debug dongle -# -TI_SRC = \ - $(ALTOS_SRC) \ - $(ALTOS_DRIVER_SRC) \ - $(TELE_RECEIVER_SRC) \ - $(TELE_COMMON_SRC) \ - $(TELE_FAKE_SRC) \ - $(TI_MAIN_SRC) +distclean: clean -TT_MAIN_SRC = \ - ao_teleterra.c -# -# All sources for TeleTerra -# -TT_SRC = \ - $(ALTOS_SRC) \ - $(ALTOS_DRIVER_SRC) \ - $(TELE_RECEIVER_SRC) \ - $(TELE_DRIVER_SRC) \ - $(TELE_COMMON_SRC) \ - $(TELE_FAKE_SRC) \ - $(TT_MAIN_SRC) +clean: clean-local clean-recursive +install: install-recursive -# -# Sources for TeleDongle -# +uninstall: -TD_MAIN_SRC = \ - ao_teledongle.c +all-recursive: all-local -TD_SRC = \ - $(ALTOS_SRC) \ - $(ALTOS_DRIVER_SRC) \ - $(TELE_RECEIVER_SRC) \ - $(TELE_COMMON_SRC) \ - $(TELE_FAKE_SRC) \ - $(TD_MAIN_SRC) - -SRC = \ - $(ALTOS_SRC) \ - $(ALTOS_DRIVER_SRC) \ - $(TELE_DRIVER_SRC) \ - $(TELE_RECEIVER_SRC) \ - $(TELE_COMMON_SRC) \ - $(TELE_FAKE_SRC) \ - $(TM_DRIVER_SRC) \ - $(TM_TASK_SRC) \ - $(TM_MAIN_SRC) \ - $(TI_MAIN_SRC) \ - $(TD_MAIN_SRC) \ - $(TT_MAIN_SRC) - -TM_REL=$(TM_SRC:.c=.rel) ao_product-telemetrum.rel -TI_REL=$(TI_SRC:.c=.rel) ao_product-tidongle.rel -TT_REL=$(TT_SRC:.c=.rel) ao_product-teleterra.rel -TD_REL=$(TD_SRC:.c=.rel) ao_product-teledongle.rel - -PROD_REL=\ - ao_product-telemetrum.rel \ - ao_product-tidongle.rel \ - ao_product-teleterra.rel \ - ao_product-teledongle.rel - -REL=$(SRC:.c=.rel) $(PROD_REL) -ADB=$(REL:.rel=.adb) -ASM=$(REL:.rel=.asm) -LNK=$(REL:.rel=.lnk) -LST=$(REL:.rel=.lst) -RST=$(REL:.rel=.rst) -SYM=$(REL:.rel=.sym) - -PROGS= telemetrum.ihx tidongle.ihx \ - teleterra.ihx teledongle.ihx - -HOST_PROGS=ao_flight_test - -PCDB=$(PROGS:.ihx=.cdb) -PLNK=$(PROGS:.ihx=.lnk) -PMAP=$(PROGS:.ihx=.map) -PMEM=$(PROGS:.ihx=.mem) -PAOM=$(PROGS:.ihx=) - -%.rel : %.c $(INC) - $(CC) -c $(CFLAGS) -o$*.rel $*.c - -all: $(PROGS) $(HOST_PROGS) - -telemetrum.ihx: $(TM_REL) Makefile - $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TM_REL) - sh check-stack ao.h telemetrum.mem - -tidongle.ihx: $(TI_REL) Makefile - $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TI_REL) - sh check-stack ao.h tidongle.mem - -tidongle.ihx: telemetrum.ihx - -teleterra.ihx: $(TT_REL) Makefile - $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TT_REL) - sh check-stack ao.h teleterra.mem - -teleterra.ihx: tidongle.ihx - -teledongle.ihx: $(TD_REL) Makefile - $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TD_REL) - sh check-stack ao.h teledongle.mem - -teledongle.ihx: teleterra.ihx +all-local: altitude.h altitude-pa.h ao_kalman.h ao_whiten.h altitude.h: make-altitude - nickle make-altitude > altitude.h - -TELEMETRUM_DEFS=ao-telemetrum.h -TELETERRA_DEFS=ao-teleterra.h -TELEDONGLE_DEFS=ao-teledongle.h -TIDONGLE_DEFS=ao-tidongle.h - -ALL_DEFS=$(TELEMETRUM_DEFS) $(TELETERRA_DEFS) \ - $(TELEDONGLE_DEFS) $(TIDONGLE_DEFS) -ao_product-telemetrum.rel: ao_product.c $(TELEMETRUM_DEFS) - $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELEMETRUM_DEFS)\"' -o$@ ao_product.c - -ao_product-teleterra.rel: ao_product.c $(TELETERRA_DEFS) - $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELETERRA_DEFS)\"' -o$@ ao_product.c - -ao_product-teledongle.rel: ao_product.c $(TELEDONGLE_DEFS) - $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELEDONGLE_DEFS)\"' -o$@ ao_product.c - -ao_product-tidongle.rel: ao_product.c $(TIDONGLE_DEFS) - $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TIDONGLE_DEFS)\"' -o$@ ao_product.c - -$(TELEMETRUM_DEFS): ao-make-product.5c - nickle ao-make-product.5c -m altusmetrum.org -p TeleMetrum -v $(VERSION) > $@ - -$(TELETERRA_DEFS): ao-make-product.5c - nickle ao-make-product.5c -m altusmetrum.org -p TeleTerra -v $(VERSION) > $@ - -$(TELEDONGLE_DEFS): ao-make-product.5c - nickle ao-make-product.5c -m altusmetrum.org -p TeleDongle -v $(VERSION) > $@ + nickle $< > $@ -$(TIDONGLE_DEFS): ao-make-product.5c - nickle ao-make-product.5c -m altusmetrum.org -p TIDongle -v $(VERSION) > $@ +altitude-pa.h: make-altitude-pa + nickle $< > $@ -clean: - rm -f $(ADB) $(ASM) $(LNK) $(LST) $(REL) $(RST) $(SYM) - rm -f $(PROGS) $(PCDB) $(PLNK) $(PMAP) $(PMEM) $(PAOM) - rm -f $(ALL_DEFS) $(HOST_PROGS) - rm -f $(TELEMETRUM_DEFS) $(TELETERRA_DEFS) $(TELEDONGLE_DEFS) $(TIDONGLE_DEFS) +ao_kalman.h: make-kalman kalman.5c kalman_filter.5c load_csv.5c matrix.5c + bash $< kalman > $@ -install: +ao_whiten.h: make-whiten + nickle $< > $@ -ao_flight_test: ao_flight.c ao_flight_test.c - cc -g -o $@ ao_flight_test.c +clean-local: + rm -f altitude.h ao_kalman.h