From cdad289a0803babecd30cbc0a95be99c5caadeb5 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 15 May 2013 01:24:56 -0700 Subject: altos: Add flash-loader for telescience-v0.2 Signed-off-by: Keith Packard --- src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index 11f149dd..c3596498 100644 --- a/src/Makefile +++ b/src/Makefile @@ -35,7 +35,7 @@ ARMDIRS=\ telegps-v0.1 telegps-v0.1/flash-loader \ stm-bringup stm-demo \ telelco-v0.2 telelco-v0.2/flash-loader \ - telescience-v0.2 + telescience-v0.2 telescience-v0.2/flash-loader ifneq ($(shell which sdcc),) SUBDIRS += $(SDCCDIRS) -- cgit v1.2.3 From c57e1630002c921739ff22395497d93027d381b6 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 18 May 2013 03:53:32 -0700 Subject: altos: Build easymini-v0.1 Signed-off-by: Keith Packard --- src/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index c3596498..5851b2a8 100644 --- a/src/Makefile +++ b/src/Makefile @@ -35,7 +35,8 @@ ARMDIRS=\ telegps-v0.1 telegps-v0.1/flash-loader \ stm-bringup stm-demo \ telelco-v0.2 telelco-v0.2/flash-loader \ - telescience-v0.2 telescience-v0.2/flash-loader + telescience-v0.2 telescience-v0.2/flash-loader \ + easymini-v0.1 ifneq ($(shell which sdcc),) SUBDIRS += $(SDCCDIRS) -- cgit v1.2.3 From 2344ba81fa51215471099e56518112478bdf2e73 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 21 May 2013 11:31:05 -0700 Subject: Separate out cortex-m0 compiler tests in configure The summon arm toolchain doesn't work for cortex-m0 parts, but the linaro toolchain does. Look in /usr/bin for the -m0 compiler but continue to use /opt/cortex/bin for the -m3 compiler Signed-off-by: Keith Packard --- configure.ac | 12 +++++++++--- src/Makefile | 10 ++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) (limited to 'src/Makefile') diff --git a/configure.ac b/configure.ac index 4a124c90..ba4fb302 100644 --- a/configure.ac +++ b/configure.ac @@ -185,9 +185,14 @@ if test "x$HAVE_SDCC" = "xno"; then AC_MSG_WARN([No sdcc found, cc1111 binaries will not be built]) fi -AC_CHECK_PROG([HAVE_ARM_GCC], [arm-none-eabi-gcc], yes, no) +AC_CHECK_PROG([HAVE_ARM_GCC],[arm-none-eabi-gcc], yes, no,[/opt/cortex/bin]) if test "x$HAVE_ARM_GCC" = "xno"; then - AC_MSG_WARN([No arm compiler found, STM32L and LPC11U14 binaries will not be built]) + AC_MSG_WARN([No summon toolchain arm compiler found, STM32L binaries will not be built]) +fi + +AC_CHECK_PROG([HAVE_ARM_M0_GCC], [arm-none-eabi-gcc], yes, no,[/usr/bin]) +if test "x$HAVE_ARM_M0_GCC" = "xno"; then + AC_MSG_WARN([No linaro toolchain arm cortex-m0 compiler found, LPC11U14 binaries will not be built]) fi AC_CHECK_PROG([HAVE_NICKLE], [nickle], yes, no) @@ -243,7 +248,8 @@ echo "" echo " Package: ${PACKAGE_NAME} ${PACKAGE_VERSION}" echo "" echo " Configuration" -echo " STM32L/LPC11U14 support.....: ${HAVE_ARM_GCC}" +echo " STM32L support..............: ${HAVE_ARM_GCC}" +echo " LPC11U14 support............: ${HAVE_ARM_M0_GCC}" echo " CC1111 support..............: ${HAVE_SDCC}" echo " Android support.............: ${HAVE_ANDROID_SDK}" echo " STlink support..............: ${HAVE_STLINK}" diff --git a/src/Makefile b/src/Makefile index 5851b2a8..7ffc52d6 100644 --- a/src/Makefile +++ b/src/Makefile @@ -35,7 +35,9 @@ ARMDIRS=\ telegps-v0.1 telegps-v0.1/flash-loader \ stm-bringup stm-demo \ telelco-v0.2 telelco-v0.2/flash-loader \ - telescience-v0.2 telescience-v0.2/flash-loader \ + telescience-v0.2 telescience-v0.2/flash-loader + +ARMM0DIRS=\ easymini-v0.1 ifneq ($(shell which sdcc),) @@ -46,10 +48,14 @@ ifneq ($(shell which avr-gcc),) SUBDIRS += $(AVRDIRS) endif -ifneq ($(shell which arm-none-eabi-gcc),) +ifneq ($(shell which /opt/cortex/bin/arm-none-eabi-gcc),) SUBDIRS += $(ARMDIRS) endif +ifneq ($(shell which /usr/bin/arm-none-eabi-gcc),) + SUBDIRS += $(ARMM0DIRS) +endif + ALLDIRS=$(SDCCDIRS) $(AVRDIRS) $(ARMDIRS) all: all-local all-recursive -- cgit v1.2.3 From 3e8b72a9dc5b6c3a0f6132dc2dec04f8c08a1deb Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 26 May 2013 22:38:56 -0600 Subject: altos: Add pyro operations to regular ignite commands Instead of having separate commands, just mix the two sets together. Signed-off-by: Keith Packard --- src/Makefile | 2 +- src/core/ao.h | 2 ++ src/core/ao_ignite.c | 45 ++++++++++++++++++++++++++++------- src/core/ao_pyro.c | 57 ++++++++++++++++++++++++++++++++------------- src/core/ao_pyro.h | 6 +++++ src/telemega-v0.1/ao_pins.h | 2 ++ src/telemega-v0.3/ao_pins.h | 1 + 7 files changed, 89 insertions(+), 26 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index 7ffc52d6..ff26ac20 100644 --- a/src/Makefile +++ b/src/Makefile @@ -26,7 +26,7 @@ SDCCDIRS=\ spiradio-v0.1 AVRDIRS=\ - telescience-v0.1 telescience-pwm telepyro-v0.1 micropeak + telescience-v0.1 telescience-pwm micropeak ARMDIRS=\ telemega-v0.1 telemega-v0.1/flash-loader \ diff --git a/src/core/ao.h b/src/core/ao.h index 7f344736..0886260f 100644 --- a/src/core/ao.h +++ b/src/core/ao.h @@ -703,6 +703,8 @@ struct ao_ignition { uint8_t firing; }; +extern __code char * __code ao_igniter_status_names[]; + extern __xdata struct ao_ignition ao_ignition[2]; enum ao_igniter_status diff --git a/src/core/ao_ignite.c b/src/core/ao_ignite.c index 74bd0c5a..9f2ec0a7 100644 --- a/src/core/ao_ignite.c +++ b/src/core/ao_ignite.c @@ -17,7 +17,11 @@ #include "ao.h" #include +#if AO_PYRO_NUM +#include +#endif +#if HAS_IGNITE __xdata struct ao_ignition ao_ignition[2]; void @@ -150,6 +154,8 @@ ao_igniter(void) } } +#endif + void ao_ignite_manual(void) { @@ -157,33 +163,50 @@ ao_ignite_manual(void) if (!ao_match_word("DoIt")) return; ao_cmd_white(); - if (ao_cmd_lex_c == 'm') { - if(ao_match_word("main")) - ao_igniter_fire(ao_igniter_main); - } else { - if(ao_match_word("drogue")) - ao_igniter_fire(ao_igniter_drogue); +#if HAS_IGNITE + if (ao_cmd_lex_c == 'm' && ao_match_word("main")) { + ao_igniter_fire(ao_igniter_main); + return; + } + if (ao_cmd_lex_c == 'd' && ao_match_word("drogue")) { + ao_igniter_fire(ao_igniter_drogue); + return; + } +#endif +#if AO_PYRO_NUM + if ('0' <= ao_cmd_lex_c && ao_cmd_lex_c <= '9') { + ao_pyro_manual(ao_cmd_lex_c - '0'); + return; } +#endif + ao_cmd_status = ao_cmd_syntax_error; } -static __code char * __code igniter_status_names[] = { +__code char * __code ao_igniter_status_names[] = { "unknown", "ready", "active", "open" }; +#if HAS_IGNITE void ao_ignite_print_status(enum ao_igniter igniter, __code char *name) __reentrant { enum ao_igniter_status status = ao_igniter_status(igniter); printf("Igniter: %6s Status: %s\n", name, - igniter_status_names[status]); + ao_igniter_status_names[status]); } +#endif void ao_ignite_test(void) { +#if HAS_IGNITE ao_ignite_print_status(ao_igniter_drogue, "drogue"); ao_ignite_print_status(ao_igniter_main, "main"); +#endif +#if AO_PYRO_NUM + ao_pyro_print_status(); +#endif } __code struct ao_cmds ao_ignite_cmds[] = { @@ -192,6 +215,7 @@ __code struct ao_cmds ao_ignite_cmds[] = { { 0, NULL }, }; +#if HAS_IGNITE __xdata struct ao_task ao_igniter_task; void @@ -200,11 +224,14 @@ ao_ignite_set_pins(void) ao_enable_output(AO_IGNITER_DROGUE_PORT, AO_IGNITER_DROGUE_PIN, AO_IGNITER_DROGUE, 0); ao_enable_output(AO_IGNITER_MAIN_PORT, AO_IGNITER_MAIN_PIN, AO_IGNITER_MAIN, 0); } +#endif void ao_igniter_init(void) { +#if HAS_IGNITE ao_ignite_set_pins(); - ao_cmd_register(&ao_ignite_cmds[0]); ao_add_task(&ao_igniter_task, ao_igniter, "igniter"); +#endif + ao_cmd_register(&ao_ignite_cmds[0]); } diff --git a/src/core/ao_pyro.c b/src/core/ao_pyro.c index 39f40dfa..531e1f50 100644 --- a/src/core/ao_pyro.c +++ b/src/core/ao_pyro.c @@ -33,6 +33,40 @@ #define ao_lowbit(x) ((x) & (-x)) +#ifndef AO_FLIGHT_TEST +enum ao_igniter_status +ao_pyro_status(uint8_t p) +{ + __xdata struct ao_data packet; + __pdata int16_t value; + + ao_arch_critical( + ao_data_get(&packet); + ); + + value = (AO_IGNITER_CLOSED>>1); + value = AO_SENSE_PYRO(&packet, p); + if (value < AO_IGNITER_OPEN) + return ao_igniter_open; + else if (value > AO_IGNITER_CLOSED) + return ao_igniter_ready; + else + return ao_igniter_unknown; +} + +void +ao_pyro_print_status(void) +{ + uint8_t p; + + for(p = 0; p < AO_PYRO_NUM; p++) { + enum ao_igniter_status status = ao_pyro_status(p); + printf("Igniter: %d Status: %s\n", + p, ao_igniter_status_names[status]); + } +} +#endif + uint16_t ao_pyro_fired; /* @@ -441,25 +475,17 @@ ao_pyro_set(void) _ao_config_edit_finish(); } -static void -ao_pyro_manual(void) +void +ao_pyro_manual(uint8_t p) { - ao_cmd_white(); - if (!ao_match_word("DoIt")) + printf ("ao_pyro_manual %d\n", p); + if (p >= AO_PYRO_NUM) { + ao_cmd_status = ao_cmd_syntax_error; return; - ao_cmd_white(); - ao_cmd_decimal(); - if (ao_cmd_lex_i < 0 || AO_PYRO_NUM <= ao_cmd_lex_i) - return; - ao_pyro_pins_fire(1 << ao_cmd_lex_i); - + } + ao_pyro_pins_fire(1 << p); } -const struct ao_cmds ao_pyro_cmds[] = { - { ao_pyro_manual, "P DoIt \0Fire igniter" }, - { 0, NULL } -}; - void ao_pyro_init(void) { @@ -487,7 +513,6 @@ ao_pyro_init(void) #if AO_PYRO_NUM > 7 ao_enable_output(AO_PYRO_PORT_7, AO_PYRO_PIN_7, AO_PYRO_7, 0); #endif - ao_cmd_register(&ao_pyro_cmds[0]); ao_add_task(&ao_pyro_task, ao_pyro, "pyro"); } #endif diff --git a/src/core/ao_pyro.h b/src/core/ao_pyro.h index 1f838542..0c5642d6 100644 --- a/src/core/ao_pyro.h +++ b/src/core/ao_pyro.h @@ -74,4 +74,10 @@ ao_pyro_show(void); void ao_pyro_init(void); +void +ao_pyro_manual(uint8_t p); + +void +ao_pyro_print_status(void); + #endif diff --git a/src/telemega-v0.1/ao_pins.h b/src/telemega-v0.1/ao_pins.h index 4c645871..78e887c3 100644 --- a/src/telemega-v0.1/ao_pins.h +++ b/src/telemega-v0.1/ao_pins.h @@ -146,6 +146,8 @@ /* Number of general purpose pyro channels available */ #define AO_PYRO_NUM 4 +#define AO_SENSE_PYRO(a,p) ((a)->adc.sense[(p) + 2]) + #define AO_IGNITER_SET_DROGUE(v) stm_gpio_set(AO_IGNITER_DROGUE_PORT, AO_IGNITER_DROGUE_PIN, v) #define AO_IGNITER_SET_MAIN(v) stm_gpio_set(AO_IGNITER_MAIN_PORT, AO_IGNITER_MAIN_PIN, v) diff --git a/src/telemega-v0.3/ao_pins.h b/src/telemega-v0.3/ao_pins.h index bace5853..a5a9eaf4 100644 --- a/src/telemega-v0.3/ao_pins.h +++ b/src/telemega-v0.3/ao_pins.h @@ -121,6 +121,7 @@ #define HAS_IGNITE 1 #define HAS_IGNITE_REPORT 1 +#define AO_SENSE_PYRO(p,n) ((p)->adc.sense[n]) #define AO_SENSE_DROGUE(p) ((p)->adc.sense[4]) #define AO_SENSE_MAIN(p) ((p)->adc.sense[5]) #define AO_IGNITER_CLOSED 400 -- cgit v1.2.3 From 187f661c2512e4260d0ca64134de8fad199f5944 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 9 Jun 2013 10:00:54 -0700 Subject: altos: Add telefire v0.2 support Signed-off-by: Keith Packard --- src/Makefile | 9 +-- src/cc1111/ao_adc.c | 2 +- src/drivers/ao_pad.c | 25 +++++-- src/telefire-v0.2/Makefile | 103 ++++++++++++++++++++++++++++ src/telefire-v0.2/ao_pins.h | 144 ++++++++++++++++++++++++++++++++++++++++ src/telefire-v0.2/ao_telefire.c | 45 +++++++++++++ 6 files changed, 317 insertions(+), 11 deletions(-) create mode 100644 src/telefire-v0.2/Makefile create mode 100644 src/telefire-v0.2/ao_pins.h create mode 100644 src/telefire-v0.2/ao_telefire.c (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index ff26ac20..ee76c325 100644 --- a/src/Makefile +++ b/src/Makefile @@ -16,14 +16,11 @@ include Version SDCCDIRS=\ telemetrum-v1.2 telemetrum-v1.1 telemetrum-v1.0 \ - teledongle-v0.2 teledongle-v0.1 \ - telemini-v1.0 telenano-v0.1 \ + teledongle-v0.2 \ + telemini-v1.0 \ telebt-v1.0 \ - 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 + telefire-v0.1 telefire-v0.2 AVRDIRS=\ telescience-v0.1 telescience-pwm micropeak diff --git a/src/cc1111/ao_adc.c b/src/cc1111/ao_adc.c index ed76179b..4a58023d 100644 --- a/src/cc1111/ao_adc.c +++ b/src/cc1111/ao_adc.c @@ -144,7 +144,7 @@ ao_adc_isr(void) __interrupt 1 } #endif /* telemini || telenano */ -#ifdef TELEFIRE_V_0_1 +#if defined(TELEFIRE_V_0_1) || defined(TELEFIRE_V_0_2) a = (uint8_t __xdata *) (&ao_data_ring[ao_data_head].adc.sense[0] + sequence - AO_ADC_FIRST_PIN); a[0] = ADCL; a[1] = ADCH; diff --git a/src/drivers/ao_pad.c b/src/drivers/ao_pad.c index 6cec98ab..e0c03c74 100644 --- a/src/drivers/ao_pad.c +++ b/src/drivers/ao_pad.c @@ -17,7 +17,7 @@ #include #include -#include +#include #include static __xdata uint8_t ao_pad_ignite; @@ -218,6 +218,21 @@ ao_pad_enable(void) ao_wakeup (&ao_pad_disabled); } +#if HAS_74HC165 +static uint8_t +ao_pad_read_box(void) +{ + uint8_t byte = ao_74hc165_read(); + uint8_t h, l; + + h = byte >> 4; + l = byte & 0xf; + return h * 10 + l; +} +#else +#define ao_pad_read_box() 0 +#endif + static void ao_pad(void) { @@ -236,8 +251,10 @@ ao_pad(void) if (ret != AO_RADIO_CMAC_OK) continue; - PRINTD ("tick %d box %d cmd %d channels %02x\n", - command.tick, command.box, command.cmd, command.channels); + ao_pad_box = ao_pad_read_box(); + + PRINTD ("tick %d box %d (me %d) cmd %d channels %02x\n", + command.tick, command.box, ao_pad_box, command.cmd, command.channels); switch (command.cmd) { case AO_LAUNCH_ARM: @@ -327,7 +344,7 @@ ao_pad_test(void) } for (c = 0; c < AO_PAD_NUM; c++) { - printf ("Pad %d: "); + printf ("Pad %d: ", c); switch (query.igniter_status[c]) { case AO_PAD_IGNITER_STATUS_NO_IGNITER_RELAY_CLOSED: printf ("No igniter. Relay closed\n"); break; case AO_PAD_IGNITER_STATUS_NO_IGNITER_RELAY_OPEN: printf ("No igniter. Relay open\n"); break; diff --git a/src/telefire-v0.2/Makefile b/src/telefire-v0.2/Makefile new file mode 100644 index 00000000..3353bc1a --- /dev/null +++ b/src/telefire-v0.2/Makefile @@ -0,0 +1,103 @@ +# +# TeleFire build file +# + +TELEFIRE_VER=0.2 +TELEFIRE_DEF=0_2 + +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 \ + ao_arch.h \ + ao_arch_funcs.h \ + ao_pad.h \ + cc1111.h \ + ao_product.h + +CORE_SRC = \ + ao_cmd.c \ + ao_config.c \ + ao_convert.c \ + ao_mutex.c \ + ao_panic.c \ + ao_stdio.c \ + ao_storage.c \ + ao_task.c \ + ao_freq.c + +CC1111_SRC = \ + ao_adc.c \ + ao_aes.c \ + ao_beep.c \ + ao_dma.c \ + ao_intflash.c \ + ao_radio.c \ + ao_radio_cmac.c \ + ao_romconfig.c \ + ao_serial.c \ + ao_spi.c \ + ao_string.c \ + ao_timer.c \ + ao_usb.c \ + _bp.c + +DRIVER_SRC = \ + ao_pca9922.c \ + ao_74hc165.c \ + ao_pad.c \ + ao_radio_cmac_cmd.c + +PRODUCT_SRC = \ + ao_telefire.c + +SRC = \ + $(CORE_SRC) \ + $(CC1111_SRC) \ + $(DRIVER_SRC) \ + $(PRODUCT_SRC) + +PROGNAME = telefire-v$(TELEFIRE_VER) +PROG = $(PROGNAME)-$(VERSION).ihx +PRODUCT=TeleFire-v$(TELEFIRE_VER) +PRODUCT_DEF=-DTELEFIRE_V_$(TELEFIRE_DEF) +IDPRODUCT=0x000f +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) ../cc1111/ao_arch.h $(PMEM) || rm $@ + +ao_product.h: ao-make-product.5c ../Version + $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ + +distclean: clean + +clean: clean-cc1111 + +install: + +uninstall: + diff --git a/src/telefire-v0.2/ao_pins.h b/src/telefire-v0.2/ao_pins.h new file mode 100644 index 00000000..f4050722 --- /dev/null +++ b/src/telefire-v0.2/ao_pins.h @@ -0,0 +1,144 @@ +/* + * Copyright © 2010 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. + */ + +#ifndef _AO_PINS_H_ +#define _AO_PINS_H_ + +#define HAS_RADIO 1 + +#define HAS_FLIGHT 0 +#define HAS_USB 1 +#define HAS_BEEP 0 +#define HAS_GPS 0 +#define HAS_SERIAL_1 0 +#define HAS_ADC 1 +#define HAS_DBG 0 +#define HAS_EEPROM 1 +#define HAS_LOG 0 +#define HAS_PAD 1 +#define USE_INTERNAL_FLASH 1 +#define DBG_ON_P1 0 +#define IGNITE_ON_P2 0 +#define IGNITE_ON_P1 1 +#define IGNITE_ON_P0 0 +#define PACKET_HAS_MASTER 0 +#define PACKET_HAS_SLAVE 0 + +#define AO_LED_CONTINUITY(c) (1 << (c)) +#define AO_LED_CONTINUITY_MASK (0xf) +#define AO_LED_RX 0x10 +#define AO_LED_TX 0x20 +#define AO_LED_ARMED 0x40 +#define AO_LED_POWER 0x80 + +#define AO_LED_RED AO_LED_TX +#define AO_LED_GREEN AO_LED_RX + +#define LEDS_AVAILABLE (0xff) +#define HAS_EXTERNAL_TEMP 0 +#define HAS_ACCEL_REF 0 +#define SPI_CS_ON_P1 1 +#define HAS_AES 1 +#define DMA_SHARE_AES_RADIO 1 + +#define SPI_CS_PORT P1 +#define SPI_CS_SEL P1SEL +#define SPI_CS_DIR P1DIR + +#define SPI_CONST 0x00 + +#define HAS_SPI_0 0 +#define HAS_SPI_1 1 +#define SPI_1_ALT_1 0 +#define SPI_1_ALT_2 1 + +#define HAS_74HC165 1 +#define AO_74HC165_CS_PORT P1 +#define AO_74HC165_CS_PIN 4 +#define AO_74HC165_CS P1_4 + +#define AO_PCA9922_CS_PORT P2 +#define AO_PCA9922_CS_PIN 0 +#define AO_PCA9922_CS P2_0 + +#define AO_PAD_NUM 4 +#define AO_PAD_PORT P1 +#define AO_PAD_DIR P1DIR + +#define AO_PAD_PIN_0 0 +#define AO_PAD_0 P1_0 +#define AO_PAD_ADC_0 0 + +#define AO_PAD_PIN_1 1 +#define AO_PAD_1 P1_1 +#define AO_PAD_ADC_1 1 + +#define AO_PAD_PIN_2 2 +#define AO_PAD_2 P1_2 +#define AO_PAD_ADC_2 2 + +#define AO_PAD_PIN_3 3 +#define AO_PAD_3 P1_3 +#define AO_PAD_ADC_3 3 + +#define AO_PAD_ALL_PINS ((1 << AO_PAD_PIN_0) | (1 << AO_PAD_PIN_1) | (1 << AO_PAD_PIN_2) | (1 << AO_PAD_PIN_3)) +#define AO_PAD_ALL_CHANNELS ((1 << 0) | (1 << 1) | (1 << 2) | (1 << 3)) + +#define AO_SIREN_PORT P2 +#define AO_SIREN_DIR P2DIR +#define AO_SIREN_PIN 3 +#define AO_SIREN P2_3 + +#define AO_STROBE_PORT P2 +#define AO_STROBE_DIR P2DIR +#define AO_STROBE_PIN 4 +#define AO_STROBE P2_4 + +/* test these values with real igniters */ +#define AO_PAD_RELAY_CLOSED 3524 +#define AO_PAD_NO_IGNITER 16904 +#define AO_PAD_GOOD_IGNITER 22514 + +#define AO_PAD_ADC_PYRO 4 +#define AO_PAD_ADC_BATT 5 + +#define AO_ADC_FIRST_PIN 0 + +struct ao_adc { + int16_t sense[AO_PAD_NUM]; + int16_t pyro; + int16_t batt; +}; + +#define AO_ADC_DUMP(p) \ + printf ("tick: %5u 0: %5d 1: %5d 2: %5d 3: %5d pyro: %5d batt %5d\n", \ + (p)->tick, \ + (p)->adc.sense[0], \ + (p)->adc.sense[1], \ + (p)->adc.sense[2], \ + (p)->adc.sense[3], \ + (p)->adc.pyro, \ + (p)->adc.batt) + +#define AO_ADC_PINS ((1 << AO_PAD_ADC_0) | \ + (1 << AO_PAD_ADC_1) | \ + (1 << AO_PAD_ADC_2) | \ + (1 << AO_PAD_ADC_3) | \ + (1 << AO_PAD_ADC_PYRO) | \ + (1 << AO_PAD_ADC_BATT)) + +#endif /* _AO_PINS_H_ */ diff --git a/src/telefire-v0.2/ao_telefire.c b/src/telefire-v0.2/ao_telefire.c new file mode 100644 index 00000000..f27ca5e8 --- /dev/null +++ b/src/telefire-v0.2/ao_telefire.c @@ -0,0 +1,45 @@ +/* + * Copyright © 2012 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 +#include +#include +#include + +void +main(void) +{ + ao_clock_init(); + + ao_led_init(LEDS_AVAILABLE); + + ao_task_init(); + + ao_timer_init(); + ao_adc_init(); + ao_cmd_init(); + ao_spi_init(); + ao_74hc165_init(); + ao_storage_init(); + ao_usb_init(); + ao_radio_init(); + ao_aes_init(); + ao_pad_init(); +// ao_radio_cmac_cmd_init(); + ao_config_init(); + ao_start_scheduler(); +} -- cgit v1.2.3 From 377a44cbfd5c8a659d2fecabb154726717a41900 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 25 Aug 2013 22:34:09 -0700 Subject: altos: Build more products by default We keep creating more hardware... Signed-off-by: Keith Packard --- src/Makefile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index ee76c325..af2630fc 100644 --- a/src/Makefile +++ b/src/Makefile @@ -20,7 +20,8 @@ SDCCDIRS=\ telemini-v1.0 \ telebt-v1.0 \ teleterra-v0.2 teleshield-v0.1 \ - telefire-v0.1 telefire-v0.2 + telefire-v0.1 telefire-v0.2 \ + telemini-v2.0 AVRDIRS=\ telescience-v0.1 telescience-pwm micropeak @@ -29,10 +30,11 @@ ARMDIRS=\ telemega-v0.1 telemega-v0.1/flash-loader \ telemega-v0.3 telemega-v0.3/flash-loader \ megadongle-v0.1 megadongle-v0.1/flash-loader \ - telegps-v0.1 telegps-v0.1/flash-loader \ + telegps-v0.3 telegps-v0.3/flash-loader \ stm-bringup stm-demo \ telelco-v0.2 telelco-v0.2/flash-loader \ - telescience-v0.2 telescience-v0.2/flash-loader + telescience-v0.2 telescience-v0.2/flash-loader \ + easymini-v0.1 easymini-v0.1/flash-loader ARMM0DIRS=\ easymini-v0.1 -- cgit v1.2.3 From b86c69d56261da54745076b1f5a9c8e8e44787c2 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 15 Sep 2013 14:13:59 -0700 Subject: altos: Add nanopeak-v0.1 The same as micropeak, just a few different pins Signed-off-by: Keith Packard --- src/Makefile | 2 +- src/nanopeak-v0.1/.gitignore | 2 + src/nanopeak-v0.1/Makefile | 114 +++++++++++++++++++++++++++++++++++++++++++ src/nanopeak-v0.1/ao_pins.h | 65 ++++++++++++++++++++++++ 4 files changed, 182 insertions(+), 1 deletion(-) create mode 100644 src/nanopeak-v0.1/.gitignore create mode 100644 src/nanopeak-v0.1/Makefile create mode 100644 src/nanopeak-v0.1/ao_pins.h (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index af2630fc..9a8cb837 100644 --- a/src/Makefile +++ b/src/Makefile @@ -24,7 +24,7 @@ SDCCDIRS=\ telemini-v2.0 AVRDIRS=\ - telescience-v0.1 telescience-pwm micropeak + telescience-v0.1 telescience-pwm micropeak nanopeak-v0.1 ARMDIRS=\ telemega-v0.1 telemega-v0.1/flash-loader \ diff --git a/src/nanopeak-v0.1/.gitignore b/src/nanopeak-v0.1/.gitignore new file mode 100644 index 00000000..27cd0a7c --- /dev/null +++ b/src/nanopeak-v0.1/.gitignore @@ -0,0 +1,2 @@ +ao_product.h +nanopeak-* diff --git a/src/nanopeak-v0.1/Makefile b/src/nanopeak-v0.1/Makefile new file mode 100644 index 00000000..cb468a06 --- /dev/null +++ b/src/nanopeak-v0.1/Makefile @@ -0,0 +1,114 @@ +# +# Tiny AltOS build +# +# +vpath % ../attiny:../drivers:../core:../product:.. +vpath ao-make-product.5c ../util +vpath make-altitude-pa ../util + +MCU=attiny85 +DUDECPUTYPE=t85 +#PROGRAMMER=stk500v2 -P usb +PROGRAMMER=usbtiny +LOADCMD=avrdude +LOADSLOW=-i 32 -B 32 +LOADARG=-p $(DUDECPUTYPE) -c $(PROGRAMMER) -e -U flash:w: +CC=avr-gcc +OBJCOPY=avr-objcopy + +LDFLAGS=-L/usr/lib/ldscripts -Tavr25.x + +ifndef VERSION +include ../Version +endif + +ALTOS_SRC = \ + ao_micropeak.c \ + ao_spi_attiny.c \ + ao_led.c \ + ao_clock.c \ + ao_ms5607.c \ + ao_exti.c \ + ao_convert_pa.c \ + ao_report_micro.c \ + ao_notask.c \ + ao_eeprom_tiny.c \ + ao_panic.c \ + ao_log_micro.c \ + ao_async.c \ + ao_microflight.c \ + ao_microkalman.c + +INC=\ + ao.h \ + ao_pins.h \ + ao_arch.h \ + ao_arch_funcs.h \ + ao_exti.h \ + ao_ms5607.h \ + ao_log_micro.h \ + ao_micropeak.h \ + altitude-pa.h + +IDPRODUCT=0 +PRODUCT=NanoPeak-v0.1 +PRODUCT_DEF=-DNANOPEAK +CFLAGS = $(PRODUCT_DEF) -I. -I../attiny -I../core -I.. -I../drivers -I../product +CFLAGS += -g -mmcu=$(MCU) -Wall -Wstrict-prototypes -O2 -mcall-prologues -DATTINY + +NICKLE=nickle + +PROG=nanopeak-v0.1 + +SRC=$(ALTOS_SRC) +OBJ=$(SRC:.c=.o) + +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).hex + +CHECK=sh ../util/check-avr-mem + +$(PROG): Makefile $(OBJ) + $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) + $(call quiet,CHECK) $(PROG) || ($(RM) -f $(PROG); exit 1) + +$(PROG).hex: $(PROG) + avr-size $(PROG) + $(OBJCOPY) -R .eeprom -O ihex $(PROG) $@ + + +load: $(PROG).hex + $(LOADCMD) $(LOADARG)$(PROG).hex + +load-slow: $(PROG).hex + $(LOADCMD) $(LOADSLOW) $(LOADARG)$(PROG).hex + +ao_product.h: ao-make-product.5c ../Version + $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ + +ao_product.o: ao_product.c ao_product.h + +%.o : %.c $(INC) + $(call quiet,CC) -c $(CFLAGS) $< + +distclean: clean + +clean: + rm -f *.o $(PROG) $(PROG).hex + rm -f ao_product.h + +../altitude-pa.h: make-altitude-pa + nickle $< > $@ + +install: + +uninstall: + +$(OBJ): ao_product.h $(INC) diff --git a/src/nanopeak-v0.1/ao_pins.h b/src/nanopeak-v0.1/ao_pins.h new file mode 100644 index 00000000..bd4a06d1 --- /dev/null +++ b/src/nanopeak-v0.1/ao_pins.h @@ -0,0 +1,65 @@ +/* + * Copyright © 2011 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. + */ + +#ifndef _AO_PINS_H_ +#define _AO_PINS_H_ +#include + +#define AO_LED_ORANGE (1<<3) +#define AO_LED_SERIAL 3 +#define AO_LED_PANIC AO_LED_ORANGE +#define AO_LED_REPORT AO_LED_ORANGE +#define LEDS_AVAILABLE (AO_LED_ORANGE) +#define USE_SERIAL_1_STDIN 0 +#define HAS_USB 0 +#define PACKET_HAS_SLAVE 0 +#define HAS_SERIAL_1 0 +#define HAS_TASK 0 +#define HAS_MS5607 1 +#define HAS_MS5611 0 +#define HAS_EEPROM 0 +#define HAS_BEEP 0 +#define AVR_CLOCK 250000UL + +/* SPI */ +#define SPI_PORT PORTB +#define SPI_PIN PINB +#define SPI_DIR DDRB +#define AO_MS5607_CS_PORT PORTB +#define AO_MS5607_CS_PIN 4 + +/* MS5607 */ +#define AO_MS5607_SPI_INDEX 0 +#define AO_MS5607_MISO_PORT PORTB +#define AO_MS5607_MISO_PIN 0 +#define AO_MS5607_BARO_OVERSAMPLE 4096 +#define AO_MS5607_TEMP_OVERSAMPLE 1024 + +/* I2C */ +#define I2C_PORT PORTB +#define I2C_PIN PINB +#define I2C_DIR DDRB +#define I2C_PIN_SCL PINB2 +#define I2C_PIN_SDA PINB0 + +#define AO_CONST_ATTRIB PROGMEM +typedef int32_t alt_t; +#define FETCH_ALT(o) ((alt_t) pgm_read_dword(&altitude_table[o])) + +#define AO_ALT_VALUE(x) ((x) * (alt_t) 10) + +#endif /* _AO_PINS_H_ */ -- cgit v1.2.3 From 258d225df1f4afe1cfdc9c43208bcd75d18cdf2d Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 7 Oct 2013 22:00:15 -0700 Subject: altos: Rename easymini-v0.1 to easymini-v1.0 The production boards are the same as the modified v0.1 boards Signed-off-by: Keith Packard --- src/Makefile | 5 +- src/easymini-v0.1/.gitignore | 2 - src/easymini-v0.1/Makefile | 85 ------------------ src/easymini-v0.1/ao_easymini.c | 46 ---------- src/easymini-v0.1/ao_pins.h | 143 ------------------------------- src/easymini-v0.1/flash-loader/Makefile | 8 -- src/easymini-v0.1/flash-loader/ao_pins.h | 33 ------- src/easymini-v1.0/.gitignore | 2 + src/easymini-v1.0/Makefile | 84 ++++++++++++++++++ src/easymini-v1.0/ao_easymini.c | 46 ++++++++++ src/easymini-v1.0/ao_pins.h | 136 +++++++++++++++++++++++++++++ src/easymini-v1.0/flash-loader/Makefile | 8 ++ src/easymini-v1.0/flash-loader/ao_pins.h | 33 +++++++ src/lpc/Makefile.defs | 8 +- 14 files changed, 314 insertions(+), 325 deletions(-) delete mode 100644 src/easymini-v0.1/.gitignore delete mode 100644 src/easymini-v0.1/Makefile delete mode 100644 src/easymini-v0.1/ao_easymini.c delete mode 100644 src/easymini-v0.1/ao_pins.h delete mode 100644 src/easymini-v0.1/flash-loader/Makefile delete mode 100644 src/easymini-v0.1/flash-loader/ao_pins.h create mode 100644 src/easymini-v1.0/.gitignore create mode 100644 src/easymini-v1.0/Makefile create mode 100644 src/easymini-v1.0/ao_easymini.c create mode 100644 src/easymini-v1.0/ao_pins.h create mode 100644 src/easymini-v1.0/flash-loader/Makefile create mode 100644 src/easymini-v1.0/flash-loader/ao_pins.h (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index 9a8cb837..23cd2920 100644 --- a/src/Makefile +++ b/src/Makefile @@ -33,11 +33,10 @@ ARMDIRS=\ telegps-v0.3 telegps-v0.3/flash-loader \ stm-bringup stm-demo \ telelco-v0.2 telelco-v0.2/flash-loader \ - telescience-v0.2 telescience-v0.2/flash-loader \ - easymini-v0.1 easymini-v0.1/flash-loader + telescience-v0.2 telescience-v0.2/flash-loader ARMM0DIRS=\ - easymini-v0.1 + easymini-v1.0 easymini-v1.0/flash-loader ifneq ($(shell which sdcc),) SUBDIRS += $(SDCCDIRS) diff --git a/src/easymini-v0.1/.gitignore b/src/easymini-v0.1/.gitignore deleted file mode 100644 index e5f7d586..00000000 --- a/src/easymini-v0.1/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -ao_product.h -*.elf diff --git a/src/easymini-v0.1/Makefile b/src/easymini-v0.1/Makefile deleted file mode 100644 index 9847656c..00000000 --- a/src/easymini-v0.1/Makefile +++ /dev/null @@ -1,85 +0,0 @@ -# -# AltOS build -# -# - -include ../lpc/Makefile.defs - -INC = \ - ao.h \ - ao_arch.h \ - ao_arch_funcs.h \ - ao_pins.h \ - ao_product.h \ - lpc.h - -# -# Common AltOS sources -# -ALTOS_SRC = \ - ao_interrupt.c \ - ao_boot_chain.c \ - ao_romconfig.c \ - ao_product.c \ - ao_mutex.c \ - ao_panic.c \ - ao_stdio.c \ - ao_storage.c \ - ao_report.c \ - ao_ignite.c \ - ao_flight.c \ - ao_kalman.c \ - ao_sample.c \ - ao_data.c \ - ao_convert_pa.c \ - ao_led_lpc.c \ - ao_task.c \ - ao_log.c \ - ao_log_mini.c \ - ao_cmd.c \ - ao_config.c \ - ao_timer_lpc.c \ - ao_exti_lpc.c \ - ao_usb_lpc.c \ - ao_spi_lpc.c \ - ao_adc_lpc.c \ - ao_beep_lpc.c \ - ao_m25.c \ - ao_ms5607.c - -PRODUCT=EasyMini-v0.1 -PRODUCT_DEF=-DEASYMINI_V_0_1 -IDPRODUCT=0x0026 - -CFLAGS = $(PRODUCT_DEF) $(LPC_CFLAGS) -g -Os - -PROGNAME=easymini-v0.1 -PROG=$(PROGNAME)-$(VERSION).elf - -SRC=$(ALTOS_SRC) ao_easymini.c -OBJ=$(SRC:.c=.o) - -all: $(PROG) - -LDFLAGS=-L../lpc -Wl,-Taltos.ld - -$(PROG): Makefile $(OBJ) altos.ld - $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) $(SAT_CLIB) -lgcc - -ao_product.h: ao-make-product.5c ../Version - $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ - -$(OBJ): $(INC) - -load: $(PROG) - lpc-load $(PROG) - -distclean: clean - -clean: - rm -f *.o $(PROG) - rm -f ao_product.h - -install: - -uninstall: diff --git a/src/easymini-v0.1/ao_easymini.c b/src/easymini-v0.1/ao_easymini.c deleted file mode 100644 index 97230b61..00000000 --- a/src/easymini-v0.1/ao_easymini.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright © 2011 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 -#include - -void -main(void) -{ - ao_clock_init(); - ao_task_init(); - ao_timer_init(); - ao_exti_init(); - - ao_beep_init(); - - ao_adc_init(); - ao_spi_init(); - ao_storage_init(); - - ao_usb_init(); - - ao_cmd_init(); - ao_flight_init(); - ao_ms5607_init(); - ao_log_init(); - ao_report_init(); - ao_igniter_init(); - ao_config_init(); - - ao_start_scheduler(); -} diff --git a/src/easymini-v0.1/ao_pins.h b/src/easymini-v0.1/ao_pins.h deleted file mode 100644 index e0eb10bf..00000000 --- a/src/easymini-v0.1/ao_pins.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright © 2013 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. - */ - -#define HAS_BEEP 1 -#define HAS_LED 1 - -#define AO_STACK_SIZE 384 - -#define IS_FLASH_LOADER 0 - -/* Crystal on the board */ -#define AO_LPC_CLKIN 12000000 - -/* Main clock frequency. 48MHz for USB so we don't use the USB PLL */ -#define AO_LPC_CLKOUT 48000000 - -/* System clock frequency */ -#define AO_LPC_SYSCLK 24000000 - -#define LED_PORT 0 -#define LED_PIN_RED 7 - -#define AO_LED_RED (1 << LED_PIN_RED) - -#define LEDS_AVAILABLE AO_LED_RED - -#define HAS_USB 1 - -#define HAS_USB_CONNECT 0 -#define HAS_USB_VBUS 0 -#define HAS_USB_PULLUP 1 -#define AO_USB_PULLUP_PORT 0 -#define AO_USB_PULLUP_PIN 20 - -#define PACKET_HAS_SLAVE 0 - -#define AO_LOG_FORMAT AO_LOG_FORMAT_EASYMINI - -/* USART */ - -#define HAS_SERIAL 0 -#define USE_SERIAL_0_STDIN 1 -#define SERIAL_0_18_19 1 -#define SERIAL_0_14_15 0 -#define SERIAL_0_17_18 0 -#define SERIAL_0_26_27 0 - -/* SPI */ - -#define HAS_SPI_0 1 -#define SPI_SCK0_P0_6 1 -#define HAS_SPI_1 1 -#define SPI_SCK1_P1_15 1 -#define SPI_MISO1_P0_22 1 -#define SPI_MOSI1_P0_21 1 - -/* M25 */ - -#define M25_MAX_CHIPS 1 -#define AO_M25_SPI_CS_PORT 0 -#define AO_M25_SPI_CS_MASK (1 << 23) -#define AO_M25_SPI_BUS 1 - -/* MS5607 */ - -#define HAS_MS5607 1 -#define HAS_MS5611 0 -#define AO_MS5607_PRIVATE_PINS 0 -#define AO_MS5607_CS_PORT 0 -#define AO_MS5607_CS_PIN 7 -#define AO_MS5607_CS_MASK (1 << AO_MS5607_CS_PIN) -#define AO_MS5607_MISO_PORT 0 -#define AO_MS5607_MISO_PIN 8 -#define AO_MS5607_MISO_MASK (1 << AO_MS5607_MISO_PIN) -#define AO_MS5607_SPI_INDEX 0 - -#define HAS_ACCEL 0 -#define HAS_GPS 0 -#define HAS_RADIO 0 -#define HAS_FLIGHT 1 -#define HAS_EEPROM 1 -#define HAS_TELEMETRY 0 -#define HAS_APRS 0 -#define HAS_LOG 1 -#define USE_INTERNAL_FLASH 0 -#define HAS_IGNITE 1 -#define HAS_IGNITE_REPORT 1 - -#define AO_DATA_RING 16 - -/* - * ADC - */ - -#define HAS_ADC 1 - -#define AO_NUM_ADC 3 - -#define AO_ADC_0 1 -#define AO_ADC_1 1 -#define AO_ADC_2 1 - -struct ao_adc { - int16_t sense_a; - int16_t sense_m; - int16_t v_batt; -}; - -/* - * Igniter - */ - -#define AO_IGNITER_CLOSED 400 -#define AO_IGNITER_OPEN 60 - -#define AO_IGNITER_DROGUE_PORT 0 -#define AO_IGNITER_DROGUE_PIN 2 -#define AO_IGNITER_SET_DROGUE(v) ao_gpio_set(AO_IGNITER_DROGUE_PORT, AO_IGNITER_DROGUE_PIN, AO_IGNITER_DROGUE, v) - -#define AO_IGNITER_MAIN_PORT 0 -#define AO_IGNITER_MAIN_PIN 3 -#define AO_IGNITER_SET_MAIN(v) ao_gpio_set(AO_IGNITER_MAIN_PORT, AO_IGNITER_MAIN_PIN, AO_IGNITER_MAIN, v) - -#define AO_SENSE_DROGUE(p) ((p)->adc.sense_a) -#define AO_SENSE_MAIN(p) ((p)->adc.sense_m) - -#define AO_ADC_DUMP(p) \ - printf("tick: %5u apogee: %5d main: %5d batt: %5d\n", \ - (p)->tick, (p)->adc.sense_a, (p)->adc.sense_m, (p)->adc.v_batt) diff --git a/src/easymini-v0.1/flash-loader/Makefile b/src/easymini-v0.1/flash-loader/Makefile deleted file mode 100644 index ab828b22..00000000 --- a/src/easymini-v0.1/flash-loader/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# -# AltOS flash loader build -# -# - -TOPDIR=../.. -HARDWARE=easymini-v0.1 -include $(TOPDIR)/lpc/Makefile-flash.defs diff --git a/src/easymini-v0.1/flash-loader/ao_pins.h b/src/easymini-v0.1/flash-loader/ao_pins.h deleted file mode 100644 index 4330151d..00000000 --- a/src/easymini-v0.1/flash-loader/ao_pins.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright © 2013 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. - */ - -#ifndef _AO_PINS_H_ -#define _AO_PINS_H_ - -#include - -#define AO_BOOT_PIN 1 -#define AO_BOOT_APPLICATION_GPIO 0 -#define AO_BOOT_APPLICATION_PIN 19 -#define AO_BOOT_APPLICATION_VALUE 1 -#define AO_BOOT_APPLICATION_MODE AO_EXTI_MODE_PULL_UP - -#define HAS_USB_PULLUP 1 -#define AO_USB_PULLUP_PORT 0 -#define AO_USB_PULLUP_PIN 20 - -#endif /* _AO_PINS_H_ */ diff --git a/src/easymini-v1.0/.gitignore b/src/easymini-v1.0/.gitignore new file mode 100644 index 00000000..e5f7d586 --- /dev/null +++ b/src/easymini-v1.0/.gitignore @@ -0,0 +1,2 @@ +ao_product.h +*.elf diff --git a/src/easymini-v1.0/Makefile b/src/easymini-v1.0/Makefile new file mode 100644 index 00000000..ec305c94 --- /dev/null +++ b/src/easymini-v1.0/Makefile @@ -0,0 +1,84 @@ +# +# AltOS build +# +# + +include ../lpc/Makefile.defs + +INC = \ + ao.h \ + ao_arch.h \ + ao_arch_funcs.h \ + ao_pins.h \ + ao_product.h \ + lpc.h + +# +# Common AltOS sources +# +ALTOS_SRC = \ + ao_interrupt.c \ + ao_boot_chain.c \ + ao_romconfig.c \ + ao_product.c \ + ao_mutex.c \ + ao_panic.c \ + ao_stdio.c \ + ao_storage.c \ + ao_report.c \ + ao_ignite.c \ + ao_flight.c \ + ao_kalman.c \ + ao_sample.c \ + ao_data.c \ + ao_convert_pa.c \ + ao_task.c \ + ao_log.c \ + ao_log_mini.c \ + ao_cmd.c \ + ao_config.c \ + ao_timer_lpc.c \ + ao_exti_lpc.c \ + ao_usb_lpc.c \ + ao_spi_lpc.c \ + ao_adc_lpc.c \ + ao_beep_lpc.c \ + ao_m25.c \ + ao_ms5607.c + +PRODUCT=EasyMini-v1.0 +PRODUCT_DEF=-DEASYMINI_V_1_0 +IDPRODUCT=0x0026 + +CFLAGS = $(PRODUCT_DEF) $(LPC_CFLAGS) -g -Os + +PROGNAME=easymini-v1.0 +PROG=$(PROGNAME)-$(VERSION).elf + +SRC=$(ALTOS_SRC) ao_easymini.c +OBJ=$(SRC:.c=.o) + +all: $(PROG) + +LDFLAGS=-L../lpc -Wl,-Taltos.ld + +$(PROG): Makefile $(OBJ) altos.ld + $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) $(SAT_CLIB) -lgcc + +ao_product.h: ao-make-product.5c ../Version + $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ + +$(OBJ): $(INC) + +load: $(PROG) + lpc-load $(PROG) + +distclean: clean + +clean: + rm -f *.o $(PROG) + rm -f ao_product.h + +install: + +uninstall: diff --git a/src/easymini-v1.0/ao_easymini.c b/src/easymini-v1.0/ao_easymini.c new file mode 100644 index 00000000..97230b61 --- /dev/null +++ b/src/easymini-v1.0/ao_easymini.c @@ -0,0 +1,46 @@ +/* + * Copyright © 2011 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 +#include + +void +main(void) +{ + ao_clock_init(); + ao_task_init(); + ao_timer_init(); + ao_exti_init(); + + ao_beep_init(); + + ao_adc_init(); + ao_spi_init(); + ao_storage_init(); + + ao_usb_init(); + + ao_cmd_init(); + ao_flight_init(); + ao_ms5607_init(); + ao_log_init(); + ao_report_init(); + ao_igniter_init(); + ao_config_init(); + + ao_start_scheduler(); +} diff --git a/src/easymini-v1.0/ao_pins.h b/src/easymini-v1.0/ao_pins.h new file mode 100644 index 00000000..e721030d --- /dev/null +++ b/src/easymini-v1.0/ao_pins.h @@ -0,0 +1,136 @@ +/* + * Copyright © 2013 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. + */ + +#define HAS_BEEP 1 +#define HAS_LED 0 + +#define AO_STACK_SIZE 384 + +#define IS_FLASH_LOADER 0 + +/* Crystal on the board */ +#define AO_LPC_CLKIN 12000000 + +/* Main clock frequency. 48MHz for USB so we don't use the USB PLL */ +#define AO_LPC_CLKOUT 48000000 + +/* System clock frequency */ +#define AO_LPC_SYSCLK 24000000 + +#define HAS_USB 1 + +#define HAS_USB_CONNECT 0 +#define HAS_USB_VBUS 0 +#define HAS_USB_PULLUP 1 +#define AO_USB_PULLUP_PORT 0 +#define AO_USB_PULLUP_PIN 20 + +#define PACKET_HAS_SLAVE 0 + +#define AO_LOG_FORMAT AO_LOG_FORMAT_EASYMINI + +/* USART */ + +#define HAS_SERIAL 0 +#define USE_SERIAL_0_STDIN 1 +#define SERIAL_0_18_19 1 +#define SERIAL_0_14_15 0 +#define SERIAL_0_17_18 0 +#define SERIAL_0_26_27 0 + +/* SPI */ + +#define HAS_SPI_0 1 +#define SPI_SCK0_P0_6 1 +#define HAS_SPI_1 1 +#define SPI_SCK1_P1_15 1 +#define SPI_MISO1_P0_22 1 +#define SPI_MOSI1_P0_21 1 + +/* M25 */ + +#define M25_MAX_CHIPS 1 +#define AO_M25_SPI_CS_PORT 0 +#define AO_M25_SPI_CS_MASK (1 << 23) +#define AO_M25_SPI_BUS 1 + +/* MS5607 */ + +#define HAS_MS5607 1 +#define HAS_MS5611 0 +#define AO_MS5607_PRIVATE_PINS 0 +#define AO_MS5607_CS_PORT 0 +#define AO_MS5607_CS_PIN 7 +#define AO_MS5607_CS_MASK (1 << AO_MS5607_CS_PIN) +#define AO_MS5607_MISO_PORT 0 +#define AO_MS5607_MISO_PIN 8 +#define AO_MS5607_MISO_MASK (1 << AO_MS5607_MISO_PIN) +#define AO_MS5607_SPI_INDEX 0 + +#define HAS_ACCEL 0 +#define HAS_GPS 0 +#define HAS_RADIO 0 +#define HAS_FLIGHT 1 +#define HAS_EEPROM 1 +#define HAS_TELEMETRY 0 +#define HAS_APRS 0 +#define HAS_LOG 1 +#define USE_INTERNAL_FLASH 0 +#define HAS_IGNITE 1 +#define HAS_IGNITE_REPORT 1 + +#define AO_DATA_RING 16 + +/* + * ADC + */ + +#define HAS_ADC 1 + +#define AO_NUM_ADC 3 + +#define AO_ADC_0 1 +#define AO_ADC_1 1 +#define AO_ADC_2 1 + +struct ao_adc { + int16_t sense_a; + int16_t sense_m; + int16_t v_batt; +}; + +/* + * Igniter + */ + +#define AO_IGNITER_CLOSED 400 +#define AO_IGNITER_OPEN 60 + +#define AO_IGNITER_DROGUE_PORT 0 +#define AO_IGNITER_DROGUE_PIN 2 +#define AO_IGNITER_SET_DROGUE(v) ao_gpio_set(AO_IGNITER_DROGUE_PORT, AO_IGNITER_DROGUE_PIN, AO_IGNITER_DROGUE, v) + +#define AO_IGNITER_MAIN_PORT 0 +#define AO_IGNITER_MAIN_PIN 3 +#define AO_IGNITER_SET_MAIN(v) ao_gpio_set(AO_IGNITER_MAIN_PORT, AO_IGNITER_MAIN_PIN, AO_IGNITER_MAIN, v) + +#define AO_SENSE_DROGUE(p) ((p)->adc.sense_a) +#define AO_SENSE_MAIN(p) ((p)->adc.sense_m) + +#define AO_ADC_DUMP(p) \ + printf("tick: %5u apogee: %5d main: %5d batt: %5d\n", \ + (p)->tick, (p)->adc.sense_a, (p)->adc.sense_m, (p)->adc.v_batt) diff --git a/src/easymini-v1.0/flash-loader/Makefile b/src/easymini-v1.0/flash-loader/Makefile new file mode 100644 index 00000000..78bb4092 --- /dev/null +++ b/src/easymini-v1.0/flash-loader/Makefile @@ -0,0 +1,8 @@ +# +# AltOS flash loader build +# +# + +TOPDIR=../.. +HARDWARE=easymini-v1.0 +include $(TOPDIR)/lpc/Makefile-flash.defs diff --git a/src/easymini-v1.0/flash-loader/ao_pins.h b/src/easymini-v1.0/flash-loader/ao_pins.h new file mode 100644 index 00000000..4330151d --- /dev/null +++ b/src/easymini-v1.0/flash-loader/ao_pins.h @@ -0,0 +1,33 @@ +/* + * Copyright © 2013 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. + */ + +#ifndef _AO_PINS_H_ +#define _AO_PINS_H_ + +#include + +#define AO_BOOT_PIN 1 +#define AO_BOOT_APPLICATION_GPIO 0 +#define AO_BOOT_APPLICATION_PIN 19 +#define AO_BOOT_APPLICATION_VALUE 1 +#define AO_BOOT_APPLICATION_MODE AO_EXTI_MODE_PULL_UP + +#define HAS_USB_PULLUP 1 +#define AO_USB_PULLUP_PORT 0 +#define AO_USB_PULLUP_PIN 20 + +#endif /* _AO_PINS_H_ */ diff --git a/src/lpc/Makefile.defs b/src/lpc/Makefile.defs index 9e87cee1..2873d5e8 100644 --- a/src/lpc/Makefile.defs +++ b/src/lpc/Makefile.defs @@ -7,13 +7,11 @@ vpath load_csv.5c ../kalman vpath matrix.5c ../kalman vpath ao-make-product.5c ../util -CC=/usr/bin/arm-none-eabi-gcc +CC=arm-none-eabi-gcc SAT=/opt/cortex SAT_CLIB=$(SAT)/lib/pdclib-cortex-m0.a SAT_CFLAGS=-I$(SAT)/include -#CC=/opt/arm-gcc-bits/bin/arm-none-eabi-gcc - ifndef VERSION include ../Version endif @@ -21,7 +19,7 @@ endif AO_CFLAGS=-I. -I../lpc -I../core -I../drivers -I.. LPC_CFLAGS=-std=gnu99 -mlittle-endian -mcpu=cortex-m0 -mthumb -ffreestanding -nostdlib $(AO_CFLAGS) $(SAT_CFLAGS) -LDFLAGS=-L../stm -Wl,-Taltos.ld +LDFLAGS=$(LPC_CFLAGS) -L../stm -Wl,-Taltos.ld NICKLE=nickle @@ -34,7 +32,7 @@ endif quiet ?= $($1) .c.o: - $(call quiet,CC) -c $(CFLAGS) -o $@ $< + $(call quiet,CC) -c $(CFLAGS) $< ao_serial_lpc.h: ../lpc/baud_rate ao_pins.h nickle ../lpc/baud_rate `awk '/AO_LPC_CLKOUT/{print $$3}' ao_pins.h` > $@ -- cgit v1.2.3 From 6a1e398e590121458176758858bb4210f3eb5a55 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 8 Oct 2013 09:22:03 -0700 Subject: Add --with parameters to configure for compiler selection This allows the user to specify which compiler to use for each target CPU. Also checks to make sure the arm compiler supports -m0 and -m3 cpu type flags. The build now actually uses the specified compilers too. Signed-off-by: Keith Packard --- configure.ac | 155 +++++++++++++++++++++++++++++++++++++++--- src/Makedefs.in | 10 +++ src/Makefile | 25 +++---- src/avr-demo/Makefile | 10 +-- src/avr/Makefile.defs | 16 +++++ src/cc1111/Makefile.cc1111 | 3 +- src/lpc/Makefile-flash.defs | 10 +-- src/lpc/Makefile.defs | 23 ++++--- src/micropeak/Makefile | 12 +--- src/nanopeak-v0.1/Makefile | 12 +--- src/stm/Makefile-flash.defs | 11 +-- src/stm/Makefile.defs | 15 ++-- src/telepyro-v0.1/Makefile | 10 +-- src/telescience-pwm/Makefile | 12 +--- src/telescience-v0.1/Makefile | 12 +--- 15 files changed, 238 insertions(+), 98 deletions(-) create mode 100644 src/Makedefs.in create mode 100644 src/avr/Makefile.defs (limited to 'src/Makefile') diff --git a/configure.ac b/configure.ac index e88109f9..729149da 100644 --- a/configure.ac +++ b/configure.ac @@ -180,21 +180,151 @@ if test "x$GCC" = "xyes"; then fi AC_SUBST(WARN_CFLAGS) -AC_CHECK_PROG([HAVE_SDCC], [sdcc], yes, no) +# +# Configure SDCC +# + +AC_ARG_WITH([sdcc], + [AS_HELP_STRING([--with-sdcc], + [Name of SDCC])], + [], + [with_sdcc=auto]) + +if test "x$with_sdcc" != "xno"; then + if test "x$with_sdcc" = "xauto"; then + with_sdcc="sdcc" + AC_CHECK_PROG([HAVE_SDCC],[$with_sdcc], yes, no) + else + HAVE_SDCC=yes + fi +else + HAVE_SDCC=no +fi + if test "x$HAVE_SDCC" = "xno"; then - AC_MSG_WARN([No sdcc found, cc1111 binaries will not be built]) + AC_MSG_WARN([SDCC not found, cc1111 binaries will not be built]) +else + SDCC=$with_sdcc +fi + +AC_SUBST(SDCC) +AC_SUBST(HAVE_SDCC) + +# +# Configure ARM compiler for STM32L and LPC11U14 +# + +AC_ARG_WITH([arm-cc], + [AS_HELP_STRING([--with-arm-cc], + [Name of ARM C compiler])], + [], + [with_arm_cc=auto]) + +if test "x$with_arm_cc" != "xno"; then + if test "x$with_arm_cc" = "xauto"; then + with_arm_cc="arm-none-eabi-gcc" + AC_CHECK_PROG([HAVE_ARM_CC],[$with_arm_cc], yes, no) + else + HAVE_ARM_CC=yes + fi +else + HAVE_ARM_CC=no fi -AC_CHECK_PROG([HAVE_ARM_GCC],[arm-none-eabi-gcc], yes, no,[/opt/cortex/bin]) -if test "x$HAVE_ARM_GCC" = "xno"; then - AC_MSG_WARN([No summon toolchain arm compiler found, STM32L binaries will not be built]) +if test "x$HAVE_ARM_CC" = "xno"; then + AC_MSG_WARN([Arm compiler not found, ARM binaries will not be built]) +else + ARM_CC=$with_arm_cc +fi +AC_SUBST(HAVE_ARM_CC) +AC_SUBST(ARM_CC) + +if test "x$HAVE_ARM_CC" = "xyes"; then + save_CC="$CC" + save_CFLAGS="$CFLAGS" + CC="$ARM_CC" + CFLAGS="-mthumb -mcpu=cortex-m0" + AC_LANG_PUSH([C]) + + AC_MSG_CHECKING([if ]$ARM_CC[ supports cortex-m0]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int i;])], + [HAVE_ARM_M0_CC=yes], + [HAVE_ARM_M0_CC=no]) + AC_MSG_RESULT([$HAVE_ARM_M0]) + CFLAGS="-mthumb -mcpu=cortex-m3" + AC_MSG_CHECKING([if ]$ARM_CC[ supports cortex-m3]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int i;])], + [HAVE_ARM_M3_CC=yes], + [HAVE_ARM_M3_CC=no]) + AC_MSG_RESULT([$HAVE_ARM_M3]) + AC_LANG_POP([C]) + CFLAGS="$save_CFLAGS" + CC="$save_CC" +else + HAVE_ARM_M3_CC=no + HAVE_ARM_M0_CC=no +fi +AC_SUBST(HAVE_ARM_M3_CC) +AC_SUBST(HAVE_ARM_M0_CC) + +if test "x$HAVE_ARM_M3_CC" = "xno"; then + AC_MSG_WARN([No cortex-m3 arm compiler found, STM32L binaries will not be built]) fi -AC_CHECK_PROG([HAVE_ARM_M0_GCC], [arm-none-eabi-gcc], yes, no,[/usr/bin]) -if test "x$HAVE_ARM_M0_GCC" = "xno"; then - AC_MSG_WARN([No linaro toolchain arm cortex-m0 compiler found, LPC11U14 binaries will not be built]) +if test "x$HAVE_ARM_M0_CC" = "xno"; then + AC_MSG_WARN([No cortex-m0 arm compiler found, LPC11U14 binaries will not be built]) fi +# +# Configure AVR compiler +# + +AC_ARG_WITH([avr-cc], + [AS_HELP_STRING([--with-avr-cc], + [Name of AVR C compiler])], + [], + [with_avr_cc=auto]) + +if test "x$with_avr_cc" != "xno"; then + if test "x$with_avr_cc" = "xauto"; then + with_avr_cc="avr-gcc" + AC_CHECK_PROG([HAVE_AVR_CC],[$with_avr_cc], yes, no) + else + HAVE_AVR_CC=yes + fi +else + HAVE_AVR_CC=no +fi + +AC_ARG_WITH([avr-objcopy], + [AS_HELP_STRING([--with-avr-objcopy], + [Name of AVR objcopy])], + [], + [with_avr_objcopy=auto]) + +if test "x$with_avr_objcopy" != "xno"; then + if test "x$with_avr_objcopy" = "xauto"; then + with_avr_objcopy="avr-objcopy" + AC_CHECK_PROG([HAVE_AVR_OBJCOPY],[$with_avr_objcopy], yes, no) + else + HAVE_AVR_OBJCOPY=yes + fi +else + HAVE_AVR_OBJCOPY=no +fi + +if test "x$HAVE_AVR_CC" = "xno" -o "x$HAVE_AVR_OBJCOPY" = "xno"; then + AC_MSG_WARN([AVR compiler and objcopy not found, atmel binaries will not be built]) + HAVE_AVR_CC=no +else + AVR_CC=$with_avr_cc + AVR_OBJCOPY=$with_avr_objcopy +fi + +AC_SUBST(AVR_CC) +AC_SUBST(AVR_OBJCOPY) +AC_SUBST(HAVE_AVR_CC) + AC_CHECK_PROG([HAVE_NICKLE], [nickle], yes, no) if test "x$HAVE_NICKLE" = "xno"; then AC_MSG_ERROR([Please install nickle to build AltOs]) @@ -213,6 +343,7 @@ AM_CONDITIONAL([LIBSTLINK], [test x$HAVE_STLINK != xno]) AC_OUTPUT([ Makefile +src/Makedefs altoslib/Makefile altosuilib/Makefile altosuilib/AltosUIVersion.java @@ -248,9 +379,13 @@ echo "" echo " Package: ${PACKAGE_NAME} ${PACKAGE_VERSION}" echo "" echo " Configuration" -echo " STM32L support..............: ${HAVE_ARM_GCC}" -echo " LPC11U14 support............: ${HAVE_ARM_M0_GCC}" +echo " Arm compiler................: ${ARM_CC}" +echo " STM32L support..............: ${HAVE_ARM_M3_CC}" +echo " LPC11U14 support............: ${HAVE_ARM_M0_CC}" +echo " SDCC........................: ${SDCC}" echo " CC1111 support..............: ${HAVE_SDCC}" +echo " AVR compiler................: ${AVR_CC} ${AVR_OBJCOPY}" +echo " AVR support.................: ${HAVE_AVR_CC}" echo " Android support.............: ${HAVE_ANDROID_SDK}" echo " STlink support..............: ${HAVE_STLINK}" echo "" diff --git a/src/Makedefs.in b/src/Makedefs.in new file mode 100644 index 00000000..6dc9ab0f --- /dev/null +++ b/src/Makedefs.in @@ -0,0 +1,10 @@ +ARM_CC=@ARM_CC@ +HAVE_ARM_M3_CC=@HAVE_ARM_M3_CC@ +HAVE_ARM_M0_CC=@HAVE_ARM_M0_CC@ + +SDCC=@SDCC@ +HAVE_SDCC=@HAVE_SDCC@ + +AVR_CC=@AVR_CC@ +AVR_OBJCOPY=@AVR_OBJCOPY@ +HAVE_AVR_CC=@HAVE_AVR_CC@ diff --git a/src/Makefile b/src/Makefile index 23cd2920..ae231c64 100644 --- a/src/Makefile +++ b/src/Makefile @@ -13,6 +13,7 @@ vpath load_csv.5c kalman vpath matrix.5c kalman include Version +include Makedefs SDCCDIRS=\ telemetrum-v1.2 telemetrum-v1.1 telemetrum-v1.0 \ @@ -23,10 +24,7 @@ SDCCDIRS=\ telefire-v0.1 telefire-v0.2 \ telemini-v2.0 -AVRDIRS=\ - telescience-v0.1 telescience-pwm micropeak nanopeak-v0.1 - -ARMDIRS=\ +ARMM3DIRS=\ telemega-v0.1 telemega-v0.1/flash-loader \ telemega-v0.3 telemega-v0.3/flash-loader \ megadongle-v0.1 megadongle-v0.1/flash-loader \ @@ -38,23 +36,26 @@ ARMDIRS=\ ARMM0DIRS=\ easymini-v1.0 easymini-v1.0/flash-loader -ifneq ($(shell which sdcc),) +AVRDIRS=\ + telescience-v0.1 telescience-pwm micropeak nanopeak-v0.1 + +ifeq ($(strip $(HAVE_SDCC)),yes) SUBDIRS += $(SDCCDIRS) endif -ifneq ($(shell which avr-gcc),) - SUBDIRS += $(AVRDIRS) +ifeq ($(strip ($HAVE_ARM_M3_CC)),yes) + SUBDIRS += $(ARMM3DIRS) endif -ifneq ($(shell which /opt/cortex/bin/arm-none-eabi-gcc),) - SUBDIRS += $(ARMDIRS) +ifneq ($(strip ($HAVE_ARM_M0_CC)),yes) + SUBDIRS += $(ARMM0DIRS) endif -ifneq ($(shell which /usr/bin/arm-none-eabi-gcc),) - SUBDIRS += $(ARMM0DIRS) +ifeq ($(strip $(HAVE_AVR_CC)),yes) + SUBDIRS += $(AVRDIRS) endif -ALLDIRS=$(SDCCDIRS) $(AVRDIRS) $(ARMDIRS) +ALLDIRS=$(SDCCDIRS) $(ARMM3DIRS) $(ARMM0DIRS) $(AVRDIRS) all: all-local all-recursive diff --git a/src/avr-demo/Makefile b/src/avr-demo/Makefile index 93295166..6d9bfea2 100644 --- a/src/avr-demo/Makefile +++ b/src/avr-demo/Makefile @@ -11,18 +11,12 @@ vpath load_csv.5c ../kalman vpath matrix.5c ../kalman vpath ao-make-product.5c ../util +include ../avr/Makefile.defs + MCU=atmega32u4 DUDECPUTYPE=m32u4 #PROGRAMMER=stk500v2 -P usb -PROGRAMMER=usbtiny -LOADCMD=avrdude LOADARG=-p $(DUDECPUTYPE) -c $(PROGRAMMER) -e -U flash:w: -CC=avr-gcc -OBJCOPY=avr-objcopy - -ifndef VERSION -include ../Version -endif INC = \ ao.h \ diff --git a/src/avr/Makefile.defs b/src/avr/Makefile.defs new file mode 100644 index 00000000..eeb9a881 --- /dev/null +++ b/src/avr/Makefile.defs @@ -0,0 +1,16 @@ +ifndef TOPDIR +TOPDIR=.. +endif + +ifndef VERSION +include $(TOPDIR)/Version +endif + +include $(TOPDIR)/Makedefs + +CC=$(AVR_CC) +OBJCOPY=$(AVR_OBJCOPY) +LDSCRIPTS=/usr/lib/avr/lib/ldscripts + +PROGRAMMER=usbtiny +LOADCMD=avrdude diff --git a/src/cc1111/Makefile.cc1111 b/src/cc1111/Makefile.cc1111 index 0e19603b..78b653b3 100644 --- a/src/cc1111/Makefile.cc1111 +++ b/src/cc1111/Makefile.cc1111 @@ -1,4 +1,5 @@ -CC=sdcc +include ../Makedefs +CC=$(SDCC) CFLAGS=--model-small --debug --opt-code-speed -DCODESIZE=$(CODESIZE) diff --git a/src/lpc/Makefile-flash.defs b/src/lpc/Makefile-flash.defs index 6bdd204c..ab7181b9 100644 --- a/src/lpc/Makefile-flash.defs +++ b/src/lpc/Makefile-flash.defs @@ -6,14 +6,16 @@ vpath ao-make-product.5c $(TOPDIR)/util .elf.ihx: objcopy -O ihex $*.elf $@ -CC=arm-none-eabi-gcc -SAT=/opt/cortex -SAT_CLIB=$(SAT)/lib/pdclib-cortex-m0.a -SAT_CFLAGS=-I$(SAT)/include ifndef VERSION include $(TOPDIR)/Version endif +include $(TOPDIR)/Makedefs + +CC=$(ARM_CC) +SAT=/opt/cortex +SAT_CLIB=$(SAT)/lib/pdclib-cortex-m0.a +SAT_CFLAGS=-I$(SAT)/include AO_CFLAGS=-I. -I$(TOPDIR)/lpc -I$(TOPDIR)/core -I$(TOPDIR)/drivers -I$(TOPDIR)/product -I$(TOPDIR) STM_CFLAGS=-std=gnu99 -mlittle-endian -mcpu=cortex-m0 -mthumb -ffreestanding -nostdlib $(AO_CFLAGS) $(SAT_CFLAGS) diff --git a/src/lpc/Makefile.defs b/src/lpc/Makefile.defs index 2873d5e8..d541230a 100644 --- a/src/lpc/Makefile.defs +++ b/src/lpc/Makefile.defs @@ -7,19 +7,24 @@ vpath load_csv.5c ../kalman vpath matrix.5c ../kalman vpath ao-make-product.5c ../util -CC=arm-none-eabi-gcc -SAT=/opt/cortex -SAT_CLIB=$(SAT)/lib/pdclib-cortex-m0.a -SAT_CFLAGS=-I$(SAT)/include +ifndef TOPDIR +TOPDIR=.. +endif ifndef VERSION -include ../Version +include $(TOPDIR)/Version endif +include $(TOPDIR)/Makedefs + +CC=$(ARM_CC) +SAT=/opt/cortex +SAT_CLIB=$(SAT)/lib/pdclib-cortex-m0.a +SAT_CFLAGS=-I$(SAT)/include -AO_CFLAGS=-I. -I../lpc -I../core -I../drivers -I.. +AO_CFLAGS=-I. -I$(TOPDIR)/lpc -I$(TOPDIR)/core -I$(TOPDIR)/drivers -I$(TOPDIR) LPC_CFLAGS=-std=gnu99 -mlittle-endian -mcpu=cortex-m0 -mthumb -ffreestanding -nostdlib $(AO_CFLAGS) $(SAT_CFLAGS) -LDFLAGS=$(LPC_CFLAGS) -L../stm -Wl,-Taltos.ld +LDFLAGS=$(LPC_CFLAGS) -L$(TOPDIR)/stm -Wl,-Taltos.ld NICKLE=nickle @@ -34,8 +39,8 @@ quiet ?= $($1) .c.o: $(call quiet,CC) -c $(CFLAGS) $< -ao_serial_lpc.h: ../lpc/baud_rate ao_pins.h - nickle ../lpc/baud_rate `awk '/AO_LPC_CLKOUT/{print $$3}' ao_pins.h` > $@ +ao_serial_lpc.h: $(TOPDIR)/lpc/baud_rate ao_pins.h + nickle $(TOPDIR)/lpc/baud_rate `awk '/AO_LPC_CLKOUT/{print $$3}' ao_pins.h` > $@ ao_serial_lpc.o: ao_serial_lpc.h diff --git a/src/micropeak/Makefile b/src/micropeak/Makefile index e51b2847..35dfaab8 100644 --- a/src/micropeak/Makefile +++ b/src/micropeak/Makefile @@ -6,21 +6,15 @@ vpath % ../attiny:../drivers:../core:../product:.. vpath ao-make-product.5c ../util vpath make-altitude-pa ../util +include ../avr/Makefile.defs + MCU=attiny85 DUDECPUTYPE=t85 #PROGRAMMER=stk500v2 -P usb -PROGRAMMER=usbtiny -LOADCMD=avrdude LOADSLOW=-i 32 -B 32 LOADARG=-p $(DUDECPUTYPE) -c $(PROGRAMMER) -e -U flash:w: -CC=avr-gcc -OBJCOPY=avr-objcopy - -LDFLAGS=-L/usr/lib/ldscripts -Tavr25.x -ifndef VERSION -include ../Version -endif +LDFLAGS=-L$(LDSCRIPTS) -Tavr25.x ALTOS_SRC = \ ao_micropeak.c \ diff --git a/src/nanopeak-v0.1/Makefile b/src/nanopeak-v0.1/Makefile index cb468a06..154d78f6 100644 --- a/src/nanopeak-v0.1/Makefile +++ b/src/nanopeak-v0.1/Makefile @@ -6,21 +6,15 @@ vpath % ../attiny:../drivers:../core:../product:.. vpath ao-make-product.5c ../util vpath make-altitude-pa ../util +include ../avr/Makefile.defs + MCU=attiny85 DUDECPUTYPE=t85 #PROGRAMMER=stk500v2 -P usb -PROGRAMMER=usbtiny -LOADCMD=avrdude LOADSLOW=-i 32 -B 32 LOADARG=-p $(DUDECPUTYPE) -c $(PROGRAMMER) -e -U flash:w: -CC=avr-gcc -OBJCOPY=avr-objcopy - -LDFLAGS=-L/usr/lib/ldscripts -Tavr25.x -ifndef VERSION -include ../Version -endif +LDFLAGS=-L$(LDSCRIPTS) -Tavr25.x ALTOS_SRC = \ ao_micropeak.c \ diff --git a/src/stm/Makefile-flash.defs b/src/stm/Makefile-flash.defs index 86f76d46..f429d9bd 100644 --- a/src/stm/Makefile-flash.defs +++ b/src/stm/Makefile-flash.defs @@ -6,14 +6,15 @@ vpath ao-make-product.5c $(TOPDIR)/util .elf.ihx: objcopy -O ihex $*.elf $@ -CC=/opt/cortex/bin/arm-none-eabi-gcc -SAT=/opt/cortex -SAT_CLIB=$(SAT)/lib/pdclib-cortex-m3.a -SAT_CFLAGS=-I$(SAT)/include - ifndef VERSION include $(TOPDIR)/Version endif +include $(TOPDIR)/Makedefs + +CC=$(ARM_CC) +SAT=/opt/cortex +SAT_CLIB=$(SAT)/lib/pdclib-cortex-m3.a +SAT_CFLAGS=-I$(SAT)/include AO_CFLAGS=-I. -I$(TOPDIR)/stm -I$(TOPDIR)/core -I$(TOPDIR)/drivers -I$(TOPDIR)/product -I$(TOPDIR) STM_CFLAGS=-std=gnu99 -mlittle-endian -mcpu=cortex-m3 -mthumb -ffreestanding -nostdlib $(AO_CFLAGS) $(SAT_CFLAGS) diff --git a/src/stm/Makefile.defs b/src/stm/Makefile.defs index 8ef30521..ede75f80 100644 --- a/src/stm/Makefile.defs +++ b/src/stm/Makefile.defs @@ -12,14 +12,19 @@ vpath ao-make-product.5c ../util .elf.ihx: objcopy -O ihex $*.elf $@ -SAT=/opt/cortex -CC=$(SAT)/bin/arm-none-eabi-gcc -SAT_CLIB=$(SAT)/lib/pdclib-cortex-m3.a -SAT_CFLAGS=-I$(SAT)/include +ifndef TOPDIR +TOPDIR=.. +endif ifndef VERSION -include ../Version +include $(TOPDIR)/Version endif +include $(TOPDIR)/Makedefs + +CC=$(ARM_CC) +SAT=/opt/cortex +SAT_CLIB=$(SAT)/lib/pdclib-cortex-m3.a +SAT_CFLAGS=-I$(SAT)/include AO_CFLAGS=-I. -I../stm -I../core -I../drivers -I.. STM_CFLAGS=-std=gnu99 -mlittle-endian -mcpu=cortex-m3 -mthumb -ffreestanding -nostdlib $(AO_CFLAGS) $(SAT_CFLAGS) diff --git a/src/telepyro-v0.1/Makefile b/src/telepyro-v0.1/Makefile index 6743ba66..025b324a 100644 --- a/src/telepyro-v0.1/Makefile +++ b/src/telepyro-v0.1/Makefile @@ -5,18 +5,12 @@ vpath % .:..:../core:../product:../drivers:../avr vpath ao-make-product.5c ../util +include ../avr/Makefile.defs + MCU=atmega32u4 DUDECPUTYPE=m32u4 #PROGRAMMER=stk500v2 -P usb -PROGRAMMER=usbtiny -LOADCMD=avrdude LOADARG=-p $(DUDECPUTYPE) -c $(PROGRAMMER) -e -U flash:w: -CC=avr-gcc -OBJCOPY=avr-objcopy - -ifndef VERSION -include ../Version -endif INC = \ ao.h \ diff --git a/src/telescience-pwm/Makefile b/src/telescience-pwm/Makefile index ce2a8fde..7f39d3f1 100644 --- a/src/telescience-pwm/Makefile +++ b/src/telescience-pwm/Makefile @@ -5,20 +5,14 @@ vpath % ..:../core:../product:../drivers:../avr vpath ao-make-product.5c ../util +include ../avr/Makefile.defs + MCU=atmega32u4 DUDECPUTYPE=m32u4 #PROGRAMMER=stk500v2 -P usb -PROGRAMMER=usbtiny -LOADCMD=avrdude LOADARG=-p $(DUDECPUTYPE) -c $(PROGRAMMER) -e -U flash:w: -CC=avr-gcc -OBJCOPY=avr-objcopy - -LDFLAGS=-L/usr/lib/ldscripts -Tavr5.x -ifndef VERSION -include ../Version -endif +LDFLAGS=-L$(LDSCRIPTS) -Tavr5.x INC = \ ao.h \ diff --git a/src/telescience-v0.1/Makefile b/src/telescience-v0.1/Makefile index 81054a75..a65b3ad0 100644 --- a/src/telescience-v0.1/Makefile +++ b/src/telescience-v0.1/Makefile @@ -5,20 +5,14 @@ vpath % ..:../core:../product:../drivers:../avr vpath ao-make-product.5c ../util +include ../avr/Makefile.defs + MCU=atmega32u4 DUDECPUTYPE=m32u4 #PROGRAMMER=stk500v2 -P usb -PROGRAMMER=usbtiny -LOADCMD=avrdude LOADARG=-p $(DUDECPUTYPE) -c $(PROGRAMMER) -e -U flash:w: -CC=avr-gcc -OBJCOPY=avr-objcopy - -LDFLAGS=-L/usr/lib/ldscripts -Tavr5.x -ifndef VERSION -include ../Version -endif +LDFLAGS=-L$(LDSCRIPTS) -Tavr5.x INC = \ ao.h \ -- cgit v1.2.3 From f7cccbb7a624a2a47b21682f416a135a28319b41 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 8 Oct 2013 09:39:29 -0700 Subject: altos: Broken test for M0 compiler in src/Makefile Was causing it to try to compiler M0 progs only when *no* compiler was found. Signed-off-by: Keith Packard --- src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index ae231c64..3e4ed68d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -47,7 +47,7 @@ ifeq ($(strip ($HAVE_ARM_M3_CC)),yes) SUBDIRS += $(ARMM3DIRS) endif -ifneq ($(strip ($HAVE_ARM_M0_CC)),yes) +ifeq ($(strip ($HAVE_ARM_M0_CC)),yes) SUBDIRS += $(ARMM0DIRS) endif -- cgit v1.2.3 From c584b5fc1128c7bfd7fb921ddc3a8ec498803b53 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 9 Oct 2013 12:37:30 -0700 Subject: altos: Messed up the ifeq syntax a bit so ARM bits weren't getting built $(x) is not the same as ($x) Signed-off-by: Keith Packard --- src/Makefile | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index 3e4ed68d..a0a271c6 100644 --- a/src/Makefile +++ b/src/Makefile @@ -39,20 +39,24 @@ ARMM0DIRS=\ AVRDIRS=\ telescience-v0.1 telescience-pwm micropeak nanopeak-v0.1 +SUBDIRS= + ifeq ($(strip $(HAVE_SDCC)),yes) - SUBDIRS += $(SDCCDIRS) +SUBDIRS+=$(SDCCDIRS) endif -ifeq ($(strip ($HAVE_ARM_M3_CC)),yes) - SUBDIRS += $(ARMM3DIRS) +ifeq ($(strip $(HAVE_ARM_M3_CC)),yes) +SUBDIRS+=$(ARMM3DIRS) +foo=bar endif -ifeq ($(strip ($HAVE_ARM_M0_CC)),yes) - SUBDIRS += $(ARMM0DIRS) +ifeq ($(strip $(HAVE_ARM_M0_CC)),yes) +SUBDIRS+=$(ARMM0DIRS) +baz=bletch endif ifeq ($(strip $(HAVE_AVR_CC)),yes) - SUBDIRS += $(AVRDIRS) +SUBDIRS += $(AVRDIRS) endif ALLDIRS=$(SDCCDIRS) $(ARMM3DIRS) $(ARMM0DIRS) $(AVRDIRS) -- cgit v1.2.3 From 0951b1ef83d8d741d65811fa23bde43ee843a939 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 12 Nov 2013 15:18:53 +0900 Subject: altos: Build TM v2.0 firmware by default Signed-off-by: Keith Packard --- src/Makefile | 1 + 1 file changed, 1 insertion(+) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index a0a271c6..e7fa728b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -27,6 +27,7 @@ SDCCDIRS=\ ARMM3DIRS=\ telemega-v0.1 telemega-v0.1/flash-loader \ telemega-v0.3 telemega-v0.3/flash-loader \ + telemetrum-v2.0 telemetrum-v2.0/flash-loader \ megadongle-v0.1 megadongle-v0.1/flash-loader \ telegps-v0.3 telegps-v0.3/flash-loader \ stm-bringup stm-demo \ -- cgit v1.2.3 From ecb0465be76e9299511aeec663d267967834f6c3 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 9 Dec 2013 16:06:22 -0800 Subject: altos: Rename telemega-v0.3 to telemega-v1.0 Signed-off-by: Keith Packard --- src/Makefile | 2 +- src/telemega-v0.3/.gitignore | 2 - src/telemega-v0.3/Makefile | 153 ------------- src/telemega-v0.3/ao_pins.h | 361 ------------------------------- src/telemega-v0.3/ao_telemega.c | 102 --------- src/telemega-v0.3/flash-loader/Makefile | 8 - src/telemega-v0.3/flash-loader/ao_pins.h | 34 --- src/telemega-v1.0/.gitignore | 2 + src/telemega-v1.0/Makefile | 153 +++++++++++++ src/telemega-v1.0/ao_pins.h | 361 +++++++++++++++++++++++++++++++ src/telemega-v1.0/ao_telemega.c | 102 +++++++++ src/telemega-v1.0/flash-loader/Makefile | 8 + src/telemega-v1.0/flash-loader/ao_pins.h | 34 +++ 13 files changed, 661 insertions(+), 661 deletions(-) delete mode 100644 src/telemega-v0.3/.gitignore delete mode 100644 src/telemega-v0.3/Makefile delete mode 100644 src/telemega-v0.3/ao_pins.h delete mode 100644 src/telemega-v0.3/ao_telemega.c delete mode 100644 src/telemega-v0.3/flash-loader/Makefile delete mode 100644 src/telemega-v0.3/flash-loader/ao_pins.h create mode 100644 src/telemega-v1.0/.gitignore create mode 100644 src/telemega-v1.0/Makefile create mode 100644 src/telemega-v1.0/ao_pins.h create mode 100644 src/telemega-v1.0/ao_telemega.c create mode 100644 src/telemega-v1.0/flash-loader/Makefile create mode 100644 src/telemega-v1.0/flash-loader/ao_pins.h (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index e7fa728b..bdd3307a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -26,7 +26,7 @@ SDCCDIRS=\ ARMM3DIRS=\ telemega-v0.1 telemega-v0.1/flash-loader \ - telemega-v0.3 telemega-v0.3/flash-loader \ + telemega-v1.0 telemega-v1.0/flash-loader \ telemetrum-v2.0 telemetrum-v2.0/flash-loader \ megadongle-v0.1 megadongle-v0.1/flash-loader \ telegps-v0.3 telegps-v0.3/flash-loader \ diff --git a/src/telemega-v0.3/.gitignore b/src/telemega-v0.3/.gitignore deleted file mode 100644 index e67759a2..00000000 --- a/src/telemega-v0.3/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -ao_product.h -telemega-*.elf diff --git a/src/telemega-v0.3/Makefile b/src/telemega-v0.3/Makefile deleted file mode 100644 index 12e4152c..00000000 --- a/src/telemega-v0.3/Makefile +++ /dev/null @@ -1,153 +0,0 @@ -# -# AltOS build -# -# - -include ../stm/Makefile.defs - -INC = \ - ao.h \ - ao_arch.h \ - ao_arch_funcs.h \ - ao_companion.h \ - ao_data.h \ - ao_sample.h \ - ao_pins.h \ - altitude-pa.h \ - ao_kalman.h \ - ao_product.h \ - ao_ms5607.h \ - ao_hmc5883.h \ - ao_mpu6000.h \ - ao_mma655x.h \ - ao_cc1120_CC1120.h \ - ao_profile.h \ - ao_task.h \ - ao_whiten.h \ - ao_sample_profile.h \ - ao_quaternion.h \ - math.h \ - ao_mpu.h \ - stm32l.h \ - math.h \ - Makefile - -# -# Common AltOS sources -# -# ao_hmc5883.c - -#PROFILE=ao_profile.c -#PROFILE_DEF=-DAO_PROFILE=1 - -#SAMPLE_PROFILE=ao_sample_profile.c \ -# ao_sample_profile_timer.c -#SAMPLE_PROFILE_DEF=-DHAS_SAMPLE_PROFILE=1 - -#STACK_GUARD=ao_mpu_stm.c -#STACK_GUARD_DEF=-DHAS_STACK_GUARD=1 - -MATH_SRC=\ - ef_acos.c \ - ef_sqrt.c \ - ef_rem_pio2.c \ - kf_cos.c \ - kf_sin.c \ - kf_rem_pio2.c \ - sf_copysign.c \ - sf_cos.c \ - sf_fabs.c \ - sf_floor.c \ - sf_scalbn.c \ - sf_sin.c - -ALTOS_SRC = \ - ao_boot_chain.c \ - ao_interrupt.c \ - ao_product.c \ - ao_romconfig.c \ - ao_cmd.c \ - ao_config.c \ - ao_task.c \ - ao_led.c \ - ao_stdio.c \ - ao_panic.c \ - ao_timer.c \ - ao_mutex.c \ - ao_serial_stm.c \ - ao_gps_ublox.c \ - ao_gps_show.c \ - ao_gps_report_mega.c \ - ao_ignite.c \ - ao_freq.c \ - ao_dma_stm.c \ - ao_spi_stm.c \ - ao_cc1120.c \ - ao_fec_tx.c \ - ao_fec_rx.c \ - ao_data.c \ - ao_ms5607.c \ - ao_mma655x.c \ - ao_hmc5883.c \ - ao_adc_stm.c \ - ao_beep_stm.c \ - ao_eeprom_stm.c \ - ao_storage.c \ - ao_m25.c \ - ao_usb_stm.c \ - ao_exti_stm.c \ - ao_report.c \ - ao_i2c_stm.c \ - ao_mpu6000.c \ - ao_convert_pa.c \ - ao_log.c \ - ao_log_mega.c \ - ao_sample.c \ - ao_kalman.c \ - ao_flight.c \ - ao_telemetry.c \ - ao_packet_slave.c \ - ao_packet.c \ - ao_companion.c \ - ao_pyro.c \ - ao_aprs.c \ - $(MATH_SRC) \ - $(PROFILE) \ - $(SAMPLE_PROFILE) \ - $(STACK_GUARD) - -PRODUCT=TeleMega-v0.3 -PRODUCT_DEF=-DTELEMEGA -IDPRODUCT=0x0023 - -CFLAGS = $(PRODUCT_DEF) $(STM_CFLAGS) $(PROFILE_DEF) $(SAMPLE_PROFILE_DEF) $(STACK_GUARD_DEF) -Os -g - -PROGNAME=telemega-v0.3 -PROG=$(PROGNAME)-$(VERSION).elf -HEX=$(PROGNAME)-$(VERSION).ihx - -SRC=$(ALTOS_SRC) ao_telemega.c -OBJ=$(SRC:.c=.o) - -all: $(PROG) $(HEX) - -$(PROG): Makefile $(OBJ) altos.ld - $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) $(LIBS) - -../altitude-pa.h: make-altitude-pa - nickle $< > $@ - -$(OBJ): $(INC) - -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 *.o $(PROGNAME)-*.elf - rm -f ao_product.h - -install: - -uninstall: diff --git a/src/telemega-v0.3/ao_pins.h b/src/telemega-v0.3/ao_pins.h deleted file mode 100644 index 7ff676ea..00000000 --- a/src/telemega-v0.3/ao_pins.h +++ /dev/null @@ -1,361 +0,0 @@ -/* - * Copyright © 2012 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. - */ - -#ifndef _AO_PINS_H_ -#define _AO_PINS_H_ - -#define HAS_TASK_QUEUE 1 - -/* 8MHz High speed external crystal */ -#define AO_HSE 8000000 - -/* PLLVCO = 96MHz (so that USB will work) */ -#define AO_PLLMUL 12 -#define AO_RCC_CFGR_PLLMUL (STM_RCC_CFGR_PLLMUL_12) - -/* SYSCLK = 32MHz (no need to go faster than CPU) */ -#define AO_PLLDIV 3 -#define AO_RCC_CFGR_PLLDIV (STM_RCC_CFGR_PLLDIV_3) - -/* HCLK = 32MHz (CPU clock) */ -#define AO_AHB_PRESCALER 1 -#define AO_RCC_CFGR_HPRE_DIV STM_RCC_CFGR_HPRE_DIV_1 - -/* Run APB1 at 16MHz (HCLK/2) */ -#define AO_APB1_PRESCALER 2 -#define AO_RCC_CFGR_PPRE1_DIV STM_RCC_CFGR_PPRE2_DIV_2 - -/* Run APB2 at 16MHz (HCLK/2) */ -#define AO_APB2_PRESCALER 2 -#define AO_RCC_CFGR_PPRE2_DIV STM_RCC_CFGR_PPRE2_DIV_2 - -#define HAS_SERIAL_1 1 -#define USE_SERIAL_1_STDIN 0 -#define SERIAL_1_PB6_PB7 0 -#define SERIAL_1_PA9_PA10 1 - -#define HAS_SERIAL_2 0 -#define USE_SERIAL_2_STDIN 0 -#define SERIAL_2_PA2_PA3 0 -#define SERIAL_2_PD5_PD6 0 - -#define HAS_SERIAL_3 1 -#define USE_SERIAL_3_STDIN 0 -#define SERIAL_3_PB10_PB11 0 -#define SERIAL_3_PC10_PC11 1 -#define SERIAL_3_PD8_PD9 0 - -#define ao_gps_getchar ao_serial3_getchar -#define ao_gps_putchar ao_serial3_putchar -#define ao_gps_set_speed ao_serial3_set_speed -#define ao_gps_fifo (ao_stm_usart3.rx_fifo) - -#define AO_CONFIG_DEFAULT_FLIGHT_LOG_MAX (1024 * 1024) -#define HAS_EEPROM 1 -#define USE_INTERNAL_FLASH 0 -#define USE_EEPROM_CONFIG 1 -#define USE_STORAGE_CONFIG 0 -#define HAS_USB 1 -#define HAS_BEEP 1 -#define HAS_RADIO 1 -#define HAS_TELEMETRY 1 -#define HAS_APRS 1 - -#define HAS_SPI_1 1 -#define SPI_1_PA5_PA6_PA7 1 /* Barometer */ -#define SPI_1_PB3_PB4_PB5 0 -#define SPI_1_PE13_PE14_PE15 1 /* Accelerometer, Gyro */ -#define SPI_1_OSPEEDR STM_OSPEEDR_10MHz - -#define HAS_SPI_2 1 -#define SPI_2_PB13_PB14_PB15 1 /* Flash, Companion */ -#define SPI_2_PD1_PD3_PD4 0 -#define SPI_2_OSPEEDR STM_OSPEEDR_10MHz - -#define SPI_2_PORT (&stm_gpiob) -#define SPI_2_SCK_PIN 13 -#define SPI_2_MISO_PIN 14 -#define SPI_2_MOSI_PIN 15 - -#define HAS_I2C_1 1 -#define I2C_1_PB8_PB9 1 - -#define HAS_I2C_2 0 -#define I2C_2_PB10_PB11 0 - -#define PACKET_HAS_SLAVE 1 -#define PACKET_HAS_MASTER 0 - -#define LOW_LEVEL_DEBUG 0 - -#define LED_PORT_ENABLE STM_RCC_AHBENR_GPIOCEN -#define LED_PORT (&stm_gpioc) -#define LED_PIN_RED 8 -#define LED_PIN_GREEN 9 -#define AO_LED_RED (1 << LED_PIN_RED) -#define AO_LED_GREEN (1 << LED_PIN_GREEN) - -#define LEDS_AVAILABLE (AO_LED_RED | AO_LED_GREEN) - -#define HAS_GPS 1 -#define HAS_FLIGHT 1 -#define HAS_ADC 1 -#define HAS_ADC_TEMP 1 -#define HAS_LOG 1 - -/* - * Igniter - */ - -#define HAS_IGNITE 1 -#define HAS_IGNITE_REPORT 1 - -#define AO_SENSE_PYRO(p,n) ((p)->adc.sense[n]) -#define AO_SENSE_DROGUE(p) ((p)->adc.sense[4]) -#define AO_SENSE_MAIN(p) ((p)->adc.sense[5]) -#define AO_IGNITER_CLOSED 400 -#define AO_IGNITER_OPEN 60 - -/* Pyro A */ -#define AO_PYRO_PORT_0 (&stm_gpiod) -#define AO_PYRO_PIN_0 6 - -/* Pyro B */ -#define AO_PYRO_PORT_1 (&stm_gpiod) -#define AO_PYRO_PIN_1 7 - -/* Pyro C */ -#define AO_PYRO_PORT_2 (&stm_gpiob) -#define AO_PYRO_PIN_2 5 - -/* Pyro D */ -#define AO_PYRO_PORT_3 (&stm_gpioe) -#define AO_PYRO_PIN_3 4 - -/* Drogue */ -#define AO_IGNITER_DROGUE_PORT (&stm_gpioe) -#define AO_IGNITER_DROGUE_PIN 6 - -/* Main */ -#define AO_IGNITER_MAIN_PORT (&stm_gpioe) -#define AO_IGNITER_MAIN_PIN 5 - -/* Number of general purpose pyro channels available */ -#define AO_PYRO_NUM 4 - -#define AO_IGNITER_SET_DROGUE(v) stm_gpio_set(AO_IGNITER_DROGUE_PORT, AO_IGNITER_DROGUE_PIN, v) -#define AO_IGNITER_SET_MAIN(v) stm_gpio_set(AO_IGNITER_MAIN_PORT, AO_IGNITER_MAIN_PIN, v) - -/* - * ADC - */ -#define AO_DATA_RING 32 -#define AO_ADC_NUM_SENSE 6 - -struct ao_adc { - int16_t sense[AO_ADC_NUM_SENSE]; - int16_t v_batt; - int16_t v_pbatt; - int16_t temp; -}; - -#define AO_ADC_DUMP(p) \ - printf("tick: %5u A: %5d B: %5d C: %5d D: %5d drogue: %5d main: %5d batt: %5d pbatt: %5d temp: %5d\n", \ - (p)->tick, \ - (p)->adc.sense[0], (p)->adc.sense[1], (p)->adc.sense[2], \ - (p)->adc.sense[3], (p)->adc.sense[4], (p)->adc.sense[5], \ - (p)->adc.v_batt, (p)->adc.v_pbatt, (p)->adc.temp) - -#define AO_ADC_SENSE_A 0 -#define AO_ADC_SENSE_A_PORT (&stm_gpioa) -#define AO_ADC_SENSE_A_PIN 0 - -#define AO_ADC_SENSE_B 1 -#define AO_ADC_SENSE_B_PORT (&stm_gpioa) -#define AO_ADC_SENSE_B_PIN 1 - -#define AO_ADC_SENSE_C 2 -#define AO_ADC_SENSE_C_PORT (&stm_gpioa) -#define AO_ADC_SENSE_C_PIN 2 - -#define AO_ADC_SENSE_D 3 -#define AO_ADC_SENSE_D_PORT (&stm_gpioa) -#define AO_ADC_SENSE_D_PIN 3 - -#define AO_ADC_SENSE_DROGUE 4 -#define AO_ADC_SENSE_DROGUE_PORT (&stm_gpioa) -#define AO_ADC_SENSE_DROGUE_PIN 4 - -#define AO_ADC_SENSE_MAIN 22 -#define AO_ADC_SENSE_MAIN_PORT (&stm_gpioe) -#define AO_ADC_SENSE_MAIN_PIN 7 - -#define AO_ADC_V_BATT 8 -#define AO_ADC_V_BATT_PORT (&stm_gpiob) -#define AO_ADC_V_BATT_PIN 0 - -#define AO_ADC_V_PBATT 9 -#define AO_ADC_V_PBATT_PORT (&stm_gpiob) -#define AO_ADC_V_PBATT_PIN 1 - -#define AO_ADC_TEMP 16 - -#define AO_ADC_RCC_AHBENR ((1 << STM_RCC_AHBENR_GPIOAEN) | \ - (1 << STM_RCC_AHBENR_GPIOEEN) | \ - (1 << STM_RCC_AHBENR_GPIOBEN)) - -#define AO_NUM_ADC_PIN (AO_ADC_NUM_SENSE + 2) - -#define AO_ADC_PIN0_PORT AO_ADC_SENSE_A_PORT -#define AO_ADC_PIN0_PIN AO_ADC_SENSE_A_PIN -#define AO_ADC_PIN1_PORT AO_ADC_SENSE_B_PORT -#define AO_ADC_PIN1_PIN AO_ADC_SENSE_B_PIN -#define AO_ADC_PIN2_PORT AO_ADC_SENSE_C_PORT -#define AO_ADC_PIN2_PIN AO_ADC_SENSE_C_PIN -#define AO_ADC_PIN3_PORT AO_ADC_SENSE_D_PORT -#define AO_ADC_PIN3_PIN AO_ADC_SENSE_D_PIN -#define AO_ADC_PIN4_PORT AO_ADC_SENSE_DROGUE_PORT -#define AO_ADC_PIN4_PIN AO_ADC_SENSE_DROGUE_PIN -#define AO_ADC_PIN5_PORT AO_ADC_SENSE_MAIN_PORT -#define AO_ADC_PIN5_PIN AO_ADC_SENSE_MAIN_PIN -#define AO_ADC_PIN6_PORT AO_ADC_V_BATT_PORT -#define AO_ADC_PIN6_PIN AO_ADC_V_BATT_PIN -#define AO_ADC_PIN7_PORT AO_ADC_V_PBATT_PORT -#define AO_ADC_PIN7_PIN AO_ADC_V_PBATT_PIN - -#define AO_NUM_ADC (AO_ADC_NUM_SENSE + 3) - -#define AO_ADC_SQ1 AO_ADC_SENSE_A -#define AO_ADC_SQ2 AO_ADC_SENSE_B -#define AO_ADC_SQ3 AO_ADC_SENSE_C -#define AO_ADC_SQ4 AO_ADC_SENSE_D -#define AO_ADC_SQ5 AO_ADC_SENSE_DROGUE -#define AO_ADC_SQ6 AO_ADC_SENSE_MAIN -#define AO_ADC_SQ7 AO_ADC_V_BATT -#define AO_ADC_SQ8 AO_ADC_V_PBATT -#define AO_ADC_SQ9 AO_ADC_TEMP - -/* - * Pressure sensor settings - */ -#define HAS_MS5607 1 -#define HAS_MS5611 0 -#define AO_MS5607_PRIVATE_PINS 1 -#define AO_MS5607_CS_PORT (&stm_gpioc) -#define AO_MS5607_CS_PIN 4 -#define AO_MS5607_CS_MASK (1 << AO_MS5607_CS) -#define AO_MS5607_MISO_PORT (&stm_gpioa) -#define AO_MS5607_MISO_PIN 6 -#define AO_MS5607_MISO_MASK (1 << AO_MS5607_MISO) -#define AO_MS5607_SPI_INDEX AO_SPI_1_PA5_PA6_PA7 - -/* - * SPI Flash memory - */ - -#define M25_MAX_CHIPS 1 -#define AO_M25_SPI_CS_PORT (&stm_gpiod) -#define AO_M25_SPI_CS_MASK (1 << 3) -#define AO_M25_SPI_BUS AO_SPI_2_PB13_PB14_PB15 - -/* - * Radio (cc1120) - */ - -/* gets pretty close to 434.550 */ - -#define AO_RADIO_CAL_DEFAULT 0x6ca333 - -#define AO_FEC_DEBUG 0 -#define AO_CC1120_SPI_CS_PORT (&stm_gpioc) -#define AO_CC1120_SPI_CS_PIN 5 -#define AO_CC1120_SPI_BUS AO_SPI_2_PB13_PB14_PB15 -#define AO_CC1120_SPI stm_spi2 - -#define AO_CC1120_INT_PORT (&stm_gpioe) -#define AO_CC1120_INT_PIN 1 -#define AO_CC1120_MCU_WAKEUP_PORT (&stm_gpioc) -#define AO_CC1120_MCU_WAKEUP_PIN (0) - -#define AO_CC1120_INT_GPIO 2 -#define AO_CC1120_INT_GPIO_IOCFG CC1120_IOCFG2 - -#define AO_CC1120_MARC_GPIO 3 -#define AO_CC1120_MARC_GPIO_IOCFG CC1120_IOCFG3 - -#define HAS_BOOT_RADIO 0 - -/* - * Mag sensor (hmc5883) - */ - -#define HAS_HMC5883 1 -#define AO_HMC5883_INT_PORT (&stm_gpioc) -#define AO_HMC5883_INT_PIN 12 -#define AO_HMC5883_I2C_INDEX STM_I2C_INDEX(1) - -/* - * mpu6000 - */ - -#define HAS_MPU6000 1 -#define AO_MPU6000_INT_PORT (&stm_gpioe) -#define AO_MPU6000_INT_PIN 0 -#define AO_MPU6000_SPI_BUS AO_SPI_1_PE13_PE14_PE15 -#define AO_MPU6000_SPI_CS_PORT (&stm_gpiod) -#define AO_MPU6000_SPI_CS_PIN 2 - -#define HAS_HIGHG_ACCEL 1 - -/* - * mma655x - */ - -#define HAS_MMA655X 1 -#define AO_MMA655X_SPI_INDEX AO_SPI_1_PE13_PE14_PE15 -#define AO_MMA655X_CS_PORT (&stm_gpiod) -#define AO_MMA655X_CS_PIN 4 - -#define NUM_CMDS 16 - -/* - * Companion - */ - -#define AO_COMPANION_CS_PORT (&stm_gpiod) -#define AO_COMPANION_CS_PIN (0) -#define AO_COMPANION_SPI_BUS AO_SPI_2_PB13_PB14_PB15 - -/* - * Monitor - */ - -#define HAS_MONITOR 0 -#define LEGACY_MONITOR 0 -#define HAS_MONITOR_PUT 1 -#define AO_MONITOR_LED 0 -#define HAS_RSSI 0 - -/* - * Profiling Viterbi decoding - */ - -#ifndef AO_PROFILE -#define AO_PROFILE 0 -#endif - -#endif /* _AO_PINS_H_ */ diff --git a/src/telemega-v0.3/ao_telemega.c b/src/telemega-v0.3/ao_telemega.c deleted file mode 100644 index 7b035269..00000000 --- a/src/telemega-v0.3/ao_telemega.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright © 2011 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#if HAS_SAMPLE_PROFILE -#include -#endif -#include -#if HAS_STACK_GUARD -#include -#endif - -int -main(void) -{ - ao_clock_init(); - -#if HAS_STACK_GUARD - ao_mpu_init(); -#endif - - ao_task_init(); - ao_serial_init(); - ao_led_init(LEDS_AVAILABLE); - ao_led_on(AO_LED_GREEN); - ao_timer_init(); - - ao_i2c_init(); - ao_spi_init(); - ao_dma_init(); - ao_exti_init(); - - ao_adc_init(); -#if HAS_BEEP - ao_beep_init(); -#endif - ao_cmd_init(); - -#if HAS_MS5607 - ao_ms5607_init(); -#endif -#if HAS_HMC5883 - ao_hmc5883_init(); -#endif -#if HAS_MPU6000 - ao_mpu6000_init(); -#endif -#if HAS_MMA655X - ao_mma655x_init(); -#endif - - ao_eeprom_init(); - ao_storage_init(); - - ao_flight_init(); - ao_log_init(); - ao_report_init(); - - ao_usb_init(); - ao_gps_init(); - ao_gps_report_mega_init(); - ao_telemetry_init(); - ao_radio_init(); - ao_packet_slave_init(FALSE); - ao_igniter_init(); - ao_companion_init(); - ao_pyro_init(); - - ao_config_init(); -#if AO_PROFILE - ao_profile_init(); -#endif -#if HAS_SAMPLE_PROFILE - ao_sample_profile_init(); -#endif - - ao_start_scheduler(); - return 0; -} diff --git a/src/telemega-v0.3/flash-loader/Makefile b/src/telemega-v0.3/flash-loader/Makefile deleted file mode 100644 index 8fda18cd..00000000 --- a/src/telemega-v0.3/flash-loader/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# -# AltOS flash loader build -# -# - -TOPDIR=../.. -HARDWARE=telemega-v0.3 -include $(TOPDIR)/stm/Makefile-flash.defs diff --git a/src/telemega-v0.3/flash-loader/ao_pins.h b/src/telemega-v0.3/flash-loader/ao_pins.h deleted file mode 100644 index 1af92f13..00000000 --- a/src/telemega-v0.3/flash-loader/ao_pins.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright © 2013 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. - */ - -#ifndef _AO_PINS_H_ -#define _AO_PINS_H_ - -/* External crystal at 8MHz */ -#define AO_HSE 8000000 - -#include - -/* Companion port cs_companion0 PD0 */ - -#define AO_BOOT_PIN 1 -#define AO_BOOT_APPLICATION_GPIO stm_gpiod -#define AO_BOOT_APPLICATION_PIN 0 -#define AO_BOOT_APPLICATION_VALUE 1 -#define AO_BOOT_APPLICATION_MODE AO_EXTI_MODE_PULL_UP - -#endif /* _AO_PINS_H_ */ diff --git a/src/telemega-v1.0/.gitignore b/src/telemega-v1.0/.gitignore new file mode 100644 index 00000000..e67759a2 --- /dev/null +++ b/src/telemega-v1.0/.gitignore @@ -0,0 +1,2 @@ +ao_product.h +telemega-*.elf diff --git a/src/telemega-v1.0/Makefile b/src/telemega-v1.0/Makefile new file mode 100644 index 00000000..e3204c11 --- /dev/null +++ b/src/telemega-v1.0/Makefile @@ -0,0 +1,153 @@ +# +# AltOS build +# +# + +include ../stm/Makefile.defs + +INC = \ + ao.h \ + ao_arch.h \ + ao_arch_funcs.h \ + ao_companion.h \ + ao_data.h \ + ao_sample.h \ + ao_pins.h \ + altitude-pa.h \ + ao_kalman.h \ + ao_product.h \ + ao_ms5607.h \ + ao_hmc5883.h \ + ao_mpu6000.h \ + ao_mma655x.h \ + ao_cc1120_CC1120.h \ + ao_profile.h \ + ao_task.h \ + ao_whiten.h \ + ao_sample_profile.h \ + ao_quaternion.h \ + math.h \ + ao_mpu.h \ + stm32l.h \ + math.h \ + Makefile + +# +# Common AltOS sources +# +# ao_hmc5883.c + +#PROFILE=ao_profile.c +#PROFILE_DEF=-DAO_PROFILE=1 + +#SAMPLE_PROFILE=ao_sample_profile.c \ +# ao_sample_profile_timer.c +#SAMPLE_PROFILE_DEF=-DHAS_SAMPLE_PROFILE=1 + +#STACK_GUARD=ao_mpu_stm.c +#STACK_GUARD_DEF=-DHAS_STACK_GUARD=1 + +MATH_SRC=\ + ef_acos.c \ + ef_sqrt.c \ + ef_rem_pio2.c \ + kf_cos.c \ + kf_sin.c \ + kf_rem_pio2.c \ + sf_copysign.c \ + sf_cos.c \ + sf_fabs.c \ + sf_floor.c \ + sf_scalbn.c \ + sf_sin.c + +ALTOS_SRC = \ + ao_boot_chain.c \ + ao_interrupt.c \ + ao_product.c \ + ao_romconfig.c \ + ao_cmd.c \ + ao_config.c \ + ao_task.c \ + ao_led.c \ + ao_stdio.c \ + ao_panic.c \ + ao_timer.c \ + ao_mutex.c \ + ao_serial_stm.c \ + ao_gps_ublox.c \ + ao_gps_show.c \ + ao_gps_report_mega.c \ + ao_ignite.c \ + ao_freq.c \ + ao_dma_stm.c \ + ao_spi_stm.c \ + ao_cc1120.c \ + ao_fec_tx.c \ + ao_fec_rx.c \ + ao_data.c \ + ao_ms5607.c \ + ao_mma655x.c \ + ao_hmc5883.c \ + ao_adc_stm.c \ + ao_beep_stm.c \ + ao_eeprom_stm.c \ + ao_storage.c \ + ao_m25.c \ + ao_usb_stm.c \ + ao_exti_stm.c \ + ao_report.c \ + ao_i2c_stm.c \ + ao_mpu6000.c \ + ao_convert_pa.c \ + ao_log.c \ + ao_log_mega.c \ + ao_sample.c \ + ao_kalman.c \ + ao_flight.c \ + ao_telemetry.c \ + ao_packet_slave.c \ + ao_packet.c \ + ao_companion.c \ + ao_pyro.c \ + ao_aprs.c \ + $(MATH_SRC) \ + $(PROFILE) \ + $(SAMPLE_PROFILE) \ + $(STACK_GUARD) + +PRODUCT=TeleMega-v1.0 +PRODUCT_DEF=-DTELEMEGA +IDPRODUCT=0x0023 + +CFLAGS = $(PRODUCT_DEF) $(STM_CFLAGS) $(PROFILE_DEF) $(SAMPLE_PROFILE_DEF) $(STACK_GUARD_DEF) -Os -g + +PROGNAME=telemega-v1.0 +PROG=$(PROGNAME)-$(VERSION).elf +HEX=$(PROGNAME)-$(VERSION).ihx + +SRC=$(ALTOS_SRC) ao_telemega.c +OBJ=$(SRC:.c=.o) + +all: $(PROG) $(HEX) + +$(PROG): Makefile $(OBJ) altos.ld + $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) $(LIBS) + +../altitude-pa.h: make-altitude-pa + nickle $< > $@ + +$(OBJ): $(INC) + +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 *.o $(PROGNAME)-*.elf + rm -f ao_product.h + +install: + +uninstall: diff --git a/src/telemega-v1.0/ao_pins.h b/src/telemega-v1.0/ao_pins.h new file mode 100644 index 00000000..7ff676ea --- /dev/null +++ b/src/telemega-v1.0/ao_pins.h @@ -0,0 +1,361 @@ +/* + * Copyright © 2012 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. + */ + +#ifndef _AO_PINS_H_ +#define _AO_PINS_H_ + +#define HAS_TASK_QUEUE 1 + +/* 8MHz High speed external crystal */ +#define AO_HSE 8000000 + +/* PLLVCO = 96MHz (so that USB will work) */ +#define AO_PLLMUL 12 +#define AO_RCC_CFGR_PLLMUL (STM_RCC_CFGR_PLLMUL_12) + +/* SYSCLK = 32MHz (no need to go faster than CPU) */ +#define AO_PLLDIV 3 +#define AO_RCC_CFGR_PLLDIV (STM_RCC_CFGR_PLLDIV_3) + +/* HCLK = 32MHz (CPU clock) */ +#define AO_AHB_PRESCALER 1 +#define AO_RCC_CFGR_HPRE_DIV STM_RCC_CFGR_HPRE_DIV_1 + +/* Run APB1 at 16MHz (HCLK/2) */ +#define AO_APB1_PRESCALER 2 +#define AO_RCC_CFGR_PPRE1_DIV STM_RCC_CFGR_PPRE2_DIV_2 + +/* Run APB2 at 16MHz (HCLK/2) */ +#define AO_APB2_PRESCALER 2 +#define AO_RCC_CFGR_PPRE2_DIV STM_RCC_CFGR_PPRE2_DIV_2 + +#define HAS_SERIAL_1 1 +#define USE_SERIAL_1_STDIN 0 +#define SERIAL_1_PB6_PB7 0 +#define SERIAL_1_PA9_PA10 1 + +#define HAS_SERIAL_2 0 +#define USE_SERIAL_2_STDIN 0 +#define SERIAL_2_PA2_PA3 0 +#define SERIAL_2_PD5_PD6 0 + +#define HAS_SERIAL_3 1 +#define USE_SERIAL_3_STDIN 0 +#define SERIAL_3_PB10_PB11 0 +#define SERIAL_3_PC10_PC11 1 +#define SERIAL_3_PD8_PD9 0 + +#define ao_gps_getchar ao_serial3_getchar +#define ao_gps_putchar ao_serial3_putchar +#define ao_gps_set_speed ao_serial3_set_speed +#define ao_gps_fifo (ao_stm_usart3.rx_fifo) + +#define AO_CONFIG_DEFAULT_FLIGHT_LOG_MAX (1024 * 1024) +#define HAS_EEPROM 1 +#define USE_INTERNAL_FLASH 0 +#define USE_EEPROM_CONFIG 1 +#define USE_STORAGE_CONFIG 0 +#define HAS_USB 1 +#define HAS_BEEP 1 +#define HAS_RADIO 1 +#define HAS_TELEMETRY 1 +#define HAS_APRS 1 + +#define HAS_SPI_1 1 +#define SPI_1_PA5_PA6_PA7 1 /* Barometer */ +#define SPI_1_PB3_PB4_PB5 0 +#define SPI_1_PE13_PE14_PE15 1 /* Accelerometer, Gyro */ +#define SPI_1_OSPEEDR STM_OSPEEDR_10MHz + +#define HAS_SPI_2 1 +#define SPI_2_PB13_PB14_PB15 1 /* Flash, Companion */ +#define SPI_2_PD1_PD3_PD4 0 +#define SPI_2_OSPEEDR STM_OSPEEDR_10MHz + +#define SPI_2_PORT (&stm_gpiob) +#define SPI_2_SCK_PIN 13 +#define SPI_2_MISO_PIN 14 +#define SPI_2_MOSI_PIN 15 + +#define HAS_I2C_1 1 +#define I2C_1_PB8_PB9 1 + +#define HAS_I2C_2 0 +#define I2C_2_PB10_PB11 0 + +#define PACKET_HAS_SLAVE 1 +#define PACKET_HAS_MASTER 0 + +#define LOW_LEVEL_DEBUG 0 + +#define LED_PORT_ENABLE STM_RCC_AHBENR_GPIOCEN +#define LED_PORT (&stm_gpioc) +#define LED_PIN_RED 8 +#define LED_PIN_GREEN 9 +#define AO_LED_RED (1 << LED_PIN_RED) +#define AO_LED_GREEN (1 << LED_PIN_GREEN) + +#define LEDS_AVAILABLE (AO_LED_RED | AO_LED_GREEN) + +#define HAS_GPS 1 +#define HAS_FLIGHT 1 +#define HAS_ADC 1 +#define HAS_ADC_TEMP 1 +#define HAS_LOG 1 + +/* + * Igniter + */ + +#define HAS_IGNITE 1 +#define HAS_IGNITE_REPORT 1 + +#define AO_SENSE_PYRO(p,n) ((p)->adc.sense[n]) +#define AO_SENSE_DROGUE(p) ((p)->adc.sense[4]) +#define AO_SENSE_MAIN(p) ((p)->adc.sense[5]) +#define AO_IGNITER_CLOSED 400 +#define AO_IGNITER_OPEN 60 + +/* Pyro A */ +#define AO_PYRO_PORT_0 (&stm_gpiod) +#define AO_PYRO_PIN_0 6 + +/* Pyro B */ +#define AO_PYRO_PORT_1 (&stm_gpiod) +#define AO_PYRO_PIN_1 7 + +/* Pyro C */ +#define AO_PYRO_PORT_2 (&stm_gpiob) +#define AO_PYRO_PIN_2 5 + +/* Pyro D */ +#define AO_PYRO_PORT_3 (&stm_gpioe) +#define AO_PYRO_PIN_3 4 + +/* Drogue */ +#define AO_IGNITER_DROGUE_PORT (&stm_gpioe) +#define AO_IGNITER_DROGUE_PIN 6 + +/* Main */ +#define AO_IGNITER_MAIN_PORT (&stm_gpioe) +#define AO_IGNITER_MAIN_PIN 5 + +/* Number of general purpose pyro channels available */ +#define AO_PYRO_NUM 4 + +#define AO_IGNITER_SET_DROGUE(v) stm_gpio_set(AO_IGNITER_DROGUE_PORT, AO_IGNITER_DROGUE_PIN, v) +#define AO_IGNITER_SET_MAIN(v) stm_gpio_set(AO_IGNITER_MAIN_PORT, AO_IGNITER_MAIN_PIN, v) + +/* + * ADC + */ +#define AO_DATA_RING 32 +#define AO_ADC_NUM_SENSE 6 + +struct ao_adc { + int16_t sense[AO_ADC_NUM_SENSE]; + int16_t v_batt; + int16_t v_pbatt; + int16_t temp; +}; + +#define AO_ADC_DUMP(p) \ + printf("tick: %5u A: %5d B: %5d C: %5d D: %5d drogue: %5d main: %5d batt: %5d pbatt: %5d temp: %5d\n", \ + (p)->tick, \ + (p)->adc.sense[0], (p)->adc.sense[1], (p)->adc.sense[2], \ + (p)->adc.sense[3], (p)->adc.sense[4], (p)->adc.sense[5], \ + (p)->adc.v_batt, (p)->adc.v_pbatt, (p)->adc.temp) + +#define AO_ADC_SENSE_A 0 +#define AO_ADC_SENSE_A_PORT (&stm_gpioa) +#define AO_ADC_SENSE_A_PIN 0 + +#define AO_ADC_SENSE_B 1 +#define AO_ADC_SENSE_B_PORT (&stm_gpioa) +#define AO_ADC_SENSE_B_PIN 1 + +#define AO_ADC_SENSE_C 2 +#define AO_ADC_SENSE_C_PORT (&stm_gpioa) +#define AO_ADC_SENSE_C_PIN 2 + +#define AO_ADC_SENSE_D 3 +#define AO_ADC_SENSE_D_PORT (&stm_gpioa) +#define AO_ADC_SENSE_D_PIN 3 + +#define AO_ADC_SENSE_DROGUE 4 +#define AO_ADC_SENSE_DROGUE_PORT (&stm_gpioa) +#define AO_ADC_SENSE_DROGUE_PIN 4 + +#define AO_ADC_SENSE_MAIN 22 +#define AO_ADC_SENSE_MAIN_PORT (&stm_gpioe) +#define AO_ADC_SENSE_MAIN_PIN 7 + +#define AO_ADC_V_BATT 8 +#define AO_ADC_V_BATT_PORT (&stm_gpiob) +#define AO_ADC_V_BATT_PIN 0 + +#define AO_ADC_V_PBATT 9 +#define AO_ADC_V_PBATT_PORT (&stm_gpiob) +#define AO_ADC_V_PBATT_PIN 1 + +#define AO_ADC_TEMP 16 + +#define AO_ADC_RCC_AHBENR ((1 << STM_RCC_AHBENR_GPIOAEN) | \ + (1 << STM_RCC_AHBENR_GPIOEEN) | \ + (1 << STM_RCC_AHBENR_GPIOBEN)) + +#define AO_NUM_ADC_PIN (AO_ADC_NUM_SENSE + 2) + +#define AO_ADC_PIN0_PORT AO_ADC_SENSE_A_PORT +#define AO_ADC_PIN0_PIN AO_ADC_SENSE_A_PIN +#define AO_ADC_PIN1_PORT AO_ADC_SENSE_B_PORT +#define AO_ADC_PIN1_PIN AO_ADC_SENSE_B_PIN +#define AO_ADC_PIN2_PORT AO_ADC_SENSE_C_PORT +#define AO_ADC_PIN2_PIN AO_ADC_SENSE_C_PIN +#define AO_ADC_PIN3_PORT AO_ADC_SENSE_D_PORT +#define AO_ADC_PIN3_PIN AO_ADC_SENSE_D_PIN +#define AO_ADC_PIN4_PORT AO_ADC_SENSE_DROGUE_PORT +#define AO_ADC_PIN4_PIN AO_ADC_SENSE_DROGUE_PIN +#define AO_ADC_PIN5_PORT AO_ADC_SENSE_MAIN_PORT +#define AO_ADC_PIN5_PIN AO_ADC_SENSE_MAIN_PIN +#define AO_ADC_PIN6_PORT AO_ADC_V_BATT_PORT +#define AO_ADC_PIN6_PIN AO_ADC_V_BATT_PIN +#define AO_ADC_PIN7_PORT AO_ADC_V_PBATT_PORT +#define AO_ADC_PIN7_PIN AO_ADC_V_PBATT_PIN + +#define AO_NUM_ADC (AO_ADC_NUM_SENSE + 3) + +#define AO_ADC_SQ1 AO_ADC_SENSE_A +#define AO_ADC_SQ2 AO_ADC_SENSE_B +#define AO_ADC_SQ3 AO_ADC_SENSE_C +#define AO_ADC_SQ4 AO_ADC_SENSE_D +#define AO_ADC_SQ5 AO_ADC_SENSE_DROGUE +#define AO_ADC_SQ6 AO_ADC_SENSE_MAIN +#define AO_ADC_SQ7 AO_ADC_V_BATT +#define AO_ADC_SQ8 AO_ADC_V_PBATT +#define AO_ADC_SQ9 AO_ADC_TEMP + +/* + * Pressure sensor settings + */ +#define HAS_MS5607 1 +#define HAS_MS5611 0 +#define AO_MS5607_PRIVATE_PINS 1 +#define AO_MS5607_CS_PORT (&stm_gpioc) +#define AO_MS5607_CS_PIN 4 +#define AO_MS5607_CS_MASK (1 << AO_MS5607_CS) +#define AO_MS5607_MISO_PORT (&stm_gpioa) +#define AO_MS5607_MISO_PIN 6 +#define AO_MS5607_MISO_MASK (1 << AO_MS5607_MISO) +#define AO_MS5607_SPI_INDEX AO_SPI_1_PA5_PA6_PA7 + +/* + * SPI Flash memory + */ + +#define M25_MAX_CHIPS 1 +#define AO_M25_SPI_CS_PORT (&stm_gpiod) +#define AO_M25_SPI_CS_MASK (1 << 3) +#define AO_M25_SPI_BUS AO_SPI_2_PB13_PB14_PB15 + +/* + * Radio (cc1120) + */ + +/* gets pretty close to 434.550 */ + +#define AO_RADIO_CAL_DEFAULT 0x6ca333 + +#define AO_FEC_DEBUG 0 +#define AO_CC1120_SPI_CS_PORT (&stm_gpioc) +#define AO_CC1120_SPI_CS_PIN 5 +#define AO_CC1120_SPI_BUS AO_SPI_2_PB13_PB14_PB15 +#define AO_CC1120_SPI stm_spi2 + +#define AO_CC1120_INT_PORT (&stm_gpioe) +#define AO_CC1120_INT_PIN 1 +#define AO_CC1120_MCU_WAKEUP_PORT (&stm_gpioc) +#define AO_CC1120_MCU_WAKEUP_PIN (0) + +#define AO_CC1120_INT_GPIO 2 +#define AO_CC1120_INT_GPIO_IOCFG CC1120_IOCFG2 + +#define AO_CC1120_MARC_GPIO 3 +#define AO_CC1120_MARC_GPIO_IOCFG CC1120_IOCFG3 + +#define HAS_BOOT_RADIO 0 + +/* + * Mag sensor (hmc5883) + */ + +#define HAS_HMC5883 1 +#define AO_HMC5883_INT_PORT (&stm_gpioc) +#define AO_HMC5883_INT_PIN 12 +#define AO_HMC5883_I2C_INDEX STM_I2C_INDEX(1) + +/* + * mpu6000 + */ + +#define HAS_MPU6000 1 +#define AO_MPU6000_INT_PORT (&stm_gpioe) +#define AO_MPU6000_INT_PIN 0 +#define AO_MPU6000_SPI_BUS AO_SPI_1_PE13_PE14_PE15 +#define AO_MPU6000_SPI_CS_PORT (&stm_gpiod) +#define AO_MPU6000_SPI_CS_PIN 2 + +#define HAS_HIGHG_ACCEL 1 + +/* + * mma655x + */ + +#define HAS_MMA655X 1 +#define AO_MMA655X_SPI_INDEX AO_SPI_1_PE13_PE14_PE15 +#define AO_MMA655X_CS_PORT (&stm_gpiod) +#define AO_MMA655X_CS_PIN 4 + +#define NUM_CMDS 16 + +/* + * Companion + */ + +#define AO_COMPANION_CS_PORT (&stm_gpiod) +#define AO_COMPANION_CS_PIN (0) +#define AO_COMPANION_SPI_BUS AO_SPI_2_PB13_PB14_PB15 + +/* + * Monitor + */ + +#define HAS_MONITOR 0 +#define LEGACY_MONITOR 0 +#define HAS_MONITOR_PUT 1 +#define AO_MONITOR_LED 0 +#define HAS_RSSI 0 + +/* + * Profiling Viterbi decoding + */ + +#ifndef AO_PROFILE +#define AO_PROFILE 0 +#endif + +#endif /* _AO_PINS_H_ */ diff --git a/src/telemega-v1.0/ao_telemega.c b/src/telemega-v1.0/ao_telemega.c new file mode 100644 index 00000000..7b035269 --- /dev/null +++ b/src/telemega-v1.0/ao_telemega.c @@ -0,0 +1,102 @@ +/* + * Copyright © 2011 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if HAS_SAMPLE_PROFILE +#include +#endif +#include +#if HAS_STACK_GUARD +#include +#endif + +int +main(void) +{ + ao_clock_init(); + +#if HAS_STACK_GUARD + ao_mpu_init(); +#endif + + ao_task_init(); + ao_serial_init(); + ao_led_init(LEDS_AVAILABLE); + ao_led_on(AO_LED_GREEN); + ao_timer_init(); + + ao_i2c_init(); + ao_spi_init(); + ao_dma_init(); + ao_exti_init(); + + ao_adc_init(); +#if HAS_BEEP + ao_beep_init(); +#endif + ao_cmd_init(); + +#if HAS_MS5607 + ao_ms5607_init(); +#endif +#if HAS_HMC5883 + ao_hmc5883_init(); +#endif +#if HAS_MPU6000 + ao_mpu6000_init(); +#endif +#if HAS_MMA655X + ao_mma655x_init(); +#endif + + ao_eeprom_init(); + ao_storage_init(); + + ao_flight_init(); + ao_log_init(); + ao_report_init(); + + ao_usb_init(); + ao_gps_init(); + ao_gps_report_mega_init(); + ao_telemetry_init(); + ao_radio_init(); + ao_packet_slave_init(FALSE); + ao_igniter_init(); + ao_companion_init(); + ao_pyro_init(); + + ao_config_init(); +#if AO_PROFILE + ao_profile_init(); +#endif +#if HAS_SAMPLE_PROFILE + ao_sample_profile_init(); +#endif + + ao_start_scheduler(); + return 0; +} diff --git a/src/telemega-v1.0/flash-loader/Makefile b/src/telemega-v1.0/flash-loader/Makefile new file mode 100644 index 00000000..a11f800b --- /dev/null +++ b/src/telemega-v1.0/flash-loader/Makefile @@ -0,0 +1,8 @@ +# +# AltOS flash loader build +# +# + +TOPDIR=../.. +HARDWARE=telemega-v1.0 +include $(TOPDIR)/stm/Makefile-flash.defs diff --git a/src/telemega-v1.0/flash-loader/ao_pins.h b/src/telemega-v1.0/flash-loader/ao_pins.h new file mode 100644 index 00000000..1af92f13 --- /dev/null +++ b/src/telemega-v1.0/flash-loader/ao_pins.h @@ -0,0 +1,34 @@ +/* + * Copyright © 2013 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. + */ + +#ifndef _AO_PINS_H_ +#define _AO_PINS_H_ + +/* External crystal at 8MHz */ +#define AO_HSE 8000000 + +#include + +/* Companion port cs_companion0 PD0 */ + +#define AO_BOOT_PIN 1 +#define AO_BOOT_APPLICATION_GPIO stm_gpiod +#define AO_BOOT_APPLICATION_PIN 0 +#define AO_BOOT_APPLICATION_VALUE 1 +#define AO_BOOT_APPLICATION_MODE AO_EXTI_MODE_PULL_UP + +#endif /* _AO_PINS_H_ */ -- cgit v1.2.3 From 9c200c3bc742b4dd1a7e28bfce9d5b27e833aae5 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 18 Dec 2013 10:01:29 -0800 Subject: altos: Build pdclib locally if necessary Signed-off-by: Keith Packard --- configure.ac | 36 +++++++++++++++++++++++++++++------- src/Makedefs.in | 4 ++++ src/Makefile | 9 ++++++++- src/lpc/Makefile-lpc.defs | 4 ++-- src/stm/Makefile.defs | 4 ++-- 5 files changed, 45 insertions(+), 12 deletions(-) (limited to 'src/Makefile') diff --git a/configure.ac b/configure.ac index 1d80376c..b6e17355 100644 --- a/configure.ac +++ b/configure.ac @@ -238,6 +238,25 @@ fi AC_SUBST(HAVE_ARM_CC) AC_SUBST(ARM_CC) +if test -d pdclib -a x"$HAVE_ARM_CC" = xyes; then + PDCLIB_INCLUDES='-I$(TOPDIR)/../pdclib/opt/include' + PDCLIB_LIBS_M0='-L$(TOPDIR)/../pdclib/opt/lib -lpdclib-cortex-m0' + PDCLIB_LIBS_M3='-L$(TOPDIR)/../pdclib/opt/lib -lpdclib-cortex-m3' + HAVE_PDCLIB=yes +else + PDCLIB_INCLUDES='' + PDCLIB_LIBS_M0='-lpdclib-cortex-m0' + PDCLIB_LIBS_M3='-lpdclib-cortex-m3' + HAVE_PDCLIB=no +fi + +AM_CONDITIONAL(PDCLIB, [test x$HAVE_PDCLIB = xyes]) + +AC_SUBST(PDCLIB_INCLUDES) +AC_SUBST(PDCLIB_LIBS_M0) +AC_SUBST(PDCLIB_LIBS_M3) +AC_SUBST(HAVE_PDCLIB) + if test "x$HAVE_ARM_CC" = "xyes"; then save_CC="$CC" save_CFLAGS="$CFLAGS" @@ -253,10 +272,6 @@ if test "x$HAVE_ARM_CC" = "xyes"; then [HAVE_ARM_M0_CC=no]) AC_MSG_RESULT([$HAVE_ARM_M0_CC]) - AC_CHECK_LIB(pdclib-cortex-m0,memcpy, - [], - [HAVE_ARM_M0_CC=no]) - CFLAGS="-mthumb -mcpu=cortex-m3" AC_MSG_CHECKING([if ]$ARM_CC[ supports cortex-m3]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int i;])], @@ -264,9 +279,15 @@ if test "x$HAVE_ARM_CC" = "xyes"; then [HAVE_ARM_M3_CC=no]) AC_MSG_RESULT([$HAVE_ARM_M3_CC]) - AC_CHECK_LIB(pdclib-cortex-m3,memcpy, - [], - [HAVE_ARM_M3_CC=no]) + if test x$HAVE_PDCLIB != xyes; then + AC_CHECK_LIB(pdclib-cortex-m0,memcpy, + [], + [HAVE_ARM_M0_CC=no]) + + AC_CHECK_LIB(pdclib-cortex-m3,memcpy, + [], + [HAVE_ARM_M3_CC=no]) + fi AC_LANG_POP([C]) LIBS="$save_LIBS" @@ -459,6 +480,7 @@ echo " AVR compiler................: ${AVR_CC} ${AVR_OBJCOPY}" echo " AVR support.................: ${HAVE_AVR_CC}" echo " Android support.............: ${HAVE_ANDROID_SDK}" echo " STlink support..............: ${HAVE_STLINK}" +echo " Local pdclib................: ${HAVE_PDCLIB}" echo "" echo " Java paths" echo " freetts.....................: ${FREETTS}" diff --git a/src/Makedefs.in b/src/Makedefs.in index 6dc9ab0f..d4ef28be 100644 --- a/src/Makedefs.in +++ b/src/Makedefs.in @@ -1,6 +1,10 @@ ARM_CC=@ARM_CC@ HAVE_ARM_M3_CC=@HAVE_ARM_M3_CC@ HAVE_ARM_M0_CC=@HAVE_ARM_M0_CC@ +PDCLIB_INCLUDES=@PDCLIB_INCLUDES@ +PDCLIB_LIBS_M0=@PDCLIB_LIBS_M0@ +PDCLIB_LIBS_M3=@PDCLIB_LIBS_M3@ +HAVE_PDCLIB=@HAVE_PDCLIB@ SDCC=@SDCC@ HAVE_SDCC=@HAVE_SDCC@ diff --git a/src/Makefile b/src/Makefile index bdd3307a..2ba59d94 100644 --- a/src/Makefile +++ b/src/Makefile @@ -42,6 +42,10 @@ AVRDIRS=\ SUBDIRS= +ifeq ($(strip $(HAVE_PDCLIB)),yes) +PDCLIB=pdclib +endif + ifeq ($(strip $(HAVE_SDCC)),yes) SUBDIRS+=$(SDCCDIRS) endif @@ -92,7 +96,7 @@ uninstall: all-recursive: all-local -all-local: altitude.h altitude-pa.h ao_kalman.h ao_whiten.h +all-local: altitude.h altitude-pa.h ao_kalman.h ao_whiten.h $(PDCLIB) altitude.h: make-altitude nickle $< > $@ @@ -108,3 +112,6 @@ ao_whiten.h: make-whiten clean-local: rm -f altitude.h ao_kalman.h + +pdclib: + cd ../pdclib && make && make prefix=`pwd`/opt install diff --git a/src/lpc/Makefile-lpc.defs b/src/lpc/Makefile-lpc.defs index fbd413b0..3d55cf67 100644 --- a/src/lpc/Makefile-lpc.defs +++ b/src/lpc/Makefile-lpc.defs @@ -26,12 +26,12 @@ endif ELFTOHEX=$(TOPDIR)/../ao-tools/ao-elftohex/ao-elftohex CC=$(ARM_CC) -AO_CFLAGS=-I. -I$(TOPDIR)/lpc -I$(TOPDIR)/core -I$(TOPDIR)/drivers -I$(TOPDIR)/product -I$(TOPDIR) +AO_CFLAGS=-I. -I$(TOPDIR)/lpc -I$(TOPDIR)/core -I$(TOPDIR)/drivers -I$(TOPDIR)/product -I$(TOPDIR) $(PDCLIB_INCLUDES) LPC_CFLAGS=-std=gnu99 -mlittle-endian -mcpu=cortex-m0 -mthumb -ffreestanding -nostdlib $(AO_CFLAGS) NICKLE=nickle -LIBS=-lpdclib-cortex-m0 -lgcc +LIBS=$(PDCLIB_LIBS_M0) -lgcc V=0 # The user has explicitly enabled quiet compilation. diff --git a/src/stm/Makefile.defs b/src/stm/Makefile.defs index b1998f93..9adcfeb3 100644 --- a/src/stm/Makefile.defs +++ b/src/stm/Makefile.defs @@ -22,9 +22,9 @@ endif include $(TOPDIR)/Makedefs CC=$(ARM_CC) -LIBS=-lpdclib-cortex-m3 -lgcc +LIBS=$(PDCLIB_LIBS_M3) -lgcc -AO_CFLAGS=-I. -I../stm -I../core -I../drivers -I../math -I.. +AO_CFLAGS=-I. -I../stm -I../core -I../drivers -I../math -I.. $(PDCLIB_INCLUDES) STM_CFLAGS=-std=gnu99 -mlittle-endian -mcpu=cortex-m3 -mthumb -ffreestanding -nostdlib $(AO_CFLAGS) LDFLAGS=-L../stm -Wl,-Taltos.ld -- cgit v1.2.3 From eb659fb0ee80c25312be36b3d8adb686813db125 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 18 Dec 2013 10:43:16 -0800 Subject: altos: create target pdclib directories before building --- src/Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index 2ba59d94..2488cbab 100644 --- a/src/Makefile +++ b/src/Makefile @@ -44,6 +44,7 @@ SUBDIRS= ifeq ($(strip $(HAVE_PDCLIB)),yes) PDCLIB=pdclib +CLEAN_PDCLIB=clean-pdclib endif ifeq ($(strip $(HAVE_SDCC)),yes) @@ -110,8 +111,11 @@ ao_kalman.h: make-kalman kalman.5c kalman_filter.5c load_csv.5c matrix.5c ao_whiten.h: make-whiten nickle $< > $@ -clean-local: +clean-local: $(CLEAN_PDCLIB) rm -f altitude.h ao_kalman.h pdclib: - cd ../pdclib && make && make prefix=`pwd`/opt install + cd ../pdclib && mkdir -p opt/include opt/lib && make && make prefix=`pwd`/opt install + +clean-pdclib: + cd ../pdclib && make clean && rm -rf opt \ No newline at end of file -- cgit v1.2.3 From 262ee65885d55902df96f4aec6a114f5ac6f2c61 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 18 Dec 2013 10:53:09 -0800 Subject: Remove stale stm test apps from regular build --- src/Makefile | 1 - 1 file changed, 1 deletion(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index 2488cbab..0ca101c0 100644 --- a/src/Makefile +++ b/src/Makefile @@ -30,7 +30,6 @@ ARMM3DIRS=\ telemetrum-v2.0 telemetrum-v2.0/flash-loader \ megadongle-v0.1 megadongle-v0.1/flash-loader \ telegps-v0.3 telegps-v0.3/flash-loader \ - stm-bringup stm-demo \ telelco-v0.2 telelco-v0.2/flash-loader \ telescience-v0.2 telescience-v0.2/flash-loader -- cgit v1.2.3 From eea036650e62bc0f8652155974b512686754fd13 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 18 Dec 2013 14:08:41 -0800 Subject: Move pdclib build results to pdclib-root This makes pdclib easier to manage as a submodule Signed-off-by: Keith Packard --- .gitignore | 1 + configure.ac | 8 +++++--- pdclib | 2 +- src/Makedefs.in | 1 + src/Makefile | 7 +++++-- 5 files changed, 13 insertions(+), 6 deletions(-) (limited to 'src/Makefile') diff --git a/.gitignore b/.gitignore index 54834f66..61f48048 100644 --- a/.gitignore +++ b/.gitignore @@ -64,3 +64,4 @@ doc/telemetrum.fo doc/telemetrum.html doc/telemetrum.pdf altosui/altos-windows.log +pdclib-root diff --git a/configure.ac b/configure.ac index b6e17355..b92e06a9 100644 --- a/configure.ac +++ b/configure.ac @@ -239,9 +239,10 @@ AC_SUBST(HAVE_ARM_CC) AC_SUBST(ARM_CC) if test -d pdclib -a x"$HAVE_ARM_CC" = xyes; then - PDCLIB_INCLUDES='-I$(TOPDIR)/../pdclib/opt/include' - PDCLIB_LIBS_M0='-L$(TOPDIR)/../pdclib/opt/lib -lpdclib-cortex-m0' - PDCLIB_LIBS_M3='-L$(TOPDIR)/../pdclib/opt/lib -lpdclib-cortex-m3' + PDCLIB_ROOT='$(TOPDIR)/../pdclib-root' + PDCLIB_INCLUDES='-I$(TOPDIR)/../pdclib-root/include' + PDCLIB_LIBS_M0='-L$(TOPDIR)/../pdclib-root/lib -lpdclib-cortex-m0' + PDCLIB_LIBS_M3='-L$(TOPDIR)/../pdclib-root/lib -lpdclib-cortex-m3' HAVE_PDCLIB=yes else PDCLIB_INCLUDES='' @@ -255,6 +256,7 @@ AM_CONDITIONAL(PDCLIB, [test x$HAVE_PDCLIB = xyes]) AC_SUBST(PDCLIB_INCLUDES) AC_SUBST(PDCLIB_LIBS_M0) AC_SUBST(PDCLIB_LIBS_M3) +AC_SUBST(PDCLIB_ROOT) AC_SUBST(HAVE_PDCLIB) if test "x$HAVE_ARM_CC" = "xyes"; then diff --git a/pdclib b/pdclib index f3165dbd..8b1c9061 160000 --- a/pdclib +++ b/pdclib @@ -1 +1 @@ -Subproject commit f3165dbd639299d08033ed5eef62a21b69540a8d +Subproject commit 8b1c9061fa3a8f1b30ee13b373afe5cc1ad9d382 diff --git a/src/Makedefs.in b/src/Makedefs.in index d4ef28be..a52f96fa 100644 --- a/src/Makedefs.in +++ b/src/Makedefs.in @@ -4,6 +4,7 @@ HAVE_ARM_M0_CC=@HAVE_ARM_M0_CC@ PDCLIB_INCLUDES=@PDCLIB_INCLUDES@ PDCLIB_LIBS_M0=@PDCLIB_LIBS_M0@ PDCLIB_LIBS_M3=@PDCLIB_LIBS_M3@ +PDCLIB_ROOT=@PDCLIB_ROOT@ HAVE_PDCLIB=@HAVE_PDCLIB@ SDCC=@SDCC@ diff --git a/src/Makefile b/src/Makefile index 0ca101c0..392262d4 100644 --- a/src/Makefile +++ b/src/Makefile @@ -13,6 +13,7 @@ vpath load_csv.5c kalman vpath matrix.5c kalman include Version +TOPDIR=. include Makedefs SDCCDIRS=\ @@ -114,7 +115,9 @@ clean-local: $(CLEAN_PDCLIB) rm -f altitude.h ao_kalman.h pdclib: - cd ../pdclib && mkdir -p opt/include opt/lib && make && make prefix=`pwd`/opt install + mkdir -p $(PDCLIB_ROOT)/include $(PDCLIB_ROOT)/lib + cd ../pdclib && make && make prefix=`pwd`/../pdclib-root install clean-pdclib: - cd ../pdclib && make clean && rm -rf opt \ No newline at end of file + rm -rf $(PDCLIB_ROOT) + cd ../pdclib && make clean -- cgit v1.2.3