include ../stmf0/Makefile.defs
+include ../scheme/Makefile-inc
+
+NEWLIB_FULL=-lm -lc -lgcc
+
+LIBS=$(NEWLIB_FULL)
+
INC = \
ao.h \
ao_arch.h \
ao_pins.h \
ao_product.h \
ao_task.h \
- ao_lisp.h \
- ao_lisp_const.h \
- ao_lisp_os.h \
+ $(SCHEME_HDRS) \
stm32f0.h \
Makefile
ao_timer.c \
ao_usb_stm.c \
ao_flash_stm.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_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
PRODUCT=LambdaKey-v1.0
PRODUCT_DEF=-DLAMBDAKEY
LDFLAGS=$(CFLAGS) -L$(TOPDIR)/stmf0 -Wl,-Tlambda.ld
+MAP=$(PROG).map
+NEWLIB=/local/newlib-mini
+MAPFILE=-Wl,-M=$(MAP)
+LDFLAGS=-L../stmf0 -L$(NEWLIB)/arm-none-eabi/lib/thumb/v6-m/ -Wl,-Tlambda.ld $(MAPFILE) -nostartfiles
+AO_CFLAGS=-I. -I../stmf0 -I../kernel -I../drivers -I.. -I../scheme -isystem $(NEWLIB)/arm-none-eabi/include
+
PROGNAME=lambdakey-v1.0
PROG=$(PROGNAME)-$(VERSION).elf
HEX=$(PROGNAME)-$(VERSION).ihx
*/
#include <ao.h>
-#include <ao_lisp.h>
+#include <ao_scheme.h>
-static void lisp_cmd() {
- ao_lisp_read_eval_print();
+static void scheme_cmd() {
+ ao_scheme_read_eval_print();
}
static const struct ao_cmds blink_cmds[] = {
- { lisp_cmd, "l\0Run lisp interpreter" },
+ { scheme_cmd, "l\0Run scheme interpreter" },
{ 0, 0 }
};
+++ /dev/null
-/*
- * 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"
-
-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)
-{
- ao_led_set(led);
-}
-
-static inline void
-ao_lisp_os_delay(int delay)
-{
- ao_delay(AO_MS_TO_TICKS(delay));
-}
-
-#endif
+++ /dev/null
-/*
- * 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 *) &__flash__[i];
- uint32_t *src = (uint32_t *) &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;
-}
--- /dev/null
+/*
+ * 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_SAVE 1
+
+#define AO_SCHEME_POOL_TOTAL 2048
+
+#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)
+{
+ ao_led_set(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
--- /dev/null
+/*
+ * 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) {
+ void *dst = &__flash__[i];
+ void *src = &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;
+}