summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMustapha Senhaji <moos@rockbox.org>2009-02-20 23:14:09 +0000
committerMustapha Senhaji <moos@rockbox.org>2009-02-20 23:14:09 +0000
commit37183be69ce68e3f9ecaf12ce668d7e21229d8f0 (patch)
tree8eb0cbff672d83e0089081ad83f283aa094bf298
parent00215348d0ee3c894707dab3c9f7288a0d93cd74 (diff)
downloadrockbox-37183be69ce68e3f9ecaf12ce668d7e21229d8f0.tar.gz
rockbox-37183be69ce68e3f9ecaf12ce668d7e21229d8f0.zip
FS#9901 by Joshua Simmons for the Goban plugin: Goban overlay for the Archos targets.
This is a first try to enable this plugin for low memory targets like our old archoses :) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20069 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugins/SOURCES5
-rw-r--r--apps/plugins/SUBDIRS3
-rw-r--r--apps/plugins/goban/archos.lds43
-rw-r--r--apps/plugins/goban/goban.c56
-rw-r--r--apps/plugins/goban/goban.make40
-rw-r--r--apps/plugins/goban/sgf_storage.c13
-rw-r--r--manual/plugins/main.tex2
7 files changed, 126 insertions, 36 deletions
diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES
index 6257a222bd..7854ef3e1d 100644
--- a/apps/plugins/SOURCES
+++ b/apps/plugins/SOURCES
@@ -107,6 +107,11 @@ rockboy.c
107zxbox.c 107zxbox.c
108#endif 108#endif
109 109
110/* overlay loader for Goban */
111#if (PLUGIN_BUFFER_SIZE < 0x10000) && !defined(SIMULATOR)
112goban.c
113#endif
114
110/* not support recorder models for now */ 115/* not support recorder models for now */
111#if (LCD_WIDTH > 112) && (LCD_HEIGHT > 64) 116#if (LCD_WIDTH > 112) && (LCD_HEIGHT > 64)
112fireworks.c 117fireworks.c
diff --git a/apps/plugins/SUBDIRS b/apps/plugins/SUBDIRS
index f07bf861b4..af5e1d0c0e 100644
--- a/apps/plugins/SUBDIRS
+++ b/apps/plugins/SUBDIRS
@@ -20,10 +20,7 @@ chessbox
20jpeg 20jpeg
21sudoku 21sudoku
22reversi 22reversi
23/* Plugin is about 40k, rounding up to 65k to be safe. */
24#if (defined(PLUGIN_BUFFER_SIZE) && PLUGIN_BUFFER_SIZE >= 0x10000)
25goban 23goban
26#endif
27#ifndef OLYMPUS_MROBE_500 24#ifndef OLYMPUS_MROBE_500
28zxbox 25zxbox
29#endif 26#endif
diff --git a/apps/plugins/goban/archos.lds b/apps/plugins/goban/archos.lds
new file mode 100644
index 0000000000..c17346ff0b
--- /dev/null
+++ b/apps/plugins/goban/archos.lds
@@ -0,0 +1,43 @@
1#include "config.h"
2
3/* linker script for goban as an overlay */
4
5OUTPUT_FORMAT(elf32-sh)
6
7#define DRAMORIG 0x09000000
8#define PLUGIN_LENGTH PLUGIN_BUFFER_SIZE
9
10#define OVERLAY_LENGTH 0x10000
11#define OVERLAY_ORIGIN (DRAMORIG + (MEMORYSIZE * 0x100000) - PLUGIN_LENGTH - OVERLAY_LENGTH)
12
13MEMORY
14{
15 OVERLAY_RAM : ORIGIN = OVERLAY_ORIGIN, LENGTH = OVERLAY_LENGTH
16}
17
18SECTIONS
19{
20 .header : {
21 _plugin_start_addr = .;
22 KEEP(*(.header))
23 } > OVERLAY_RAM
24
25 .text : {
26 *(.text*)
27 } > OVERLAY_RAM
28
29 .rodata : {
30 *(.rodata*)
31 } > OVERLAY_RAM
32
33 .data : {
34 *(.data*)
35 } > OVERLAY_RAM
36
37 .bss : {
38 *(.bss*)
39 *(COMMON)
40 . = ALIGN(0x4);
41 _plugin_end_addr = .;
42 } > OVERLAY_RAM
43}
diff --git a/apps/plugins/goban/goban.c b/apps/plugins/goban/goban.c
index 04b74b7f59..20cccd7e03 100644
--- a/apps/plugins/goban/goban.c
+++ b/apps/plugins/goban/goban.c
@@ -1,25 +1,37 @@
1/*************************************************************************** 1/***************************************************************************
2 * __________ __ ___. 2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/ 7 * \/ \/ \/ \/ \/
8 * $Id$ 8 * $Id$
9 * 9 *
10 * Copyright (C) 2007-2009 Joshua Simmons <mud at majidejima dot com> 10 * Copyright (C) 2007-2009 Joshua Simmons <mud at majidejima dot com>
11 * 11 *
12 * This program is free software; you can redistribute it and/or 12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License 13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2 14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version. 15 * of the License, or (at your option) any later version.
16 * 16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied. 18 * KIND, either express or implied.
19 * 19 *
20 ****************************************************************************/ 20 ****************************************************************************/
21 21#include "plugin.h"
22#include "plugin.h" 22
23#if PLUGIN_BUFFER_SIZE < 0x10000 && !defined(SIMULATOR)
24
25#include "lib/overlay.h"
26
27PLUGIN_HEADER
28
29enum plugin_status plugin_start(const void* parameter)
30{
31 return run_overlay(parameter, PLUGIN_GAMES_DIR "/goban.ovl", "Goban");
32}
33#endif
34
23#include "lib/playback_control.h" 35#include "lib/playback_control.h"
24#include "lib/configfile.h" 36#include "lib/configfile.h"
25 37
diff --git a/apps/plugins/goban/goban.make b/apps/plugins/goban/goban.make
index f3f96ff5c6..b8866fbc4f 100644
--- a/apps/plugins/goban/goban.make
+++ b/apps/plugins/goban/goban.make
@@ -8,15 +8,41 @@
8# 8#
9 9
10 10
11GOBANSRCDIR := $(APPSDIR)/plugins/goban 11GOBAN_SRCDIR := $(APPSDIR)/plugins/goban
12GOBANBUILDDIR := $(BUILDDIR)/apps/plugins/goban 12GOBAN_BUILDDIR := $(BUILDDIR)/apps/plugins/goban
13 13
14ROCKS += $(GOBANBUILDDIR)/goban.rock 14GOBAN_SRC := $(call preprocess, $(GOBAN_SRCDIR)/SOURCES)
15
16
17GOBAN_SRC := $(call preprocess, $(GOBANSRCDIR)/SOURCES)
18GOBAN_OBJ := $(call c2obj, $(GOBAN_SRC)) 15GOBAN_OBJ := $(call c2obj, $(GOBAN_SRC))
19 16
20OTHER_SRC += $(GOBAN_SRC) 17OTHER_SRC += $(GOBAN_SRC)
21 18
22$(GOBANBUILDDIR)/goban.rock: $(GOBAN_OBJ) 19ifndef SIMVER
20ifneq (,$(strip $(foreach tgt,RECORDER ONDIO,$(findstring $(tgt),$(TARGET)))))
21 ### archos recorder targets
22 GOBAN_INLDS := $(GOBAN_SRCDIR)/archos.lds
23 ROCKS += $(GOBAN_BUILDDIR)/goban.ovl
24else
25 ### all other targets
26 GOBAN_INLDS := $(APPSDIR)/plugins/plugin.lds
27 ROCKS += $(GOBAN_BUILDDIR)/goban.rock
28endif
29 GOBAN_OVLFLAGS = -T$(GOBAN_OUTLDS) -Wl,--gc-sections -Wl,-Map,$(basename $@).map
30 GOBAN_OUTLDS = $(GOBAN_BUILDDIR)/goban.lds
31else
32 ### simulator
33 ROCKS += $(GOBAN_BUILDDIR)/goban.rock
34 GOBAN_OVLFLAGS = $(SHARED_FLAG) # <-- from Makefile
35endif
36
37$(GOBAN_OUTLDS): $(GOBAN_INLDS) $(GOBAN_OBJ)
38 $(call PRINTS,PP $(<F))$(call preprocess2file,$<,$@)
39
40$(GOBAN_BUILDDIR)/goban.rock: $(GOBAN_OBJ) $(GOBAN_OUTLDS)
41
42$(GOBAN_BUILDDIR)/goban.ovl: $(GOBAN_OBJ) $(GOBAN_OUTLDS)
43 $(SILENT)$(CC) $(PLUGINFLAGS) -o $(basename $@).elf \
44 $(filter %.o, $^) \
45 $(filter %.a, $^) \
46 -lgcc $(GOBAN_OVLFLAGS)
47 $(call PRINTS,LD $(@F))$(OC) -O binary $(basename $@).elf $@
48
diff --git a/apps/plugins/goban/sgf_storage.c b/apps/plugins/goban/sgf_storage.c
index 8afc3ea80f..7ee0848543 100644
--- a/apps/plugins/goban/sgf_storage.c
+++ b/apps/plugins/goban/sgf_storage.c
@@ -326,7 +326,7 @@ setup_sgf (void)
326 326
327 if (total_storage_size < MIN_STORAGE_BUFFER_SIZE) 327 if (total_storage_size < MIN_STORAGE_BUFFER_SIZE)
328 { 328 {
329 rb->splash (2 * HZ, "Stopping music playback to get more space"); 329 rb->splash (1 * HZ, "Stopping music playback to get more space");
330 DEBUGF ("storage_buffer_size < MIN!!: %d\n", (int) total_storage_size); 330 DEBUGF ("storage_buffer_size < MIN!!: %d\n", (int) total_storage_size);
331 331
332 temp_buffer = rb->plugin_get_audio_buffer (&size); 332 temp_buffer = rb->plugin_get_audio_buffer (&size);
@@ -335,7 +335,7 @@ setup_sgf (void)
335 335
336 if (total_storage_size < MIN_STORAGE_BUFFER_SIZE) 336 if (total_storage_size < MIN_STORAGE_BUFFER_SIZE)
337 { 337 {
338 rb->splash (5 * HZ, "Low memory. Large files may not load."); 338 rb->splash (1 * HZ, "Low memory. Large files may not load.");
339 339
340 DEBUGF ("storage_buffer_size < MIN!!!!: %d\n", 340 DEBUGF ("storage_buffer_size < MIN!!!!: %d\n",
341 (int) total_storage_size); 341 (int) total_storage_size);
@@ -387,6 +387,15 @@ setup_storage_buffer (char *temp_buffer, size_t size)
387 unsigned int index = 0; 387 unsigned int index = 0;
388 int temp; 388 int temp;
389 389
390#if PLUGIN_BUFFER_SIZE < 0x10000 && !defined(SIMULATOR)
391 /* loaded as an overlay plugin, protect from overwriting ourselves */
392 if (plugin_start_addr >= (unsigned char *) temp_buffer &&
393 plugin_start_addr < (unsigned char *) temp_buffer + size)
394 {
395 size = plugin_start_addr - (unsigned char *) temp_buffer;
396 }
397#endif
398
390 while (1) 399 while (1)
391 { 400 {
392 if (index >= sizeof (storage_initialized) / 401 if (index >= sizeof (storage_initialized) /
diff --git a/manual/plugins/main.tex b/manual/plugins/main.tex
index 54b051fab7..04ded681a3 100644
--- a/manual/plugins/main.tex
+++ b/manual/plugins/main.tex
@@ -35,9 +35,7 @@ text files%
35 35
36{\input{plugins/flipit.tex}} 36{\input{plugins/flipit.tex}}
37 37
38\nopt{recorder,recorderv2fm,ondio}{
39\opt{lcd_bitmap}{\input{plugins/goban.tex}} 38\opt{lcd_bitmap}{\input{plugins/goban.tex}}
40}
41 39
42\opt{lcd_non-mono}{\nopt{h10_5gb,ipodmini,c200}{ 40\opt{lcd_non-mono}{\nopt{h10_5gb,ipodmini,c200}{
43 \input{plugins/invadrox.tex}}} 41 \input{plugins/invadrox.tex}}}