diff options
Diffstat (limited to 'src/lambdakey-v1.0')
-rw-r--r-- | src/lambdakey-v1.0/Makefile | 17 | ||||
-rw-r--r-- | src/lambdakey-v1.0/ao_lambdakey.c | 15 | ||||
-rw-r--r-- | src/lambdakey-v1.0/ao_pins.h | 8 | ||||
-rw-r--r-- | src/lambdakey-v1.0/ao_scheme_os.h | 20 | ||||
-rw-r--r-- | src/lambdakey-v1.0/lambda.ld | 114 |
5 files changed, 23 insertions, 151 deletions
diff --git a/src/lambdakey-v1.0/Makefile b/src/lambdakey-v1.0/Makefile index 33c68cf5..b94c3873 100644 --- a/src/lambdakey-v1.0/Makefile +++ b/src/lambdakey-v1.0/Makefile @@ -9,10 +9,6 @@ aoschemelib=$(shell pkg-config --variable=aoschemelib ao-scheme) include $(aoschemelib)/Makefile-scheme -NEWLIB_FULL=-lm -lc -lgcc - -LIBS=$(NEWLIB_FULL) - INC = \ ao.h \ ao_arch.h \ @@ -34,7 +30,6 @@ ALTOS_SRC = \ ao_led.c \ ao_notask.c \ ao_stdio.c \ - ao_stdio_newlib.c \ ao_panic.c \ ao_timer.c \ ao_usb_stm.c \ @@ -45,15 +40,7 @@ PRODUCT=LambdaKey-v1.0 PRODUCT_DEF=-DLAMBDAKEY IDPRODUCT=0x000a -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,-Map=$(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$(aoschemelib) -isystem $(NEWLIB)/arm-none-eabi/include -DNEWLIB +CFLAGS = $(PRODUCT_DEF) -I. -I$(aoschemelib) $(STMF0_CFLAGS) -Os -g PROGNAME=lambdakey-v1.0 PROG=$(PROGNAME)-$(VERSION).elf @@ -67,7 +54,7 @@ bletch: all: $(PROG) $(HEX) -$(PROG): Makefile $(OBJ) lambda.ld +$(PROG): Makefile $(OBJ) $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) $(LIBS) $(OBJ): $(INC) diff --git a/src/lambdakey-v1.0/ao_lambdakey.c b/src/lambdakey-v1.0/ao_lambdakey.c index f1a2aa38..a608d8e4 100644 --- a/src/lambdakey-v1.0/ao_lambdakey.c +++ b/src/lambdakey-v1.0/ao_lambdakey.c @@ -24,6 +24,21 @@ static const struct ao_cmds blink_cmds[] = { { 0, 0 } }; +int +_ao_scheme_getc(void) +{ + static uint8_t at_eol; + int c; + + if (at_eol) { + ao_cmd_readline(ao_scheme_read_list ? "Λ " : "λ "); + at_eol = 0; + } + c = (unsigned char) ao_cmd_lex(); + if (c == '\n') + at_eol = 1; + return c; +} void main(void) { diff --git a/src/lambdakey-v1.0/ao_pins.h b/src/lambdakey-v1.0/ao_pins.h index 58a75080..92ed24ee 100644 --- a/src/lambdakey-v1.0/ao_pins.h +++ b/src/lambdakey-v1.0/ao_pins.h @@ -19,14 +19,6 @@ #ifndef _AO_PINS_H_ #define _AO_PINS_H_ -#define fprintf(file, ...) ({ (void) (file); printf(__VA_ARGS__); }) -#undef putc -#define putc(c,file) ({ (void) (file); putchar(c); }) -#define fputs(s,file) ({ (void) (file); ao_put_string(s); }) -#undef getc -#define getc(file) ({ (void) (file); getchar(); }) -#define fflush(file) ({ (void) (file); flush(); }) - #define HAS_TASK 0 #define HAS_AO_DELAY 1 diff --git a/src/lambdakey-v1.0/ao_scheme_os.h b/src/lambdakey-v1.0/ao_scheme_os.h index 8af199c2..41357552 100644 --- a/src/lambdakey-v1.0/ao_scheme_os.h +++ b/src/lambdakey-v1.0/ao_scheme_os.h @@ -19,6 +19,7 @@ #define _AO_SCHEME_OS_H_ #include "ao.h" +#include "ao_scheme.h" #define AO_SCHEME_POOL 3792 #define AO_SCHEME_TOKEN_MAX 64 @@ -29,22 +30,13 @@ #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; -} +extern int _ao_scheme_getc(void); #define ao_scheme_getc(f) ({ (void) (f); _ao_scheme_getc(); }) +#undef putc +#define putc(c, f) ({ (void) (f); ao_putchar(c); }) +#define fputs(s, f) ({ (void) (f); ao_put_string(s); }) +#define fiprintf(f, ...) ({ (void) (f); iprintf(__VA_ARGS__); }) static inline void ao_scheme_abort(void) diff --git a/src/lambdakey-v1.0/lambda.ld b/src/lambdakey-v1.0/lambda.ld deleted file mode 100644 index b09fdb4a..00000000 --- a/src/lambdakey-v1.0/lambda.ld +++ /dev/null @@ -1,114 +0,0 @@ -/* - * 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; 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. - * - * 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. - */ - -MEMORY { - rom (rx) : ORIGIN = 0x08001000, LENGTH = 28K - ram (!w) : ORIGIN = 0x20000000, LENGTH = 6k - 1k - stack (!w) : ORIGIN = 0x20000000 + 6k - 1k, LENGTH = 1k -} - -INCLUDE registers.ld - -EXTERN (stm_interrupt_vector) - -SECTIONS { - /* - * Rom contents - */ - - .interrupt ORIGIN(ram) : AT (ORIGIN(rom)) { - __interrupt_start__ = .; - __interrupt_rom__ = ORIGIN(rom); - *(.interrupt) /* Interrupt vectors */ - __interrupt_end__ = .; - } > ram - - .text ORIGIN(rom) + 0x100 : { - __text_start__ = .; - - /* Ick. What I want is to specify the - * addresses of some global constants so - * that I can find them across versions - * of the application. I can't figure out - * how to make gnu ld do that, so instead - * we just load the two files that include - * these defines in the right order here and - * expect things to 'just work'. Don't change - * the contents of those files, ok? - */ - ao_romconfig.o(.romconfig*) - ao_product.o(.romconfig*) - - *(.text*) /* Executable code */ - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - *(.rodata*) /* Constants */ - - } > rom - __text_end__ = .; - - - /* Boot data which must live at the start of ram so that - * the application and bootloader share the same addresses. - * This must be all uninitialized data - */ - .boot (NOLOAD) : { - __boot_start__ = .; - *(.boot) - . = ALIGN(4); - __boot_end__ = .; - } >ram - - /* Functions placed in RAM (required for flashing) - * - * Align to 8 bytes as that's what the ARM likes text - * segment alignments to be, and if we don't, then - * we end up with a mismatch between the location in - * ROM and the desired location in RAM. I don't - * entirely understand this, but at least this appears - * to work... - */ - - .textram BLOCK(8): { - __data_start__ = .; - __text_ram_start__ = .; - *(.ramtext) - __text_ram_end = .; - } >ram AT>rom - - /* Data -- relocated to RAM, but written to ROM - */ - .data BLOCK(8): { - *(.data) /* initialized data */ - . = ALIGN(8); - __data_end__ = .; - } >ram AT>rom - - .bss : { - __bss_start__ = .; - *(.bss) - *(COMMON) - . = ALIGN(4); - __bss_end__ = .; - } >ram - - PROVIDE(end = .); - - PROVIDE(__stack__ = ORIGIN(stack) + LENGTH(stack)); -} - -ENTRY(start); |