From 9513be7f9d3d0b0ec29f6487fa9dc8f1ac24d0de Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 25 Aug 2011 20:43:44 -0700 Subject: [PATCH] altos: Restructure altos build to prepare for multi-arch support Split out sources into separate directories: core: architecture and product independent bits cc1111: cc1111-specific code drivers: architecture independent drivers product: product-specific sources and Makefile fragments util: scripts for building stuff This should have no effect on the built products, but testing is encouraged Signed-off-by: Keith Packard --- configure.ac | 2 +- src/Makefile | 25 +- src/Makefile.proto | 380 ------------------ src/ao_adc_fake.c | 27 -- src/ao_main.c | 43 -- src/cc1111/Makefile.cc1111 | 27 ++ src/{ => cc1111}/_bp.c | 0 src/{ => cc1111}/ao_adc.c | 0 src/{ => cc1111}/ao_beep.c | 0 src/{ => cc1111}/ao_dbg.c | 0 src/{ => cc1111}/ao_dma.c | 0 src/{ => cc1111}/ao_ignite.c | 0 src/{ => cc1111}/ao_intflash.c | 0 src/{ => cc1111}/ao_led.c | 0 src/{ => cc1111}/ao_packet.c | 0 src/{ => cc1111}/ao_packet_master.c | 0 src/{ => cc1111}/ao_packet_slave.c | 0 src/{ => cc1111}/ao_radio.c | 0 src/{ => cc1111}/ao_reboot.c | 0 src/{ => cc1111}/ao_romconfig.c | 0 src/{ => cc1111}/ao_serial.c | 0 src/{ => cc1111}/ao_spi.c | 0 src/{ => cc1111}/ao_timer.c | 0 src/{ => cc1111}/ao_usb.c | 0 src/{ => cc1111}/ao_usb.h | 0 src/{ => cc1111}/cc1111.h | 0 src/{ => core}/altitude.h | 0 src/{ => core}/ao.h | 0 src/{ => core}/ao_cmd.c | 0 src/{ => core}/ao_config.c | 0 src/{ => core}/ao_convert.c | 0 src/{ => core}/ao_convert_test.c | 0 src/{ => core}/ao_ee_fake.c | 0 src/{ => core}/ao_flight.c | 0 src/{ => core}/ao_flight_nano.c | 0 src/{ => core}/ao_gps_print.c | 0 src/{ => core}/ao_gps_report.c | 0 src/{ => core}/ao_host.h | 0 src/{ => core}/ao_kalman.c | 0 src/{ => core}/ao_log.c | 0 src/{ => core}/ao_log_big.c | 0 src/{ => core}/ao_log_telem.c | 0 src/{ => core}/ao_log_tiny.c | 0 src/{ => core}/ao_monitor.c | 0 src/{ => core}/ao_mutex.c | 0 src/{ => core}/ao_panic.c | 0 src/{ => core}/ao_pins.h | 0 src/{ => core}/ao_product.c | 0 src/{ => core}/ao_report.c | 0 src/{ => core}/ao_rssi.c | 0 src/{ => core}/ao_sample.c | 0 src/{ => core}/ao_state.c | 0 src/{ => core}/ao_stdio.c | 0 src/{ => core}/ao_storage.c | 0 src/{ => core}/ao_task.c | 0 src/{ => core}/ao_telem.h | 0 src/{ => core}/ao_telemetry.c | 0 src/{ao_ee.c => drivers/ao_25lc1024.c} | 2 +- src/{25lc1024.h => drivers/ao_25lc1024.h} | 0 src/{ao_flash.c => drivers/ao_at45db161d.c} | 2 +- src/{at45db161d.h => drivers/ao_at45db161d.h} | 0 src/{ => drivers}/ao_btm.c | 0 src/{ => drivers}/ao_companion.c | 0 src/{ => drivers}/ao_gps_sirf.c | 0 src/{ => drivers}/ao_gps_skytraq.c | 0 src/{ => drivers}/ao_m25.c | 0 src/product/Makefile.telebt | 97 +++++ src/product/Makefile.teledongle | 96 +++++ src/product/Makefile.telemetrum | 111 +++++ src/product/Makefile.telemini | 100 +++++ src/product/Makefile.telenano | 99 +++++ src/{ => product}/ao_telebt.c | 0 src/{ => product}/ao_teledongle.c | 0 src/{ => product}/ao_telemetrum.c | 0 src/{ => product}/ao_telemini.c | 0 src/{ => product}/ao_telenano.c | 0 src/{ => product}/ao_teleterra.c | 0 src/{ => product}/ao_test.c | 0 src/{ => product}/ao_tidongle.c | 0 src/telebt-v0.0/Makefile | 10 +- src/telebt-v0.0/Makefile.defs | 8 - src/telebt-v0.1/Makefile | 20 +- src/telebt-v0.1/Makefile.defs | 8 - src/teledongle-v0.1/Makefile | 9 +- src/teledongle-v0.1/Makefile.defs | 9 - src/teledongle-v0.2/Makefile | 9 +- src/teledongle-v0.2/Makefile.defs | 9 - src/telemetrum-v0.1-sirf/Makefile | 17 +- src/telemetrum-v0.1-sirf/Makefile.defs | 12 - src/telemetrum-v0.1-sky/Makefile | 17 +- src/telemetrum-v0.1-sky/Makefile.defs | 12 - src/telemetrum-v1.0/Makefile | 17 +- src/telemetrum-v1.0/Makefile.defs | 13 - src/telemetrum-v1.1/Makefile | 17 +- src/telemetrum-v1.1/Makefile.defs | 13 - src/telemini-v1.0/Makefile | 9 +- src/telemini-v1.0/Makefile.defs | 9 - src/telenano-v0.1/Makefile | 10 +- src/telenano-v0.1/Makefile.defs | 9 - src/test/Makefile | 20 +- src/{ => test}/ao_flight_test.c | 0 src/{ => test}/ao_gps_test.c | 0 src/{ => test}/ao_gps_test_skytraq.c | 0 src/tidongle/Makefile | 93 ++++- src/tidongle/Makefile.defs | 9 - src/{ => util}/ao-make-product.5c | 0 src/{ => util}/check-stack | 0 src/{ => util}/gps-cksum | 0 src/{ => util}/make-altitude | 0 src/{ => util}/make-kalman | 2 +- src/{ => util}/sirf-cksum | 0 src/{ => util}/skytraq-cksum | 0 112 files changed, 781 insertions(+), 591 deletions(-) delete mode 100644 src/Makefile.proto delete mode 100644 src/ao_adc_fake.c delete mode 100644 src/ao_main.c create mode 100644 src/cc1111/Makefile.cc1111 rename src/{ => cc1111}/_bp.c (100%) rename src/{ => cc1111}/ao_adc.c (100%) rename src/{ => cc1111}/ao_beep.c (100%) rename src/{ => cc1111}/ao_dbg.c (100%) rename src/{ => cc1111}/ao_dma.c (100%) rename src/{ => cc1111}/ao_ignite.c (100%) rename src/{ => cc1111}/ao_intflash.c (100%) rename src/{ => cc1111}/ao_led.c (100%) rename src/{ => cc1111}/ao_packet.c (100%) rename src/{ => cc1111}/ao_packet_master.c (100%) rename src/{ => cc1111}/ao_packet_slave.c (100%) rename src/{ => cc1111}/ao_radio.c (100%) rename src/{ => cc1111}/ao_reboot.c (100%) rename src/{ => cc1111}/ao_romconfig.c (100%) rename src/{ => cc1111}/ao_serial.c (100%) rename src/{ => cc1111}/ao_spi.c (100%) rename src/{ => cc1111}/ao_timer.c (100%) rename src/{ => cc1111}/ao_usb.c (100%) rename src/{ => cc1111}/ao_usb.h (100%) rename src/{ => cc1111}/cc1111.h (100%) rename src/{ => core}/altitude.h (100%) rename src/{ => core}/ao.h (100%) rename src/{ => core}/ao_cmd.c (100%) rename src/{ => core}/ao_config.c (100%) rename src/{ => core}/ao_convert.c (100%) rename src/{ => core}/ao_convert_test.c (100%) rename src/{ => core}/ao_ee_fake.c (100%) rename src/{ => core}/ao_flight.c (100%) rename src/{ => core}/ao_flight_nano.c (100%) rename src/{ => core}/ao_gps_print.c (100%) rename src/{ => core}/ao_gps_report.c (100%) rename src/{ => core}/ao_host.h (100%) rename src/{ => core}/ao_kalman.c (100%) rename src/{ => core}/ao_log.c (100%) rename src/{ => core}/ao_log_big.c (100%) rename src/{ => core}/ao_log_telem.c (100%) rename src/{ => core}/ao_log_tiny.c (100%) rename src/{ => core}/ao_monitor.c (100%) rename src/{ => core}/ao_mutex.c (100%) rename src/{ => core}/ao_panic.c (100%) rename src/{ => core}/ao_pins.h (100%) rename src/{ => core}/ao_product.c (100%) rename src/{ => core}/ao_report.c (100%) rename src/{ => core}/ao_rssi.c (100%) rename src/{ => core}/ao_sample.c (100%) rename src/{ => core}/ao_state.c (100%) rename src/{ => core}/ao_stdio.c (100%) rename src/{ => core}/ao_storage.c (100%) rename src/{ => core}/ao_task.c (100%) rename src/{ => core}/ao_telem.h (100%) rename src/{ => core}/ao_telemetry.c (100%) rename src/{ao_ee.c => drivers/ao_25lc1024.c} (99%) rename src/{25lc1024.h => drivers/ao_25lc1024.h} (100%) rename src/{ao_flash.c => drivers/ao_at45db161d.c} (99%) rename src/{at45db161d.h => drivers/ao_at45db161d.h} (100%) rename src/{ => drivers}/ao_btm.c (100%) rename src/{ => drivers}/ao_companion.c (100%) rename src/{ => drivers}/ao_gps_sirf.c (100%) rename src/{ => drivers}/ao_gps_skytraq.c (100%) rename src/{ => drivers}/ao_m25.c (100%) create mode 100644 src/product/Makefile.telebt create mode 100644 src/product/Makefile.teledongle create mode 100644 src/product/Makefile.telemetrum create mode 100644 src/product/Makefile.telemini create mode 100644 src/product/Makefile.telenano rename src/{ => product}/ao_telebt.c (100%) rename src/{ => product}/ao_teledongle.c (100%) rename src/{ => product}/ao_telemetrum.c (100%) rename src/{ => product}/ao_telemini.c (100%) rename src/{ => product}/ao_telenano.c (100%) rename src/{ => product}/ao_teleterra.c (100%) rename src/{ => product}/ao_test.c (100%) rename src/{ => product}/ao_tidongle.c (100%) delete mode 100644 src/telebt-v0.0/Makefile.defs delete mode 100644 src/telebt-v0.1/Makefile.defs delete mode 100644 src/teledongle-v0.1/Makefile.defs delete mode 100644 src/teledongle-v0.2/Makefile.defs delete mode 100644 src/telemetrum-v0.1-sirf/Makefile.defs delete mode 100644 src/telemetrum-v0.1-sky/Makefile.defs delete mode 100644 src/telemetrum-v1.0/Makefile.defs delete mode 100644 src/telemetrum-v1.1/Makefile.defs delete mode 100644 src/telemini-v1.0/Makefile.defs delete mode 100644 src/telenano-v0.1/Makefile.defs rename src/{ => test}/ao_flight_test.c (100%) rename src/{ => test}/ao_gps_test.c (100%) rename src/{ => test}/ao_gps_test_skytraq.c (100%) delete mode 100644 src/tidongle/Makefile.defs rename src/{ => util}/ao-make-product.5c (100%) rename src/{ => util}/check-stack (100%) rename src/{ => util}/gps-cksum (100%) rename src/{ => util}/make-altitude (100%) rename src/{ => util}/make-kalman (97%) rename src/{ => util}/sirf-cksum (100%) rename src/{ => util}/skytraq-cksum (100%) diff --git a/configure.ac b/configure.ac index f9002508..da9d9991 100644 --- a/configure.ac +++ b/configure.ac @@ -19,7 +19,7 @@ dnl Process this file with autoconf to create configure. AC_PREREQ(2.57) AC_INIT([altos], 1.0) -AC_CONFIG_SRCDIR([src/ao.h]) +AC_CONFIG_SRCDIR([src/core/ao.h]) AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_MAINTAINER_MODE diff --git a/src/Makefile b/src/Makefile index 018f0c5c..4e40c2bf 100644 --- a/src/Makefile +++ b/src/Makefile @@ -2,7 +2,13 @@ # AltOS build # # -CC=sdcc + +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 include Version @@ -14,7 +20,7 @@ SUBDIRS=\ telemetrum-v0.1-sky telemetrum-v0.1-sirf \ tidongle test -all: all-recursive +all: all-local all-recursive RECURSIVE_TARGETS = all-recursive clean-recursive install-recursive @@ -27,8 +33,21 @@ $(RECURSIVE_TARGETS): distclean: clean -clean: clean-recursive +clean: clean-local clean-recursive install: install-recursive uninstall: + +all-recursive: all-local + +all-local: altitude.h ao_kalman.h + +altitude.h: make-altitude + nickle $< > $@ + +ao_kalman.h: make-kalman kalman.5c kalman_filter.5c load_csv.5c matrix.5c + sh $< kalman > $@ + +clean-local: + rm -f altitude.h ao_kalman.h \ No newline at end of file diff --git a/src/Makefile.proto b/src/Makefile.proto deleted file mode 100644 index 8f98d354..00000000 --- a/src/Makefile.proto +++ /dev/null @@ -1,380 +0,0 @@ -# -# AltOS build -# -# -vpath %.c .. -vpath %.h .. -vpath make-altitude .. -vpath make-kalman .. -vpath kalman.5c ../kalman -vpath kalman_filter.5c ../kalman -vpath load_csv.5c ../kalman -vpath matrix.5c ../kalman -vpath ao-make-product.5c .. - -CC=sdcc - -ifndef VERSION -include ../Version -endif - -CFLAGS=--model-small --debug --opt-code-speed -DCODESIZE=$(CODESIZE) - -CODESIZE ?= 0x8000 - -LDFLAGS=--out-fmt-ihx --code-loc 0x0000 --code-size $(CODESIZE) \ - --xram-loc 0xf000 --xram-size 0xda2 --iram-size 0xff - -INC = \ - ao.h \ - ao_pins.h \ - cc1111.h \ - altitude.h \ - ao_kalman.h \ - 25lc1024.h - -# -# Common AltOS sources -# -ALTOS_SRC = \ - ao_cmd.c \ - ao_dma.c \ - ao_mutex.c \ - ao_panic.c \ - ao_task.c \ - ao_timer.c \ - ao_romconfig.c \ - _bp.c - -# -# Shared AltOS drivers -# -ALTOS_DRIVER_SRC = \ - ao_config.c \ - ao_led.c \ - ao_radio.c \ - ao_stdio.c - -BEEP_DRIVER_SRC = \ - ao_beep.c - -USB_DRIVER_SRC = \ - ao_usb.c - -TELE_COMMON_SRC = \ - ao_packet.c - -# -# Receiver code -# -TELE_RECEIVER_SRC =\ - ao_monitor.c \ - ao_gps_print.c \ - ao_packet_master.c \ - ao_state.c \ - ao_rssi.c - -# -# Shared Tele drivers (on TeleMetrum, TeleTerra, TeleDongle) -# - -TELE_DRIVER_SRC = \ - ao_convert.c - -# -# Serial port driver -# -SERIAL_DRIVER_SRC = \ - ao_serial.c - -# -# Spi bus driver -# -SPI_DRIVER_SRC = \ - ao_spi.c - -# -# Debug dongle driver (only on TI) -# -DBG_SRC = \ - ao_dbg.c - -# -# Drivers only on TeleMetrum -# -TM_DRIVER_SRC = \ - ao_adc.c \ - ao_gps_report.c \ - ao_ignite.c \ - ao_packet_slave.c \ - $(BEEP_DRIVER_SRC) \ - $(USB_DRIVER_SRC) - -# -# 25LC1024 driver source -EE_DRIVER_SRC = \ - ao_storage.c \ - ao_ee.c - -# -# AT45DB161D driver source - -FLASH_DRIVER_SRC = \ - ao_storage.c \ - ao_flash.c - -# -# Numonyx M25P80 driver source -# - -M25_DRIVER_SRC = \ - ao_storage.c \ - ao_m25.c - -# -# SiRF driver source -# -SIRF_DRIVER_SRC = \ - ao_gps_sirf.c - -# -# Skytraq driver source -# -SKY_DRIVER_SRC = \ - ao_gps_skytraq.c - - -# -# BTM-182 driver source -# -BTM_DRIVER_SRC = \ - ao_btm.c - -# -# Companion port driver source -# -COMPANION_SRC = \ - ao_companion.c - -# -# Tasks run on TeleMetrum -# -TM_TASK_SRC = \ - ao_flight.c \ - ao_sample.c \ - ao_kalman.c \ - ao_log.c \ - ao_log_big.c \ - ao_report.c \ - ao_telemetry.c - -TM_MAIN_SRC = \ - ao_telemetrum.c - -# -# Base sources for TeleMetrum -# -TM_BASE_SRC = \ - $(ALTOS_SRC) \ - $(ALTOS_DRIVER_SRC) \ - $(TELE_DRIVER_SRC) \ - $(SERIAL_DRIVER_SRC) \ - $(TELE_COMMON_SRC) \ - $(TM_DRIVER_SRC) \ - $(TM_TASK_SRC) \ - $(TM_MAIN_SRC) - -# -# Sources for TeleMini -TMINI_DRIVER_SRC = \ - ao_adc.c \ - ao_ignite.c \ - ao_config.c \ - ao_storage.c \ - ao_packet_slave.c \ - ao_intflash.c - -TMINI_TASK_SRC = \ - ao_flight.c \ - ao_sample.c \ - ao_kalman.c \ - ao_log.c \ - ao_log_tiny.c \ - ao_report.c \ - ao_telemetry.c - -TMINI_MAIN_SRC = \ - ao_telemini.c - -TMINI_BASE_SRC = \ - $(ALTOS_SRC) \ - $(ALTOS_DRIVER_SRC) \ - $(TELE_DRIVER_SRC) \ - $(TELE_COMMON_SRC) \ - $(TMINI_DRIVER_SRC) \ - $(TMINI_TASK_SRC) \ - $(TMINI_MAIN_SRC) - -# -# Sources for TeleNano -TNANO_DRIVER_SRC = \ - ao_adc.c \ - ao_config.c \ - ao_storage.c \ - ao_packet_slave.c \ - ao_intflash.c - -TNANO_TASK_SRC = \ - ao_flight_nano.c \ - ao_sample.c \ - ao_kalman.c \ - ao_log.c \ - ao_log_tiny.c \ - ao_report.c \ - ao_telemetry.c - -TNANO_MAIN_SRC = \ - ao_telenano.c - -TNANO_BASE_SRC = \ - $(ALTOS_SRC) \ - $(ALTOS_DRIVER_SRC) \ - $(TELE_DRIVER_SRC) \ - $(TELE_COMMON_SRC) \ - $(TNANO_DRIVER_SRC) \ - $(TNANO_TASK_SRC) \ - $(TNANO_MAIN_SRC) - -# -# Sources for TeleBluetooth -# - -TBT_MAIN_SRC = \ - ao_telebt.c - -TBT_BASE_SRC = \ - $(ALTOS_SRC) \ - $(ALTOS_DRIVER_SRC) \ - $(TELE_RECEIVER_SRC) \ - $(TELE_COMMON_SRC) \ - $(SERIAL_DRIVER_SRC) \ - $(USB_DRIVER_SRC) \ - $(BTM_DRIVER_SRC) \ - $(DBG_SRC) \ - $(TBT_MAIN_SRC) - -TBT_V_0_1_SRC = \ - $(TBT_BASE_SRC) \ - $(SPI_DRIVER_SRC) \ - $(M25_DRIVER_SRC) \ - $(BEEP_DRIVER_SRC) \ - ao_log_telem.c - -# -# TI Dongle sources -# -TI_MAIN_SRC = \ - ao_tidongle.c - -# -# All sources for the TI debug dongle -# -TI_SRC = \ - $(ALTOS_SRC) \ - $(ALTOS_DRIVER_SRC) \ - $(TELE_RECEIVER_SRC) \ - $(TELE_COMMON_SRC) \ - $(USB_DRIVER_SRC) \ - $(TI_MAIN_SRC) \ - $(DBG_SRC) - -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) \ - $(USB_DRIVER_SRC) \ - $(TT_MAIN_SRC) - - -# -# Sources for TeleDongle -# - -TD_MAIN_SRC = \ - ao_teledongle.c - -TD_SRC = \ - $(ALTOS_SRC) \ - $(ALTOS_DRIVER_SRC) \ - $(TELE_RECEIVER_SRC) \ - $(TELE_COMMON_SRC) \ - $(USB_DRIVER_SRC) \ - $(TD_MAIN_SRC) - -include Makefile.defs - -CFLAGS += $(PRODUCT_DEF) -I. - -NICKLE=nickle -CHECK_STACK=sh ../check-stack - -REL=$(SRC:.c=.rel) ao_product.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) - -PCDB=$(PROG:.ihx=.cdb) -PLNK=$(PROG:.ihx=.lnk) -PMAP=$(PROG:.ihx=.map) -PMEM=$(PROG:.ihx=.mem) -PAOM=$(PROG:.ihx=) - -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) - -%.rel : %.c $(INC) - $(call quiet,CC,$(PRODUCT_DEF)) $(CFLAGS) -c -o$@ $< - -all: ../$(PROG) - -../$(PROG): $(REL) Makefile Makefile.defs ../Makefile.proto - $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(REL) && cp $(PROG) $(PMAP) .. - $(call quiet,CHECK_STACK) ../ao.h $(PMEM) - -../altitude.h: make-altitude - nickle $< > $@ - -../ao_kalman.h: make-kalman kalman.5c kalman_filter.5c load_csv.5c matrix.5c - sh $< > $@ - -ao_product.h: ao-make-product.5c ../Version - $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ - -$(REL): ao_product.h - -distclean: clean - -clean: - rm -f $(ADB) $(ASM) $(LNK) $(LST) $(REL) $(RST) $(SYM) - rm -f $(PCDB) $(PLNK) $(PMAP) $(PMEM) $(PAOM) - rm -f ao_product.h - rm -f ../$(PROG) - -install: - -uninstall: diff --git a/src/ao_adc_fake.c b/src/ao_adc_fake.c deleted file mode 100644 index 6ca88d4e..00000000 --- a/src/ao_adc_fake.c +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright © 2009 Keith Packard - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -#include "ao.h" - -volatile __xdata struct ao_adc ao_adc_ring[AO_ADC_RING]; -volatile __data uint8_t ao_adc_head; - -/* Stub for systems which have no ADC */ -void -ao_adc_poll(void) -{ -} diff --git a/src/ao_main.c b/src/ao_main.c deleted file mode 100644 index 25acccfc..00000000 --- a/src/ao_main.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright © 2009 Keith Packard - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -#include "ao.h" - -void -main(void) -{ - ao_clock_init(); - - /* Turn on the red LED until the system is stable */ - ao_led_init(); - ao_led_on(AO_LED_RED); - - ao_timer_init(); - ao_adc_init(); - ao_beep_init(); - ao_cmd_init(); - ao_ee_init(); - ao_flight_init(); - ao_log_init(); - ao_report_init(); - ao_usb_init(); - ao_serial_init(); - ao_gps_init(); - ao_telemetry_init(); - ao_radio_init(); - ao_start_scheduler(); -} diff --git a/src/cc1111/Makefile.cc1111 b/src/cc1111/Makefile.cc1111 new file mode 100644 index 00000000..8de4a9b2 --- /dev/null +++ b/src/cc1111/Makefile.cc1111 @@ -0,0 +1,27 @@ +CC=sdcc + +CFLAGS=--model-small --debug --opt-code-speed -DCODESIZE=$(CODESIZE) + +CFLAGS += $(PRODUCT_DEF) -I. -I.. -I../core -I../cc1111 -I../driver -I../product + +CODESIZE ?= 0x8000 + +LDFLAGS=--out-fmt-ihx --code-loc 0x0000 --code-size $(CODESIZE) \ + --xram-loc 0xf000 --xram-size 0xda2 --iram-size 0xff + +REL=$(SRC:.c=.rel) ao_product.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) + +PCDB=$(PROG:.ihx=.cdb) +PLNK=$(PROG:.ihx=.lnk) +PMAP=$(PROG:.ihx=.map) +PMEM=$(PROG:.ihx=.mem) +PAOM=$(PROG:.ihx=) + +%.rel : %.c $(INC) + $(call quiet,CC,$(PRODUCT_DEF)) $(CFLAGS) -c -o$@ $< diff --git a/src/_bp.c b/src/cc1111/_bp.c similarity index 100% rename from src/_bp.c rename to src/cc1111/_bp.c diff --git a/src/ao_adc.c b/src/cc1111/ao_adc.c similarity index 100% rename from src/ao_adc.c rename to src/cc1111/ao_adc.c diff --git a/src/ao_beep.c b/src/cc1111/ao_beep.c similarity index 100% rename from src/ao_beep.c rename to src/cc1111/ao_beep.c diff --git a/src/ao_dbg.c b/src/cc1111/ao_dbg.c similarity index 100% rename from src/ao_dbg.c rename to src/cc1111/ao_dbg.c diff --git a/src/ao_dma.c b/src/cc1111/ao_dma.c similarity index 100% rename from src/ao_dma.c rename to src/cc1111/ao_dma.c diff --git a/src/ao_ignite.c b/src/cc1111/ao_ignite.c similarity index 100% rename from src/ao_ignite.c rename to src/cc1111/ao_ignite.c diff --git a/src/ao_intflash.c b/src/cc1111/ao_intflash.c similarity index 100% rename from src/ao_intflash.c rename to src/cc1111/ao_intflash.c diff --git a/src/ao_led.c b/src/cc1111/ao_led.c similarity index 100% rename from src/ao_led.c rename to src/cc1111/ao_led.c diff --git a/src/ao_packet.c b/src/cc1111/ao_packet.c similarity index 100% rename from src/ao_packet.c rename to src/cc1111/ao_packet.c diff --git a/src/ao_packet_master.c b/src/cc1111/ao_packet_master.c similarity index 100% rename from src/ao_packet_master.c rename to src/cc1111/ao_packet_master.c diff --git a/src/ao_packet_slave.c b/src/cc1111/ao_packet_slave.c similarity index 100% rename from src/ao_packet_slave.c rename to src/cc1111/ao_packet_slave.c diff --git a/src/ao_radio.c b/src/cc1111/ao_radio.c similarity index 100% rename from src/ao_radio.c rename to src/cc1111/ao_radio.c diff --git a/src/ao_reboot.c b/src/cc1111/ao_reboot.c similarity index 100% rename from src/ao_reboot.c rename to src/cc1111/ao_reboot.c diff --git a/src/ao_romconfig.c b/src/cc1111/ao_romconfig.c similarity index 100% rename from src/ao_romconfig.c rename to src/cc1111/ao_romconfig.c diff --git a/src/ao_serial.c b/src/cc1111/ao_serial.c similarity index 100% rename from src/ao_serial.c rename to src/cc1111/ao_serial.c diff --git a/src/ao_spi.c b/src/cc1111/ao_spi.c similarity index 100% rename from src/ao_spi.c rename to src/cc1111/ao_spi.c diff --git a/src/ao_timer.c b/src/cc1111/ao_timer.c similarity index 100% rename from src/ao_timer.c rename to src/cc1111/ao_timer.c diff --git a/src/ao_usb.c b/src/cc1111/ao_usb.c similarity index 100% rename from src/ao_usb.c rename to src/cc1111/ao_usb.c diff --git a/src/ao_usb.h b/src/cc1111/ao_usb.h similarity index 100% rename from src/ao_usb.h rename to src/cc1111/ao_usb.h diff --git a/src/cc1111.h b/src/cc1111/cc1111.h similarity index 100% rename from src/cc1111.h rename to src/cc1111/cc1111.h diff --git a/src/altitude.h b/src/core/altitude.h similarity index 100% rename from src/altitude.h rename to src/core/altitude.h diff --git a/src/ao.h b/src/core/ao.h similarity index 100% rename from src/ao.h rename to src/core/ao.h diff --git a/src/ao_cmd.c b/src/core/ao_cmd.c similarity index 100% rename from src/ao_cmd.c rename to src/core/ao_cmd.c diff --git a/src/ao_config.c b/src/core/ao_config.c similarity index 100% rename from src/ao_config.c rename to src/core/ao_config.c diff --git a/src/ao_convert.c b/src/core/ao_convert.c similarity index 100% rename from src/ao_convert.c rename to src/core/ao_convert.c diff --git a/src/ao_convert_test.c b/src/core/ao_convert_test.c similarity index 100% rename from src/ao_convert_test.c rename to src/core/ao_convert_test.c diff --git a/src/ao_ee_fake.c b/src/core/ao_ee_fake.c similarity index 100% rename from src/ao_ee_fake.c rename to src/core/ao_ee_fake.c diff --git a/src/ao_flight.c b/src/core/ao_flight.c similarity index 100% rename from src/ao_flight.c rename to src/core/ao_flight.c diff --git a/src/ao_flight_nano.c b/src/core/ao_flight_nano.c similarity index 100% rename from src/ao_flight_nano.c rename to src/core/ao_flight_nano.c diff --git a/src/ao_gps_print.c b/src/core/ao_gps_print.c similarity index 100% rename from src/ao_gps_print.c rename to src/core/ao_gps_print.c diff --git a/src/ao_gps_report.c b/src/core/ao_gps_report.c similarity index 100% rename from src/ao_gps_report.c rename to src/core/ao_gps_report.c diff --git a/src/ao_host.h b/src/core/ao_host.h similarity index 100% rename from src/ao_host.h rename to src/core/ao_host.h diff --git a/src/ao_kalman.c b/src/core/ao_kalman.c similarity index 100% rename from src/ao_kalman.c rename to src/core/ao_kalman.c diff --git a/src/ao_log.c b/src/core/ao_log.c similarity index 100% rename from src/ao_log.c rename to src/core/ao_log.c diff --git a/src/ao_log_big.c b/src/core/ao_log_big.c similarity index 100% rename from src/ao_log_big.c rename to src/core/ao_log_big.c diff --git a/src/ao_log_telem.c b/src/core/ao_log_telem.c similarity index 100% rename from src/ao_log_telem.c rename to src/core/ao_log_telem.c diff --git a/src/ao_log_tiny.c b/src/core/ao_log_tiny.c similarity index 100% rename from src/ao_log_tiny.c rename to src/core/ao_log_tiny.c diff --git a/src/ao_monitor.c b/src/core/ao_monitor.c similarity index 100% rename from src/ao_monitor.c rename to src/core/ao_monitor.c diff --git a/src/ao_mutex.c b/src/core/ao_mutex.c similarity index 100% rename from src/ao_mutex.c rename to src/core/ao_mutex.c diff --git a/src/ao_panic.c b/src/core/ao_panic.c similarity index 100% rename from src/ao_panic.c rename to src/core/ao_panic.c diff --git a/src/ao_pins.h b/src/core/ao_pins.h similarity index 100% rename from src/ao_pins.h rename to src/core/ao_pins.h diff --git a/src/ao_product.c b/src/core/ao_product.c similarity index 100% rename from src/ao_product.c rename to src/core/ao_product.c diff --git a/src/ao_report.c b/src/core/ao_report.c similarity index 100% rename from src/ao_report.c rename to src/core/ao_report.c diff --git a/src/ao_rssi.c b/src/core/ao_rssi.c similarity index 100% rename from src/ao_rssi.c rename to src/core/ao_rssi.c diff --git a/src/ao_sample.c b/src/core/ao_sample.c similarity index 100% rename from src/ao_sample.c rename to src/core/ao_sample.c diff --git a/src/ao_state.c b/src/core/ao_state.c similarity index 100% rename from src/ao_state.c rename to src/core/ao_state.c diff --git a/src/ao_stdio.c b/src/core/ao_stdio.c similarity index 100% rename from src/ao_stdio.c rename to src/core/ao_stdio.c diff --git a/src/ao_storage.c b/src/core/ao_storage.c similarity index 100% rename from src/ao_storage.c rename to src/core/ao_storage.c diff --git a/src/ao_task.c b/src/core/ao_task.c similarity index 100% rename from src/ao_task.c rename to src/core/ao_task.c diff --git a/src/ao_telem.h b/src/core/ao_telem.h similarity index 100% rename from src/ao_telem.h rename to src/core/ao_telem.h diff --git a/src/ao_telemetry.c b/src/core/ao_telemetry.c similarity index 100% rename from src/ao_telemetry.c rename to src/core/ao_telemetry.c diff --git a/src/ao_ee.c b/src/drivers/ao_25lc1024.c similarity index 99% rename from src/ao_ee.c rename to src/drivers/ao_25lc1024.c index a2fe8dc1..738f8ce6 100644 --- a/src/ao_ee.c +++ b/src/drivers/ao_25lc1024.c @@ -16,7 +16,7 @@ */ #include "ao.h" -#include "25lc1024.h" +#include "ao_25lc1024.h" #define EE_BLOCK_SIZE ((uint16_t) (256)) #define EE_BLOCK_SHIFT 8 diff --git a/src/25lc1024.h b/src/drivers/ao_25lc1024.h similarity index 100% rename from src/25lc1024.h rename to src/drivers/ao_25lc1024.h diff --git a/src/ao_flash.c b/src/drivers/ao_at45db161d.c similarity index 99% rename from src/ao_flash.c rename to src/drivers/ao_at45db161d.c index bb40f6f7..aee9877a 100644 --- a/src/ao_flash.c +++ b/src/drivers/ao_at45db161d.c @@ -16,7 +16,7 @@ */ #include "ao.h" -#include "at45db161d.h" +#include "ao_at45db161d.h" /* Total bytes of available storage */ __pdata uint32_t ao_storage_total; diff --git a/src/at45db161d.h b/src/drivers/ao_at45db161d.h similarity index 100% rename from src/at45db161d.h rename to src/drivers/ao_at45db161d.h diff --git a/src/ao_btm.c b/src/drivers/ao_btm.c similarity index 100% rename from src/ao_btm.c rename to src/drivers/ao_btm.c diff --git a/src/ao_companion.c b/src/drivers/ao_companion.c similarity index 100% rename from src/ao_companion.c rename to src/drivers/ao_companion.c diff --git a/src/ao_gps_sirf.c b/src/drivers/ao_gps_sirf.c similarity index 100% rename from src/ao_gps_sirf.c rename to src/drivers/ao_gps_sirf.c diff --git a/src/ao_gps_skytraq.c b/src/drivers/ao_gps_skytraq.c similarity index 100% rename from src/ao_gps_skytraq.c rename to src/drivers/ao_gps_skytraq.c diff --git a/src/ao_m25.c b/src/drivers/ao_m25.c similarity index 100% rename from src/ao_m25.c rename to src/drivers/ao_m25.c diff --git a/src/product/Makefile.telebt b/src/product/Makefile.telebt new file mode 100644 index 00000000..99730b9f --- /dev/null +++ b/src/product/Makefile.telebt @@ -0,0 +1,97 @@ +# +# TeleBT build file +# +# Define TELEBT_VER, TELEBT_DEF, TELEBT_INC and TELEBT_SRC +# and include this file + +vpath %.c ..:../core:../cc1111:../drivers:../product +vpath %.h ..:../core:../cc1111:../drivers:../product +vpath ao-make-product.5c ../util + +ifndef VERSION +include ../Version +endif + +INC = \ + ao.h \ + ao_pins.h \ + cc1111.h \ + ao_product.h \ + $(TELEBT_INC) + +CORE_SRC = \ + ao_cmd.c \ + ao_config.c \ + ao_gps_print.c \ + ao_monitor.c \ + ao_mutex.c \ + ao_panic.c \ + ao_rssi.c \ + ao_state.c \ + ao_stdio.c \ + ao_task.c + +CC1111_SRC = \ + ao_dbg.c \ + ao_dma.c \ + ao_led.c \ + ao_packet.c \ + ao_packet_master.c \ + ao_radio.c \ + ao_romconfig.c \ + ao_serial.c \ + ao_timer.c \ + ao_usb.c \ + _bp.c + +DRIVER_SRC = \ + ao_btm.c + +PRODUCT_SRC = \ + ao_telebt.c + +SRC = \ + $(CORE_SRC) \ + $(CC1111_SRC) \ + $(DRIVER_SRC) \ + $(PRODUCT_SRC) \ + $(TELEBT_SRC) + +PROG = telebt-v$(TELEBT_VER)-$(VERSION).ihx +PRODUCT=TeleBT-v$(TELEBT_VER) +PRODUCT_DEF=-DTELEBT_V_$(TELEBT_DEF) +IDPRODUCT=0x000e + +include ../cc1111/Makefile.cc1111 + +NICKLE=nickle +CHECK_STACK=sh ../util/check-stack + +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) + +all: ../$(PROG) + +../$(PROG): $(REL) Makefile + $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(REL) && cp $(PROG) $(PMAP) .. + $(call quiet,CHECK_STACK) ../core/ao.h $(PMEM) + +ao_product.h: ao-make-product.5c ../Version + $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ + +distclean: clean + +clean: + rm -f $(ADB) $(ASM) $(LNK) $(LST) $(REL) $(RST) $(SYM) + rm -f $(PROG) $(PCDB) $(PLNK) $(PMAP) $(PMEM) $(PAOM) + rm -f ao_product.h + rm -f ../$(PROG) ../$(PMAP) + +install: + +uninstall: diff --git a/src/product/Makefile.teledongle b/src/product/Makefile.teledongle new file mode 100644 index 00000000..f32c037f --- /dev/null +++ b/src/product/Makefile.teledongle @@ -0,0 +1,96 @@ +# +# TeleDongle build file +# +# The various teledongle versions differ only +# in minor pin variations +# so the per-board makefiles simply define +# TD_VER, TD_DEF and include +# this file + +vpath %.c ..:../core:../cc1111:../drivers:../product +vpath %.h ..:../core:../cc1111:../drivers:../product +vpath ao-make-product.5c ../util + +ifndef VERSION +include ../Version +endif + +INC = \ + ao.h \ + ao_pins.h \ + cc1111.h \ + ao_product.h + +CORE_SRC = \ + ao_cmd.c \ + ao_config.c \ + ao_gps_print.c \ + ao_monitor.c \ + ao_mutex.c \ + ao_panic.c \ + ao_rssi.c \ + ao_state.c \ + ao_stdio.c \ + ao_task.c + +CC1111_SRC = \ + ao_dbg.c \ + ao_dma.c \ + ao_led.c \ + ao_packet.c \ + ao_packet_master.c \ + ao_radio.c \ + ao_romconfig.c \ + ao_timer.c \ + ao_usb.c \ + _bp.c + +DRIVER_SRC = + +PRODUCT_SRC = \ + ao_teledongle.c + +SRC = \ + $(CORE_SRC) \ + $(CC1111_SRC) \ + $(DRIVER_SRC) \ + $(PRODUCT_SRC) + +PROG = teledongle-v$(TD_VER)-$(VERSION).ihx +PRODUCT=TeleDongle-v$(TD_VER) +PRODUCT_DEF=-DTELEDONGLE_V_$(TD_DEF) +IDPRODUCT=0x000c + +include ../cc1111/Makefile.cc1111 + +NICKLE=nickle +CHECK_STACK=sh ../util/check-stack + +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) + +all: ../$(PROG) + +../$(PROG): $(REL) Makefile + $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(REL) && cp $(PROG) $(PMAP) .. + $(call quiet,CHECK_STACK) ../core/ao.h $(PMEM) + +ao_product.h: ao-make-product.5c ../Version + $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ + +distclean: clean + +clean: + rm -f $(ADB) $(ASM) $(LNK) $(LST) $(REL) $(RST) $(SYM) + rm -f $(PROG) $(PCDB) $(PLNK) $(PMAP) $(PMEM) $(PAOM) + rm -f ao_product.h + rm -f ../$(PROG) ../$(PMAP) + +install: + +uninstall: diff --git a/src/product/Makefile.telemetrum b/src/product/Makefile.telemetrum new file mode 100644 index 00000000..fd958aea --- /dev/null +++ b/src/product/Makefile.telemetrum @@ -0,0 +1,111 @@ +# +# TeleMetrum build file +# +# The various telemetrum versions differ only +# in which flash and GPS drivers are included, +# so the per-board makefiles simply define +# TM_VER, TM_DEF, TM_INC and TM_SRC and include +# this file + +vpath %.c ..:../core:../cc1111:../drivers:../product +vpath %.h ..:../core:../cc1111:../drivers:../product +vpath ao-make-product.5c ../util + +ifndef VERSION +include ../Version +endif + +INC = \ + ao.h \ + ao_pins.h \ + cc1111.h \ + altitude.h \ + ao_kalman.h \ + ao_product.h \ + $(TM_INC) + +CORE_SRC = \ + ao_cmd.c \ + ao_config.c \ + ao_convert.c \ + ao_gps_report.c \ + ao_mutex.c \ + ao_panic.c \ + ao_stdio.c \ + ao_storage.c \ + ao_task.c \ + ao_flight.c \ + ao_sample.c \ + ao_kalman.c \ + ao_log.c \ + ao_log_big.c \ + ao_report.c \ + ao_telemetry.c + +CC1111_SRC = \ + ao_adc.c \ + ao_beep.c \ + ao_dbg.c \ + ao_dma.c \ + ao_ignite.c \ + ao_led.c \ + ao_packet.c \ + ao_packet_slave.c \ + ao_radio.c \ + ao_romconfig.c \ + ao_serial.c \ + ao_spi.c \ + ao_timer.c \ + ao_usb.c \ + _bp.c + +DRIVER_SRC = \ + $(TM_SRC) + +PRODUCT_SRC = \ + ao_telemetrum.c + +SRC = \ + $(CORE_SRC) \ + $(CC1111_SRC) \ + $(DRIVER_SRC) \ + $(PRODUCT_SRC) + +PROG = telemetrum-v$(TM_VER)-$(VERSION).ihx +PRODUCT=TeleMetrum-v$(TM_VER) +PRODUCT_DEF=-DTELEMETRUM_V_$(TM_DEF) +IDPRODUCT=0x000b + +include ../cc1111/Makefile.cc1111 + +NICKLE=nickle +CHECK_STACK=sh ../util/check-stack + +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) + +all: ../$(PROG) + +../$(PROG): $(REL) Makefile + $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(REL) && cp $(PROG) $(PMAP) .. + $(call quiet,CHECK_STACK) ../core/ao.h $(PMEM) + +ao_product.h: ao-make-product.5c ../Version + $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ + +distclean: clean + +clean: + rm -f $(ADB) $(ASM) $(LNK) $(LST) $(REL) $(RST) $(SYM) + rm -f $(PROG) $(PCDB) $(PLNK) $(PMAP) $(PMEM) $(PAOM) + rm -f ao_product.h + rm -f ../$(PROG) ../$(PMAP) + +install: + +uninstall: diff --git a/src/product/Makefile.telemini b/src/product/Makefile.telemini new file mode 100644 index 00000000..3bd14226 --- /dev/null +++ b/src/product/Makefile.telemini @@ -0,0 +1,100 @@ +# +# TeleMini build file +# +# Define TELEMINI_VER and TELEMINI_DEF and then +# include this file + +vpath %.c ..:../core:../cc1111:../drivers:../product +vpath %.h ..:../core:../cc1111:../drivers:../product +vpath ao-make-product.5c ../util + +ifndef VERSION +include ../Version +endif + +INC = \ + ao.h \ + ao_pins.h \ + cc1111.h \ + ao_product.h + +CORE_SRC = \ + ao_cmd.c \ + ao_config.c \ + ao_convert.c \ + ao_flight.c \ + ao_kalman.c \ + ao_log.c \ + ao_log_tiny.c \ + ao_mutex.c \ + ao_panic.c \ + ao_report.c \ + ao_sample.c \ + ao_stdio.c \ + ao_storage.c \ + ao_task.c \ + ao_telemetry.c + +CC1111_SRC = \ + ao_adc.c \ + ao_dma.c \ + ao_ignite.c \ + ao_intflash.c \ + ao_led.c \ + ao_packet.c \ + ao_packet_slave.c \ + ao_radio.c \ + ao_romconfig.c \ + ao_timer.c \ + _bp.c + +DRIVER_SRC = + +PRODUCT_SRC = \ + ao_telemini.c + +SRC = \ + $(CORE_SRC) \ + $(CC1111_SRC) \ + $(DRIVER_SRC) \ + $(PRODUCT_SRC) + +PROG = telemini-v$(TELEMINI_VER)-$(VERSION).ihx +PRODUCT=TeleMini-v$(TELEMINI_VER) +PRODUCT_DEF=-DTELEMINI_V_$(TELEMINI_DEF) +IDPRODUCT=0x000a +CODESIZE=0x6700 + +include ../cc1111/Makefile.cc1111 + +NICKLE=nickle +CHECK_STACK=sh ../util/check-stack + +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) + +all: ../$(PROG) + +../$(PROG): $(REL) Makefile + $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(REL) && cp $(PROG) $(PMAP) .. + $(call quiet,CHECK_STACK) ../core/ao.h $(PMEM) + +ao_product.h: ao-make-product.5c ../Version + $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ + +distclean: clean + +clean: + rm -f $(ADB) $(ASM) $(LNK) $(LST) $(REL) $(RST) $(SYM) + rm -f $(PROG) $(PCDB) $(PLNK) $(PMAP) $(PMEM) $(PAOM) + rm -f ao_product.h + rm -f ../$(PROG) ../$(PMAP) + +install: + +uninstall: diff --git a/src/product/Makefile.telenano b/src/product/Makefile.telenano new file mode 100644 index 00000000..72043044 --- /dev/null +++ b/src/product/Makefile.telenano @@ -0,0 +1,99 @@ +# +# TeleNano build file +# +# Define TELENANO_VER and TELENANO_DEF and then +# include this file + +vpath %.c ..:../core:../cc1111:../drivers:../product +vpath %.h ..:../core:../cc1111:../drivers:../product +vpath ao-make-product.5c ../util + +ifndef VERSION +include ../Version +endif + +INC = \ + ao.h \ + ao_pins.h \ + cc1111.h \ + ao_product.h + +CORE_SRC = \ + ao_cmd.c \ + ao_config.c \ + ao_convert.c \ + ao_flight_nano.c \ + ao_kalman.c \ + ao_log.c \ + ao_log_tiny.c \ + ao_mutex.c \ + ao_panic.c \ + ao_report.c \ + ao_sample.c \ + ao_stdio.c \ + ao_storage.c \ + ao_task.c \ + ao_telemetry.c + +CC1111_SRC = \ + ao_adc.c \ + ao_dma.c \ + ao_intflash.c \ + ao_led.c \ + ao_packet.c \ + ao_packet_slave.c \ + ao_radio.c \ + ao_romconfig.c \ + ao_timer.c \ + _bp.c + +DRIVER_SRC = + +PRODUCT_SRC = \ + ao_telenano.c + +SRC = \ + $(CORE_SRC) \ + $(CC1111_SRC) \ + $(DRIVER_SRC) \ + $(PRODUCT_SRC) + +PROG = telenano-v$(TELENANO_VER)-$(VERSION).ihx +PRODUCT=TeleNano-v$(TELENANO_VER) +PRODUCT_DEF=-DTELENANO_V_$(TELENANO_DEF) +IDPRODUCT=0x000a +CODESIZE=0x6700 + +include ../cc1111/Makefile.cc1111 + +NICKLE=nickle +CHECK_STACK=sh ../util/check-stack + +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) + +all: ../$(PROG) + +../$(PROG): $(REL) Makefile + $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(REL) && cp $(PROG) $(PMAP) .. + $(call quiet,CHECK_STACK) ../core/ao.h $(PMEM) + +ao_product.h: ao-make-product.5c ../Version + $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ + +distclean: clean + +clean: + rm -f $(ADB) $(ASM) $(LNK) $(LST) $(REL) $(RST) $(SYM) + rm -f $(PROG) $(PCDB) $(PLNK) $(PMAP) $(PMEM) $(PAOM) + rm -f ao_product.h + rm -f ../$(PROG) ../$(PMAP) + +install: + +uninstall: diff --git a/src/ao_telebt.c b/src/product/ao_telebt.c similarity index 100% rename from src/ao_telebt.c rename to src/product/ao_telebt.c diff --git a/src/ao_teledongle.c b/src/product/ao_teledongle.c similarity index 100% rename from src/ao_teledongle.c rename to src/product/ao_teledongle.c diff --git a/src/ao_telemetrum.c b/src/product/ao_telemetrum.c similarity index 100% rename from src/ao_telemetrum.c rename to src/product/ao_telemetrum.c diff --git a/src/ao_telemini.c b/src/product/ao_telemini.c similarity index 100% rename from src/ao_telemini.c rename to src/product/ao_telemini.c diff --git a/src/ao_telenano.c b/src/product/ao_telenano.c similarity index 100% rename from src/ao_telenano.c rename to src/product/ao_telenano.c diff --git a/src/ao_teleterra.c b/src/product/ao_teleterra.c similarity index 100% rename from src/ao_teleterra.c rename to src/product/ao_teleterra.c diff --git a/src/ao_test.c b/src/product/ao_test.c similarity index 100% rename from src/ao_test.c rename to src/product/ao_test.c diff --git a/src/ao_tidongle.c b/src/product/ao_tidongle.c similarity index 100% rename from src/ao_tidongle.c rename to src/product/ao_tidongle.c diff --git a/src/telebt-v0.0/Makefile b/src/telebt-v0.0/Makefile index d8867b19..e89639ab 100644 --- a/src/telebt-v0.0/Makefile +++ b/src/telebt-v0.0/Makefile @@ -1 +1,9 @@ -include ../Makefile.proto +# +# TeleBT v0.0 build +# + +TELEBT_VER=0.0 +TELEBT_DEF=0_0 + +include ../product/Makefile.telebt + diff --git a/src/telebt-v0.0/Makefile.defs b/src/telebt-v0.0/Makefile.defs deleted file mode 100644 index f0bb5e0c..00000000 --- a/src/telebt-v0.0/Makefile.defs +++ /dev/null @@ -1,8 +0,0 @@ -PROG = telebt-v0.0-$(VERSION).ihx - -SRC = \ - $(TBT_BASE_SRC) - -PRODUCT=TeleBT-v0.0 -PRODUCT_DEF=-DTELEBT_V_0_0 -IDPRODUCT=0x000e diff --git a/src/telebt-v0.1/Makefile b/src/telebt-v0.1/Makefile index d8867b19..a34e8912 100644 --- a/src/telebt-v0.1/Makefile +++ b/src/telebt-v0.1/Makefile @@ -1 +1,19 @@ -include ../Makefile.proto +# +# TeleBT v0.1 build +# + +TELEBT_VER=0.1 +TELEBT_DEF=0_1 + +TELEBT_INC = \ + ao_25lc1024.h + +TELEBT_SRC = \ + ao_beep.c \ + ao_log_telem.c \ + ao_spi.c \ + ao_storage.c \ + ao_m25.c + +include ../product/Makefile.telebt + diff --git a/src/telebt-v0.1/Makefile.defs b/src/telebt-v0.1/Makefile.defs deleted file mode 100644 index 50657c83..00000000 --- a/src/telebt-v0.1/Makefile.defs +++ /dev/null @@ -1,8 +0,0 @@ -PROG = telebt-v0.1-$(VERSION).ihx - -SRC = \ - $(TBT_V_0_1_SRC) - -PRODUCT=TeleBT-v0.1 -PRODUCT_DEF=-DTELEBT_V_0_1 -IDPRODUCT=0x000e diff --git a/src/teledongle-v0.1/Makefile b/src/teledongle-v0.1/Makefile index d8867b19..48425107 100644 --- a/src/teledongle-v0.1/Makefile +++ b/src/teledongle-v0.1/Makefile @@ -1 +1,8 @@ -include ../Makefile.proto +# +# TeleDongle v0.2 build +# + +TD_VER=0.1 +TD_DEF=0_1 + +include ../product/Makefile.teledongle diff --git a/src/teledongle-v0.1/Makefile.defs b/src/teledongle-v0.1/Makefile.defs deleted file mode 100644 index ceb80b7a..00000000 --- a/src/teledongle-v0.1/Makefile.defs +++ /dev/null @@ -1,9 +0,0 @@ -PROG = teledongle-v0.1-$(VERSION).ihx - -SRC = \ - $(TD_SRC) \ - $(DBG_SRC) - -PRODUCT=TeleDongle-v0.1 -PRODUCT_DEF=-DTELEDONGLE_V_0_1 -IDPRODUCT=0x000c diff --git a/src/teledongle-v0.2/Makefile b/src/teledongle-v0.2/Makefile index d8867b19..ce4ab437 100644 --- a/src/teledongle-v0.2/Makefile +++ b/src/teledongle-v0.2/Makefile @@ -1 +1,8 @@ -include ../Makefile.proto +# +# TeleDongle v0.2 build +# + +TD_VER=0.2 +TD_DEF=0_2 + +include ../product/Makefile.teledongle \ No newline at end of file diff --git a/src/teledongle-v0.2/Makefile.defs b/src/teledongle-v0.2/Makefile.defs deleted file mode 100644 index ea9713b6..00000000 --- a/src/teledongle-v0.2/Makefile.defs +++ /dev/null @@ -1,9 +0,0 @@ -PROG = teledongle-v0.2-$(VERSION).ihx - -SRC = \ - $(TD_SRC) \ - $(DBG_SRC) - -PRODUCT=TeleDongle-v0.2 -PRODUCT_DEF=-DTELEDONGLE_V_0_2 -IDPRODUCT=0x000c diff --git a/src/telemetrum-v0.1-sirf/Makefile b/src/telemetrum-v0.1-sirf/Makefile index d8867b19..00cdc9c5 100644 --- a/src/telemetrum-v0.1-sirf/Makefile +++ b/src/telemetrum-v0.1-sirf/Makefile @@ -1 +1,16 @@ -include ../Makefile.proto +# +# TeleMetrum v0.1 with SkyTraq GPS build +# + +TM_VER=0.1 +TM_DEF=0_1 + +TM_INC = \ + ao_25lc1024.h + +TM_SRC = \ + ao_gps_sirf.c \ + ao_25lc1024.c + +include ../product/Makefile.telemetrum + diff --git a/src/telemetrum-v0.1-sirf/Makefile.defs b/src/telemetrum-v0.1-sirf/Makefile.defs deleted file mode 100644 index ac8dcdb9..00000000 --- a/src/telemetrum-v0.1-sirf/Makefile.defs +++ /dev/null @@ -1,12 +0,0 @@ -PROG = telemetrum-v0.1-sirf-$(VERSION).ihx - -SRC = \ - $(TM_BASE_SRC) \ - $(SPI_DRIVER_SRC) \ - $(EE_DRIVER_SRC) \ - $(SIRF_DRIVER_SRC) \ - $(DBG_SRC) - -PRODUCT=TeleMetrum-v0.1-SiRF -PRODUCT_DEF=-DTELEMETRUM_V_0_1 -IDPRODUCT=0x000b diff --git a/src/telemetrum-v0.1-sky/Makefile b/src/telemetrum-v0.1-sky/Makefile index d8867b19..e3c61db6 100644 --- a/src/telemetrum-v0.1-sky/Makefile +++ b/src/telemetrum-v0.1-sky/Makefile @@ -1 +1,16 @@ -include ../Makefile.proto +# +# TeleMetrum v0.1 with SkyTraq GPS build +# + +TM_VER=0.1 +TM_DEF=0_1 + +TM_INC = \ + ao_25lc1024.h + +TM_SRC = \ + ao_gps_skytraq.c \ + ao_25lc1024.c + +include ../product/Makefile.telemetrum + diff --git a/src/telemetrum-v0.1-sky/Makefile.defs b/src/telemetrum-v0.1-sky/Makefile.defs deleted file mode 100644 index e032d1eb..00000000 --- a/src/telemetrum-v0.1-sky/Makefile.defs +++ /dev/null @@ -1,12 +0,0 @@ -PROG = telemetrum-v0.1-sky-$(VERSION).ihx - -SRC = \ - $(TM_BASE_SRC) \ - $(SPI_DRIVER_SRC) \ - $(EE_DRIVER_SRC) \ - $(SKY_DRIVER_SRC) \ - $(DBG_SRC) - -PRODUCT=TeleMetrum-v0.1 -PRODUCT_DEF=-DTELEMETRUM_V_0_1 -IDPRODUCT=0x000b diff --git a/src/telemetrum-v1.0/Makefile b/src/telemetrum-v1.0/Makefile index d8867b19..4aae84c8 100644 --- a/src/telemetrum-v1.0/Makefile +++ b/src/telemetrum-v1.0/Makefile @@ -1 +1,16 @@ -include ../Makefile.proto +# +# TeleMetrum v1.0 build +# + +TM_VER=1.0 +TM_DEF=1_0 + +TM_INC = \ + ao_at45db161d.h + +TM_SRC = \ + ao_companion.c \ + ao_gps_skytraq.c \ + ao_at45db161d.c + +include ../product/Makefile.telemetrum diff --git a/src/telemetrum-v1.0/Makefile.defs b/src/telemetrum-v1.0/Makefile.defs deleted file mode 100644 index 5eefc392..00000000 --- a/src/telemetrum-v1.0/Makefile.defs +++ /dev/null @@ -1,13 +0,0 @@ -PROG = telemetrum-v1.0-$(VERSION).ihx - -SRC = \ - $(TM_BASE_SRC) \ - $(SPI_DRIVER_SRC) \ - $(FLASH_DRIVER_SRC) \ - $(SKY_DRIVER_SRC) \ - $(COMPANION_SRC) \ - $(DBG_SRC) - -PRODUCT=TeleMetrum-v1.0 -PRODUCT_DEF=-DTELEMETRUM_V_1_0 -IDPRODUCT=0x000b diff --git a/src/telemetrum-v1.1/Makefile b/src/telemetrum-v1.1/Makefile index d8867b19..4bea03db 100644 --- a/src/telemetrum-v1.1/Makefile +++ b/src/telemetrum-v1.1/Makefile @@ -1 +1,16 @@ -include ../Makefile.proto +# +# AltOS build +# +# + +TM_VER=1.1 +TM_DEF=1_1 + +TM_INC = + +TM_SRC = \ + ao_companion.c \ + ao_gps_skytraq.c \ + ao_m25.c + +include ../product/Makefile.telemetrum diff --git a/src/telemetrum-v1.1/Makefile.defs b/src/telemetrum-v1.1/Makefile.defs deleted file mode 100644 index 3c8b8793..00000000 --- a/src/telemetrum-v1.1/Makefile.defs +++ /dev/null @@ -1,13 +0,0 @@ -PROG = telemetrum-v1.1-$(VERSION).ihx - -SRC = \ - $(TM_BASE_SRC) \ - $(SPI_DRIVER_SRC) \ - $(M25_DRIVER_SRC) \ - $(SKY_DRIVER_SRC) \ - $(COMPANION_SRC) \ - $(DBG_SRC) - -PRODUCT=TeleMetrum-v1.1 -PRODUCT_DEF=-DTELEMETRUM_V_1_1 -IDPRODUCT=0x000b diff --git a/src/telemini-v1.0/Makefile b/src/telemini-v1.0/Makefile index d8867b19..4f1c8b51 100644 --- a/src/telemini-v1.0/Makefile +++ b/src/telemini-v1.0/Makefile @@ -1 +1,8 @@ -include ../Makefile.proto +# +# TeleMini build file +# + +TELEMINI_VER=1.0 +TELEMINI_DEF=1_0 + +include ../product/Makefile.telemini diff --git a/src/telemini-v1.0/Makefile.defs b/src/telemini-v1.0/Makefile.defs deleted file mode 100644 index 0e91f2fc..00000000 --- a/src/telemini-v1.0/Makefile.defs +++ /dev/null @@ -1,9 +0,0 @@ -PROG = telemini-v1.0-$(VERSION).ihx - -SRC = \ - $(TMINI_BASE_SRC) - -PRODUCT=TeleMini-v1.0 -PRODUCT_DEF=-DTELEMINI_V_1_0 -IDPRODUCT=0x000a -CODESIZE=0x6700 diff --git a/src/telenano-v0.1/Makefile b/src/telenano-v0.1/Makefile index d8867b19..2714c1e9 100644 --- a/src/telenano-v0.1/Makefile +++ b/src/telenano-v0.1/Makefile @@ -1 +1,9 @@ -include ../Makefile.proto +# +# TeleNano build file +# + +TELENANO_VER=0.1 +TELENANO_DEF=0_1 + +include ../product/Makefile.telenano + diff --git a/src/telenano-v0.1/Makefile.defs b/src/telenano-v0.1/Makefile.defs deleted file mode 100644 index 34cf69d1..00000000 --- a/src/telenano-v0.1/Makefile.defs +++ /dev/null @@ -1,9 +0,0 @@ -PROG = telenano-v0.1-$(VERSION).ihx - -SRC = \ - $(TNANO_BASE_SRC) - -PRODUCT=TeleNano-v0.1 -PRODUCT_DEF=-DTELENANO_V_0_1 -IDPRODUCT=0x000a -CODESIZE=0x6700 diff --git a/src/test/Makefile b/src/test/Makefile index 33203ffd..333850e4 100644 --- a/src/test/Makefile +++ b/src/test/Makefile @@ -1,9 +1,8 @@ -vpath % .. -vpath % ../kalman +vpath % ..:../core:../drivers PROGS=ao_flight_test ao_flight_test_baro ao_flight_test_accel ao_gps_test ao_gps_test_skytraq ao_convert_test -CFLAGS=-I.. -I. +CFLAGS=-I.. -I. -I../core -I../drivers -O0 -g all: $(PROGS) @@ -13,22 +12,19 @@ clean: install: ao_flight_test: ao_flight_test.c ao_host.h ao_flight.c ao_sample.c ao_kalman.c altitude.h ao_kalman.h - cc -g -o $@ $< + cc $(CFLAGS) -o $@ $< ao_flight_test_baro: ao_flight_test.c ao_host.h ao_flight.c ao_sample.c ao_kalman.c altitude.h ao_kalman.h - cc -g -o $@ -DHAS_ACCEL=0 ../ao_flight_test.c + cc $(CFLAGS) -o $@ -DHAS_ACCEL=0 ao_flight_test.c ao_flight_test_accel: ao_flight_test.c ao_host.h ao_flight.c ao_sample.c ao_kalman.c altitude.h ao_kalman.h - cc -g -o $@ -DFORCE_ACCEL=1 ../ao_flight_test.c + cc $(CFLAGS) -o $@ -DFORCE_ACCEL=1 ao_flight_test.c ao_gps_test: ao_gps_test.c ao_gps_sirf.c ao_gps_print.c ao_host.h - cc -g -o $@ $< + cc $(CFLAGS) -o $@ $< ao_gps_test_skytraq: ao_gps_test_skytraq.c ao_gps_skytraq.c ao_gps_print.c ao_host.h - cc -g -o $@ $< + cc $(CFLAGS) -o $@ $< ao_convert_test: ao_convert_test.c ao_convert.c altitude.h - cc -g -o $@ $< - -../ao_kalman.h: make-kalman kalman.5c kalman_filter.5c load_csv.5c matrix.5c - sh $< > $@ + cc $(CFLAGS) -o $@ $< diff --git a/src/ao_flight_test.c b/src/test/ao_flight_test.c similarity index 100% rename from src/ao_flight_test.c rename to src/test/ao_flight_test.c diff --git a/src/ao_gps_test.c b/src/test/ao_gps_test.c similarity index 100% rename from src/ao_gps_test.c rename to src/test/ao_gps_test.c diff --git a/src/ao_gps_test_skytraq.c b/src/test/ao_gps_test_skytraq.c similarity index 100% rename from src/ao_gps_test_skytraq.c rename to src/test/ao_gps_test_skytraq.c diff --git a/src/tidongle/Makefile b/src/tidongle/Makefile index d8867b19..fc8df1f4 100644 --- a/src/tidongle/Makefile +++ b/src/tidongle/Makefile @@ -1 +1,92 @@ -include ../Makefile.proto +# +# TIDongle build file +# + +vpath %.c ..:../core:../cc1111:../drivers:../product +vpath %.h ..:../core:../cc1111:../drivers:../product +vpath ao-make-product.5c ../util + +ifndef VERSION +include ../Version +endif + +INC = \ + ao.h \ + ao_pins.h \ + cc1111.h \ + ao_product.h + +CORE_SRC = \ + ao_cmd.c \ + ao_config.c \ + ao_gps_print.c \ + ao_monitor.c \ + ao_mutex.c \ + ao_panic.c \ + ao_rssi.c \ + ao_state.c \ + ao_stdio.c \ + ao_task.c + +CC1111_SRC = \ + ao_dbg.c \ + ao_dma.c \ + ao_led.c \ + ao_packet.c \ + ao_packet_master.c \ + ao_radio.c \ + ao_romconfig.c \ + ao_timer.c \ + ao_usb.c \ + _bp.c + +DRIVER_SRC = + +PRODUCT_SRC = \ + ao_tidongle.c + +SRC = \ + $(CORE_SRC) \ + $(CC1111_SRC) \ + $(DRIVER_SRC) \ + $(PRODUCT_SRC) + +PROG = tidongle-$(VERSION).ihx +PRODUCT=TIDongle +PRODUCT_DEF=-DTIDONGLE +IDPRODUCT=0x000a + +include ../cc1111/Makefile.cc1111 + +NICKLE=nickle +CHECK_STACK=sh ../util/check-stack + +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) + +all: ../$(PROG) + +../$(PROG): $(REL) Makefile + $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(REL) && cp $(PROG) $(PMAP) .. + $(call quiet,CHECK_STACK) ../core/ao.h $(PMEM) + +ao_product.h: ao-make-product.5c ../Version + $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ + +distclean: clean + +clean: + rm -f $(ADB) $(ASM) $(LNK) $(LST) $(REL) $(RST) $(SYM) + rm -f $(PROG) $(PCDB) $(PLNK) $(PMAP) $(PMEM) $(PAOM) + rm -f ao_product.h + rm -f ../$(PROG) ../$(PMAP) + +install: + +uninstall: + diff --git a/src/tidongle/Makefile.defs b/src/tidongle/Makefile.defs deleted file mode 100644 index 0e13cb20..00000000 --- a/src/tidongle/Makefile.defs +++ /dev/null @@ -1,9 +0,0 @@ -PROG = tidongle-$(VERSION).ihx - -SRC = \ - $(TI_SRC) - -PRODUCT=TIDongle - -PRODUCT_DEF=-DTIDONGLE -IDPRODUCT=0x000a diff --git a/src/ao-make-product.5c b/src/util/ao-make-product.5c similarity index 100% rename from src/ao-make-product.5c rename to src/util/ao-make-product.5c diff --git a/src/check-stack b/src/util/check-stack similarity index 100% rename from src/check-stack rename to src/util/check-stack diff --git a/src/gps-cksum b/src/util/gps-cksum similarity index 100% rename from src/gps-cksum rename to src/util/gps-cksum diff --git a/src/make-altitude b/src/util/make-altitude similarity index 100% rename from src/make-altitude rename to src/util/make-altitude diff --git a/src/make-kalman b/src/util/make-kalman similarity index 97% rename from src/make-kalman rename to src/util/make-kalman index 9ac35134..f78f30a9 100644 --- a/src/make-kalman +++ b/src/util/make-kalman @@ -1,6 +1,6 @@ #!/bin/sh -cd ../kalman +cd $1 >&/dev/null SIGMA_BOTH="-M 2 -H 6 -A 2" SIGMA_BARO="-M 2 -H 6 -A 2" diff --git a/src/sirf-cksum b/src/util/sirf-cksum similarity index 100% rename from src/sirf-cksum rename to src/util/sirf-cksum diff --git a/src/skytraq-cksum b/src/util/skytraq-cksum similarity index 100% rename from src/skytraq-cksum rename to src/util/skytraq-cksum -- 2.30.2