From 6e699fa4971668bbe569d2a0e2ed9f891877d140 Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Tue, 18 Apr 2017 16:47:43 -0600 Subject: need top level Makefile too --- src/telefiretwo-v1.0/Makefile | 90 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 src/telefiretwo-v1.0/Makefile (limited to 'src/telefiretwo-v1.0/Makefile') diff --git a/src/telefiretwo-v1.0/Makefile b/src/telefiretwo-v1.0/Makefile new file mode 100644 index 00000000..0a2f9b58 --- /dev/null +++ b/src/telefiretwo-v1.0/Makefile @@ -0,0 +1,90 @@ +# +# TeleFire build file +# + +include ../stm/Makefile.defs + +INC = \ + ao.h \ + ao_pins.h \ + ao_arch.h \ + ao_arch_funcs.h \ + ao_pad.h \ + ao_product.h \ + ao_radio_spi.h \ + ao_radio_cmac.h \ + ao_cc1200_CC1200.h \ + ao_cc1200.h \ + stm32l.h +# +# Common AltOS sources +# + +#PROFILE=ao_profile.c +#PROFILE_DEF=-DAO_PROFILE=1 + +ALTOS_SRC = \ + ao_boot_chain.c \ + ao_interrupt.c \ + ao_product.c \ + ao_romconfig.c \ + ao_cmd.c \ + ao_adc_stm.c \ + ao_data.c \ + ao_config.c \ + ao_task.c \ + ao_led.c \ + ao_stdio.c \ + ao_panic.c \ + ao_timer.c \ + ao_mutex.c \ + ao_freq.c \ + ao_dma_stm.c \ + ao_spi_stm.c \ + ao_beep_stm.c \ + ao_eeprom_stm.c \ + ao_usb_stm.c \ + ao_exti_stm.c \ + ao_cc1200.c \ + ao_radio_cmac.c \ + ao_aes.c \ + ao_aes_tables.c \ + ao_pad.c \ + ao_radio_cmac_cmd.c + +PRODUCT_SRC = \ + ao_telefiretwo.c + +PRODUCT=TeleFire-v1.0 +PRODUCT_DEF=-DTELEFIRETWO_V_1_0 +IDPRODUCT=0x000f + +CFLAGS = $(PRODUCT_DEF) $(STM_CFLAGS) $(PROFILE_DEF) -Os -g + +PROGNAME = telefiretwo-v1.0 +PROG = $(PROGNAME)-$(VERSION).elf +HEX = $(PROGNAME)-$(VERSION).ihx + +SRC = $(ALTOS_SRC) $(PRODUCT_SRC) +OBJ=$(SRC:.c=.o) + +all: $(PROG) $(HEX) + +$(PROG): Makefile $(OBJ) altos.ld + $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) $(LIBS) + +$(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 $(PROGNAME)-*.ihx + rm -f ao_product.h + +install: + +uninstall: + -- cgit v1.2.3 From ffc90fa3f932aef4dd85147817949aa9474b6d26 Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Sat, 22 Apr 2017 11:38:08 -0600 Subject: fix TeleFireTwo product name in ao-list output --- src/telefiretwo-v1.0/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/telefiretwo-v1.0/Makefile') diff --git a/src/telefiretwo-v1.0/Makefile b/src/telefiretwo-v1.0/Makefile index 0a2f9b58..927b3a80 100644 --- a/src/telefiretwo-v1.0/Makefile +++ b/src/telefiretwo-v1.0/Makefile @@ -55,7 +55,7 @@ ALTOS_SRC = \ PRODUCT_SRC = \ ao_telefiretwo.c -PRODUCT=TeleFire-v1.0 +PRODUCT=TeleFireTwo-v1.0 PRODUCT_DEF=-DTELEFIRETWO_V_1_0 IDPRODUCT=0x000f -- cgit v1.2.3 From 439a51ed503b74c1739cf150cdc91685653deed0 Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Sat, 22 Apr 2017 15:45:52 -0600 Subject: enable spi flash on telefiretwo --- src/telefiretwo-v1.0/Makefile | 2 ++ src/telefiretwo-v1.0/ao_pins.h | 9 +++++++++ src/telefiretwo-v1.0/ao_telefiretwo.c | 2 ++ 3 files changed, 13 insertions(+) (limited to 'src/telefiretwo-v1.0/Makefile') diff --git a/src/telefiretwo-v1.0/Makefile b/src/telefiretwo-v1.0/Makefile index 927b3a80..f4629599 100644 --- a/src/telefiretwo-v1.0/Makefile +++ b/src/telefiretwo-v1.0/Makefile @@ -43,6 +43,8 @@ ALTOS_SRC = \ ao_spi_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_cc1200.c \ diff --git a/src/telefiretwo-v1.0/ao_pins.h b/src/telefiretwo-v1.0/ao_pins.h index 8cde0043..aa8501c0 100644 --- a/src/telefiretwo-v1.0/ao_pins.h +++ b/src/telefiretwo-v1.0/ao_pins.h @@ -99,6 +99,15 @@ #define FAST_TIMER_FREQ 10000 /* .1ms for debouncing */ +/* + * SPI Flash memory + */ + +#define M25_MAX_CHIPS 1 +#define AO_M25_SPI_CS_PORT (&stm_gpioa) +#define AO_M25_SPI_CS_MASK (1 << 15) +#define AO_M25_SPI_BUS AO_SPI_2_PB13_PB14_PB15 + /* * Radio is a cc1200 connected via SPI */ diff --git a/src/telefiretwo-v1.0/ao_telefiretwo.c b/src/telefiretwo-v1.0/ao_telefiretwo.c index bdcf3213..fa7b7679 100644 --- a/src/telefiretwo-v1.0/ao_telefiretwo.c +++ b/src/telefiretwo-v1.0/ao_telefiretwo.c @@ -20,6 +20,7 @@ #include #include #include +#include void main(void) @@ -40,6 +41,7 @@ main(void) ao_adc_init(); ao_eeprom_init(); + ao_storage_init(); ao_radio_init(); -- cgit v1.2.3 From db12c17e9538bd82f2c2bf21357887ee7d894a1c Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Sat, 22 Apr 2017 16:59:03 -0600 Subject: a stab at turning on rudimentary logging for telefiretwo --- src/kernel/ao_log_firetwo.c | 28 +++++++++++----------------- src/telefiretwo-v1.0/Makefile | 5 ++++- src/telefiretwo-v1.0/ao_pins.h | 2 ++ 3 files changed, 17 insertions(+), 18 deletions(-) (limited to 'src/telefiretwo-v1.0/Makefile') diff --git a/src/kernel/ao_log_firetwo.c b/src/kernel/ao_log_firetwo.c index 71e84dfe..46559206 100644 --- a/src/kernel/ao_log_firetwo.c +++ b/src/kernel/ao_log_firetwo.c @@ -75,7 +75,9 @@ typedef uint8_t check_log_size[1-(256 % sizeof(struct ao_log_firetwo))] ; void ao_log(void) { - __pdata uint16_t next_sensor, next_other; + uint16_t ao_idle_pressure = 0; // write code to capture pre-test values someday + uint16_t ao_idle_thrust = 0; + uint16_t ao_flight_state = ao_flight_startup; ao_storage_setup(); @@ -84,37 +86,31 @@ ao_log(void) while (!ao_log_running) ao_sleep(&ao_log_running); -#if HAS_FLIGHT log.type = AO_LOG_FLIGHT; - log.tick = ao_sample_tick; + log.tick = ao_time(); log.u.flight.idle_pressure = ao_idle_pressure; log.u.flight.idle_thrust = ao_idle_thrust; log.u.flight.flight = ao_flight_number; ao_log_firetwo(&log); -#endif /* Write the whole contents of the ring to the log * when starting up. */ ao_log_data_pos = ao_data_ring_next(ao_data_head); - next_other = next_sensor = ao_data_ring[ao_log_data_pos].tick; ao_log_state = ao_flight_startup; for (;;) { /* Write samples to EEPROM */ while (ao_log_data_pos != ao_data_head) { log.tick = ao_data_ring[ao_log_data_pos].tick; - if ((int16_t) (log.tick - next_sensor) >= 0) { - log.type = AO_LOG_SENSOR; - log.u.sensor.pressure = ao_data_ring[ao_log_data_pos].sensor.pressure; - log.u.sensor.thrust = ao_data_ring[ao_log_data_pos].sensor.thrust; - for (i = 0; i < 4; i++) { - log.u.sensor.thermistor[i] = ao_data_ring[ao_log_data_pos].sensor.thermistor[i]; - } - ao_log_firetwo(&log); - } + log.type = AO_LOG_SENSOR; + log.u.sensor.pressure = ao_data_ring[ao_log_data_pos].adc.pressure; + log.u.sensor.thrust = ao_data_ring[ao_log_data_pos].adc.thrust; +// for (i = 0; i < 4; i++) { +// log.u.sensor.thermistor[i] = ao_data_ring[ao_log_data_pos].sensor.thermistor[i]; +// } + ao_log_firetwo(&log); ao_log_data_pos = ao_data_ring_next(ao_log_data_pos); } -#if HAS_FLIGHT /* Write state change to EEPROM */ if (ao_flight_state != ao_log_state) { ao_log_state = ao_flight_state; @@ -127,7 +123,6 @@ ao_log(void) if (ao_log_state == ao_flight_landed) ao_log_stop(); } -#endif ao_log_flush(); @@ -139,7 +134,6 @@ ao_log(void) ao_sleep(&ao_log_running); } } -#endif uint16_t ao_log_flight(uint8_t slot) diff --git a/src/telefiretwo-v1.0/Makefile b/src/telefiretwo-v1.0/Makefile index f4629599..87d5d477 100644 --- a/src/telefiretwo-v1.0/Makefile +++ b/src/telefiretwo-v1.0/Makefile @@ -7,6 +7,7 @@ include ../stm/Makefile.defs INC = \ ao.h \ ao_pins.h \ + ao_log.h \ ao_arch.h \ ao_arch_funcs.h \ ao_pad.h \ @@ -52,7 +53,9 @@ ALTOS_SRC = \ ao_aes.c \ ao_aes_tables.c \ ao_pad.c \ - ao_radio_cmac_cmd.c + ao_radio_cmac_cmd.c \ + ao_log.c \ + ao_log_firetwo.c PRODUCT_SRC = \ ao_telefiretwo.c diff --git a/src/telefiretwo-v1.0/ao_pins.h b/src/telefiretwo-v1.0/ao_pins.h index aa8501c0..95189cdc 100644 --- a/src/telefiretwo-v1.0/ao_pins.h +++ b/src/telefiretwo-v1.0/ao_pins.h @@ -41,6 +41,8 @@ #define AO_DATA_RING 32 #define HAS_FIXED_PAD_BOX 1 +#define LOG_ERASE_MARK 0x55 + /* 8MHz High speed external crystal */ #define AO_HSE 8000000 -- cgit v1.2.3