altos/cortexelf-v1: Adapt to lisp->scheme name change
authorKeith Packard <keithp@keithp.com>
Tue, 5 Dec 2017 18:48:04 +0000 (10:48 -0800)
committerKeith Packard <keithp@keithp.com>
Tue, 5 Dec 2017 18:50:03 +0000 (10:50 -0800)
Signed-off-by: Keith Packard <keithp@keithp.com>
src/cortexelf-v1/.gitignore [new file with mode: 0644]
src/cortexelf-v1/Makefile
src/cortexelf-v1/ao_cortexelf.c
src/cortexelf-v1/ao_lisp_os.h [deleted file]
src/cortexelf-v1/ao_lisp_os_save.c [deleted file]
src/cortexelf-v1/ao_scheme_os.h [new file with mode: 0644]
src/cortexelf-v1/ao_scheme_os_save.c [new file with mode: 0644]
src/scheme/Makefile-scheme
src/stm/Makefile.defs

diff --git a/src/cortexelf-v1/.gitignore b/src/cortexelf-v1/.gitignore
new file mode 100644 (file)
index 0000000..0189131
--- /dev/null
@@ -0,0 +1,3 @@
+cortexelf-v1*.elf
+cortexelf-v1*.hex
+ao_product.h
index be225e5797510e55f5bf7e14b8d2bb5aa7c5df45..12c658dc22be0ba2980b79a99232ab770e68316a 100644 (file)
@@ -4,7 +4,8 @@
 #
 
 include ../stm/Makefile.defs
-LDFLAGS=-L../stm -Wl,-Tcortexelf.ld
+include ../scheme/Makefile-inc
+
 
 INC = \
        ao.h \
@@ -19,15 +20,12 @@ INC = \
        math.h \
        ao_mpu.h \
        stm32l.h \
-       math.h \
        ao_vga.h \
        ao_draw.h \
        ao_draw_int.h \
        ao_font.h \
        ao_ps2.h \
-       ao_lisp.h \
-       ao_lisp_const.h \
-       ao_lisp_os.h \
+       $(SCHEME_HDRS) \
        ao_flip_bits.h \
        Makefile
 
@@ -46,6 +44,7 @@ ALTOS_SRC = \
        ao_cmd.c \
        ao_config.c \
        ao_task.c \
+       ao_errno.c \
        ao_stdio.c \
        ao_panic.c \
        ao_timer.c \
@@ -74,24 +73,8 @@ ALTOS_SRC = \
        ao_event.c \
        ao_1802.c \
        ao_hex.c \
-       ao_lisp_lex.c \
-       ao_lisp_mem.c \
-       ao_lisp_cons.c \
-       ao_lisp_eval.c \
-       ao_lisp_string.c \
-       ao_lisp_atom.c \
-       ao_lisp_int.c \
-       ao_lisp_poly.c \
-       ao_lisp_bool.c \
-       ao_lisp_builtin.c \
-       ao_lisp_read.c \
-       ao_lisp_rep.c \
-       ao_lisp_frame.c \
-       ao_lisp_error.c \
-       ao_lisp_lambda.c \
-       ao_lisp_save.c \
-       ao_lisp_stack.c \
-       ao_lisp_os_save.c \
+       $(SCHEME_SRCS) \
+       ao_scheme_os_save.c \
        $(PROFILE) \
        $(SAMPLE_PROFILE) \
        $(STACK_GUARD)
@@ -100,12 +83,21 @@ PRODUCT=CortexELF-v1
 PRODUCT_DEF=-DCORTEXELF
 IDPRODUCT=0x000a
 
-CFLAGS = $(PRODUCT_DEF) $(STM_CFLAGS) $(PROFILE_DEF) $(SAMPLE_PROFILE_DEF) $(STACK_GUARD_DEF) -Os -g
-
 PROGNAME=cortexelf-v1
 PROG=$(PROGNAME)-$(VERSION).elf
 HEX=$(PROGNAME)-$(VERSION).ihx
 
+MAP=$(PROG).map
+
+MAPFILE=-Wl,-M=$(MAP)
+
+LDFLAGS=-L../stm -L/local/newlib-mini/arm-none-eabi/lib/thumb/v7-m/ -Wl,-Tcortexelf.ld $(MAPFILE) -nostartfiles
+AO_CFLAGS=-I. -I../stm -I../kernel -I../drivers -I../draw -I../scheme -I.. -I/local/newlib-mini/arm-none-eabi/include
+LIBS=-lc -lm -lgcc
+
+CFLAGS = $(PRODUCT_DEF) $(STM_CFLAGS) $(PROFILE_DEF) $(SAMPLE_PROFILE_DEF) $(STACK_GUARD_DEF) -Os -g
+
+
 SRC=$(ALTOS_SRC) ao_cortexelf.c
 OBJ=$(SRC:.c=.o)
 
@@ -131,7 +123,7 @@ clean::
 ao_flip_bits.h: ao_flip_bits.5c
        nickle ao_flip_bits.5c > $@
 
-include ../lisp/Makefile-lisp
+include ../scheme/Makefile-scheme
 
 install:
 
index 61a9d2199be2fcff5c62b0ccc98f814643797382..5ed78bf09c65865041ef80a530403efd9e331d5e 100644 (file)
@@ -27,7 +27,7 @@
 #include <ao_console.h>
 #include <ao_sdcard.h>
 #include <ao_fat.h>
-#include <ao_lisp.h>
+#include <ao_scheme.h>
 #include <ao_button.h>
 #include <ao_event.h>
 #include <ao_as1107.h>
@@ -188,8 +188,8 @@ ao_console_send(void)
        }
 }
 
-static void lisp_cmd() {
-       ao_lisp_read_eval_print();
+static void scheme_cmd() {
+       ao_scheme_read_eval_print();
 }
 
 static void
@@ -224,7 +224,7 @@ __code struct ao_cmds ao_demo_cmds[] = {
        { ao_ps2_read_keys, "K\0Read keys from keyboard" },
        { ao_console_send, "C\0Send data to console, end with ~" },
        { ao_serial_blather, "S\0Blather on serial ports briefly" },
-       { lisp_cmd, "l\0Run lisp interpreter" },
+       { scheme_cmd, "l\0Run scheme interpreter" },
        { led_cmd, "L start value\0Show value (byte) at digit start" },
        { 0, NULL }
 };
diff --git a/src/cortexelf-v1/ao_lisp_os.h b/src/cortexelf-v1/ao_lisp_os.h
deleted file mode 100644 (file)
index 27ea780..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright © 2016 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_LISP_OS_H_
-#define _AO_LISP_OS_H_
-
-#include "ao.h"
-
-#define AO_LISP_POOL_TOTAL             16384
-#define AO_LISP_SAVE                   1
-
-#ifndef __BYTE_ORDER
-#define        __LITTLE_ENDIAN 1234
-#define        __BIG_ENDIAN    4321
-#define __BYTE_ORDER   __LITTLE_ENDIAN
-#endif
-
-static inline int
-ao_lisp_getc() {
-       static uint8_t  at_eol;
-       int c;
-
-       if (at_eol) {
-               ao_cmd_readline();
-               at_eol = 0;
-       }
-       c = ao_cmd_lex();
-       if (c == '\n')
-               at_eol = 1;
-       return c;
-}
-
-static inline void
-ao_lisp_os_flush(void)
-{
-       flush();
-}
-
-static inline void
-ao_lisp_abort(void)
-{
-       ao_panic(1);
-}
-
-static inline void
-ao_lisp_os_led(int led)
-{
-       (void) led;
-}
-
-#define AO_LISP_JIFFIES_PER_SECOND     AO_HERTZ
-
-static inline void
-ao_lisp_os_delay(int delay)
-{
-       ao_delay(delay);
-}
-
-static inline int
-ao_lisp_os_jiffy(void)
-{
-       return ao_tick_count;
-}
-
-#endif
diff --git a/src/cortexelf-v1/ao_lisp_os_save.c b/src/cortexelf-v1/ao_lisp_os_save.c
deleted file mode 100644 (file)
index 7c85399..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright © 2016 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, either version 2 of the License, or
- * (at your option) any later version.
- *
- * 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.
- */
-
-#include <ao.h>
-#include <ao_lisp.h>
-#include <ao_flash.h>
-
-extern uint8_t __flash__[];
-
-/* saved variables to rebuild the heap
-
-   ao_lisp_atoms
-   ao_lisp_frame_global
- */
-
-int
-ao_lisp_os_save(void)
-{
-       int i;
-
-       for (i = 0; i < AO_LISP_POOL_TOTAL; i += 256) {
-               uint32_t        *dst = (uint32_t *) (void *) &__flash__[i];
-               uint32_t        *src = (uint32_t *) (void *) &ao_lisp_pool[i];
-
-               ao_flash_page(dst, src);
-       }
-       return 1;
-}
-
-int
-ao_lisp_os_restore_save(struct ao_lisp_os_save *save, int offset)
-{
-       memcpy(save, &__flash__[offset], sizeof (struct ao_lisp_os_save));
-       return 1;
-}
-
-int
-ao_lisp_os_restore(void)
-{
-       memcpy(ao_lisp_pool, __flash__, AO_LISP_POOL_TOTAL);
-       return 1;
-}
diff --git a/src/cortexelf-v1/ao_scheme_os.h b/src/cortexelf-v1/ao_scheme_os.h
new file mode 100644 (file)
index 0000000..58e4f5b
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * Copyright © 2016 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_SCHEME_OS_H_
+#define _AO_SCHEME_OS_H_
+
+#include "ao.h"
+
+#define AO_SCHEME_POOL_TOTAL           16384
+#define AO_SCHEME_SAVE                 1
+
+#ifndef __BYTE_ORDER
+#define        __LITTLE_ENDIAN 1234
+#define        __BIG_ENDIAN    4321
+#define __BYTE_ORDER   __LITTLE_ENDIAN
+#endif
+
+static inline int
+ao_scheme_getc() {
+       static uint8_t  at_eol;
+       int c;
+
+       if (at_eol) {
+               ao_cmd_readline();
+               at_eol = 0;
+       }
+       c = ao_cmd_lex();
+       if (c == '\n')
+               at_eol = 1;
+       return c;
+}
+
+static inline void
+ao_scheme_os_flush(void)
+{
+       flush();
+}
+
+static inline void
+ao_scheme_abort(void)
+{
+       ao_panic(1);
+}
+
+static inline void
+ao_scheme_os_led(int led)
+{
+       (void) led;
+}
+
+#define AO_SCHEME_JIFFIES_PER_SECOND   AO_HERTZ
+
+static inline void
+ao_scheme_os_delay(int delay)
+{
+       ao_delay(delay);
+}
+
+static inline int
+ao_scheme_os_jiffy(void)
+{
+       return ao_tick_count;
+}
+
+#endif
diff --git a/src/cortexelf-v1/ao_scheme_os_save.c b/src/cortexelf-v1/ao_scheme_os_save.c
new file mode 100644 (file)
index 0000000..4cec79c
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright © 2016 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, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ */
+
+#include <ao.h>
+#include <ao_scheme.h>
+#include <ao_flash.h>
+
+extern uint8_t __flash__[];
+
+/* saved variables to rebuild the heap
+
+   ao_scheme_atoms
+   ao_scheme_frame_global
+ */
+
+int
+ao_scheme_os_save(void)
+{
+       int i;
+
+       for (i = 0; i < AO_SCHEME_POOL_TOTAL; i += 256) {
+               uint32_t        *dst = (uint32_t *) (void *) &__flash__[i];
+               uint32_t        *src = (uint32_t *) (void *) &ao_scheme_pool[i];
+
+               ao_flash_page(dst, src);
+       }
+       return 1;
+}
+
+int
+ao_scheme_os_restore_save(struct ao_scheme_os_save *save, int offset)
+{
+       memcpy(save, &__flash__[offset], sizeof (struct ao_scheme_os_save));
+       return 1;
+}
+
+int
+ao_scheme_os_restore(void)
+{
+       memcpy(ao_scheme_pool, __flash__, AO_SCHEME_POOL_TOTAL);
+       return 1;
+}
index 2427cffa20410ef0b8ab659140046492e5bdadf7..b9018e19568599b2cdebf4f76d455ea95609f609 100644 (file)
@@ -1,4 +1,4 @@
-include ../lisp/Makefile-inc
+include ../scheme/Makefile-inc
 
-ao_scheme_const.h: $(LISP_SRCS) $(LISP_HDRS)
-       +cd ../lisp && make $@
+ao_scheme_const.h: $(SCHEME_SRCS) $(SCHEME_HDRS)
+       +cd ../scheme && make $@
index 66ed4be8d77974763e35b005adfecf340b8143f3..4d0d27c7af385f037b330b90c22868a1f322b82d 100644 (file)
@@ -1,4 +1,4 @@
-vpath % ../stm:../product:../drivers:../kernel:../util:../kalman:../aes:../math:../draw:../lisp:..
+vpath % ../stm:../product:../drivers:../kernel:../util:../kalman:../aes:../math:../draw:../scheme:..
 vpath make-altitude ../util
 vpath make-kalman ../util
 vpath kalman.5c ../kalman