Index: tools/configure =================================================================== --- tools/configure (revision 24695) +++ tools/configure (working copy) @@ -966,6 +966,9 @@ # plugins: set to 'yes' to build the plugins. Early development builds can # set this to no in the early stages to have an easier life for a # while + # pebbles: set to 'yes' to build the pebbles. Early development builds can + # set this to no in the early stages to have an easier life for a + # while # swcodec: set 'yes' on swcodec targets # toolset: lists what particular tools in the tools/ directory that this # target needs to have built prior to building Rockbox @@ -988,6 +991,7 @@ archosrom="$pwd/rombox.ucl" flash="$pwd/rockbox.ucl" plugins="yes" + pebbles="yes" swcodec="" # toolset is the tools within the tools directory that we build for @@ -1016,6 +1020,7 @@ #archosrom="$pwd/rombox.ucl" flash="$pwd/rockbox.ucl" plugins="yes" + pebbles="yes" swcodec="" # toolset is the tools within the tools directory that we build for # this particular target. @@ -1038,6 +1043,7 @@ #archosrom="$pwd/rombox.ucl" flash="$pwd/rockbox.ucl" plugins="yes" + pebbles="yes" swcodec="" # toolset is the tools within the tools directory that we build for # this particular target. @@ -1060,6 +1066,7 @@ #archosrom="$pwd/rombox.ucl" flash="$pwd/rockbox.ucl" plugins="yes" + pebbles="yes" swcodec="" # toolset is the tools within the tools directory that we build for # this particular target. @@ -1082,6 +1089,7 @@ archosrom="$pwd/rombox.ucl" flash="$pwd/rockbox.ucl" plugins="yes" + pebbles="yes" swcodec="" # toolset is the tools within the tools directory that we build for # this particular target. @@ -1104,6 +1112,7 @@ #archosrom="$pwd/rombox.ucl" flash="$pwd/rockbox.ucl" plugins="yes" + pebbles="yes" swcodec="" toolset=$archosbitmaptools t_cpu="sh" @@ -1123,6 +1132,7 @@ output="cjbm.ajz" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="" # toolset is the tools within the tools directory that we build for # this particular target. @@ -1149,6 +1159,7 @@ appextra="recorder:gui" flash="$pwd/rombox.iriver" plugins="yes" + pebbles="yes" swcodec="yes" # toolset is the tools within the tools directory that we build for # this particular target. @@ -1172,6 +1183,7 @@ output="rockbox.iriver" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" # toolset is the tools within the tools directory that we build for # this particular target. @@ -1197,6 +1209,7 @@ appextra="recorder:gui" flash="$pwd/rombox.iriver" plugins="yes" + pebbles="yes" swcodec="yes" # toolset is the tools within the tools directory that we build for # this particular target. @@ -1218,6 +1231,7 @@ output="rockbox.wma" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" # toolset is the tools within the tools directory that we build for # this particular target. @@ -1239,6 +1253,7 @@ output="rockbox.mi4" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" boottool="$rootdir/tools/scramble -mi4v3 -model=h10 -type=RBBL" bootoutput="H10_20GC.mi4" @@ -1263,6 +1278,7 @@ output="rockbox.mi4" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" boottool="$rootdir/tools/scramble -mi4v2 -model=h105 -type=RBBL" bootoutput="H10.mi4" @@ -1287,6 +1303,7 @@ output="rockbox.ipod" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" bootoutput="bootloader-$modelname.ipod" # toolset is the tools within the tools directory that we build for @@ -1310,6 +1327,7 @@ output="rockbox.ipod" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" bootoutput="bootloader-$modelname.ipod" # toolset is the tools within the tools directory that we build for @@ -1332,6 +1350,7 @@ output="rockbox.ipod" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" bootoutput="bootloader-$modelname.ipod" # toolset is the tools within the tools directory that we build for @@ -1355,6 +1374,7 @@ output="rockbox.ipod" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" bootoutput="bootloader-$modelname.ipod" # toolset is the tools within the tools directory that we build for @@ -1378,6 +1398,7 @@ output="rockbox.ipod" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" bootoutput="bootloader-$modelname.ipod" # toolset is the tools within the tools directory that we build for @@ -1401,6 +1422,7 @@ output="rockbox.ipod" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" bootoutput="bootloader-$modelname.ipod" # toolset is the tools within the tools directory that we build for @@ -1424,6 +1446,7 @@ output="rockbox.ipod" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" bootoutput="bootloader-$modelname.ipod" # toolset is the tools within the tools directory that we build for @@ -1447,6 +1470,7 @@ output="rockbox.ipod" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" bootoutput="bootloader-$modelname.ipod" # toolset is the tools within the tools directory that we build for @@ -1470,6 +1494,7 @@ output="rockbox.ipod" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" bootoutput="bootloader-$modelname.ipod" # toolset is the tools within the tools directory that we build for @@ -1495,6 +1520,7 @@ output="rockbox.iaudio" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" # toolset is the tools within the tools directory that we build for # this particular target. @@ -1519,6 +1545,7 @@ output="rockbox.iaudio" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" # toolset is the tools within the tools directory that we build for # this particular target. @@ -1542,6 +1569,7 @@ output="rockbox.iaudio" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" bootoutput="I7_FW.BIN" # toolset is the tools within the tools directory that we build for @@ -1567,6 +1595,7 @@ bootoutput="bootloader-cowond2.bin" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" toolset="$tccbitmaptools" # architecture, manufacturer and model for the target-tree build @@ -1587,6 +1616,7 @@ output="rockbox.iaudio" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" # toolset is the tools within the tools directory that we build for # this particular target. @@ -1609,6 +1639,7 @@ output="rockbox.gigabeat" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" toolset=$gigabeatbitmaptools boottool="$rootdir/tools/scramble -gigabeat" @@ -1631,6 +1662,7 @@ output="rockbox.gigabeat" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" toolset="$gigabeatbitmaptools" boottool="$rootdir/tools/scramble -gigabeats" @@ -1655,6 +1687,7 @@ output="rockbox.mrobe500" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" toolset=$gigabeatbitmaptools boottool="cp " @@ -1679,6 +1712,7 @@ output="rockbox.mi4" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" boottool="$rootdir/tools/scramble -mi4v2 -model=m100 -type=RBBL" bootoutput="pp5020.mi4" @@ -1728,6 +1762,7 @@ output="rockbox.zvm" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" toolset=$ipodbitmaptools boottool="$rootdir/tools/scramble -creative=zvm -no-ciff" @@ -1751,6 +1786,7 @@ output="rockbox.zvm60" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" toolset=$ipodbitmaptools boottool="$rootdir/tools/scramble -creative=zvm60" @@ -1796,6 +1832,7 @@ output="rockbox.mi4" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" boottool="$rootdir/tools/scramble -mi4v3 -model=e200 -type=RBBL" bootoutput="PP5022.mi4" @@ -1823,6 +1860,7 @@ output="rockbox.mi4" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" boottool="$rootdir/tools/scramble -mi4r -model=e20r -type=RBBL" bootoutput="pp5022.mi4" @@ -1847,6 +1885,7 @@ output="rockbox.mi4" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" boottool="$rootdir/tools/scramble -mi4v3 -model=c200 -type=RBBL" bootoutput="firmware.mi4" @@ -1919,6 +1958,7 @@ bootoutput="bootloader-clip.sansa" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" toolset=$scramblebitmaptools t_cpu="arm" @@ -1940,6 +1980,7 @@ bootoutput="bootloader-e200v2.sansa" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" toolset=$scramblebitmaptools t_cpu="arm" @@ -1961,6 +2002,7 @@ bootoutput="bootloader-m200v4.sansa" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" toolset=$scramblebitmaptools t_cpu="arm" @@ -1982,6 +2024,7 @@ bootoutput="bootloader-fuze.sansa" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" toolset=$scramblebitmaptools t_cpu="arm" @@ -2003,6 +2046,7 @@ bootoutput="bootloader-c200v2.sansa" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" # toolset is the tools within the tools directory that we build for # this particular target. @@ -2027,6 +2071,7 @@ bootoutput="bootloader-clipv2.sansa" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" toolset=$scramblebitmaptools t_cpu="arm" @@ -2071,6 +2116,7 @@ bootoutput="bootloader-clipplus.sansa" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" toolset=$scramblebitmaptools t_cpu="arm" @@ -2090,6 +2136,7 @@ output="rockbox.elio" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" boottool="$rootdir/tools/scramble -mi4v2" bootoutput="pp5020.mi4" @@ -2138,6 +2185,7 @@ output="rockbox.mi4" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" boottool="$rootdir/tools/scramble -mi4v3 -model=1630 -type=RBBL" bootoutput="FWImage.ebn" @@ -2186,6 +2234,7 @@ output="rockbox.meizu" appextra="recorder:gui" plugins="no" #FIXME + pebbles="no" #FIXME swcodec="yes" toolset=$genericbitmaptools boottool="cp" @@ -2208,6 +2257,7 @@ output="rockbox.meizu" appextra="recorder:gui" plugins="no" #FIXME + pebbles="no" #FIXME swcodec="yes" toolset=$genericbitmaptools boottool="cp" @@ -2230,6 +2280,7 @@ output="rockbox.meizu" appextra="recorder:gui" plugins="no" #FIXME + pebbles="no" #FIXME swcodec="yes" toolset=$genericbitmaptools boottool="cp" @@ -2252,6 +2303,7 @@ output="rockbox.vx747" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" toolset=$genericbitmaptools boottool="$rootdir/tools/scramble -ccpmp" @@ -2274,6 +2326,7 @@ output="rockbox.vx767" appextra="recorder:gui" plugins="" #FIXME + pebbles="" #FIXME swcodec="yes" toolset=$genericbitmaptools boottool="$rootdir/tools/scramble -ccpmp" @@ -2296,6 +2349,7 @@ output="rockbox.vx747p" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" toolset=$genericbitmaptools boottool="$rootdir/tools/scramble -ccpmp" @@ -2318,6 +2372,7 @@ output="rockbox.vx777" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" toolset=$genericbitmaptools boottool="$rootdir/tools/scramble -ccpmp" @@ -2384,6 +2439,7 @@ output="rockbox.mi4" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" boottool="$rootdir/tools/scramble -mi4v2 -model=y820 -type=RBBL" bootoutput="FW_YH820.mi4" @@ -2408,6 +2464,7 @@ output="rockbox.mi4" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" boottool="$rootdir/tools/scramble -mi4v2 -model=y920 -type=RBBL" bootoutput="PP5020.mi4" @@ -2432,6 +2489,7 @@ output="rockbox.mi4" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" boottool="$rootdir/tools/scramble -mi4v2 -model=y925 -type=RBBL" bootoutput="FW_YH925.mi4" @@ -2456,6 +2514,7 @@ output="rockbox.yps3" appextra="recorder:gui" plugins="no" #FIXME + pebbles="no" #FIXME swcodec="yes" toolset=$genericbitmaptools boottool="cp" @@ -2478,6 +2537,7 @@ output="jukebox.mi4" appextra="recorder:gui" plugins="yes" + pebbles="yes" swcodec="yes" boottool="$rootdir/tools/scramble -mi4v3 -model=v500 -type=RBBL" bootoutput="rockbox.mi4" @@ -2972,6 +3032,7 @@ -e "s,@ARCHOSROM@,${archosrom},g" \ -e "s,@FLASHFILE@,${flash},g" \ -e "s,@PLUGINS@,${plugins},g" \ + -e "s,@PLUGINS@,${pebbles},g" \ -e "s,@CODECS@,${swcodec},g" \ -e "s,@PROFILE_OPTS@,${PROFILE_OPTS},g" \ -e "s,@SHARED_FLAG@,${SHARED_FLAG},g" \ @@ -3035,6 +3096,7 @@ export BINARY=@OUTPUT@ export APPEXTRA=@APPEXTRA@ export ENABLEDPLUGINS=@PLUGINS@ +export ENABLEDPEBBLES=@PEBBLES@ export SOFTWARECODECS=@CODECS@ export EXTRA_DEFINES=@EXTRADEF@ export HOSTCC=@HOSTCC@ Index: tools/buildzip.pl =================================================================== --- tools/buildzip.pl (revision 24695) +++ tools/buildzip.pl (working copy) @@ -221,6 +221,7 @@ mkdir "$rbdir/rocks/apps", 0777; mkdir "$rbdir/rocks/demos", 0777; mkdir "$rbdir/rocks/viewers", 0777; + mkdir "$rbdir/pebbles", 0777; if ($recording) { mkdir "$rbdir/recpresets", 0777; @@ -275,6 +276,7 @@ } find(find_copyfile(qr/\.(rock|ovl|lua)/, abs_path("$rbdir/rocks/")), 'apps/plugins'); + find(find_copyfile(qr/\.(pebble)/, abs_path("$rbdir/pebbles/")), 'apps/pebbles'); open VIEWERS, "$ROOT/apps/plugins/viewers.config" or die "can't open viewers.config"; Index: tools/root.make =================================================================== --- tools/root.make (revision 24695) +++ tools/root.make (working copy) @@ -82,6 +82,11 @@ include $(APPSDIR)/plugins/plugins.make endif + ifdef ENABLEDPEBBLES + include $(APPSDIR)/pebbles/pebbles.make + endif + + ifdef SIMVER include $(ROOTDIR)/uisimulator/uisimulator.make endif @@ -92,7 +97,7 @@ OBJ += $(BMP:.bmp=.o) OBJ := $(subst $(ROOTDIR),$(BUILDDIR),$(OBJ)) -build: $(TOOLS) $(BUILDDIR)/$(BINARY) $(CODECS) $(ROCKS) $(ARCHOSROM) $(RBINFO) +build: $(TOOLS) $(BUILDDIR)/$(BINARY) $(CODECS) $(ROCKS) $(PEBBLES) $(ARCHOSROM) $(RBINFO) $(RBINFO): $(BUILDDIR)/$(BINARY) $(SILENT)echo Creating $(@F) Index: apps/pebble.h =================================================================== --- apps/pebble.h (revision 0) +++ apps/pebble.h (revision 0) @@ -0,0 +1,35 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: $ + * + * Copyright (C) 2010 Frank Gevaerts + * + * 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 "viewport.h" + +struct plugin_api; +#define NUM_PEBBLES 4 + +struct pebble +{ + int (*run)(bool init,bool exit,char *line,struct viewport *vp,char *blob,struct plugin_api *rb); +}; + +int pebble_load(const char* pebble); +void pebble_run(unsigned short index); + +int pebble_do(bool init,bool exit,char *line,struct viewport *vp,char *blob,struct plugin_api *rb); Index: apps/gui/skin_engine/skin_parser.c =================================================================== --- apps/gui/skin_engine/skin_parser.c (revision 24695) +++ apps/gui/skin_engine/skin_parser.c (working copy) @@ -27,6 +27,7 @@ #include "misc.h" #include "plugin.h" #include "viewport.h" +#include "pebble.h" #ifdef __PCTOOL__ #ifdef WPSEDITOR @@ -143,6 +144,8 @@ return 0; } +static int parse_pebble(const char *wps_bufptr, + struct wps_token *token, struct wps_data *wps_data); #ifdef HAVE_LCD_BITMAP static int parse_viewport_display(const char *wps_bufptr, struct wps_token *token, struct wps_data *wps_data); @@ -379,6 +382,8 @@ { WPS_TOKEN_TRANSLATEDSTRING, "Sx", WPS_REFRESH_STATIC, parse_setting_and_lang }, { WPS_TOKEN_LANG_IS_RTL , "Sr", WPS_REFRESH_STATIC, NULL }, + + { WPS_TOKEN_PEBBLE , "P", WPS_REFRESH_DYNAMIC, parse_pebble }, { WPS_TOKEN_LASTTOUCH, "Tl", WPS_REFRESH_DYNAMIC, parse_timeout }, { WPS_TOKEN_CURRENT_SCREEN, "cs", WPS_REFRESH_DYNAMIC, NULL }, @@ -531,6 +536,17 @@ return true; } +static int parse_pebble(const char *wps_bufptr, + struct wps_token *token, + struct wps_data *wps_data) +{ + (void)token; /* Kill warnings */ + short index=pebble_load("/.rockbox/pebbles/test_pebble.pebble"); + if(index>0) + token->value.i = index; + return skip_end_of_line(wps_bufptr); +} + #ifdef HAVE_LCD_BITMAP static int parse_statusbar_enable(const char *wps_bufptr, Index: apps/gui/skin_engine/skin_display.c =================================================================== --- apps/gui/skin_engine/skin_display.c (revision 24695) +++ apps/gui/skin_engine/skin_display.c (working copy) @@ -37,6 +37,7 @@ #include "screen_access.h" #include "playlist.h" #include "audio.h" +#include "pebble.h" #ifdef HAVE_LCD_BITMAP #include "peakmeter.h" @@ -80,6 +81,11 @@ return retval; } +static void draw_pebble(unsigned short pebble) +{ + pebble_run(pebble); +} + #ifdef HAVE_LCD_BITMAP void skin_statusbar_changed(struct gui_wps *skin) @@ -266,7 +272,6 @@ } } - /* clears the area where the image was shown */ static void clear_image_pos(struct gui_wps *gwps, struct gui_img *img) { @@ -703,6 +708,9 @@ draw_playlist_viewer_list(gwps, data->tokens[i].value.data); break; #endif + case WPS_TOKEN_PEBBLE: + draw_pebble(data->tokens[i].value.i); + break; default: { /* get the value of the tag and copy it to the buffer */ Index: apps/gui/skin_engine/skin_tokens.h =================================================================== --- apps/gui/skin_engine/skin_tokens.h (revision 24695) +++ apps/gui/skin_engine/skin_tokens.h (working copy) @@ -207,6 +207,8 @@ WPS_TOKEN_SETTING, WPS_TOKEN_CURRENT_SCREEN, WPS_TOKEN_LANG_IS_RTL, + + WPS_TOKEN_PEBBLE, /* Recording Tokens */ TOKEN_MARKER_RECORDING, Index: apps/pebbles/SOURCES =================================================================== --- apps/pebbles/SOURCES (revision 0) +++ apps/pebbles/SOURCES (revision 0) @@ -0,0 +1 @@ +test_pebble.c Index: apps/pebbles/pebbles.make =================================================================== --- apps/pebbles/pebbles.make (revision 0) +++ apps/pebbles/pebbles.make (revision 0) @@ -0,0 +1,61 @@ +# __________ __ ___. +# Open \______ \ ____ ____ | | _\_ |__ _______ ___ +# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / +# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < +# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ +# \/ \/ \/ \/ \/ +# $Id: pebbles.make 24322 2010-01-24 15:32:23Z funman $ +# + +# single-file pebbles: +PEBBLES_SRC = $(call preprocess, $(APPSDIR)/pebbles/SOURCES) +OTHER_SRC += $(PEBBLES_SRC) +PEBBLES1 := $(PEBBLES_SRC:.c=.pebble) +PEBBLES1 := $(subst $(ROOTDIR),$(BUILDDIR),$(PEBBLES1)) + +PEBBLES := $(PEBBLES1) + +### build data / rules +ifndef SIMVER +CONFIGFILE := $(FIRMDIR)/export/config/$(MODELNAME).h +PEBBLE_LDS := $(APPSDIR)/pebbles/pebble.lds +PEBBLELINK_LDS := $(BUILDDIR)/apps/pebbles/pebble.link +endif + +OTHER_INC += -I$(APPSDIR)/pebbles + +# special compile flags for pebbles: +PEBBLEFLAGS = -I$(APPSDIR)/pebbles -DPEBBLE $(CFLAGS) + +# single-file pebbles depend on their respective .o +$(PEBBLES1): $(BUILDDIR)/%.pebble : $(BUILDDIR)/%.o + +# dependency for all pebbles +$(PEBBLES): $(APPSDIR)/pebble.h $(PEBBLELINK_LDS) + +$(PEBBLELINK_LDS): $(PEBBLE_LDS) $(CONFIGFILE) + $(call PRINTS,PP $(@F)) + $(shell mkdir -p $(dir $@)) + $(call preprocess2file,$<,$@,-DLOADADDRESS=$(LOADADDRESS)) + +# special pattern rule for compiling pebbles with extra flags +$(BUILDDIR)/apps/pebbles/%.o: $(ROOTDIR)/apps/pebbles/%.c + $(SILENT)mkdir -p $(dir $@) + $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) -I$(dir $<) $(PEBBLEFLAGS) -c $< -o $@ + +ifdef SIMVER + PEBBLELDFLAGS = $(SHARED_FLAG) # <-- from Makefile +else + PEBBLELDFLAGS = -T$(PEBBLELINK_LDS) -Wl,--gc-sections -Wl,-Map,$*.map +endif + +$(BUILDDIR)/%.pebble: + $(call PRINTS,LD $(@F))$(CC) $(PEBBLEFLAGS) -o $(BUILDDIR)/$*.elf \ + $(filter %.o, $^) \ + $(filter %.a, $+) \ + -lgcc $(PEBBLELDFLAGS) +ifdef SIMVER + $(SILENT)cp $(BUILDDIR)/$*.elf $@ +else + $(SILENT)$(OC) -O binary $(BUILDDIR)/$*.elf $@ +endif Index: apps/pebbles/test_pebble.c =================================================================== --- apps/pebbles/test_pebble.c (revision 0) +++ apps/pebbles/test_pebble.c (revision 0) @@ -0,0 +1,29 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: $ + * + * Copyright (C) 2010 Frank Gevaerts + * + * 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 "pebble.h" +#include "plugin.h" + +int pebble_do(bool init,bool exit,char *line,struct viewport *vp,char *blob,struct plugin_api *rb) +{ + rb->lcd_fillrect(10, 10, 20, 20); + return 0; +} Index: apps/pebbles/pebble.lds =================================================================== --- apps/pebbles/pebble.lds (revision 0) +++ apps/pebbles/pebble.lds (revision 0) @@ -0,0 +1,58 @@ +#include "config.h" + +/* These output formats should be in the config-files */ + +#ifdef CPU_COLDFIRE +OUTPUT_FORMAT(elf32-m68k) +ENTRY(pebble_do) +#elif defined(CPU_ARM) +OUTPUT_FORMAT(elf32-littlearm) +ENTRY(pebble_do) +#elif defined(CPU_SH) +OUTPUT_FORMAT(elf32-sh) +ENTRY(_pebble_do) +#elif defined(CPU_MIPS) +OUTPUT_FORMAT(elf32-littlemips) +ENTRY(pebble_do) +#else +/* We can have an #error here we don't use this file when build sims! */ +#error Unknown CPU architecture +#endif + +#define THIS_ORIGIN 0xDEAD0000 +#define THIS_LENGTH 1000 + + + +MEMORY +{ + PEBBLE_RAM : ORIGIN = THIS_ORIGIN, LENGTH = THIS_LENGTH +} + +SECTIONS +{ + .text : + { + *(.text*) +#ifdef CPU_ARM + *(.glue_7) + *(.glue_7t) +#endif + + } > PEBBLE_RAM + + .rodata : + { + *(.rodata*) + . = ALIGN(0x4); + } > PEBBLE_RAM + + + /DISCARD/ : + { + *(.eh_frame) +#ifdef CPU_MIPS + *(.rel.dyn) +#endif + } +} Index: apps/plugin.c =================================================================== --- apps/plugin.c (revision 24695) +++ apps/plugin.c (working copy) @@ -99,7 +99,7 @@ static int creat_wrapper(const char *pathname); #endif -static const struct plugin_api rockbox_api = { +const struct plugin_api rockbox_api = { /* lcd */ #ifdef HAVE_LCD_CONTRAST Index: apps/SOURCES =================================================================== --- apps/SOURCES (revision 24695) +++ apps/SOURCES (working copy) @@ -39,6 +39,7 @@ playlist_catalog.c playlist_viewer.c plugin.c +pebble.c root_menu.c screens.c settings.c Index: apps/pebble.c =================================================================== --- apps/pebble.c (revision 0) +++ apps/pebble.c (revision 0) @@ -0,0 +1,97 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: plugin.c 24644 2010-02-14 06:26:16Z jdgordon $ + * + * Copyright (C) 2002 Björn Stenberg + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include + + +#include "config.h" +#include "pebble.h" +#include "plugin.h" +#include "lang.h" +#include "splash.h" +#include "logf.h" +#include "skin_engine/skin_buffer.h" +#include "settings.h" + + +struct pebble pebbles[NUM_PEBBLES]; +int last_plugin=0; +extern struct plugin_api rockbox_api; + +int pebble_load(const char* pebble) +{ + int fd; + ssize_t readsize; +#if NUM_CORES > 1 + unsigned my_core; +#endif + + splash(0, ID2P(LANG_WAIT)); + + int max_size=1000; + char *buffer=skin_buffer_alloc(max_size); + + fd = open(pebble, O_RDONLY); + if (fd < 0) { + splashf(HZ*2, str(LANG_PLUGIN_CANT_OPEN), pebble); + return fd; + } +#if NUM_CORES > 1 + /* Make sure COP cache is flushed and invalidated before loading */ + my_core = switch_core(CURRENT_CORE ^ 1); + cpucache_invalidate(); + switch_core(my_core); +#endif + + readsize = read(fd, buffer, max_size); + close(fd); + + if (readsize < 0) { + splashf(HZ*2, str(LANG_READ_FAILED), pebble); + return -1; + } + if (readsize == max_size) { + /* Suspicious. FIXME: This should be handled better */ + splashf(HZ*2, str(LANG_READ_FAILED), pebble); + return -1; + } + + //FIXME: increment last_plugin + pebbles[last_plugin].run=(struct pebble*)buffer; + + /* FIXME: put back header and version checks? */ + + cpucache_invalidate(); + return (last_plugin); +} + + +void pebble_run(unsigned short index) +{ + pebbles[index].run(false,false,NULL,NULL,NULL,&rockbox_api); +}