summaryrefslogtreecommitdiff
path: root/src/stm-demo
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2012-03-17 00:06:59 -0700
committerKeith Packard <keithp@keithp.com>2012-03-28 21:37:02 -0700
commit8ba5344514f8ed51f6fd69ca09f6c7035c4fd0da (patch)
tree0389904daef28481f4e39830f5739b13ae097f32 /src/stm-demo
parent1d1b24bb20dec09145fbaa6fe6897898d47dd16e (diff)
Add stm-demo program
This runs AltOS and talks over the serial port. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/stm-demo')
-rw-r--r--src/stm-demo/.gitignore2
-rw-r--r--src/stm-demo/Makefile95
-rw-r--r--src/stm-demo/ao_demo.c49
-rw-r--r--src/stm-demo/ao_pins.h27
4 files changed, 173 insertions, 0 deletions
diff --git a/src/stm-demo/.gitignore b/src/stm-demo/.gitignore
new file mode 100644
index 00000000..32b08ce8
--- /dev/null
+++ b/src/stm-demo/.gitignore
@@ -0,0 +1,2 @@
+stm-demo
+ao_product.h
diff --git a/src/stm-demo/Makefile b/src/stm-demo/Makefile
new file mode 100644
index 00000000..e009c30c
--- /dev/null
+++ b/src/stm-demo/Makefile
@@ -0,0 +1,95 @@
+#
+# AltOS build
+#
+#
+vpath % ..:../core:../product:../drivers:../stm
+vpath make-altitude ..
+vpath make-kalman ..
+vpath kalman.5c ../kalman
+vpath kalman_filter.5c ../kalman
+vpath load_csv.5c ../kalman
+vpath matrix.5c ../kalman
+vpath ao-make-product.5c ../util
+
+#PROGRAMMER=stk500v2 -P usb
+#PROGRAMMER=usbtiny
+#LOADCMD=avrdude
+#LOADARG=-p $(DUDECPUTYPE) -c $(PROGRAMMER) -e -U flash:w:
+CC=arm-none-eabi-gcc
+#OBJCOPY=avr-objcopy
+
+ifndef VERSION
+include ../Version
+endif
+
+INC = \
+ ao.h \
+ ao_pins.h \
+ altitude.h \
+ ao_kalman.h
+
+#
+# Common AltOS sources
+#
+ALTOS_SRC = \
+ ao_interrupt.c \
+ ao_product.c \
+ ao_romconfig.c \
+ ao_cmd.c \
+ ao_task.c \
+ ao_stdio.c \
+ ao_panic.c \
+ ao_timer.c \
+ ao_serial_stm.c
+
+PRODUCT=StmDemo-v0.0
+PRODUCT_DEF=-DSTM_DEMO
+IDPRODUCT=0x000a
+CPU=cortex-m3
+CFLAGS = $(PRODUCT_DEF) -I. -I../stm -I../core -I..
+CFLAGS += -g -std=gnu99 -Os -mlittle-endian -mcpu=cortex-m3 -mthumb -ffreestanding -nostdlib -I../stm $(CINC)
+
+NICKLE=nickle
+
+PROG=stm-demo
+
+SRC=$(ALTOS_SRC) ao_demo.c
+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)
+
+CLIB=/home/keithp/sat/lib/pdclib.a
+CINC=-I/home/keithp/sat/include
+LDFLAGS=-L../stm -Wl,-Taltos.ld
+
+$(PROG): Makefile $(OBJ)
+ $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) $(CLIB) -lgcc
+
+../altitude.h: make-altitude
+ nickle $< > $@
+
+ao_product.h: ao-make-product.5c ../Version
+ $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@
+
+ao_product.rel: ao_product.c ao_product.h
+ $(call quiet,CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"ao_product.h\"' -o$@ $<
+
+distclean: clean
+
+clean:
+ rm -f $(OBJ)
+ rm -f ao_product.h
+
+install:
+
+uninstall:
+
+$(OBJ): ao.h ao_product.h \ No newline at end of file
diff --git a/src/stm-demo/ao_demo.c b/src/stm-demo/ao_demo.c
new file mode 100644
index 00000000..90216535
--- /dev/null
+++ b/src/stm-demo/ao_demo.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright © 2011 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#include "ao.h"
+
+struct ao_task demo_task;
+
+void
+ao_demo(void)
+{
+ int i = 0;
+ for (;;) {
+ printf ("hello %d\n", i++);
+ }
+}
+
+void _close() { }
+void _sbrk() { }
+void _isatty() { }
+void _lseek() { }
+void _exit () { }
+void _read () { }
+void _fstat() { }
+int
+main(void)
+{
+ ao_clock_init();
+
+ ao_serial_init();
+ ao_timer_init();
+ ao_cmd_init();
+
+ ao_demo();
+ return 0;
+}
diff --git a/src/stm-demo/ao_pins.h b/src/stm-demo/ao_pins.h
new file mode 100644
index 00000000..82d70bb6
--- /dev/null
+++ b/src/stm-demo/ao_pins.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright © 2012 Keith Packard <keithp@keithp.com>
+ *
+ * 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_SERIAL_1 1
+#define USE_SERIAL_STDIN 1
+#define HAS_USB 0
+#define HAS_BEEP 0
+#define PACKET_HAS_SLAVE 0
+
+#endif /* _AO_PINS_H_ */