summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2017-12-10 18:21:01 -0800
committerKeith Packard <keithp@keithp.com>2017-12-11 12:20:25 -0800
commit655576011e9cc648c7c4bbf51179744a427ff237 (patch)
tree8569a5c9ea7aea02ce6f80b571ea3f7afccb2a71
parent7d77071f5b45632937f262600ca95c7b71f4d3da (diff)
altos/lambdakey-v1.0: Switch to newlib, get things compiling again
scheme is now way too large to fit on this device; some subsetting is clearly indicated. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--src/lambdakey-v1.0/Makefile35
-rw-r--r--src/lambdakey-v1.0/ao_lambdakey.c8
-rw-r--r--src/lambdakey-v1.0/ao_scheme_os.h (renamed from src/lambdakey-v1.0/ao_lisp_os.h)33
-rw-r--r--src/lambdakey-v1.0/ao_scheme_os_save.c (renamed from src/lambdakey-v1.0/ao_lisp_os_save.c)22
4 files changed, 55 insertions, 43 deletions
diff --git a/src/lambdakey-v1.0/Makefile b/src/lambdakey-v1.0/Makefile
index 2609bea3..6b819ffb 100644
--- a/src/lambdakey-v1.0/Makefile
+++ b/src/lambdakey-v1.0/Makefile
@@ -5,6 +5,12 @@
include ../stmf0/Makefile.defs
+include ../scheme/Makefile-inc
+
+NEWLIB_FULL=-lm -lc -lgcc
+
+LIBS=$(NEWLIB_FULL)
+
INC = \
ao.h \
ao_arch.h \
@@ -13,9 +19,7 @@ INC = \
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
@@ -35,23 +39,8 @@ ALTOS_SRC = \
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
@@ -61,6 +50,12 @@ CFLAGS = $(PRODUCT_DEF) -I. $(STMF0_CFLAGS) -Os -g
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
diff --git a/src/lambdakey-v1.0/ao_lambdakey.c b/src/lambdakey-v1.0/ao_lambdakey.c
index 8bd344cf..d0996eb4 100644
--- a/src/lambdakey-v1.0/ao_lambdakey.c
+++ b/src/lambdakey-v1.0/ao_lambdakey.c
@@ -13,14 +13,14 @@
*/
#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 }
};
diff --git a/src/lambdakey-v1.0/ao_lisp_os.h b/src/lambdakey-v1.0/ao_scheme_os.h
index 1993ac44..a620684f 100644
--- a/src/lambdakey-v1.0/ao_lisp_os.h
+++ b/src/lambdakey-v1.0/ao_scheme_os.h
@@ -15,13 +15,23 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-#ifndef _AO_LISP_OS_H_
-#define _AO_LISP_OS_H_
+#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_lisp_getc() {
+ao_scheme_getc() {
static uint8_t at_eol;
int c;
@@ -36,27 +46,34 @@ ao_lisp_getc() {
}
static inline void
-ao_lisp_os_flush(void)
+ao_scheme_os_flush(void)
{
flush();
}
static inline void
-ao_lisp_abort(void)
+ao_scheme_abort(void)
{
ao_panic(1);
}
static inline void
-ao_lisp_os_led(int led)
+ao_scheme_os_led(int led)
{
ao_led_set(led);
}
+#define AO_SCHEME_JIFFIES_PER_SECOND AO_HERTZ
+
static inline void
-ao_lisp_os_delay(int delay)
+ao_scheme_os_delay(int delay)
{
- ao_delay(AO_MS_TO_TICKS(delay));
+ ao_delay(delay);
}
+static inline int
+ao_scheme_os_jiffy(void)
+{
+ return ao_tick_count;
+}
#endif
diff --git a/src/lambdakey-v1.0/ao_lisp_os_save.c b/src/lambdakey-v1.0/ao_scheme_os_save.c
index 44138398..184ddb8d 100644
--- a/src/lambdakey-v1.0/ao_lisp_os_save.c
+++ b/src/lambdakey-v1.0/ao_scheme_os_save.c
@@ -13,25 +13,25 @@
*/
#include <ao.h>
-#include <ao_lisp.h>
+#include <ao_scheme.h>
#include <ao_flash.h>
extern uint8_t __flash__[];
/* saved variables to rebuild the heap
- ao_lisp_atoms
- ao_lisp_frame_global
+ ao_scheme_atoms
+ ao_scheme_frame_global
*/
int
-ao_lisp_os_save(void)
+ao_scheme_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];
+ 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);
}
@@ -39,15 +39,15 @@ ao_lisp_os_save(void)
}
int
-ao_lisp_os_restore_save(struct ao_lisp_os_save *save, int offset)
+ao_scheme_os_restore_save(struct ao_scheme_os_save *save, int offset)
{
- memcpy(save, &__flash__[offset], sizeof (struct ao_lisp_os_save));
+ memcpy(save, &__flash__[offset], sizeof (struct ao_scheme_os_save));
return 1;
}
int
-ao_lisp_os_restore(void)
+ao_scheme_os_restore(void)
{
- memcpy(ao_lisp_pool, __flash__, AO_LISP_POOL_TOTAL);
+ memcpy(ao_scheme_pool, __flash__, AO_SCHEME_POOL_TOTAL);
return 1;
}