diff options
Diffstat (limited to 'apps/plugins')
| -rw-r--r-- | apps/plugins/SOURCES | 5 | ||||
| -rw-r--r-- | apps/plugins/SUBDIRS | 3 | ||||
| -rw-r--r-- | apps/plugins/goban/archos.lds | 43 | ||||
| -rw-r--r-- | apps/plugins/goban/goban.c | 56 | ||||
| -rw-r--r-- | apps/plugins/goban/goban.make | 40 | ||||
| -rw-r--r-- | apps/plugins/goban/sgf_storage.c | 13 |
6 files changed, 126 insertions, 34 deletions
diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES index 6257a22..7854ef3 100644 --- a/apps/plugins/SOURCES +++ b/apps/plugins/SOURCES @@ -107,6 +107,11 @@ rockboy.c zxbox.c #endif +/* overlay loader for Goban */ +#if (PLUGIN_BUFFER_SIZE < 0x10000) && !defined(SIMULATOR) +goban.c +#endif + /* not support recorder models for now */ #if (LCD_WIDTH > 112) && (LCD_HEIGHT > 64) fireworks.c diff --git a/apps/plugins/SUBDIRS b/apps/plugins/SUBDIRS index f07bf86..af5e1d0 100644 --- a/apps/plugins/SUBDIRS +++ b/apps/plugins/SUBDIRS @@ -20,10 +20,7 @@ chessbox jpeg sudoku reversi -/* Plugin is about 40k, rounding up to 65k to be safe. */ -#if (defined(PLUGIN_BUFFER_SIZE) && PLUGIN_BUFFER_SIZE >= 0x10000) goban -#endif #ifndef OLYMPUS_MROBE_500 zxbox #endif diff --git a/apps/plugins/goban/archos.lds b/apps/plugins/goban/archos.lds new file mode 100644 index 0000000..c17346f --- /dev/null +++ b/apps/plugins/goban/archos.lds @@ -0,0 +1,43 @@ +#include "config.h" + +/* linker script for goban as an overlay */ + +OUTPUT_FORMAT(elf32-sh) + +#define DRAMORIG 0x09000000 +#define PLUGIN_LENGTH PLUGIN_BUFFER_SIZE + +#define OVERLAY_LENGTH 0x10000 +#define OVERLAY_ORIGIN (DRAMORIG + (MEMORYSIZE * 0x100000) - PLUGIN_LENGTH - OVERLAY_LENGTH) + +MEMORY +{ + OVERLAY_RAM : ORIGIN = OVERLAY_ORIGIN, LENGTH = OVERLAY_LENGTH +} + +SECTIONS +{ + .header : { + _plugin_start_addr = .; + KEEP(*(.header)) + } > OVERLAY_RAM + + .text : { + *(.text*) + } > OVERLAY_RAM + + .rodata : { + *(.rodata*) + } > OVERLAY_RAM + + .data : { + *(.data*) + } > OVERLAY_RAM + + .bss : { + *(.bss*) + *(COMMON) + . = ALIGN(0x4); + _plugin_end_addr = .; + } > OVERLAY_RAM +} diff --git a/apps/plugins/goban/goban.c b/apps/plugins/goban/goban.c index 04b74b7..20cccd7 100644 --- a/apps/plugins/goban/goban.c +++ b/apps/plugins/goban/goban.c @@ -1,25 +1,37 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2007-2009 Joshua Simmons <mud at majidejima dot 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 software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ - -#include "plugin.h" +/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2007-2009 Joshua Simmons <mud at majidejima dot 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 software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#include "plugin.h"
+
+#if PLUGIN_BUFFER_SIZE < 0x10000 && !defined(SIMULATOR)
+
+#include "lib/overlay.h"
+
+PLUGIN_HEADER
+
+enum plugin_status plugin_start(const void* parameter)
+{
+ return run_overlay(parameter, PLUGIN_GAMES_DIR "/goban.ovl", "Goban");
+}
+#endif +
#include "lib/playback_control.h" #include "lib/configfile.h" diff --git a/apps/plugins/goban/goban.make b/apps/plugins/goban/goban.make index f3f96ff..b8866fb 100644 --- a/apps/plugins/goban/goban.make +++ b/apps/plugins/goban/goban.make @@ -8,15 +8,41 @@ # -GOBANSRCDIR := $(APPSDIR)/plugins/goban -GOBANBUILDDIR := $(BUILDDIR)/apps/plugins/goban +GOBAN_SRCDIR := $(APPSDIR)/plugins/goban +GOBAN_BUILDDIR := $(BUILDDIR)/apps/plugins/goban -ROCKS += $(GOBANBUILDDIR)/goban.rock - - -GOBAN_SRC := $(call preprocess, $(GOBANSRCDIR)/SOURCES) +GOBAN_SRC := $(call preprocess, $(GOBAN_SRCDIR)/SOURCES) GOBAN_OBJ := $(call c2obj, $(GOBAN_SRC)) OTHER_SRC += $(GOBAN_SRC) -$(GOBANBUILDDIR)/goban.rock: $(GOBAN_OBJ) +ifndef SIMVER +ifneq (,$(strip $(foreach tgt,RECORDER ONDIO,$(findstring $(tgt),$(TARGET))))) + ### archos recorder targets + GOBAN_INLDS := $(GOBAN_SRCDIR)/archos.lds + ROCKS += $(GOBAN_BUILDDIR)/goban.ovl +else + ### all other targets + GOBAN_INLDS := $(APPSDIR)/plugins/plugin.lds + ROCKS += $(GOBAN_BUILDDIR)/goban.rock +endif + GOBAN_OVLFLAGS = -T$(GOBAN_OUTLDS) -Wl,--gc-sections -Wl,-Map,$(basename $@).map + GOBAN_OUTLDS = $(GOBAN_BUILDDIR)/goban.lds +else + ### simulator + ROCKS += $(GOBAN_BUILDDIR)/goban.rock + GOBAN_OVLFLAGS = $(SHARED_FLAG) # <-- from Makefile +endif + +$(GOBAN_OUTLDS): $(GOBAN_INLDS) $(GOBAN_OBJ) + $(call PRINTS,PP $(<F))$(call preprocess2file,$<,$@) + +$(GOBAN_BUILDDIR)/goban.rock: $(GOBAN_OBJ) $(GOBAN_OUTLDS) + +$(GOBAN_BUILDDIR)/goban.ovl: $(GOBAN_OBJ) $(GOBAN_OUTLDS) + $(SILENT)$(CC) $(PLUGINFLAGS) -o $(basename $@).elf \ + $(filter %.o, $^) \ + $(filter %.a, $^) \ + -lgcc $(GOBAN_OVLFLAGS) + $(call PRINTS,LD $(@F))$(OC) -O binary $(basename $@).elf $@ + diff --git a/apps/plugins/goban/sgf_storage.c b/apps/plugins/goban/sgf_storage.c index 8afc3ea..7ee0848 100644 --- a/apps/plugins/goban/sgf_storage.c +++ b/apps/plugins/goban/sgf_storage.c @@ -326,7 +326,7 @@ setup_sgf (void) if (total_storage_size < MIN_STORAGE_BUFFER_SIZE) { - rb->splash (2 * HZ, "Stopping music playback to get more space"); + rb->splash (1 * HZ, "Stopping music playback to get more space"); DEBUGF ("storage_buffer_size < MIN!!: %d\n", (int) total_storage_size); temp_buffer = rb->plugin_get_audio_buffer (&size); @@ -335,7 +335,7 @@ setup_sgf (void) if (total_storage_size < MIN_STORAGE_BUFFER_SIZE) { - rb->splash (5 * HZ, "Low memory. Large files may not load."); + rb->splash (1 * HZ, "Low memory. Large files may not load."); DEBUGF ("storage_buffer_size < MIN!!!!: %d\n", (int) total_storage_size); @@ -387,6 +387,15 @@ setup_storage_buffer (char *temp_buffer, size_t size) unsigned int index = 0; int temp; +#if PLUGIN_BUFFER_SIZE < 0x10000 && !defined(SIMULATOR) + /* loaded as an overlay plugin, protect from overwriting ourselves */ + if (plugin_start_addr >= (unsigned char *) temp_buffer && + plugin_start_addr < (unsigned char *) temp_buffer + size) + { + size = plugin_start_addr - (unsigned char *) temp_buffer; + } +#endif + while (1) { if (index >= sizeof (storage_initialized) / |