Index: include/conf.h
===================================================================
--- include/conf.h	(Revision 557)
+++ include/conf.h	(Arbeitskopie)
@@ -258,6 +258,7 @@
     int script_param_save;
     
     long mem_view_addr_init;
+    int edge_overlay_play; // whether edge overlay is switched on also for play mode
 } Conf;
 
 extern Conf conf;
Index: include/lolevel.h
===================================================================
--- include/lolevel.h	(Revision 557)
+++ include/lolevel.h	(Arbeitskopie)
@@ -42,6 +42,10 @@
 extern void _SleepTask(long msec);
 extern void __attribute__((noreturn)) _ExitTask();
 extern int _taskNameToId(char* taskName); // VxWorks only, task's name first letter must be 't', maximum 10 chars total 
+// for getting and setting environment variables. Those somehow seem to
+// influence time based functions, but this is mainly for playing around
+extern char* _getenv(const char* name); 
+extern int _putenv(char* string);
 extern const char *_taskName(int taskID); // VxWorks only for now
 extern int _taskIdListGet(int *idlist,int max); // VxWorks only for now
 extern void _taskSuspend(int taskId); 
Index: platform/s2is/sub/100e/makefile.inc.new
===================================================================
--- platform/s2is/sub/100e/makefile.inc.new	(Revision 0)
+++ platform/s2is/sub/100e/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/s2is/sub/100f/makefile.inc.new
===================================================================
--- platform/s2is/sub/100f/makefile.inc.new	(Revision 0)
+++ platform/s2is/sub/100f/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/s2is/sub/100g/makefile.inc.new
===================================================================
--- platform/s2is/sub/100g/makefile.inc.new	(Revision 0)
+++ platform/s2is/sub/100g/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/s2is/makefile.inc.new
===================================================================
--- platform/s2is/makefile.inc.new	(Revision 0)
+++ platform/s2is/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/platform/makefile_generic.inc.new
+
+# vim: ft=make
Index: platform/s3is/sub/100a/makefile.inc.new
===================================================================
--- platform/s3is/sub/100a/makefile.inc.new	(Revision 0)
+++ platform/s3is/sub/100a/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o mount.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c mount.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/s3is/makefile.inc.new
===================================================================
--- platform/s3is/makefile.inc.new	(Revision 0)
+++ platform/s3is/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/platform/makefile_generic.inc.new
+
+# vim: ft=make
Index: platform/ixus65_sd630/sub/100a/makefile.inc.new
===================================================================
--- platform/ixus65_sd630/sub/100a/makefile.inc.new	(Revision 0)
+++ platform/ixus65_sd630/sub/100a/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o lib.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/ixus65_sd630/makefile.inc.new
===================================================================
--- platform/ixus65_sd630/makefile.inc.new	(Revision 0)
+++ platform/ixus65_sd630/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/platform/makefile_generic.inc.new
+
+# vim: ft=make
Index: platform/s5is/sub/101a/makefile.inc.new
===================================================================
--- platform/s5is/sub/101a/makefile.inc.new	(Revision 0)
+++ platform/s5is/sub/101a/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o  lib.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c 
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/s5is/sub/101b/makefile.inc.new
===================================================================
--- platform/s5is/sub/101b/makefile.inc.new	(Revision 0)
+++ platform/s5is/sub/101b/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o lib.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/s5is/makefile.inc.new
===================================================================
--- platform/s5is/makefile.inc.new	(Revision 0)
+++ platform/s5is/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/platform/makefile_generic.inc.new
+
+# vim: ft=make
Index: platform/ixus70_sd1000/sub/100c/makefile.inc.new
===================================================================
--- platform/ixus70_sd1000/sub/100c/makefile.inc.new	(Revision 0)
+++ platform/ixus70_sd1000/sub/100c/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/ixus70_sd1000/sub/101b/makefile.inc.new
===================================================================
--- platform/ixus70_sd1000/sub/101b/makefile.inc.new	(Revision 0)
+++ platform/ixus70_sd1000/sub/101b/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/ixus70_sd1000/sub/102a/makefile.inc.new
===================================================================
--- platform/ixus70_sd1000/sub/102a/makefile.inc.new	(Revision 0)
+++ platform/ixus70_sd1000/sub/102a/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c 
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/ixus70_sd1000/makefile.inc.new
===================================================================
--- platform/ixus70_sd1000/makefile.inc.new	(Revision 0)
+++ platform/ixus70_sd1000/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/platform/makefile_generic.inc.new
+
+# vim: ft=make
Index: platform/ixusW_sd430/sub/110a/makefile.inc.new
===================================================================
--- platform/ixusW_sd430/sub/110a/makefile.inc.new	(Revision 0)
+++ platform/ixusW_sd430/sub/110a/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o mount.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c mount.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/ixusW_sd430/makefile.inc.new
===================================================================
--- platform/ixusW_sd430/makefile.inc.new	(Revision 0)
+++ platform/ixusW_sd430/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/platform/makefile_generic.inc.new
+
+# vim: ft=make
Index: platform/ixus850_sd800/sub/100e/makefile.inc.new
===================================================================
--- platform/ixus850_sd800/sub/100e/makefile.inc.new	(Revision 0)
+++ platform/ixus850_sd800/sub/100e/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/ixus850_sd800/makefile.inc.new
===================================================================
--- platform/ixus850_sd800/makefile.inc.new	(Revision 0)
+++ platform/ixus850_sd800/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/platform/makefile_generic.inc.new
+
+# vim: ft=make
Index: platform/ixus40_sd300/sub/100k/makefile.inc.new
===================================================================
--- platform/ixus40_sd300/sub/100k/makefile.inc.new	(Revision 0)
+++ platform/ixus40_sd300/sub/100k/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/ixus40_sd300/makefile.inc.new
===================================================================
--- platform/ixus40_sd300/makefile.inc.new	(Revision 0)
+++ platform/ixus40_sd300/makefile.inc.new	(Revision 0)
@@ -0,0 +1,5 @@
+
+EXTRA_ASM_OBJS := stubs_auto.o
+include $(TOPDIR)/platform/makefile_generic.inc.new
+
+# vim: ft=make
Index: platform/a700/sub/100b/makefile.inc.new
===================================================================
--- platform/a700/sub/100b/makefile.inc.new	(Revision 0)
+++ platform/a700/sub/100b/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/a700/makefile.inc.new
===================================================================
--- platform/a700/makefile.inc.new	(Revision 0)
+++ platform/a700/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/platform/makefile_generic.inc.new
+
+# vim: ft=make
Index: platform/a620/sub/100f/makefile.inc.new
===================================================================
--- platform/a620/sub/100f/makefile.inc.new	(Revision 0)
+++ platform/a620/sub/100f/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/a620/makefile.inc.new
===================================================================
--- platform/a620/makefile.inc.new	(Revision 0)
+++ platform/a620/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/platform/makefile_generic.inc.new
+
+# vim: ft=make
Index: platform/a540/sub/100b/makefile.inc.new
===================================================================
--- platform/a540/sub/100b/makefile.inc.new	(Revision 0)
+++ platform/a540/sub/100b/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/a540/makefile.inc.new
===================================================================
--- platform/a540/makefile.inc.new	(Revision 0)
+++ platform/a540/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/platform/makefile_generic.inc.new
+
+# vim: ft=make
Index: platform/a720/sub/100c/makefile.inc.new
===================================================================
--- platform/a720/sub/100c/makefile.inc.new	(Revision 0)
+++ platform/a720/sub/100c/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/a720/makefile.inc.new
===================================================================
--- platform/a720/makefile.inc.new	(Revision 0)
+++ platform/a720/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/platform/makefile_generic.inc.new
+
+# vim: ft=make
Index: platform/a640/sub/100b/makefile.inc.new
===================================================================
--- platform/a640/sub/100b/makefile.inc.new	(Revision 0)
+++ platform/a640/sub/100b/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o mount.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c mount.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/a640/makefile.inc.new
===================================================================
--- platform/a640/makefile.inc.new	(Revision 0)
+++ platform/a640/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/platform/makefile_generic.inc.new
+
+# vim: ft=make
Index: platform/a460/sub/100d/makefile.inc.new
===================================================================
--- platform/a460/sub/100d/makefile.inc.new	(Revision 0)
+++ platform/a460/sub/100d/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/a460/makefile.inc.new
===================================================================
--- platform/a460/makefile.inc.new	(Revision 0)
+++ platform/a460/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/platform/makefile_generic.inc.new
+
+# vim: ft=make
Index: platform/ixus60_sd600/sub/100a/makefile.inc.new
===================================================================
--- platform/ixus60_sd600/sub/100a/makefile.inc.new	(Revision 0)
+++ platform/ixus60_sd600/sub/100a/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o  lib.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/ixus60_sd600/sub/100d/makefile.inc.new
===================================================================
--- platform/ixus60_sd600/sub/100d/makefile.inc.new	(Revision 0)
+++ platform/ixus60_sd600/sub/100d/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o  lib.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/ixus60_sd600/makefile.inc.new
===================================================================
--- platform/ixus60_sd600/makefile.inc.new	(Revision 0)
+++ platform/ixus60_sd600/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/platform/makefile_generic.inc.new
+
+# vim: ft=make
Index: platform/s80/sub/100g/makefile.inc.new
===================================================================
--- platform/s80/sub/100g/makefile.inc.new	(Revision 0)
+++ platform/s80/sub/100g/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o mount.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c mount.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/s80/makefile.inc.new
===================================================================
--- platform/s80/makefile.inc.new	(Revision 0)
+++ platform/s80/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/platform/makefile_generic.inc.new
+
+# vim: ft=make
Index: platform/a560/sub/100a/makefile.inc.new
===================================================================
--- platform/a560/sub/100a/makefile.inc.new	(Revision 0)
+++ platform/a560/sub/100a/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o mount.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c mount.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/a560/makefile.inc.new
===================================================================
--- platform/a560/makefile.inc.new	(Revision 0)
+++ platform/a560/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/platform/makefile_generic.inc.new
+
+# vim: ft=make
Index: platform/ixus860_sd870/sub/100c/makefile.inc.new
===================================================================
--- platform/ixus860_sd870/sub/100c/makefile.inc.new	(Revision 0)
+++ platform/ixus860_sd870/sub/100c/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o touch_wheel.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c touch_wheel.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/ixus860_sd870/makefile.inc.new
===================================================================
--- platform/ixus860_sd870/makefile.inc.new	(Revision 0)
+++ platform/ixus860_sd870/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/platform/makefile_generic.inc.new
+
+# vim: ft=make
Index: platform/ixus960_sd950/sub/100d/makefile.inc.new
===================================================================
--- platform/ixus960_sd950/sub/100d/makefile.inc.new	(Revision 0)
+++ platform/ixus960_sd950/sub/100d/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/ixus960_sd950/makefile.inc.new
===================================================================
--- platform/ixus960_sd950/makefile.inc.new	(Revision 0)
+++ platform/ixus960_sd950/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/platform/makefile_generic.inc.new
+
+# vim: ft=make
Index: platform/tx1/sub/101b/makefile.inc.new
===================================================================
--- platform/tx1/sub/101b/makefile.inc.new	(Revision 0)
+++ platform/tx1/sub/101b/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o mount.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c mount.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/tx1/sub/100g/makefile.inc.new
===================================================================
--- platform/tx1/sub/100g/makefile.inc.new	(Revision 0)
+++ platform/tx1/sub/100g/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o mount.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c mount.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/tx1/makefile.inc.new
===================================================================
--- platform/tx1/makefile.inc.new	(Revision 0)
+++ platform/tx1/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/platform/makefile_generic.inc.new
+
+# vim: ft=make
Index: platform/ixus55_sd450/sub/100b/makefile.inc.new
===================================================================
--- platform/ixus55_sd450/sub/100b/makefile.inc.new	(Revision 0)
+++ platform/ixus55_sd450/sub/100b/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/ixus55_sd450/sub/100c/makefile.inc.new
===================================================================
--- platform/ixus55_sd450/sub/100c/makefile.inc.new	(Revision 0)
+++ platform/ixus55_sd450/sub/100c/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/ixus55_sd450/sub/100d/makefile.inc.new
===================================================================
--- platform/ixus55_sd450/sub/100d/makefile.inc.new	(Revision 0)
+++ platform/ixus55_sd450/sub/100d/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/ixus55_sd450/makefile.inc.new
===================================================================
--- platform/ixus55_sd450/makefile.inc.new	(Revision 0)
+++ platform/ixus55_sd450/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/platform/makefile_generic.inc.new
+
+# vim: ft=make
Index: platform/makefile_sub.inc.new
===================================================================
--- platform/makefile_sub.inc.new	(Revision 0)
+++ platform/makefile_sub.inc.new	(Revision 0)
@@ -0,0 +1,79 @@
+# This file is included from */sub/*/makefile.inc.new
+
+
+
+LOCAL_CFLAGS:=-DLOW_LEVEL
+
+sub-platform-all: $(subdir)/libplatformsub.a
+
+TARGET_PRIMARY = PRIMARY.BIN
+
+#OBJS= should be defined in */sub/*/Makefile
+
+
+$(eval $(call gen-rule, sub-platform-clean, $(PLATFORM)-platform-clean, rm -f $(OBJS) $(subdir)/libplatformsub.a $(subdir)/stubs_entry.S.err $(subdir)/stubs_not_found_names.err ))
+
+$(eval $(call gen-rule, sub-platform-distclean, clean, rm -f $(subdir)/stubs_entry.S $(subdir)/stubs_auto.S; rm -rf $(subdir)/.dep ))
+
+OBJS:=$(call subdirize,$(ASM_OBJS) $(C_OBJS) )
+ASM_OBJS:=$(call subdirize,$(ASM_OBJS))
+C_OBJS:=$(call subdirize,$(C_OBJS))
+
+STUBS_AUTO_DEPS:=$(call subdirize , $(STUBS_AUTO_DEPS) )
+
+$(eval $(call ar-targets, libplatformsub.a, $(OBJS), ))
+
+$(eval $(call compile-asm-targets, $(ASM_OBJS) ) )
+$(eval $(call compile-targets, $(C_OBJS), $(LOCAL_CFLAGS) ) )
+
+ifeq ($(OSTYPE),Windows)
+$(eval $(call gen-rule, $(subdir)/stubs_auto.S, $(STUBS_AUTO_DEPS), \
+	cat $(STUBS_AUTO_DEPS) | \						
+	    grep -E 'B[[:alpha:]]*[[:space:]]+sub_[0-9A-Fa-f]' | \
+	    sed 's/.*[[:space:]]sub_\\([0-9A-Fa-f]*\\).*/\\1/' | \
+	    $(SORT) | uniq | \
+	    awk 'BEGIN {print "/* THIS FILE IS GENERATED */\n/* DO NOT EDIT THIS FILE! */\n\n#include \"stubs_asm.h\"\n"} \
+	        {printf("STUB(%s)\n",$$$$1)}' > $(subdir)/stubs_auto.S	
+	    ) )
+else							
+$(eval $(call gen-rule, $(subdir)/stubs_auto.S, $(STUBS_AUTO_DEPS), \
+	cat $(STUBS_AUTO_DEPS) | \
+	    grep -E 'B[[:alpha:]]*[[:space:]]+sub_[0-9A-Fa-f]' | \
+	    sed 's/.*[[:space:]]sub_\([0-9A-Fa-f]*\).*/\1/' | \
+	    $(SORT) | uniq | \
+	    awk 'BEGIN {print "/* THIS FILE IS GENERATED */\n/* DO NOT EDIT THIS FILE! */\n\n#include \"stubs_asm.h\"\n"} \
+	        {printf("STUB(%s)\n",$$$$1)}' > $(subdir)/stubs_auto.S \
+	    ))
+endif
+
+define extract-stubs-entry
+	rm -f stubs_entry.S.err
+	if [ -s $(TARGET_PRIMARY) ] ; then \
+	  $(topdir)tools/finsig $(TARGET_PRIMARY) $(ROMBASEADDR) > stubs_entry.S ; \
+	else \
+	  echo CAUTION! \'stubs_entry.S\' is not uptated due to target firmware binary not found! ; \
+	  touch stubs_entry.S ; \
+	fi ; \
+	if [ "X`grep 'ERROR' stubs_entry.S`" != "X" ] ; then \
+	  grep "ERROR" stubs_entry.S | $(ESED) "s/\/\/ ERROR: ([^ ]+) is not found.*/\1/" | $(SORT) | uniq > stubs_nf.names ; \
+	  grep -E "NH?STUB" stubs_entry_2.S | $(ESED) "s/ *NH?STUB\( *([^ ,]+).*/\1/" | $(SORT) | uniq > stubs_mn.names ; \
+	  comm -23 stubs_nf.names stubs_mn.names > stubs_not_found_names.err ; \
+	  rm -f stubs_nf.names stubs_mn.names ; \
+	  if [ -s stubs_not_found_names.err ] ; then \
+	    echo ERROR! There are unresolved addresses in \'stubs_entry.S\' \($(PLATFORM)-$(PLATFORMSUB)\) for the following names: ; \
+	    cat stubs_not_found_names.err ; \
+	    echo Please, add them into \'stubs_entry_2.S\' manually! ; \
+	    mv stubs_entry.S stubs_entry.S.err ; \
+	    exit 1 ; \
+	  fi ; \
+	  rm -f stubs_not_found_names.err ; \
+	fi
+endef
+
+$(eval $(call gen-rule, $(subdir)/stubs_entry.S, $(TARGET_PRIMARY) $(topdir)tools/signatures_$(PLATFORMOS).h $(topdir)tools/finsig$(EXE), \
+	$(extract-stubs-entry) ) )
+
+$(TARGET_PRIMARY):
+	touch $(TARGET_PRIMARY)
+
+# vim: ft=make
Index: platform/ixus700_sd500/sub/101a/makefile.inc.new
===================================================================
--- platform/ixus700_sd500/sub/101a/makefile.inc.new	(Revision 0)
+++ platform/ixus700_sd500/sub/101a/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o mount.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c mount.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/ixus700_sd500/sub/101b/makefile.inc.new
===================================================================
--- platform/ixus700_sd500/sub/101b/makefile.inc.new	(Revision 0)
+++ platform/ixus700_sd500/sub/101b/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o mount.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c mount.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/ixus700_sd500/makefile.inc.new
===================================================================
--- platform/ixus700_sd500/makefile.inc.new	(Revision 0)
+++ platform/ixus700_sd500/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/platform/makefile_generic.inc.new
+
+# vim: ft=make
Index: platform/ixus800_sd700/sub/100b/makefile.inc.new
===================================================================
--- platform/ixus800_sd700/sub/100b/makefile.inc.new	(Revision 0)
+++ platform/ixus800_sd700/sub/100b/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/ixus800_sd700/sub/101b/makefile.inc.new
===================================================================
--- platform/ixus800_sd700/sub/101b/makefile.inc.new	(Revision 0)
+++ platform/ixus800_sd700/sub/101b/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/ixus800_sd700/makefile.inc.new
===================================================================
--- platform/ixus800_sd700/makefile.inc.new	(Revision 0)
+++ platform/ixus800_sd700/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/platform/makefile_generic.inc.new
+
+# vim: ft=make
Index: platform/ixus750_sd550/sub/100f/makefile.inc.new
===================================================================
--- platform/ixus750_sd550/sub/100f/makefile.inc.new	(Revision 0)
+++ platform/ixus750_sd550/sub/100f/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o mount.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c mount.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/ixus750_sd550/sub/100g/makefile.inc.new
===================================================================
--- platform/ixus750_sd550/sub/100g/makefile.inc.new	(Revision 0)
+++ platform/ixus750_sd550/sub/100g/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o mount.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c mount.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/ixus750_sd550/makefile.inc.new
===================================================================
--- platform/ixus750_sd550/makefile.inc.new	(Revision 0)
+++ platform/ixus750_sd550/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/platform/makefile_generic.inc.new
+
+# vim: ft=make
Index: platform/sx100is/sub/100b/boot.c
===================================================================
--- platform/sx100is/sub/100b/boot.c	(Revision 557)
+++ platform/sx100is/sub/100b/boot.c	(Arbeitskopie)
@@ -99,6 +99,7 @@
 		 "BCC	loc_FFC00200\n"
 
 		 "BL	sub_FFC00FB8_my\n"				// <----------
+		 ".pool\n" // needed for gcc 4.x
 	);
 } //#fe
 
@@ -154,6 +155,7 @@
 		 "BL	sub_FFC02D70\n"
 		 "ADD	SP, SP,	#0x74\n"
 		 "LDR	PC, [SP],#4\n"
+		 ".pool\n" // needed for gcc 4.x
 	);
 }; //#fe
 
Index: platform/sx100is/sub/100b/makefile.inc.new
===================================================================
--- platform/sx100is/sub/100b/makefile.inc.new	(Revision 0)
+++ platform/sx100is/sub/100b/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/sx100is/sub/100c/boot.c
===================================================================
--- platform/sx100is/sub/100c/boot.c	(Revision 557)
+++ platform/sx100is/sub/100c/boot.c	(Arbeitskopie)
@@ -99,6 +99,7 @@
 		 "BCC	loc_FFC00200\n"
 
 		 "BL	sub_FFC00FB8_my\n"				// <----------
+		 ".pool\n"
 	);
 } //#fe
 
@@ -154,6 +155,7 @@
 		 "BL	sub_FFC02D70\n"
 		 "ADD	SP, SP,	#0x74\n"
 		 "LDR	PC, [SP],#4\n"
+		 ".pool\n"
 	);
 }; //#fe
 
Index: platform/sx100is/sub/100c/makefile.inc.new
===================================================================
--- platform/sx100is/sub/100c/makefile.inc.new	(Revision 0)
+++ platform/sx100is/sub/100c/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/sx100is/makefile.inc.new
===================================================================
--- platform/sx100is/makefile.inc.new	(Revision 0)
+++ platform/sx100is/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/platform/makefile_generic.inc.new
+
+# vim: ft=make
Index: platform/a610/sub/100e/makefile.inc.new
===================================================================
--- platform/a610/sub/100e/makefile.inc.new	(Revision 0)
+++ platform/a610/sub/100e/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/a610/sub/100f/makefile.inc.new
===================================================================
--- platform/a610/sub/100f/makefile.inc.new	(Revision 0)
+++ platform/a610/sub/100f/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/a610/makefile.inc.new
===================================================================
--- platform/a610/makefile.inc.new	(Revision 0)
+++ platform/a610/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/platform/makefile_generic.inc.new
+
+# vim: ft=make
Index: platform/ixus50_sd400/sub/101a/makefile.inc.new
===================================================================
--- platform/ixus50_sd400/sub/101a/makefile.inc.new	(Revision 0)
+++ platform/ixus50_sd400/sub/101a/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/ixus50_sd400/sub/101b/makefile.inc.new
===================================================================
--- platform/ixus50_sd400/sub/101b/makefile.inc.new	(Revision 0)
+++ platform/ixus50_sd400/sub/101b/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/ixus50_sd400/makefile.inc.new
===================================================================
--- platform/ixus50_sd400/makefile.inc.new	(Revision 0)
+++ platform/ixus50_sd400/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/platform/makefile_generic.inc.new
+
+# vim: ft=make
Index: platform/a710/sub/100a/makefile.inc.new
===================================================================
--- platform/a710/sub/100a/makefile.inc.new	(Revision 0)
+++ platform/a710/sub/100a/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o mount.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c mount.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/a710/makefile.inc.new
===================================================================
--- platform/a710/makefile.inc.new	(Revision 0)
+++ platform/a710/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/platform/makefile_generic.inc.new
+
+# vim: ft=make
Index: platform/a530/sub/100a/makefile.inc.new
===================================================================
--- platform/a530/sub/100a/makefile.inc.new	(Revision 0)
+++ platform/a530/sub/100a/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/a530/makefile.inc.new
===================================================================
--- platform/a530/makefile.inc.new	(Revision 0)
+++ platform/a530/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/platform/makefile_generic.inc.new
+
+# vim: ft=make
Index: platform/a450/sub/100d/makefile.inc.new
===================================================================
--- platform/a450/sub/100d/makefile.inc.new	(Revision 0)
+++ platform/a450/sub/100d/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/a450/makefile.inc.new
===================================================================
--- platform/a450/makefile.inc.new	(Revision 0)
+++ platform/a450/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/platform/makefile_generic.inc.new
+
+# vim: ft=make
Index: platform/ixus950_sd850/sub/100c/stubs_entry_2.S
===================================================================
--- platform/ixus950_sd850/sub/100c/stubs_entry_2.S	(Revision 557)
+++ platform/ixus950_sd850/sub/100c/stubs_entry_2.S	(Arbeitskopie)
@@ -57,6 +57,10 @@
 NHSTUB(GetOpticalTemperature, 0xFFA3D3E0)
 NHSTUB(PT_PlaySound, 0xFFB1A0A4)
 NHSTUB(taskNameToId, 0xFF935A64)
-
+// those are mainly to play around with them for me and to figure out how time
+// related functions work on my cam
+NHSTUB(getenv,0xFF9263C0)
+NHSTUB(putenv,0xFF92641C)
+NSTUB(localtime_r, 0xff924788)
 //NHSTUB(EnterToCompensationEVF, 0xFFFFFFFF) // Stub not found. When found, remove dummy function from lib.c.
 //NHSTUB(ExitFromCompensationEVF, 0xFFFFFFFF) // Stub not found. When found, remove dummy function from lib.c.
Index: platform/ixus950_sd850/sub/100c/makefile.inc.new
===================================================================
--- platform/ixus950_sd850/sub/100c/makefile.inc.new	(Revision 0)
+++ platform/ixus950_sd850/sub/100c/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o mount.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c mount.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/ixus950_sd850/makefile.inc.new
===================================================================
--- platform/ixus950_sd850/makefile.inc.new	(Revision 0)
+++ platform/ixus950_sd850/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/platform/makefile_generic.inc.new
+
+# vim: ft=make
Index: platform/a630/sub/100c/makefile.inc.new
===================================================================
--- platform/a630/sub/100c/makefile.inc.new	(Revision 0)
+++ platform/a630/sub/100c/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o mount.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c mount.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/a630/makefile.inc.new
===================================================================
--- platform/a630/makefile.inc.new	(Revision 0)
+++ platform/a630/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/platform/makefile_generic.inc.new
+
+# vim: ft=make
Index: platform/makefile_generic.inc.new
===================================================================
--- platform/makefile_generic.inc.new	(Revision 0)
+++ platform/makefile_generic.inc.new	(Revision 0)
@@ -0,0 +1,25 @@
+
+
+LOCAL_CFLAGS:=-DLOW_LEVEL
+
+SUBDIRS=sub
+
+C_OBJS := main.o lib.o wrappers.o kbd.o shooting.o $(EXTRA_C_OBJS)
+ASM_OBJS := $(EXTRA_ASM_OBJS)
+OBJS := $(C_OBJS) $(ASM_OBJS)
+
+# stubs_init.o
+OBJS := $(call subdirize,$(OBJS) )
+C_OBJS := $(call subdirize,$(C_OBJS) )
+ASM_OBJS := $(call subdirize,$(ASM_OBJS) )
+
+$(eval $(call compile-targets, $(C_OBJS), $(LOCAL_CFLAGS) ) )
+$(eval $(call compile-asm-targets, $(ASM_OBJS), $(LOCAL_CFLAGS) ) )
+
+$(eval $(call ar-targets, libplatform.a, $(OBJS), ))
+
+$(eval $(call gen-rule, $(PLATFORM)-platform-clean,, rm -f $(OBJS) $(subdir)/*.$(DEPSUFFIX) $(subdir)/libplatform.a ))
+
+$(PLATFORM)-platform-distclean: $(PLATFORM)-platform-clean
+
+# vim: ft=make
Index: platform/a550/sub/100c/makefile.inc.new
===================================================================
--- platform/a550/sub/100c/makefile.inc.new	(Revision 0)
+++ platform/a550/sub/100c/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o mount.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c mount.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/a550/makefile.inc.new
===================================================================
--- platform/a550/makefile.inc.new	(Revision 0)
+++ platform/a550/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/platform/makefile_generic.inc.new
+
+# vim: ft=make
Index: platform/a650/sub/100d/makefile.inc.new
===================================================================
--- platform/a650/sub/100d/makefile.inc.new	(Revision 0)
+++ platform/a650/sub/100d/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/a650/makefile.inc.new
===================================================================
--- platform/a650/makefile.inc.new	(Revision 0)
+++ platform/a650/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/platform/makefile_generic.inc.new
+
+# vim: ft=make
Index: platform/generic/makefile.inc.new
===================================================================
--- platform/generic/makefile.inc.new	(Revision 0)
+++ platform/generic/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/platform/makefile_generic.inc.new
+
+# vim: ft=make
Index: platform/a570/sub/101a/makefile.inc.new
===================================================================
--- platform/a570/sub/101a/makefile.inc.new	(Revision 0)
+++ platform/a570/sub/101a/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o mount.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c mount.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/a570/sub/100e/makefile.inc.new
===================================================================
--- platform/a570/sub/100e/makefile.inc.new	(Revision 0)
+++ platform/a570/sub/100e/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o mount.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c mount.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/a570/makefile.inc.new
===================================================================
--- platform/a570/makefile.inc.new	(Revision 0)
+++ platform/a570/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/platform/makefile_generic.inc.new
+
+# vim: ft=make
Index: platform/g7/sub/100e/makefile.inc.new
===================================================================
--- platform/g7/sub/100e/makefile.inc.new	(Revision 0)
+++ platform/g7/sub/100e/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o mount.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c mount.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/g7/sub/100g/makefile.inc.new
===================================================================
--- platform/g7/sub/100g/makefile.inc.new	(Revision 0)
+++ platform/g7/sub/100g/makefile.inc.new	(Revision 0)
@@ -0,0 +1,7 @@
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o mount.o
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c mount.c
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/g7/sub/100i/makefile.inc.new
===================================================================
--- platform/g7/sub/100i/makefile.inc.new	(Revision 0)
+++ platform/g7/sub/100i/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o mount.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c mount.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/g7/sub/100j/makefile.inc.new
===================================================================
--- platform/g7/sub/100j/makefile.inc.new	(Revision 0)
+++ platform/g7/sub/100j/makefile.inc.new	(Revision 0)
@@ -0,0 +1,11 @@
+
+
+ASM_OBJS:= stubs_min.o stubs_auto.o stubs_entry.o stubs_entry_2.o 
+C_OBJS:= boot.o capt_seq.o movie_rec.o lib.o mount.o
+
+
+STUBS_AUTO_DEPS:=boot.c capt_seq.c movie_rec.c mount.c
+
+
+include $(subdir)/../../../makefile_sub.inc.new
+# vim: ft=make
Index: platform/g7/makefile.inc.new
===================================================================
--- platform/g7/makefile.inc.new	(Revision 0)
+++ platform/g7/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/platform/makefile_generic.inc.new
+
+# vim: ft=make
Index: platform/makefile.inc.new
===================================================================
--- platform/makefile.inc.new	(Revision 0)
+++ platform/makefile.inc.new	(Revision 0)
@@ -0,0 +1,13 @@
+
+LOCAL_SUBDIRS := $(PLATFORM)
+LOCAL_SUBSUBDIRS := $(subdir)/$(PLATFORM)/sub/$(PLATFORMSUB)
+
+$(eval $(call gen-rule, platform-clean, $(foreach lsub,$(LOCAL_SUBDIRS),sub-platform-clean), ))
+
+$(eval $(call gen-rule, platform-distclean, $(foreach lsub,$(LOCAL_SUBDIRS),sub-platform-distclean), ))
+LOCAL_SUBDIRS:=$(call subdirize,$(LOCAL_SUBDIRS) )
+
+$(foreach subdir,$(LOCAL_SUBDIRS),$(eval include $(subdir)/makefile.inc.new) )
+$(foreach subdir,$(LOCAL_SUBSUBDIRS),$(eval include $(subdir)/makefile.inc.new) )
+
+# vim: ft=make
Index: core/conf.c
===================================================================
--- core/conf.c	(Revision 557)
+++ core/conf.c	(Arbeitskopie)
@@ -369,6 +369,8 @@
     CONF_INFO(218, conf.clear_zoom_override,         CONF_DEF_VALUE, i:1, NULL),			
     CONF_INFO(219, conf.bracketing_add_raw_suffix,         CONF_DEF_VALUE, i:0, NULL),			
     CONF_INFO(220, conf.temperature_unit,              CONF_DEF_VALUE, i:0, NULL),
+    CONF_INFO(221, conf.clear_zoom_override,         CONF_DEF_VALUE, i:1, NULL),			
+    CONF_INFO(221, conf.edge_overlay_play,    CONF_DEF_VALUE, i:0, NULL),
     };
 #define CONF_NUM (sizeof(conf_info)/sizeof(conf_info[0]))
 
Index: core/gui_lang.c
===================================================================
--- core/gui_lang.c	(Revision 557)
+++ core/gui_lang.c	(Arbeitskopie)
@@ -535,7 +535,12 @@
 "414 \"   Clear on start\"\n"
 "415 \"Add raw-suffix\"\n"
 "416 \"  in Fahrenheit\"\n"
-
+"417 \"Load Edge Overlay\"\n"
+"418 \"Save Edge Overlay\"\n"
+"419 \"Enable in Review\"\n"
+"420 \"Free internal Memory\"\n"
+"421 \"Property Compare/Dump\"\n"
+"422 \"Params Compare/Dump\"\n"
 ;
 
 //-------------------------------------------------------------------
Index: core/gui_fselect.c
===================================================================
--- core/gui_fselect.c	(Revision 557)
+++ core/gui_fselect.c	(Arbeitskopie)
@@ -655,7 +655,7 @@
 //-------------------------------------------------------------------
 static void fselect_marked_paste_cb(unsigned int btn) {
     struct fitem  *ptr;
-    int ss, sd, fsrc, fdst, i=0;
+    int ss, sd = 0, fsrc, fdst, i=0;
     register int *buf;
     unsigned char fend;
     static struct utimbuf t;
Index: core/gui_osd.c
===================================================================
--- core/gui_osd.c	(Revision 557)
+++ core/gui_osd.c	(Arbeitskopie)
@@ -1,3 +1,4 @@
+#include "camera.h"
 #include "stdlib.h"
 #include "keyboard.h"
 #include "platform.h"
@@ -279,7 +280,17 @@
 
     if (buf) {
         ++timer;
-        img_buf=((mode_get()&MODE_MASK) == MODE_PLAY)?vid_get_viewport_fb_d():vid_get_viewport_fb();
+	// Try to get the best viewport buffer. In playmode its the _d one, in
+	// record mode we try to get the fast live one first
+	if( (mode_get() & MODE_MASK) == MODE_PLAY ) {
+	    img_buf = vid_get_viewport_fb_d();
+	}
+	else {
+	    img_buf = vid_get_viewport_live_fb();
+	    if( !img_buf ) {
+		img_buf = vid_get_viewport_fb();
+	    }
+	}
         viewport_height = vid_get_viewport_height();
         switch (conf.zebra_mode) {
             case ZEBRA_MODE_ZEBRA_1:
Index: core/gui_lang.h
===================================================================
--- core/gui_lang.h	(Revision 557)
+++ core/gui_lang.h	(Arbeitskopie)
@@ -519,15 +519,21 @@
 #define LANG_POPUP_SUB_FROM_MARKED 409
 #define LANG_MENU_SCRIPT_PARAM_SAVE 410
 #define LANG_OSD_LAYOUT_EDITOR_EV_VIDEO 411
-
 #define	LANG_MENU_OVERRIDE_ZOOM_VALUE          412
 #define	LANG_MENU_OVERRIDE_ZOOM           413
 #define LANG_MENU_CLEAR_ZOOM_OVERRIDE_VALUES 414
 #define LANG_MENU_BRACKETING_ADD_RAW_SUFFIX 415
 #define LANG_MENU_OSD_TEMP_FAHRENHEIT 416
+#define LANG_MENU_EDGE_LOAD		417
+#define LANG_MENU_EDGE_SAVE		418
+#define LANG_MENU_EDGE_PLAY		419
+#define LANG_MENU_EDGE_FREE		420
+#define LANG_XXX_PROPCOMPARE		421
+#define LANG_XXX_PARAMCOMPARE		422
+
 //-------------------------------------------------------------------
 
-#define GUI_LANG_ITEMS                  416
+#define GUI_LANG_ITEMS                  422
 
 //-------------------------------------------------------------------
 extern void gui_lang_init();
Index: core/edgeoverlay.c
===================================================================
--- core/edgeoverlay.c	(Revision 557)
+++ core/edgeoverlay.c	(Arbeitskopie)
@@ -5,226 +5,224 @@
 #include "stdlib.h"
 #include "gui_draw.h"
 
-// until the edge thresh is put into conf structure I have hardcoded the threshold  see "thresh" below
+// This edge overlay code has major changes to the "old" one. One major change
+// is, that it doesn cause my cam (ixus 950) to crash anymore by mistaking the
+// boundaries of the viewport buffer it can read from and write pixels to.
+// Unfortunately it still has the bug (that is also present in the original
+// version) that when you move the overlay too much you again overwrite data.
+// One might not necessarily notice it at once, or at all, but for me
+// unfortunately it overwrote vital data for the chdk menu structure.
+// 
+// Also the old version was flickering for me and wasn't playing well with the
+// chdk osd. I tried to change a bit about that, which makes it also a bit
+// faster updating, at least on my cam.
+//
+// And then of course, this can load the viewport to a seperate file 
+
+// the way we save edge overlays on their own...
+#define EDGE_FILE_PREFIX "edge_"
+#define EDGE_FILE_FORMAT EDGE_FILE_PREFIX "%04d.edg"
+
 static char * imgbuf = 0;
- 
+static char * imgbuf_end = 0;
+static int inmem=0;
+// whole viewport size in bytes ??
+static int viewport_size = 0;
+// width in bytes of one viewport line ??
+static int viewport_width;// screenwidth * 3
+// flag to remember if current buffer is already saved, so hitting save won't
+// save it again
+static int is_saved = 0;
+// set this to 1 when things need to be moved, so that a redraw clears "old"
+// pixels... Otherwise it just will write pixels that need edge overlay data.
+// This sometimes leaves trails when the pixel alignment isn't nice but it is
+// better than writing "transparent" to everwhere, essentially overwriting
+// important things that will cause flickering.
+static int need_redraw = 0;
 
-void edge_overlay(){
+// debug output that waits
+void out_wait( const char* buf );
 
-	//if(!(conf.edge_overlay_thresh) || !(conf.edge_overlay_enable)) return;
-
-	static int inmem=0;
+void get_viewport_size( ) {
 	static int viewport_height;
-	static int viewport_width;// screenwidth * 3
-	static int viewport_size;
-	static int shotTaken = 0;
-	static int imgmem = 0;
-	static int ymin = 0;
-	static int thresh;
-    thresh = conf.edge_overlay_thresh; //40
-	static int xoffset = 0;
-	static int yoffset = 0;
-	static int full_press = 0;//cure for flaky behavior. due to multiple  returns to the scrip during one full press
-	static char strbuf[7] = "Frozen";
- 	static unsigned char *img;
-	int i, hi, c;
-	int x, y, h, v, ymax, y1, x1, y2;
-	char * ptrh1;
-	char * ptrh2;
-	char * ptrv1;
-	char * ptrv2;
-	char * optr;
 
+	// since screen_height is used in the drawing downwards, we should use it
+	// here too to calculate the buffer we need...
+	viewport_height = screen_height;//vid_get_viewport_height();
+	viewport_width = screen_width * 3;
+	viewport_size = viewport_height * screen_width * 3;
+}
 
-	img = vid_get_viewport_fb();
-    viewport_height = vid_get_viewport_height();
-	viewport_width = screen_width * 3;
-    viewport_size = viewport_height * screen_width;
-	if(imgbuf == 0) imgbuf = malloc(viewport_size * 3);
- 
-	if((mode_get()&MODE_MASK) != MODE_PLAY) {
-		if (kbd_is_key_pressed(KEY_RIGHT)) {
-			xoffset -=XINC;
+void ensure_allocate_imagebuffer( ) { 
+	if(imgbuf == 0)
+	{
+		imgbuf = malloc( viewport_size );
+		imgbuf_end = imgbuf + (viewport_size);
+	}
+}
+
+// scans a filename for the number of the edge detection file it contains
+int get_edge_file_num( const char* fn )
+{
+	int num = 0;
+	if( strncmp(fn,EDGE_FILE_PREFIX,sizeof(EDGE_FILE_PREFIX)-1) == 0 )
+	{ // has the correct beginning at least, now try to read as a number...
+		fn += sizeof(EDGE_FILE_PREFIX);
+		while( *fn == '0' ) // skip leading 0s
+		{
+			++fn;
 		}
-		if (kbd_is_key_pressed(KEY_LEFT)) {
-			xoffset +=XINC;
+		while( isdigit(*fn) )
+		{
+			num *= 10;
+			num += *fn - '0';
+			++fn;
 		}
-		if (kbd_is_key_pressed(KEY_DOWN)) {
-			yoffset -=YINC;
+		// ignore anything else after it, that is like the ending etc.
+	}
+	return num;
+}
+
+// we eat up to 300k of memory, for people needing it we have a menu point
+// where they can manually free it. makes of course only sense when the edge
+// overlay is not active.
+void free_memory_edge_overlay(void){
+	char buf[64];
+	free(imgbuf);
+	imgbuf = 0;
+	sprintf(buf,"Freed %u bytes",viewport_size);
+	draw_string(30, 10, buf, conf.osd_color);
+	viewport_size = 0;
+}
+
+// saves the actual active overlay data to a file... Well, actually the
+// viewport is saved...
+void save_edge_overlay(void){
+
+	char fn[64];
+	char msg[64];
+	int fd;
+	DIR* d;
+	int fnum = 0;
+	int fr = 0;
+	struct dirent* de;
+
+	// nothing to save? then dont save
+	if( !imgbuf ) return;
+
+	// first figure out the most appropriate filename to use
+	d = opendir(EDGE_SAVE_DIR);
+	if( ! d )
+	{
+		return;
+	}
+
+	while( (de = readdir(d)) )
+	{
+		fr = get_edge_file_num(de->name);
+		if( fr > fnum )
+		{
+			fnum = fr;
 		}
-		if (kbd_is_key_pressed(KEY_UP)) {
-			yoffset +=YINC;
-		}
- 
-		if (kbd_is_key_pressed(KEY_SHOOT_HALF)||kbd_is_key_pressed(KEY_SHOOT_FULL)) {
-			if (kbd_is_key_pressed(KEY_SHOOT_FULL) && !full_press) {
-				shotTaken = 1 - shotTaken;
-				memcpy(imgbuf,img,viewport_size * 3);
-				ymin = CALCYMARGIN;
-				inmem = 1;
-				full_press = 1;
-				xoffset = 0;
-				yoffset = 0;
-				return;
-			}
-			if(shotTaken) {
-				return;
-			}
-			memcpy(imgbuf,img,viewport_size * 3);
-			ymin = CALCYMARGIN;
-			inmem = 1;
-			xoffset = 0;
-			yoffset = 0;
-			return;
-		}
-		else full_press = 0;
-		if (inmem && (ymin < screen_height-CALCYMARGIN)) {
-			ymax = ymin + (screen_height - 2 * CALCYMARGIN) / NSTAGES;
-			if(ymax > screen_height - CALCYMARGIN) ymax = screen_height - CALCYMARGIN;
-			for (y=ymin; y<ymax; y++) {
-				ptrh1 = imgbuf + y * viewport_width + 7;
-				ptrh2 = imgbuf + y * viewport_width - 5;
-				ptrv1 = imgbuf + (y + 1) * viewport_width + 1;
-				ptrv2 = imgbuf + (y - 1) * viewport_width + 1;
-				optr = imgbuf + y * viewport_width + 3;
-				for (x=12; x<(screen_width- 4) * 3; x+=6) {
-					h = ptrh1[x] - ptrh2[x];
-					if(h  < 0) h = -h;
-					v = ptrv1[x] - ptrv2[x];
-					if(v  < 0) v = -v;
-					optr[x] = h + v;
-					h = ptrh1[x + 3] - ptrh2[x + 3];
-					if(h  < 0) h = -h;
-					v = ptrv1[x + 3] - ptrv2[x + 3];
-					if(v  < 0) v = -v;
-					optr[x + 2] = h + v;
-				}
-			}
-			ymin += (screen_height - 2 * CALCYMARGIN) / NSTAGES;
-			return;
-		}
-		if(inmem &&(ymin >= screen_height-CALCYMARGIN) && 
-			((gui_get_mode() == GUI_MODE_NONE) || (gui_get_mode() == GUI_MODE_ALT))){
-				//thresh = (conf.edge_overlay_thresh - 1) * 12;
-				for (y=MARGIN; y<screen_height-MARGIN; y++) {
-					y1 = y + yoffset;
-					if((y1 < CALCYMARGIN) || (y1 >= screen_height - CALCYMARGIN)) {
-						for (x=MARGIN; x < screen_width - MARGIN; x+=2) {
-							draw_pixel(x, y, 0);
-							draw_pixel(x+1, y, 0);
-						}
-					}
-					else {
-						for (x=MARGIN; x < screen_width - MARGIN; x+=2) {
-							x1 = x + xoffset;
-							if((x1 < 12) || (x1 >= screen_width-13)) {
-								draw_pixel(x, y, 0);
-								draw_pixel(x+1, y, 0);
-							}
-							else {
-								c = 0;
-								if(imgbuf[y1 * viewport_width + x1 * 3 + 3]  > thresh)
-									c = conf.edge_overlay_color;
-								draw_pixel(x, y, c);
-								c = 0;
-								if(imgbuf[y1 * viewport_width + x1 * 3 + 5]  > thresh)
-									c = conf.edge_overlay_color;
-								draw_pixel(x+1, y, c);
-							}
-						}
-				}
-				for (y2=MARGIN; y2<screen_height-MARGIN; y2++) {
-					draw_pixel(XGRID1,y2,0xff);
-					draw_pixel(XGRID2,y2,0xff);
-					if(y2 == YGRID1) for (x=MARGIN; x < screen_width - MARGIN; x++) draw_pixel(x,y2,0xff);
-					if(y2 == YGRID2) for (x=MARGIN; x < screen_width - MARGIN; x++) draw_pixel(x,y2,0xff);
-				}
-				if(shotTaken) draw_string(30, 10, strbuf, conf.osd_color);
-			}
-			return;
-		}
 	}
-	else {
-		full_press = 0;
-		inmem = 0;
-		shotTaken = 0;
-		ymin = 0;
-		xoffset = 0;
-		yoffset = 0;
+	++fnum; // the highest is set, we use the next one
+	get_viewport_size();
+	// open the right file
+	sprintf(fn, EDGE_SAVE_DIR "/" EDGE_FILE_FORMAT, fnum );
+	fd = open(fn, O_RDWR|O_CREAT|O_TRUNC, 0777);
+	if( fd > 0 )
+	{
+		// write the data
+		write(fd,imgbuf,viewport_size);
+		is_saved = 1;
+		close(fd);
+		sprintf(msg, "Saved as %s",fn);
+		draw_string(30, 10, msg, conf.osd_color);
 	}
-	return;
+	closedir(d);
 }
- 
 
-/*// Code to test the idea of an edge overlay
-// Put  		edge_overlay(); 		after the line histogram_process(); 
- 
- 
-// Put the following after  the line #include "motion_detector.h" in main.c
-#include "gui_draw.h"
- 
-// until the edge thresh is put into conf structure I have hardcoded the threshold  see "thresh" below
-static char * imgbuf = 0;
- 
-#define MARGIN 30
-#define CALCYMARGIN 3
-#define EDGECOLOR 0x66
-#define NSTAGES 4
-#define XINC 6
-#define YINC 2
-#define XGRID1 120
-#define XGRID2 240
-#define YGRID1 80
-#define YGRID2 160
- 
+// load the viewport copy thats being used for edge detection (and from that
+// displaying) from a file
+void load_edge_overlay( const char* fn ) {
+	int fd;
+	int ret;
+
+	is_saved = 1; // won't want to save it again, its already there
+	get_viewport_size();
+	ensure_allocate_imagebuffer( );
+	fd = open(fn, O_RDONLY, 0777);
+	if( fd > 0 )
+	{
+		ret = read(fd,imgbuf,viewport_size);
+		close(fd);
+		if( ret == viewport_size )
+		{
+			inmem = 1; // fake having loaded stuff
+		}
+	}
+}
+
+// paint the edge overlay
 void edge_overlay(){
-	static int inmem=0;
-	static int viewport_height;
-	static int viewport_width;// screenwidth * 3
-	static int viewport_size;
+
 	static int shotTaken = 0;
 	static int imgmem = 0;
 	static int ymin = 0;
-	static  int thresh = 40;
+	static int thresh;
+	thresh = conf.edge_overlay_thresh; //40
 	static int xoffset = 0;
 	static int yoffset = 0;
 	static int full_press = 0;//cure for flaky behavior. due to multiple  returns to the scrip during one full press
 	static char strbuf[7] = "Frozen";
- 	static unsigned char *img;
+	static unsigned char *img;
 	int i, hi, c;
 	int x, y, h, v, ymax, y1, x1, y2;
-	char * ptrh1;
-	char * ptrh2;
-	char * ptrv1;
-	char * ptrv2;
+	const char * ptrh1;
+	const char * ptrh2;
+	const char * ptrv1;
+	const char * ptrv2;
+	char xbuf[64];
 	char * optr;
- 
-//	if(!conf.edge_thresh) return;
- 
-	img = vid_get_viewport_fb();
-    viewport_height = vid_get_viewport_height();
-	viewport_width = screen_width * 3;
-    viewport_size = viewport_height * screen_width;
-	if(imgbuf == 0) imgbuf = malloc(viewport_size * 3);
- 
-	if((mode_get()&MODE_MASK) != MODE_PLAY) {
+
+	is_saved = 0; // a new one, we could potentially save it
+	if((mode_get()&MODE_MASK) != MODE_PLAY)
+	{
+		img = vid_get_viewport_fb();
+	}
+	else
+	{
+		img = vid_get_viewport_fb_d();
+	}
+	get_viewport_size();
+	ensure_allocate_imagebuffer( );
+	if(imgbuf == 0) return; // ensure failed, make the best we can out of it
+
+	if(conf.edge_overlay_play || ((mode_get()&MODE_MASK) != MODE_PLAY) ) {
+		// setup offsets for moving the edge overlay around. Always set
+		// need_redraw so that we actually do a complete redraw, overwriting
+		// also old pixels
 		if (kbd_is_key_pressed(KEY_RIGHT)) {
 			xoffset -=XINC;
+			++need_redraw;
 		}
 		if (kbd_is_key_pressed(KEY_LEFT)) {
 			xoffset +=XINC;
+			++need_redraw;
 		}
 		if (kbd_is_key_pressed(KEY_DOWN)) {
 			yoffset -=YINC;
+			++need_redraw;
 		}
 		if (kbd_is_key_pressed(KEY_UP)) {
 			yoffset +=YINC;
+			++need_redraw;
 		}
- 
+
 		if (kbd_is_key_pressed(KEY_SHOOT_HALF)||kbd_is_key_pressed(KEY_SHOOT_FULL)) {
 			if (kbd_is_key_pressed(KEY_SHOOT_FULL) && !full_press) {
 				shotTaken = 1 - shotTaken;
-				memcpy(imgbuf,img,viewport_size * 3);
+				memcpy(imgbuf,img,viewport_size);
 				ymin = CALCYMARGIN;
 				inmem = 1;
 				full_press = 1;
@@ -235,7 +233,7 @@
 			if(shotTaken) {
 				return;
 			}
-			memcpy(imgbuf,img,viewport_size * 3);
+			memcpy(imgbuf,img,viewport_size);
 			ymin = CALCYMARGIN;
 			inmem = 1;
 			xoffset = 0;
@@ -243,6 +241,9 @@
 			return;
 		}
 		else full_press = 0;
+
+
+
 		if (inmem && (ymin < screen_height-CALCYMARGIN)) {
 			ymax = ymin + (screen_height - 2 * CALCYMARGIN) / NSTAGES;
 			if(ymax > screen_height - CALCYMARGIN) ymax = screen_height - CALCYMARGIN;
@@ -268,44 +269,70 @@
 			ymin += (screen_height - 2 * CALCYMARGIN) / NSTAGES;
 			return;
 		}
+
 		if(inmem &&(ymin >= screen_height-CALCYMARGIN) && 
 			((gui_get_mode() == GUI_MODE_NONE) || (gui_get_mode() == GUI_MODE_ALT))){
-//				thresh = (conf.edge_thresh - 1) * 12;
+
 				for (y=MARGIN; y<screen_height-MARGIN; y++) {
 					y1 = y + yoffset;
 					if((y1 < CALCYMARGIN) || (y1 >= screen_height - CALCYMARGIN)) {
+						/*
 						for (x=MARGIN; x < screen_width - MARGIN; x+=2) {
 							draw_pixel(x, y, 0);
 							draw_pixel(x+1, y, 0);
 						}
+						*/
 					}
 					else {
 						for (x=MARGIN; x < screen_width - MARGIN; x+=2) {
 							x1 = x + xoffset;
+							// leave a margin normally, only write to it when a
+							// full redraw is requested
 							if((x1 < 12) || (x1 >= screen_width-13)) {
-								draw_pixel(x, y, 0);
-								draw_pixel(x+1, y, 0);
+								if( need_redraw )
+								{
+									draw_pixel(x, y, 0);
+									draw_pixel(x+1, y, 0);
+								}
 							}
 							else {
-								c = 0;
+								// draw a pixel if the threshold is reached. If
+								// not, draw it transparent only if we want a
+								// complete redraw to overwrite spurious pixels
+								// or if the color of the existing pixel is the
+								// same as the overlay color
 								if(imgbuf[y1 * viewport_width + x1 * 3 + 3]  > thresh)
-									c = EDGECOLOR;
-								draw_pixel(x, y, c);
-								c = 0;
+								{
+									draw_pixel(x, y, conf.edge_overlay_color );
+								}
+								else if( need_redraw || (draw_get_pixel(x,y) == conf.edge_overlay_color) )
+								{
+									draw_pixel(x, y, 0);
+								}
+
 								if(imgbuf[y1 * viewport_width + x1 * 3 + 5]  > thresh)
-									c = EDGECOLOR;
-								draw_pixel(x+1, y, c);
+								{
+									draw_pixel(x+1, y, conf.edge_overlay_color );
+								}
+								else if( need_redraw || (draw_get_pixel(x,y) == conf.edge_overlay_color) )
+								{
+									draw_pixel(x+1, y, 0);
+								}
 							}
 						}
 				}
-				for (y2=MARGIN; y2<screen_height-MARGIN; y2++) {
-					draw_pixel(XGRID1,y2,0xff);
-					draw_pixel(XGRID2,y2,0xff);
-					if(y2 == YGRID1) for (x=MARGIN; x < screen_width - MARGIN; x++) draw_pixel(x,y2,0xff);
-					if(y2 == YGRID2) for (x=MARGIN; x < screen_width - MARGIN; x++) draw_pixel(x,y2,0xff);
-				}
+				// disabled drawing the grid, the new way of drawing the
+				// overlay should leave the standard grid intact, allowing the
+				// custom grid to remain intact too.
 				if(shotTaken) draw_string(30, 10, strbuf, conf.osd_color);
 			}
+			// If a complete redraw was requested, decrement the request. That
+			// way we do it as much as it was requested, also in one run. Will
+			// cause some flickering, but better than nothing.
+			if( need_redraw )
+			{
+				--need_redraw;
+			}
 			return;
 		}
 	}
@@ -319,6 +346,8 @@
 	}
 	return;
 }
+
+// there used to be some commented out version here. it was confusing, so I
+// removed it. Its still in the svn anyways.
  
-//End of edge detector code.  next put  		edge_overlay(); 		after the line histogram_process(); 
-*/
+// vim: tabstop=4 shiftwidth=4
Index: core/edgeoverlay.h
===================================================================
--- core/edgeoverlay.h	(Revision 557)
+++ core/edgeoverlay.h	(Arbeitskopie)
@@ -1,17 +1,22 @@
 #ifndef EDGE_OVERLAY_H
 #define EDGE_OVERLAY_H
 
+// margin in which around the center nothing is displayed. Good for not
+// interfering too much with the OSD
 #define MARGIN 30
+// stuff influencing the algorithm
 #define CALCYMARGIN 3
-//#define EDGECOLOR 0x66
 #define NSTAGES 4
+// steps for up/down/left/right moving the overlay in ALT mode
 #define XINC 6
 #define YINC 2
-#define XGRID1 120
-#define XGRID2 240
-#define YGRID1 80
-#define YGRID2 160
 
+// if you change this, remember to change the mkdir in main too
+#define EDGE_SAVE_DIR "A/CHDK/EDGE"
+
 void edge_overlay();
+void save_edge_overlay(void);
+void load_edge_overlay( const char* );
+void free_memory_edge_overlay(void);
 
 #endif
Index: core/gui.c
===================================================================
--- core/gui.c	(Revision 557)
+++ core/gui.c	(Arbeitskopie)
@@ -43,10 +43,11 @@
 #ifdef OPT_BOOTLOGO
 	#include "gui_logo.h"
 #endif
+#include "edgeoverlay.h"
 //-------------------------------------------------------------------
 
 #define OPTIONS_AUTOSAVE
-#define SPLASH_TIME               20
+#define SPLASH_TIME               5 // XXX A configure option for this would be great
 
 int script_params_has_changed=0;
 //shortcuts
@@ -151,6 +152,11 @@
 #endif
 static void gui_draw_load_lang(int arg);
 static void gui_menuproc_mkbootdisk(int arg);
+static void gui_menuproc_edge_save(int arg);
+static void gui_menuproc_edge_load(int arg);
+static void gui_menuproc_edge_free(int arg);
+static void gui_compare_props(int arg);
+static void gui_compare_params(int arg);
 #ifndef OPTIONS_AUTOSAVE
 static void gui_menuproc_save(int arg);
 #endif
@@ -397,6 +403,8 @@
     {0x2a,LANG_MENU_MAIN_DEBUG,              MENUITEM_SUBMENU,   (int*)&debug_submenu },
 #endif
     {0x2b,LANG_MENU_MAIN_RESET_OPTIONS,      MENUITEM_PROC,      (int*)gui_menuproc_reset },
+    {0x80,LANG_XXX_PROPCOMPARE,        MENUITEM_PROC,    (int*)gui_compare_props},
+    {0x80,LANG_XXX_PARAMCOMPARE,        MENUITEM_PROC,   (int*)gui_compare_params},
     {0x51,LANG_MENU_BACK,                    MENUITEM_UP },
     {0},
 };
@@ -576,6 +584,10 @@
     {0x7f,LANG_MENU_EDGE_OVERLAY_ENABLE,     MENUITEM_BOOL,          &conf.edge_overlay_enable },
     {0x7f,LANG_MENU_EDGE_OVERLAY_TRESH,      MENUITEM_INT|MENUITEM_F_UNSIGNED|MENUITEM_F_MINMAX, &conf.edge_overlay_thresh, MENU_MINMAX(0, 255)},
     {0x65,LANG_MENU_EDGE_OVERLAY_COLOR,      MENUITEM_COLOR_FG,      (int*)&conf.edge_overlay_color },
+    {0x7f,LANG_MENU_EDGE_PLAY,			MENUITEM_BOOL,		&conf.edge_overlay_play },
+    {0x33,LANG_MENU_EDGE_SAVE,			MENUITEM_PROC,		(int*)gui_menuproc_edge_save },
+    {0x33,LANG_MENU_EDGE_LOAD,			MENUITEM_PROC,		(int*)gui_menuproc_edge_load },
+    {0x33,LANG_MENU_EDGE_FREE,			MENUITEM_PROC,		(int*)gui_menuproc_edge_free },
 
     {0x51,LANG_MENU_BACK,                    MENUITEM_UP },
     {0}
@@ -1865,6 +1877,11 @@
 #endif
 }
 
+static void gui_load_edge_selected( const char* fn ) {
+    if( fn )
+	load_edge_overlay(fn);
+}
+
 //-------------------------------------------------------------------
 #ifdef OPT_CURVES
 static void gui_load_curve_selected(const char *fn) {
@@ -2880,6 +2897,30 @@
     mark_filesystem_bootable();
 }
 
+void gui_menuproc_edge_free(int arg) {
+    free_memory_edge_overlay();
+}
+
+void gui_menuproc_edge_save(int arg) {
+    save_edge_overlay();
+}
+
+void gui_menuproc_edge_load(int arg) {
+    DIR   *d;
+    char  *path = EDGE_SAVE_DIR;
+    const char* fn;
+
+    // if exists, go into
+    d=opendir(path);
+    if (d) {
+        closedir(d);
+    } else {
+        path="A";
+    }
+
+    gui_fselect_init(LANG_MENU_EDGE_LOAD, path, gui_load_edge_selected);
+}
+
 //-------------------------------------------------------------------
 #ifdef OPT_CALENDAR
 void gui_draw_calendar(int arg) {
@@ -3014,3 +3055,237 @@
 		find_mnu(&root_menu, conf.user_menu_vars[x], x);
 	}
 }
+
+void gui_compare_props(int arg)
+{
+#define NUM_PROPS 512
+    static int initialized = 0;
+    static int props[NUM_PROPS] = { };
+    char buf[64];
+    int i;
+    int p;
+    int c;
+
+
+    if( initialized )
+    { // we have previous data set! do a comparison
+	c = 0;
+	for( i = 0; i < NUM_PROPS; ++i )
+	{
+	    p = shooting_get_prop(i);
+	    if( props[i] != p )
+	    {
+		++c;
+		sprintf(buf,"%4d is %8d was %8d",i,p,props[i]);
+		draw_string(16,16*c,buf,MAKE_COLOR(COLOR_BLACK,COLOR_YELLOW));
+	    }
+	    props[i] = p;
+	    if( c == 12 )
+	    {
+		++c;
+		sprintf(buf,"%s","Waiting 10 Seconds");
+		draw_string(16,16*c,buf,MAKE_COLOR(COLOR_BLACK,COLOR_YELLOW));
+		msleep(10000);
+		c = 0;
+	    }
+	}
+	++c;
+	sprintf(buf,"%s","Waiting 10 Seconds");
+	draw_string(16,16*c,buf,MAKE_COLOR(COLOR_BLACK,COLOR_YELLOW));
+	msleep(10000);
+    }
+    else
+    {
+	// no previous data was set so we save the data initially
+	for( i = 0; i < NUM_PROPS; ++i )
+	{
+	    props[i] = shooting_get_prop(i);
+	}
+    }
+    initialized = 1;
+}
+
+#define NUM_params 256
+#define BLACKLIST_FILENAME "A/CHDK/DATA/BLACKLIST.PAR"
+static signed char *blacklist = 0;
+int shooting_get_param( int id )
+{
+    int r = 0;
+    int s = sizeof(r);
+    if( blacklist )
+    {
+	if( id < 0 || id >= NUM_params )
+	{
+	    s = 0;
+	}
+	else
+	{
+	    s = blacklist[id];
+	}
+    }
+    if( s )
+    {
+	get_parameter_data(id,&r,s);
+    }
+    return r;
+}
+
+void write_blacklist_file( const signed char* bl )
+{
+    int fd;
+    fd = open(BLACKLIST_FILENAME, O_RDWR|O_CREAT|O_TRUNC, 0777);
+    write(fd,bl,NUM_params);
+    close(fd);
+}
+
+void gui_compare_params(int arg)
+{
+    static int initialized = 0;
+    static int *params = 0;
+    char buf[64];
+    int i;
+    int p;
+    int c;
+    int fd;
+    int test = 0;
+
+    if( 0 == blacklist )
+    { 
+	blacklist = malloc(NUM_params);
+	// blacklist creation/loading of next step wasn't done yet, lets have a look if...
+	// the file exists at all
+	struct stat s;
+	s.st_size = 0;
+
+	stat(BLACKLIST_FILENAME,&s);
+	if( s.st_size < NUM_params )
+	{ // either from another compile or broken in another way or not there or... well whatever
+	    for(i = 0; i < NUM_params; ++i )
+	    { // initialize all to -8 meaning: not yet tested
+		blacklist[i] = -8;
+	    }
+	}
+	else
+	{
+	    // open and read the file
+	    fd = open(BLACKLIST_FILENAME, O_RDONLY,0);
+	    read(fd,blacklist,NUM_params);
+	    close(fd);
+	}
+	/*
+	 * The following entries are possible with the said meaning in the
+	 * blacklist file:
+	 * -8 : This param has not yet been tested, you should do this
+	 * -4 : The last test was tried with reading 4 bytes and failed. Action to be taken: write 2
+	 * -2 : The last test was tried with reading 4 bytes and failed. Action to be taken: write 1
+	 * -1 : The last test was tried with reading 4 bytes and failed. Action to be taken: write 0
+	 *  0 : Not a single byte can ever be read from this location
+	 *  1 : Only ever read 1 byte from the location
+	 *  2 : Only ever read 2 bytes from the location
+	 *  4 : It is save to read 4 bytes from this location
+	 */
+	i = 0;
+	// skip all entries that have been tested already
+	while( i < NUM_params )
+	{
+	    switch(blacklist[i])
+	    {
+		case -8:
+		    sprintf(buf,"Testing param %d read 1",i);
+		    draw_string(16,16,buf,MAKE_COLOR(COLOR_BLACK,COLOR_YELLOW));
+		    // need to test, so... note in the array
+		    blacklist[i] = -1;
+		    write_blacklist_file(blacklist);
+		    get_parameter_data(i,&test,1);
+
+		    sprintf(buf,"Testing param %d read 2",i);
+		    draw_string(16,16,buf,MAKE_COLOR(COLOR_BLACK,COLOR_YELLOW));
+		    // no crash? try more!
+		    blacklist[i] = -2;
+		    write_blacklist_file(blacklist);
+		    get_parameter_data(i,&test,2);
+
+		    sprintf(buf,"Testing param %d read 4",i);
+		    draw_string(16,16,buf,MAKE_COLOR(COLOR_BLACK,COLOR_YELLOW));
+		    // no crash? try more!
+		    blacklist[i] = -4;
+		    write_blacklist_file(blacklist);
+		    get_parameter_data(i,&test,4);
+
+		    sprintf(buf,"Testing param %d was successfull up to 4",i);
+		    draw_string(16,16,buf,MAKE_COLOR(COLOR_BLACK,COLOR_YELLOW));
+		    // still no crash? wow, nice
+		    blacklist[i] = 4;
+		    write_blacklist_file(blacklist);
+		    break;
+		case -4: // last test failed, record this
+		    blacklist[i] = 2;
+		    break;
+		case -2: // last test failed, record this
+		    blacklist[i] = 1;
+		    break;
+		case -1: // last test failed, record this
+		    blacklist[i] = 0;
+		    break;
+		case 0:
+		case 1:
+		case 2:
+		case 4:
+		default:
+		    // this one is safe...
+		    break;
+	    }
+	    // advance to the next...
+	    ++i;
+	}
+	// we went here without any crashes, that means the blacklist is
+	// complete now
+	write_blacklist_file(blacklist);
+    }
+    if( 0 == params )
+    {
+	params = malloc(NUM_params * sizeof(int));
+    }
+
+    if( initialized )
+    { // we have previous data set! do a comparison
+	c = 0;
+	for( i = 0; i < NUM_params; ++i )
+	{
+	    p = shooting_get_param(i);
+	    if( params[i] != p )
+	    {
+		++c;
+		sprintf(buf,"%4d is %8d was %8d",i,p,params[i]);
+		draw_string(16,16*c,buf,MAKE_COLOR(COLOR_BLACK,COLOR_YELLOW));
+	    }
+	    params[i] = p;
+	    if( c == 12 )
+	    {
+		++c;
+		sprintf(buf,"%s","Waiting 10 Seconds");
+		draw_string(16,16*c,buf,MAKE_COLOR(COLOR_BLACK,COLOR_YELLOW));
+		msleep(10000);
+		c = 0;
+	    }
+	}
+	++c;
+	sprintf(buf,"%s","Waiting 10 Seconds");
+	draw_string(16,16*c,buf,MAKE_COLOR(COLOR_BLACK,COLOR_YELLOW));
+	msleep(10000);
+    }
+    else
+    {
+	// no previous data was set so we save the data initially
+	for( i = 0; i < NUM_params; ++i )
+	{
+#if 0
+	    sprintf(buf,"About to read %d",i);
+	    draw_string(16,16,buf,MAKE_COLOR(COLOR_BLACK,COLOR_YELLOW));
+	    msleep(1000);
+#endif
+	    params[i] = shooting_get_param(i);
+	}
+    }
+    initialized = 1;
+}
Index: core/main.c
===================================================================
--- core/main.c	(Revision 557)
+++ core/main.c	(Arbeitskopie)
@@ -68,6 +68,22 @@
         spytask_can_start = 1;
 }
 
+#include "gui.h"
+#include "gui_draw.h"
+
+void brain_dump() 
+{
+    char buf[64];
+    static const int p = 20;
+    static const long a = 4;
+    static int v = 0;
+
+    get_parameter_data(p,&v,a);
+
+    sprintf(buf,"param %d is %d",p,v);
+    draw_string(16,0,buf,MAKE_COLOR(COLOR_BLACK,COLOR_YELLOW));
+}
+
 void core_spytask()
 {
     int cnt = 1;
@@ -103,6 +119,7 @@
 #endif
     mkdir("A/CHDK/DATA");
     mkdir("A/CHDK/LOGS");
+    mkdir("A/CHDK/EDGE");
     auto_started = 0;
 
     if (conf.script_startup==1) script_autostart();				// remote autostart
@@ -130,6 +147,8 @@
 #endif
 	}
 
+//	brain_dump();
+
 	if ((state_shooting_progress == SHOOTING_PROGRESS_PROCESSING) && (!shooting_in_progress())) {
 	    state_shooting_progress = SHOOTING_PROGRESS_DONE;
             if (raw_need_postprocess) raw_postprocess();
Index: core/raw.c
===================================================================
--- core/raw.c	(Revision 557)
+++ core/raw.c	(Arbeitskopie)
@@ -26,7 +26,46 @@
 //-------------------------------------------------------------------
 void patch_bad_pixels(void);
 //-------------------------------------------------------------------
+int raw_savefile_cr();
+int raw_savefile_sensor_dump();
+
 int raw_savefile() {
+	if(1) // XXX Make a config option for this one!
+	{
+		return raw_savefile_sensor_dump(); // "old" format
+	}
+	else
+	{
+		return raw_savefile_cr(); // "new" format
+	}
+}
+
+int raw_savefile_cr() {
+    static struct utimbuf t;
+	int fd;
+//http://lclevy.free.fr/cr2/
+	started();
+
+	t.actime = t.modtime = time(NULL);
+
+	mkdir("A/DCIM");
+	sprintf(dir, RAW_TARGET_DIRECTORY, (conf.raw_in_dir)?get_target_dir_num():100);
+	mkdir(dir);
+
+	sprintf(fn, "%s/", dir);
+	sprintf(fn+strlen(fn), RAW_TARGET_FILENAME, img_prefixes[conf.raw_prefix], get_target_file_num(), img_exts[conf.raw_ext]);
+
+	fd = open(fn, O_WRONLY|O_CREAT, 0777);
+	if (fd>=0) {
+
+		// WRITE DATA! ;)
+	}
+
+	finished();
+	return 0;
+}
+
+int raw_savefile_sensor_dump() {
 		int fd, m=(mode_get()&MODE_SHOOTING_MASK);
     static struct utimbuf t;
     static int br_counter; 
@@ -135,7 +174,7 @@
 //-------------------------------------------------------------------
 
 void set_raw_pixel(unsigned int x, unsigned int y, unsigned short value){
- unsigned char* addr=hook_raw_image_addr()+y*RAW_ROWLEN+(x/8)*10;
+ unsigned char* addr=(unsigned char*)hook_raw_image_addr()+y*RAW_ROWLEN+(x/8)*10;
  switch (x%8) {
   case 0: addr[0]=(addr[0]&0x3F)|(value<<6); addr[1]=value>>2;                  break;
   case 1: addr[0]=(addr[0]&0xC0)|(value>>4); addr[3]=(addr[3]&0x0F)|(value<<4); break;
@@ -150,7 +189,7 @@
 
 //-------------------------------------------------------------------
 unsigned short get_raw_pixel(unsigned int x,unsigned  int y){
- unsigned char* addr=hook_raw_image_addr()+y*RAW_ROWLEN+(x/8)*10;
+ unsigned char* addr=(unsigned char*)hook_raw_image_addr()+y*RAW_ROWLEN+(x/8)*10;
  switch (x%8) {
   case 0: return ((0x3fc&(((unsigned short)addr[1])<<2)) | (addr[0] >> 6));
   case 1: return ((0x3f0&(((unsigned short)addr[0])<<4)) | (addr[3] >> 4));
@@ -244,3 +283,4 @@
     }
 
 }
+// vim: tabstop=4 shiftwidth=4
Index: core/makefile.inc.new
===================================================================
--- core/makefile.inc.new	(Revision 0)
+++ core/makefile.inc.new	(Revision 0)
@@ -0,0 +1,93 @@
+
+LOCAL_CFLAGS:=$(CTHUMB)
+
+# warning: library order matters!
+CORE_LDLIBS:= -lgcc
+CORE_LDOPTS=-nostdlib -Wl,--allow-shlib-undefined -Wl,-T,$(TOPDIR)/tools/link-boot.ld
+CORE_LDOPTS+=-Wl,-N,-Ttext,$(MEMISOSTART)
+
+OPT_OBJS:=
+ifdef OPT_GAME_REVERSI
+LOCAL_CFLAGS +=-DOPT_GAME_REVERSI
+OPT_OBJS+=gui_reversi.o
+endif
+ifdef OPT_GAME_SOKOBAN
+LOCAL_CFLAGS+=-DOPT_GAME_SOKOBAN
+OPT_OBJS+=gui_sokoban.o
+endif
+ifdef OPT_BOOTLOGO
+CFLAGS+=-DOPT_BOOTLOGO
+endif
+ifdef OPT_CURVES
+CFLAGS+=-DOPT_CURVES
+OPT_OBJS+=curves.o
+endif
+ifdef OPT_TEXTREADER
+CFLAGS+=-DOPT_TEXTREADER
+OPT_OBJS+=gui_read.o 
+endif
+ifdef OPT_CALENDAR
+CFLAGS+=-DOPT_CALENDAR
+OPT_OBJS+=gui_calendar.o 
+endif
+ifdef OPT_DEBUGGING
+CFLAGS+=-DOPT_DEBUGGING
+OPT_OBJS+=gui_debug.o gui_bench.o 
+endif
+ifdef OPT_EDGEOVERLAY
+CFLAGS+=-DOPT_EDGEOVERLAY
+OPT_OBJS+=edgeoverlay.o 
+endif
+
+N_OBJS:= nothumb.o
+C_OBJS:= main.o gui_draw.o gui_menu.o gui_palette.o gui_mbox.o \
+     gui_debug.o gui_fselect.o gui_read.o gui.o kbd.o conf.o \
+     histogram.o gui_batt.o gui_space.o gui_osd.o script.o curves.o raw.o gui_calendar.o \
+     gui_lang.o gui_bench.o gui_mpopup.o gui_grid.o motion_detector.o raw_merge.o \
+     luascript.o edgeoverlay.o shot_histogram.o $(OPT_OBJS)
+
+ASM_OBJS:=entry.o
+
+OBJS := $(call subdirize,$(ASM_OBJS) $(C_OBJS) $(N_OBJS) )
+N_OBJS:=$(call subdirize, $(N_OBJS) )
+C_OBJS:=$(call subdirize, $(C_OBJS) )
+ASM_OBJS:=$(call subdirize, $(ASM_OBJS) )
+
+MAIN_LIBS := \
+	$(TOPDIR)/platform/$(PLATFORM)/libplatform.a \
+	$(TOPDIR)/platform/$(PLATFORM)/sub/$(PLATFORMSUB)/libplatformsub.a \
+	$(TOPDIR)/lib/font/libfont.a \
+	$(TOPDIR)/lib/math/libmath.a \
+	$(TOPDIR)/lib/ubasic/libubasic.a \
+	$(TOPDIR)/lib/lang/liblang.a \
+	$(TOPDIR)/lib/lua/liblua.a
+
+core/nothumb.o:: core/nothumb.c
+	@echo $< \-\> $@
+	$(CC) $(CFLAGS) -marm -nostdinc -c -o $@ $<
+
+$(eval $(call compile-targets,$(C_OBJS),$(LOCAL_CFLAGS)))
+$(eval $(call compile-asm-targets,$(ASM_OBJS),$(LOCAL_CFLAGS)))
+
+$(eval $(call gen-rule, $(subdir)/main.bin, $(OBJS) $(subdir)/main.elf,  \
+	$(OBJDUMP) -z -d $(subdir)/main.elf > $(subdir)/main.dump; \
+	$(OBJCOPY) -O binary $(subdir)/main.elf $(subdir)/main.bin ))
+
+define postprocess-main-elf
+	( $(NM) $(subdir)/main.elf | grep ' U ' > $(subdir)/main.elf.syms ) && exit 1 || exit 0;
+	$(SIZE) $(subdir)/main.elf | tee $(TOPDIR)/size.txt;
+	$(SIZLENCE)printf " %s-%s (%s, #%s): MEMISOSIZE used: 0x%s\n" \
+	$(PLATFORM) $(PLATFORMSUB) $(PLATFORMOS) $(PLATFORMID) \
+	`cut -f5 $(TOPDIR)/size.txt | tail -1` >> $(TOPDIR)/bin/caminfo.txt;
+endef
+
+$(eval $(call gen-rule, $(subdir)/main.elf, $(OBJS) $(MAIN_LIBS), \
+    $(CC) $(CFLAGS) $(LOCAL_CFLAGS) -o $$@ --start-group $$^  $(CORE_LDLIBS) --end-group $(LDFLAGS) $(CORE_LDOPTS) || exit 1; \
+    $(call postprocess-main-elf) \
+    ))
+
+$(eval $(call gen-rule, core-clean,, rm -f $(OBJS) $(subdir)/*.$(DEPSUFFIX) $(subdir)/main.bin $(subdir)/main.elf $(subdir)/main.dump $(subdir)/main.elf.syms ))
+
+$(eval $(call gen-rule, core-distclean, core-clean, rm -f $(OBJS:.o=.d) ))
+
+# vim: filetype=make
Index: version.inc
===================================================================
--- version.inc	(Revision 557)
+++ version.inc	(Arbeitskopie)
@@ -1 +1 @@
-BUILD_NUMBER := 0.7.4
+BUILD_NUMBER := 0.7.4-p0
Index: tools/makefile.inc.new
===================================================================
--- tools/makefile.inc.new	(Revision 0)
+++ tools/makefile.inc.new	(Revision 0)
@@ -0,0 +1,55 @@
+
+
+OBJS:=pakwif.o finsig.o gensig.o dumpchk.o
+OBJS:=$(call subdirize,$(OBJS))
+
+$(eval $(call compile-host-targets, $(OBJS), -DPLATFORMOS_$(PLATFORMOS) ) )
+
+$(eval $(call gen-rule, $(subdir)/pakwif$(EXE), $(subdir)/pakwif.o, $(HOSTCC) $(HOSTCFLAGS) -o $$@ $$^ ))
+$(eval $(call gen-rule, $(subdir)/finsig$(EXE), $(subdir)/finsig.o, $(HOSTCC) $(HOSTCFLAGS) -o $$@ $$^ ))
+$(eval $(call gen-rule, $(subdir)/gensig$(EXE), $(subdir)/gensig.o, $(HOSTCC) $(HOSTCFLAGS) -o $$@ $$^ ))
+$(eval $(call gen-rule, $(subdir)/dumpchk$(EXE), $(subdir)/dumpchk.o, $(HOSTCC) $(HOSTCFLAGS) -o $$@ $$^ ))
+
+$(eval $(call gen-rule,tools-clean,,rm -f $(subdir)/*.HOST.d $(subdir)/pakwif$(EXE) $(subdir)/finsig$(EXE) $(subdir)/gensig$(EXE) $(OBJS)))
+#	if [ -s sig_ref_vxworks_1.bin ] && [ -s sig_ref_vxworks_2.bin ] && [ -s sig_ref_vxworks_3.bin ] ; then \
+#	  rm -f signatures_vxworks.h ; \
+#	fi
+#	if [ -s sig_ref_dryos_1.bin ] ; then \
+#	  rm -f signatures_dryos.h ; \
+#	fi
+
+tools-distclean: tools-clean
+#	rm -f signatures.h
+
+
+tools/signatures_vxworks.h: tools/gensig$(EXE) tools/gensigs.sh tools/sig_ref_vxworks_1.txt tools/sig_ref_vxworks_1.bin tools/sig_ref_vxworks_2.txt tools/sig_ref_vxworks_2.bin tools/sig_ref_vxworks_3.txt tools/sig_ref_vxworks_3.bin
+	@echo \-\> $@
+	if [ -s tools/sig_ref_vxworks_1.bin ] && [ -s tools/sig_ref_vxworks_2.bin ] && [ -s tools/sig_ref_vxworks_3.bin ] ; then \
+	  $(SH) tools/gensigs.sh $(SORT) vxworks "1 2 3" > tools/signatures_vxworks.h ; \
+	else \
+	  echo CAUTION! \'signatures_vxworks.h\' is not uptated due to \'sig_ref_vxworks_1.bin\` or \'sig_ref_vxworks_2.bin\` or \'sig_ref_vxworks_3.bin\` is empty! ; \
+	  touch tools/signatures_vxworks.h ; \
+	fi
+
+tools/signatures_dryos.h: tools/gensig$(EXE) tools/gensigs.sh tools/sig_ref_dryos_1.txt tools/sig_ref_dryos_1.bin
+	@echo \-\> $@
+	if [ -s tools/sig_ref_dryos_1.bin ] ; then \
+	  $(SH) tools/gensigs.sh $(SORT) dryos "1" > tools/signatures_dryos.h ; \
+	else \
+	  echo CAUTION! \'signatures_dryos.h\' is not uptated due to \'sig_ref_dryos_1.bin\` is empty! ; \
+	  touch tools/signatures_dryos.h ; \
+	fi
+
+tools/sig_ref_vxworks_1.bin:
+	touch tools/sig_ref_vxworks_1.bin
+
+tools/sig_ref_vxworks_2.bin:
+	touch tools/sig_ref_vxworks_2.bin
+
+tools/sig_ref_vxworks_3.bin:
+	touch tools/sig_ref_vxworks_3.bin
+
+tools/sig_ref_dryos_1.bin:
+	touch tools/sig_ref_dryos_1.bin
+
+# vim: filetype=make
Index: Makefile.new
===================================================================
--- Makefile.new	(Revision 0)
+++ Makefile.new	(Revision 0)
@@ -0,0 +1,704 @@
+# This is an entirely new set of makefiles, completely independent from the
+# usual ones. The primary goal is to have proper (partly auto-generated during
+# compile, without a separate make depend step) dependencies. It uses a
+# completely different philosophy of generating the rules, so you need a pretty
+# new make version (3.81 or higher). The advantage is that now you should be
+# able to do a make -j N for quite big Ns (as much as you have cores + 2
+# recommended) to massively speed up your builds.
+
+#PLATFORM=s3is
+#PLATFORMSUB=100a
+
+#PLATFORM=a620
+#PLATFORMSUB=100f
+
+#PLATFORM=ixus40_sd300
+#PLATFORMSUB=100k
+
+#PLATFORM=sx100is
+#PLATFORMSUB=100c
+
+#PLATFORM=sx100is
+#PLATFORMSUB=100b
+
+#PLATFORM=ixus50_sd400
+#PLATFORMSUB=101a
+
+#PLATFORM=ixus50_sd400
+#PLATFORMSUB=101b
+
+#PLATFORM=ixus750_sd550
+#PLATFORMSUB=100f
+
+#PLATFORM=ixus750_sd550
+#PLATFORMSUB=100g
+
+#PLATFORM=a640
+#PLATFORMSUB=100b
+
+#PLATFORM=a700
+#PLATFORMSUB=100b
+
+#PLATFORM=a710
+#PLATFORMSUB=100a
+
+#PLATFORM=s2is
+#PLATFORMSUB=100e
+
+#PLATFORM=s2is
+#PLATFORMSUB=100f
+
+#PLATFORM=s2is
+#PLATFORMSUB=100g
+
+#PLATFORM=g7
+#PLATFORMSUB=100e
+
+#PLATFORM=g7
+#PLATFORMSUB=100g
+
+#PLATFORM=g7
+#PLATFORMSUB=100i
+
+#PLATFORM=g7
+#PLATFORMSUB=100j
+
+#PLATFORM=a530
+#PLATFORMSUB=100a
+
+#PLATFORM=a540
+#PLATFORMSUB=100b
+
+#PLATFORM=a560
+#PLATFORMSUB=100a
+
+#PLATFORM=a570
+#PLATFORMSUB=100a
+
+#PLATFORM=a570
+#PLATFORMSUB=100e
+
+#PLATFORM=a610
+#PLATFORMSUB=100e
+
+#PLATFORM=a610
+#PLATFORMSUB=100f
+
+#PLATFORM=ixus700_sd500
+#PLATFORMSUB=101a
+
+#PLATFORM=ixus700_sd500
+#PLATFORMSUB=101b
+
+#PLATFORM=ixus800_sd700
+#PLATFORMSUB=100b
+
+#PLATFORM=ixus800_sd700
+#PLATFORMSUB=101b
+
+#PLATFORM=a720
+#PLATFORMSUB=100c
+
+#PLATFORM=ixus850_sd800
+#PLATFORMSUB=100e
+
+#PLATFORM=ixus860_sd870
+#PLATFORMSUB=100c
+
+PLATFORM=ixus950_sd850
+PLATFORMSUB=100c
+
+#PLATFORM=ixus55_sd450
+#PLATFORMSUB=100b
+
+#PLATFORM=ixus55_sd450
+#PLATFORMSUB=100c
+
+#PLATFORM=ixus55_sd450
+#PLATFORMSUB=100d
+
+#PLATFORM=ixus60_sd600
+#PLATFORMSUB=100a
+
+#PLATFORM=ixus60_sd600
+#PLATFORMSUB=100d
+
+#PLATFORM=ixus70_sd1000
+#PLATFORMSUB=100c
+
+#PLATFORM=ixus70_sd1000
+#PLATFORMSUB=101b
+
+#PLATFORM=ixus70_sd1000
+#PLATFORMSUB=102a
+
+#PLATFORM=a650
+#PLATFORMSUB=100d
+
+#PLATFORM=a450
+#PLATFORMSUB=100d
+
+#PLATFORM=a460
+#PLATFORMSUB=100d
+
+#PLATFORM=a550
+#PLATFORMSUB=100c
+
+#PLATFORM=a630
+#PLATFORMSUB=100c
+
+#PLATFORM=s5is
+#PLATFORMSUB=101a
+
+#PLATFORM=s5is
+#PLATFORMSUB=101b
+
+#PLATFORM=ixus65_sd630
+#PLATFORMSUB=100a
+
+#PLATFORM=tx1
+#PLATFORMSUB=100g
+
+#PLATFORM=tx1
+#PLATFORMSUB=101b
+
+#PLATFORM=ixus960_sd950
+#PLATFORM=100d
+
+TOPDIR:=.
+SRCDIR:=.
+BINDIR:=$(TOPDIR)/bin
+
+VER=CHDK
+
+# build time optional components
+OPT_LUA_IOLIB=1
+OPT_LUA_OSLIB=1
+#OPT_LUA_STRLIB=1
+OPT_GAME_REVERSI=1
+OPT_GAME_SOKOBAN=1
+
+MEMISOSIZE="(&_end-&_start)"
+include $(TOPDIR)/version.inc
+include $(TOPDIR)/buildconf.inc
+include $(TOPDIR)/platform/$(PLATFORM)/sub/$(PLATFORMSUB)/makefile.inc
+
+NOZERO100K=TRUE
+
+##########################################################################
+##########################################################################
+##########################################################################
+
+ESED = sed -r
+
+ifndef OSTYPE
+  HOSTPLATFORM:=$(patsubst MINGW%,MINGW,$(shell uname -s))
+  ifeq ($(HOSTPLATFORM),MINGW)
+    OSTYPE = Windows
+    EXE = .exe
+    SH = sh
+    DEVNULL = NUL
+    SORT = $(dir $(shell which uniq.exe | sed s/\\\\/\\\/g))/sort.exe
+  else
+    ifeq ($(HOSTPLATFORM),Linux)
+      OSTYPE = Linux
+      EXE =
+      SH =
+      DEVNULL = /dev/null
+      SORT = sort
+    else
+      ifeq ($(HOSTPLATFORM),Darwin)
+        OSTYPE = Darwin
+        EXE =
+        SH =
+        DEVNULL = /dev/null
+        SORT = sort
+        ESED = sed -E
+      else
+        OSTYPE = Other
+        EXE =
+        SH =
+        DEVNULL = /dev/null
+        SORT = sort
+      endif
+    endif
+  endif
+else
+  EXE =
+  SH =
+  DEVNULL = /dev/null
+  SORT = sort
+endif
+
+##########################################################################
+##########################################################################
+##########################################################################
+
+HOSTCC=gcc
+HOSTCFLAGS=-g -O2 -Wall
+
+PAKWIF=$(TOPDIR)/tools/pakwif$(EXE)
+
+##########################################################################
+
+CC=arm-elf-gcc
+OBJCOPY=arm-elf-objcopy
+OBJDUMP=arm-elf-objdump
+STRIP=arm-elf-strip
+NM=arm-elf-nm
+AR=arm-elf-ar
+RANLIB=arm-elf-ranlib
+SIZE=arm-elf-size
+
+# -msoft-float is used per default but object files are marked as hard-float
+CFLAGS:=-fno-inline -fno-strict-aliasing -Wall -Os
+# -Wextra
+
+# flags for gcc v4
+# CFLAGS+=-mtune=arm946e-s
+CTHUMB:=-mthumb
+CFLAGS+=-mthumb-interwork
+CFLAGS+=-I$(TOPDIR)/include $(PLFLAGS) $(CPPFLAGS)
+CFLAGS+=-DPLATFORM=\"$(PLATFORM)\" -DPLATFORMSUB=\"$(PLATFORMSUB)\" -DHDK_VERSION=\"$(VER)\" -DBUILD_NUMBER=\"$(BUILD_NUMBER)\" -DCAMERA_$(PLATFORM)=1
+CFLAGS+=-Wall -Wno-unused -Wno-format
+LDFLAGS:=-L$(TOPDIR)/lib/math -L$(TOPDIR)/lib/font
+LDFLAGS+=-L$(TOPDIR)/lib/libc -L$(TOPDIR)/lib/ubasic
+LDFLAGS+=-L$(TOPDIR)/platform/$(PLATFORM) -L$(TOPDIR)/platform/$(PLATFORM)/sub/$(PLATFORMSUB)
+
+##########################################################################
+
+#ifndef NO_INC_BUILD
+#BUILD_NUMBER := $(shell expr $(BUILD_NUMBER) + 1)
+#endif
+
+ifdef VERBOSE
+    ECHOTARGET:=&> /dev/null
+    SILENCE:=
+else
+    ECHOTARGET:=
+    SILENCE:=@
+endif
+
+SUBDIRS=tools lib platform core loader
+SUBRULES := all clean distclean
+
+default: all
+
+DEPFLAGS:=-MD -MF
+DEPSUFFIX:=$(PLATFORM)_$(PLATFORMSUB).d
+define single-compile-targets
+-include $(1).$(DEPSUFFIX)
+$(1): $(1:.o=.c) $(3)
+	@echo $$< \-\> $$@
+	$(CC) $(CFLAGS) $(2) $(DEPFLAGS) $(1).$(DEPSUFFIX) -nostdinc -o $$@ -c $$<
+endef
+
+define compile-targets
+$(foreach target,$(1),$(eval $(call single-compile-targets,$(target),$(2),$(3) ) ) )
+endef
+
+define single-compile-host-targets
+-include $(1).HOST.d
+$(1): $(1:.o=.c) $(3)
+	@echo $$< \-\> $$@
+	$(HOSTCC) $(HOSTCFLAGS) $(2) $(DEPFLAGS) $(1).HOST.d -o $$@ -c $$<
+endef
+
+define compile-host-targets
+$(foreach target,$(1),$(eval $(call single-compile-host-targets,$(target),$(2),$(3) ) ) )
+endef
+
+define single-compile-asm-targets
+-include $(1).$(PLATFORM)_$(PLATFORMSUB).d
+$(1): $(1:.o=.S) $(3)
+	@echo $$< \-\> $$@
+	$(CC) $(CFLAGS) $(2) $(DEPFLAGS) $(1).$(DEPSUFFIX) -nostdinc -o $$@ -c $$<
+endef
+
+define compile-asm-targets
+$(foreach target,$(1),$(eval $(call single-compile-asm-targets,$(target),$(2),$(3) ) ) )
+endef
+
+# use this helper function if you want to have immedeate evaluation of your
+# variables (usually for $(OBJS) you want) instead of evaluation only at the
+# point the rule is executed. As a nice side-effect this also prints whats going on, rule-wise
+define gen-rule
+$(1):: $(2)
+	@echo Executing commands for rule $(1): prerequisites \[$(strip $(2))\] already done
+	$(SILENCE)$(3)
+endef
+
+define ar-targets
+$(subdir)/$(strip $(1)): $(2)
+	@echo creating $(1) from $(2)
+	$(SILENCE)$(AR) rcs $(subdir)/$(strip $(1)) $(2)
+endef
+
+# rules for debugging, need to be tweaked each time
+#%.o: %.S
+#	if [ -n "$(echo $@ $< | grep \/)" ]; then echo $@ $< FAIL, PLEASE FIX RULE!; exit 1; fi
+#
+#%.o: %.c
+#	if [ -n "$(echo $@ $< | grep \/)" ]; then echo $@ $< FAIL, PLEASE FIX RULE!; exit 1; fi
+
+.dep/%.d: %.c .dep
+	$(CC) $(CFLAGS) -M $< > $@.$$$$; \
+	    sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
+	    rm -f $@.$$$$
+
+.dep/%.d: %.S .dep
+	$(CC) $(CFLAGS) -M $< > $@.$$$$; \
+	    sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
+	    rm -f $@.$$$$
+
+all: fir $(PAKWIF) tools/gensig tools/finsig
+
+
+clean: clean-recursive
+
+distclean: distclean-recursive
+
+.dep:
+	mkdir .dep
+
+.PHONY: $(SUBDIRS)
+
+define subdirize
+$(foreach f,$(1),$(subdir)/$(f))
+endef
+
+SAVEDSUBDIRS:=$(SUBDIRS) # the includes sometimes overwrite SUBDIRS
+# be carefull to leave the varname subdir it is used in the included makefiles
+#$(foreach subdir,$(SUBDIRS),$(info "include $(subdir)/makefile.inc.new") )
+$(foreach subdir,$(SUBDIRS),$(eval include $(subdir)/makefile.inc.new) )
+SUBDIRS:=$(SAVEDSUBDIRS)
+VPATH:=$(TOPDIR)
+
+#$(strip $(1))-recursive: $(foreach subdir,$(SUBDIRS),$(info "Generating $(strip $(1))-recursive: $(subdir)-$(strip $(1))"))
+define subdir-recursive-rule
+$(eval $(call gen-rule, $(strip $(1))-recursive, $(foreach subdir,$(SUBDIRS),$(subdir)-$(strip $(1))),))
+endef
+
+$(foreach subrule,$(SUBRULES),$(eval $(call subdir-recursive-rule,$(strip $(subrule) ) ) ) )
+
+MAKE:=$(MAKE) -f Makefile.new
+
+$(BINDIR):
+	@echo mkdir -p $@ $(ECHOTARGET)
+	$(SILENCE)mkdir -p $@
+
+
+
+fir: version firsub
+
+firsub: $(BINDIR) $(TOPDIR)/loader/$(PLATFORM)/main.bin $(PAKWIF)
+	$(SILENCE)mkdir -p $(TOPDIR)/bin
+	$(SILENCE)cp $(TOPDIR)/loader/$(PLATFORM)/main.bin $(TOPDIR)/bin/main.bin
+ifndef NOZERO100K
+ifeq ($(OSTYPE),Windows)
+	zero | dd bs=1k count=100 >> $(TOPDIR)/bin/main.bin 2> $(DEVNULL)
+else
+	dd if=/dev/zero bs=1k count=100 >> $(TOPDIR)/bin/main.bin 2> $(DEVNULL)
+endif
+endif
+ifdef PLATFORMOS
+  ifeq ($(PLATFORMOS),vxworks)
+	@echo \-\> $(PLATFORM)-$(PLATFORMSUB).FIR
+	$(PAKWIF) $(TOPDIR)/bin/$(PLATFORM)-$(PLATFORMSUB).FIR \
+	     $(TOPDIR)/bin/main.bin\
+	    $(PLATFORMID) 0x01000101
+  endif
+  ifeq ($(PLATFORMOS),dryos)
+	#@echo \-\> $(PLATFORM)-$(PLATFORMSUB).FI2
+  endif
+endif
+	mv $(TOPDIR)/bin/main.bin $(TOPDIR)/bin/DISKBOOT.BIN
+	@echo "**** Firmware creation completed successfully"
+
+upload: fir
+	@echo Uploading...
+	cp $(TOPDIR)/bin/$(PLATFORM)-$(PLATFORMSUB).FIR $(TOPDIR)/bin/PS.FIR
+	/home/vitalyb/Projects/ch/libptp2-1.1.0/src/ptpcam -u -m 0xbf01 --filename $(TOPDIR)/bin/PS.FIR
+
+infoline:
+	@echo "**** BUILDING CHDK-$(VER), #$(BUILD_NUMBER) FOR $(PLATFORM)-$(PLATFORMSUB)"
+
+version: FORCE
+	@echo "**** Build: $(BUILD_NUMBER)"
+	@echo "BUILD_NUMBER := $(BUILD_NUMBER)" > version.inc
+
+FORCE:
+
+firzip: version clean
+	$(MAKE) firsub
+
+firzipsub: infoline firzip
+	@echo \-\> $(VER)-$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER).zip
+	rm -f $(TOPDIR)/bin/$(VER)-$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER).zip
+	LANG=C echo -e "CHDK-$(VER) for $(PLATFORM) fw:$(PLATFORMSUB) build:$(BUILD_NUMBER) date:`date -R`" | \
+	    zip -9jz $(TOPDIR)/bin/$(VER)-$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER).zip $(TOPDIR)/bin/DISKBOOT.BIN > $(DEVNULL)
+ifdef PLATFORMOS
+  ifeq ($(PLATFORMOS),vxworks)
+	cp $(TOPDIR)/bin/$(PLATFORM)-$(PLATFORMSUB).FIR $(TOPDIR)/bin/PS.FIR
+	zip -9j $(TOPDIR)/bin/$(VER)-$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER).zip $(TOPDIR)/bin/PS.FIR > $(DEVNULL)
+	rm -f $(TOPDIR)/bin/$(PLATFORM)-$(PLATFORMSUB).FIR
+	rm -f $(TOPDIR)/bin/PS.FIR
+  endif
+  ifeq ($(PLATFORMOS),dryos)
+	#cp $(TOPDIR)/bin/$(PLATFORM)-$(PLATFORMSUB).FI2 $(TOPDIR)/bin/PS.FI2
+	#zip -9jc $(TOPDIR)/bin/$(VER)-$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER).zip $(TOPDIR)/bin/PS.FI2 > $(DEVNULL)
+	#rm -f $(TOPDIR)/bin/PS.FI2
+  endif
+endif
+	rm -f $(TOPDIR)/bin/DISKBOOT.BIN
+
+firzipsubcomplete: infoline clean firsub
+	@echo \-\> $(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full.zip
+	rm -f $(TOPDIR)/bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full.zip
+	@echo \-\> $(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER).zip
+	rm -f $(TOPDIR)/bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER).zip
+	LANG=C echo -e "CHDK-$(VER) for $(PLATFORM) fw:$(PLATFORMSUB) build:$(BUILD_NUMBER) date:`date -R`" | \
+	zip -9jz $(TOPDIR)/bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full.zip $(TOPDIR)/bin/DISKBOOT.BIN > $(DEVNULL)
+	LANG=C echo -e "CHDK-$(VER) for $(PLATFORM) fw:$(PLATFORMSUB) build:$(BUILD_NUMBER) date:`date -R`" | \
+	zip -9jz $(TOPDIR)/bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER).zip $(TOPDIR)/bin/DISKBOOT.BIN > $(DEVNULL)
+	zip -9 $(TOPDIR)/bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full.zip $(TOPDIR)/CHDK/SYMBOLS/*  > $(DEVNULL)
+	zip -9 $(TOPDIR)/bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full.zip $(TOPDIR)/CHDK/BOOKS/*  > $(DEVNULL)
+	zip -9 $(TOPDIR)/bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full.zip $(TOPDIR)/CHDK/CURVES/*  > $(DEVNULL)
+	zip -9 $(TOPDIR)/bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full.zip $(TOPDIR)/CHDK/FONTS/*  > $(DEVNULL)
+	zip -9 $(TOPDIR)/bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full.zip $(TOPDIR)/CHDK/GAMES/*   > $(DEVNULL)
+	zip -9 $(TOPDIR)/bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full.zip $(TOPDIR)/CHDK/GRIDS/* > $(DEVNULL)
+	zip -9 $(TOPDIR)/bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full.zip $(TOPDIR)/CHDK/LANG/*   > $(DEVNULL)
+	zip -9 $(TOPDIR)/bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full.zip $(TOPDIR)/CHDK/SCRIPTS/*  > $(DEVNULL)
+	zip -9 $(TOPDIR)/bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full.zip $(TOPDIR)/CHDK/SCRIPTS/examples/* 	 > $(DEVNULL)
+	zip -9 $(TOPDIR)/bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full.zip $(TOPDIR)/CHDK/syscurves.CVF 	 > $(DEVNULL)
+	zip -9j $(TOPDIR)/bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full.zip $(TOPDIR)/doc/version.txt  > $(DEVNULL)
+	zip -9j $(TOPDIR)/bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER).zip $(TOPDIR)/doc/version.txt  > $(DEVNULL)
+	zip -9j $(TOPDIR)/bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full.zip $(TOPDIR)/tools/vers.req  > $(DEVNULL)
+ifdef PLATFORMOS
+  ifeq ($(PLATFORMOS),vxworks)
+	cp $(TOPDIR)/bin/$(PLATFORM)-$(PLATFORMSUB).FIR $(TOPDIR)/bin/PS.FIR
+	zip -9j $(TOPDIR)/bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full.zip $(TOPDIR)/bin/PS.FIR > $(DEVNULL)
+	zip -9j $(TOPDIR)/bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER).zip $(TOPDIR)/bin/PS.FIR > $(DEVNULL)
+	cat $(TOPDIR)/doc/1_intro.txt $(TOPDIR)/platform/$(PLATFORM)/notes.txt $(TOPDIR)/doc/2_vxworks.txt $(TOPDIR)/doc/3_faq.txt $(TOPDIR)/doc/4_urls.txt $(TOPDIR)/doc/5_gpl.txt > $(TOPDIR)/doc/readme.txt
+	zip -9j $(TOPDIR)/bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full.zip $(TOPDIR)/doc/readme.txt  > $(DEVNULL)
+	zip -9j $(TOPDIR)/bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER).zip $(TOPDIR)/doc/readme.txt  > $(DEVNULL)
+	rm -f $(TOPDIR)/bin/$(PLATFORM)-$(PLATFORMSUB).FIR
+	rm -f $(TOPDIR)/bin/PS.FIR
+  endif
+  ifeq ($(PLATFORMOS),dryos)
+	cat $(TOPDIR)/doc/1_intro.txt $(TOPDIR)/platform/$(PLATFORM)/notes.txt $(TOPDIR)/doc/2_dryos.txt $(TOPDIR)/doc/3_faq.txt $(TOPDIR)/doc/4_urls.txt $(TOPDIR)/doc/5_gpl.txt > $(TOPDIR)/doc/readme.txt
+	zip -9j $(TOPDIR)/bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full.zip $(TOPDIR)/doc/readme.txt  > $(DEVNULL)
+	zip -9j $(TOPDIR)/bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER).zip $(TOPDIR)/doc/readme.txt  > $(DEVNULL)
+	#cp $(TOPDIR)/bin/$(PLATFORM)-$(PLATFORMSUB).FI2 $(TOPDIR)/bin/PS.FI2
+	#zip -9jc $(TOPDIR)/bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full.zip $(TOPDIR)/bin/PS.FI2 > $(DEVNULL)
+	#zip -9jc $(TOPDIR)/bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER).zip $(TOPDIR)/bin/PS.FI2 > $(DEVNULL)
+	#rm -f $(TOPDIR)/bin/PS.FI2
+  endif
+endif
+	rm -f $(TOPDIR)/bin/DISKBOOT.BIN
+
+
+batch-zip: version
+	$(MAKE)   -s --no-print-directory PLATFORM=a610 PLATFORMSUB=100e NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=a610 PLATFORMSUB=100f NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=a620 PLATFORMSUB=100f NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=a630 PLATFORMSUB=100c NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=a640 PLATFORMSUB=100b NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=a700 PLATFORMSUB=100b NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=a710 PLATFORMSUB=100a NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=s2is PLATFORMSUB=100e NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=s2is PLATFORMSUB=100f NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=s2is PLATFORMSUB=100g NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=s3is PLATFORMSUB=100a NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=g7   PLATFORMSUB=100e NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=g7   PLATFORMSUB=100g NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=g7   PLATFORMSUB=100i NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=g7   PLATFORMSUB=100j NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=a530 PLATFORMSUB=100a NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=a540 PLATFORMSUB=100b NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=a560 PLATFORMSUB=100a NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=a570 PLATFORMSUB=100e NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=a570 PLATFORMSUB=101a NO_INC_BUILD=1 firzipsub
+	#$(MAKE)  -s --no-print-directory PLATFORM=s80  PLATFORMSUB=100g NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus700_sd500   PLATFORMSUB=101a NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus700_sd500   PLATFORMSUB=101b NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus800_sd700   PLATFORMSUB=101b NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus800_sd700   PLATFORMSUB=100b NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus850_sd800   PLATFORMSUB=100e NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus860_sd870   PLATFORMSUB=100c NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus950_sd850   PLATFORMSUB=100c NO_INC_BUILD=1 firzipsub	
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus40_sd300    PLATFORMSUB=100k NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus50_sd400    PLATFORMSUB=101a NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus50_sd400    PLATFORMSUB=101b NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus55_sd450    PLATFORMSUB=100b NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus55_sd450    PLATFORMSUB=100c NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus55_sd450    PLATFORMSUB=100d NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus65_sd630    PLATFORMSUB=100a NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus70_sd1000   PLATFORMSUB=100c NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus70_sd1000   PLATFORMSUB=101b NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus70_sd1000   PLATFORMSUB=102a NO_INC_BUILD=1 firzipsub
+	#$(MAKE)  -s --no-print-directory PLATFORM=ixusW_sd430     PLATFORMSUB=110a NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=a720 PLATFORMSUB=100c NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=a650 PLATFORMSUB=100d NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=a450 PLATFORMSUB=100d NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=a460 PLATFORMSUB=100d NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=a550 PLATFORMSUB=100c NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=s5is PLATFORMSUB=101a NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=s5is PLATFORMSUB=101b NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=tx1  PLATFORMSUB=100g NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=tx1  PLATFORMSUB=101b NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=sx100is  PLATFORMSUB=100b NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=sx100is  PLATFORMSUB=100c NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus750_sd550  PLATFORMSUB=100f NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus750_sd550  PLATFORMSUB=100g NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus60_sd600  PLATFORMSUB=100a NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus60_sd600  PLATFORMSUB=100d NO_INC_BUILD=1 firzipsub
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus960_sd950  PLATFORMSUB=100d NO_INC_BUILD=1 firzipsub
+	@echo "**** All firmwares created successfully"
+	@echo "**** Copying duplicate Firmwares"
+	cp $(TOPDIR)/bin/$(VER)-a610-100e-$(BUILD_NUMBER).zip $(TOPDIR)/bin/$(VER)-a610-100d-$(BUILD_NUMBER).zip
+	cp $(TOPDIR)/bin/$(VER)-s2is-100g-$(BUILD_NUMBER).zip $(TOPDIR)/bin/$(VER)-s2is-100i-$(BUILD_NUMBER).zip
+	cp $(TOPDIR)/bin/$(VER)-ixus800_sd700-101b-$(BUILD_NUMBER).zip $(TOPDIR)/bin/$(VER)-ixus800_sd700-101a-$(BUILD_NUMBER).zip
+	cp $(TOPDIR)/bin/$(VER)-ixus850_sd800-100e-$(BUILD_NUMBER).zip $(TOPDIR)/bin/$(VER)-ixus850_sd800-100d-$(BUILD_NUMBER).zip
+	cp $(TOPDIR)/bin/$(VER)-ixus70_sd1000-101b-$(BUILD_NUMBER).zip $(TOPDIR)/bin/$(VER)-ixus70_sd1000-101a-$(BUILD_NUMBER).zip
+	@echo "**** Done Copying duplicate Firmwares"
+	@echo "**** Summary of memisosizes"
+	cat $(TOPDIR)/bin/caminfo.txt
+	rm -f $(TOPDIR)/bin/caminfo.txt   > $(DEVNULL)
+
+batch-zip-complete: version
+	$(MAKE)  -s --no-print-directory PLATFORM=a610 PLATFORMSUB=100e NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=a610 PLATFORMSUB=100f NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=a620 PLATFORMSUB=100f NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=a630 PLATFORMSUB=100c NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=a640 PLATFORMSUB=100b NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=a700 PLATFORMSUB=100b NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=a710 PLATFORMSUB=100a NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=s2is PLATFORMSUB=100e NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=s2is PLATFORMSUB=100f NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=s2is PLATFORMSUB=100g NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=s3is PLATFORMSUB=100a NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=g7   PLATFORMSUB=100e NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=g7   PLATFORMSUB=100g NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=g7   PLATFORMSUB=100i NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=g7   PLATFORMSUB=100j NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=a530 PLATFORMSUB=100a NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=a540 PLATFORMSUB=100b NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=a560 PLATFORMSUB=100a NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=a570 PLATFORMSUB=100e NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=a570 PLATFORMSUB=101a NO_INC_BUILD=1 firzipsubcomplete
+	#$(MAKE)  -s --no-print-directory PLATFORM=s80  PLATFORMSUB=100g NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus700_sd500   PLATFORMSUB=101a NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus700_sd500   PLATFORMSUB=101b NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus800_sd700   PLATFORMSUB=101b NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus800_sd700   PLATFORMSUB=100b NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus850_sd800   PLATFORMSUB=100e NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus860_sd870   PLATFORMSUB=100c NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus950_sd850   PLATFORMSUB=100c NO_INC_BUILD=1 firzipsubcomplete	
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus40_sd300    PLATFORMSUB=100k NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus50_sd400    PLATFORMSUB=101a NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus50_sd400    PLATFORMSUB=101b NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus55_sd450    PLATFORMSUB=100b NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus55_sd450    PLATFORMSUB=100c NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus55_sd450    PLATFORMSUB=100d NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus65_sd630    PLATFORMSUB=100a NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus70_sd1000   PLATFORMSUB=100c NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus70_sd1000   PLATFORMSUB=101b NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus70_sd1000   PLATFORMSUB=102a NO_INC_BUILD=1 firzipsubcomplete
+	#$(MAKE)  -s --no-print-directory PLATFORM=ixusW_sd430     PLATFORMSUB=110a NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=a720 PLATFORMSUB=100c NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=a650 PLATFORMSUB=100d NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=a450 PLATFORMSUB=100d NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=a460 PLATFORMSUB=100d NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=a550 PLATFORMSUB=100c NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=s5is PLATFORMSUB=101a NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=s5is PLATFORMSUB=101b NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=tx1  PLATFORMSUB=100g NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=tx1  PLATFORMSUB=101b NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=sx100is  PLATFORMSUB=100b NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=sx100is  PLATFORMSUB=100c NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus750_sd550  PLATFORMSUB=100f NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus750_sd550  PLATFORMSUB=100g NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus60_sd600  PLATFORMSUB=100a NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus60_sd600  PLATFORMSUB=100d NO_INC_BUILD=1 firzipsubcomplete
+	$(MAKE)  -s --no-print-directory PLATFORM=ixus960_sd950  PLATFORMSUB=100d NO_INC_BUILD=1 firzipsubcomplete
+	@echo "**** All zipfiles including firmwares and extra stuff created successfully"
+	@echo "**** Copying duplicate Firmwares"
+	cp $(TOPDIR)/bin/a610-100e-$(BUILD_NUMBER)-full.zip $(TOPDIR)/bin/a610-100d-$(BUILD_NUMBER)-full.zip
+	cp $(TOPDIR)/bin/a610-100e-$(BUILD_NUMBER).zip $(TOPDIR)/bin/a610-100d-$(BUILD_NUMBER).zip
+	cp $(TOPDIR)/bin/s2is-100g-$(BUILD_NUMBER)-full.zip $(TOPDIR)/bin/s2is-100i-$(BUILD_NUMBER)-full.zip
+	cp $(TOPDIR)/bin/s2is-100g-$(BUILD_NUMBER).zip $(TOPDIR)/bin/s2is-100i-$(BUILD_NUMBER).zip
+	cp $(TOPDIR)/bin/ixus800_sd700-101b-$(BUILD_NUMBER)-full.zip $(TOPDIR)/bin/ixus800_sd700-101a-$(BUILD_NUMBER)-full.zip
+	cp $(TOPDIR)/bin/ixus800_sd700-101b-$(BUILD_NUMBER).zip $(TOPDIR)/bin/ixus800_sd700-101a-$(BUILD_NUMBER).zip
+	cp $(TOPDIR)/bin/ixus850_sd800-100e-$(BUILD_NUMBER)-full.zip $(TOPDIR)/bin/ixus850_sd800-100d-$(BUILD_NUMBER)-full.zip
+	cp $(TOPDIR)/bin/ixus850_sd800-100e-$(BUILD_NUMBER).zip $(TOPDIR)/bin/ixus850_sd800-100d-$(BUILD_NUMBER).zip
+	cp $(TOPDIR)/bin/ixus70_sd1000-101b-$(BUILD_NUMBER)-full.zip $(TOPDIR)/bin/ixus70_sd1000-101a-$(BUILD_NUMBER)-full.zip
+	cp $(TOPDIR)/bin/ixus70_sd1000-101b-$(BUILD_NUMBER).zip $(TOPDIR)/bin/ixus70_sd1000-101a-$(BUILD_NUMBER).zip
+	@echo "**** Done Copying duplicate Firmwares"
+	@echo "**** Summary of memisosizes"
+	cat $(TOPDIR)/bin/caminfo.txt
+	rm -f $(TOPDIR)/bin/caminfo.txt   > $(DEVNULL)
+
+
+batch-clean:
+	$(MAKE) -s --no-print-directory PLATFORM=a610 PLATFORMSUB=100e NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=a610 PLATFORMSUB=100f NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=a620 PLATFORMSUB=100f NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=a630 PLATFORMSUB=100c NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=a640 PLATFORMSUB=100b NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=a700 PLATFORMSUB=100b NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=a710 PLATFORMSUB=100a NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=s2is PLATFORMSUB=100e NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=s2is PLATFORMSUB=100f NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=s2is PLATFORMSUB=100g NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=s3is PLATFORMSUB=100a NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=g7   PLATFORMSUB=100e NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=g7   PLATFORMSUB=100g NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=g7   PLATFORMSUB=100i NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=g7   PLATFORMSUB=100j NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=a530 PLATFORMSUB=100a NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=a540 PLATFORMSUB=100b NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=a560 PLATFORMSUB=100a NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=a570 PLATFORMSUB=100e NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=a570 PLATFORMSUB=101a NO_INC_BUILD=1 clean
+	#$(MAKE) -s --no-print-directory PLATFORM=s80  PLATFORMSUB=100g NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=ixus700_sd500   PLATFORMSUB=101a NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=ixus700_sd500   PLATFORMSUB=101b NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=ixus800_sd700   PLATFORMSUB=101b NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=ixus800_sd700   PLATFORMSUB=100b NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=ixus850_sd800   PLATFORMSUB=100e NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=ixus860_sd870   PLATFORMSUB=100c NO_INC_BUILD=1 clean	
+	$(MAKE) -s --no-print-directory PLATFORM=ixus950_sd850   PLATFORMSUB=100c NO_INC_BUILD=1 clean	
+	$(MAKE) -s --no-print-directory PLATFORM=ixus40_sd300    PLATFORMSUB=100k NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=ixus50_sd400    PLATFORMSUB=101a NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=ixus50_sd400    PLATFORMSUB=101b NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=ixus55_sd450    PLATFORMSUB=100b NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=ixus55_sd450    PLATFORMSUB=100c NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=ixus55_sd450    PLATFORMSUB=100d NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=ixus65_sd630    PLATFORMSUB=100a NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=ixus70_sd1000   PLATFORMSUB=100c NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=ixus70_sd1000   PLATFORMSUB=101b NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=ixus70_sd1000   PLATFORMSUB=102a NO_INC_BUILD=1 clean
+	#$(MAKE) -s --no-print-directory PLATFORM=ixusW_sd430     PLATFORMSUB=110a NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=a720 PLATFORMSUB=100c NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=a650 PLATFORMSUB=100d NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=a450 PLATFORMSUB=100d NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=a460 PLATFORMSUB=100d NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=a550 PLATFORMSUB=100c NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=s5is PLATFORMSUB=101a NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=s5is PLATFORMSUB=101b NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=tx1  PLATFORMSUB=100g NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=tx1  PLATFORMSUB=101b NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=sx100is  PLATFORMSUB=100b NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=sx100is  PLATFORMSUB=100c NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=ixus750_sd550  PLATFORMSUB=100f NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=ixus750_sd550  PLATFORMSUB=100g NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=ixus60_sd600  PLATFORMSUB=100a NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=ixus60_sd600  PLATFORMSUB=100d NO_INC_BUILD=1 clean
+	$(MAKE) -s --no-print-directory PLATFORM=ixus960_sd950  PLATFORMSUB=100d NO_INC_BUILD=1 clean
+	
+
+.PHONY: fir upload
+
+include bottom.inc
+
Index: lib/lang/makefile.inc.new
===================================================================
--- lib/lang/makefile.inc.new	(Revision 0)
+++ lib/lang/makefile.inc.new	(Revision 0)
@@ -0,0 +1,17 @@
+
+LOCAL_CFLAGS:=$(CTHUMB)
+
+OBJS := lang.o
+OBJS := $(call subdirize, $(OBJS) )
+
+$(eval $(call compile-targets,$(OBJS),$(LOCAL_CFLAGS)))
+
+$(eval $(call ar-targets, liblang.a, $(OBJS) ))
+
+$(eval $(call gen-rule, lang-lib-clean,, rm -f $(OBJS) $(subdir)/*.$(DEPSUFFIX) $(subdir)/liblang.a))
+
+lang-lib-distclean: lang-lib-clean
+	rm -f $(OBJS:.o=.d)
+
+# vim: ft=make
+
Index: lib/lua/makefile.inc.new
===================================================================
--- lib/lua/makefile.inc.new	(Revision 0)
+++ lib/lua/makefile.inc.new	(Revision 0)
@@ -0,0 +1,46 @@
+
+
+LOCAL_CFLAGS := $(CTHUMB) -DSTDIO_COMPAT_FILE -DFS_USE_FUT
+
+LUA_OPTLIB_OBJS:=
+
+ifdef OPT_LUA_IOLIB
+LOCAL_CFLAGS+=-DOPT_LUA_IOLIB
+LUA_OPTLIB_OBJS+=liolib.o
+endif
+
+ifdef OPT_LUA_OSLIB
+LOCAL_CFLAGS+=-DOPT_LUA_OSLIB
+LUA_OPTLIB_OBJS+=loslib.o
+endif
+
+ifdef OPT_LUA_STRLIB
+LOCAL_CFLAGS+=-DOPT_LUA_STRLIB
+LUA_OPTLIB_OBJS+=lstrlib.o
+endif
+
+ASM_OBJS := setjmp.o
+
+C_OBJS := \
+       lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \
+       lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o \
+       lundump.o lvm.o lzio.o \
+       \
+       lauxlib.o lbaselib.o ldblib.o ltablib.o lmathlib.o \
+	   $(LUA_OPTLIB_OBJS) loadlib.o linit.o
+
+OBJS := $(call subdirize,$(ASM_OBJS) $(C_OBJS) )
+C_OBJS := $(call subdirize,$(C_OBJS) )
+ASM_OBJS := $(call subdirize,$(ASM_OBJS) )
+
+$(eval $(call compile-targets,$(C_OBJS),$(LOCAL_CFLAGS)))
+$(eval $(call compile-asm-targets,$(ASM_OBJS),$(LOCAL_CFLAGS)))
+
+
+$(eval $(call ar-targets, liblua.a, $(OBJS)))
+
+$(eval $(call gen-rule, lua-lib-clean,, rm -f $(OBJS) $(subdir)/*.$(DEPSUFFIX) $(subdir)/liblua.a ))
+
+$(eval $(call gen-rule, lua-lib-distclean, lua-lib-clean, rm -f $(OBJS:.o=.d)))
+
+# vim: filetype=make
Index: lib/font/rbf_font.c
===================================================================
--- lib/font/rbf_font.c	(Revision 557)
+++ lib/font/rbf_font.c	(Arbeitskopie)
@@ -210,7 +210,7 @@
     need_free = 0;
     
     for (i=0; i<256; ++i) {
-        rbf_assign_char_8x16(&rbf_font.cTable[i], font[i], rbf_font.height);
+        rbf_assign_char_8x16(&rbf_font.cTable[i], (char*)font[i], rbf_font.height);
     }
     need_free = 1;
 }
Index: lib/font/makefile.inc.new
===================================================================
--- lib/font/makefile.inc.new	(Revision 0)
+++ lib/font/makefile.inc.new	(Revision 0)
@@ -0,0 +1,18 @@
+
+
+LOCAL_CFLAGS:=$(CTHUMB)
+
+OBJS := font_8x16.o rbf_font.o
+OBJS := $(call subdirize, $(OBJS) )
+
+$(eval $(call compile-targets,$(OBJS),$(LOCAL_CFLAGS)))
+
+$(eval $(call ar-targets, libfont.a, $(OBJS)))
+
+# XXX generate the .h deps automatically via -MMD !!
+font_8x16.o: font_8x16.c codepages.h font_8x16_uni.h
+
+$(eval $(call gen-rule,font-lib-clean,,rm -f $(OBJS) $(subdir)/*.$(DEPSUFFIX) $(subdir)/libfont.a))
+$(eval $(call gen-rule,font-lib-distclean,font-lib-clean,rm -rf $(OBJS:.o=.d)))
+
+# vim: ft=make
Index: lib/ubasic/makefile.inc.new
===================================================================
--- lib/ubasic/makefile.inc.new	(Revision 0)
+++ lib/ubasic/makefile.inc.new	(Revision 0)
@@ -0,0 +1,18 @@
+
+LOCAL_CFLAGS:=$(CTHUMB)
+
+OBJS := camera_functions.o tokenizer.o ubasic.o
+OBJS := $(call subdirize, $(OBJS) )
+
+$(eval $(call compile-targets,$(OBJS),$(LOCAL_CFLAGS)))
+
+$(eval $(call ar-targets, libubasic.a, $(OBJS),))
+
+check:
+	gcc -g -Wall -DTEST -DCAMERA_a610 -o ubasic_test$(EXE) *.c
+
+$(eval $(call gen-rule, ubasic-lib-clean,, rm -f $(OBJS) $(subdir)/*.$(DEPSUFFIX) $(subdir)/libubasic.a $(subdir)/ubasic_test$(EXE) ))
+
+$(eval $(call gen-rule, ubasic-lib-distclean, ubasic-lib-clean, rm -f $(OBJS:.o=.d) ))
+
+# vim: ft=make
Index: lib/libc/Makefile
===================================================================
--- lib/libc/Makefile	(Revision 557)
+++ lib/libc/Makefile	(Arbeitskopie)
@@ -1,5 +1,7 @@
 topdir=../../
 
+primary: libc.a
+
 include $(topdir)makefile.inc
 
 CFLAGS+=$(CTHUMB)
Index: lib/libc/makefile.inc.new
===================================================================
--- lib/libc/makefile.inc.new	(Revision 0)
+++ lib/libc/makefile.inc.new	(Revision 0)
@@ -0,0 +1,18 @@
+
+LOCAL_CFLAGS:=$(CTHUMB)
+
+OBJS := issmth.o strncmp.o strtol.o strchr.o \
+    memcmp.o memset.o memmove.o memcpy.o strlen.o \
+    strcmp.o
+
+OBJS := $(call subdirize, $(OBJS) )
+
+$(eval $(call compile-targets,$(OBJS),$(LOCAL_CFLAGS)))
+
+$(eval $(call gen-rule, libc.a, $(OBJS),))
+
+$(eval $(call gen-rule, libc-lib-clean,, rm -f $(OBJS) $(subdir)/*.$(DEPSUFFIX) $(subdir)/libc.a))
+
+$(eval $(call gen-rule, libc-lib-distclean, libc-lib-clean, rm -f $(OBJS:.o=.d)))
+
+# vim: ft=make
Index: lib/math/makefile.inc.new
===================================================================
--- lib/math/makefile.inc.new	(Revision 0)
+++ lib/math/makefile.inc.new	(Revision 0)
@@ -0,0 +1,18 @@
+
+LOCAL_CFLAGS:=$(CTHUMB)
+
+OBJS := d2d.o wrapper.o
+OBJS := $(call subdirize, $(OBJS) )
+
+$(eval $(call compile-targets,$(OBJS),$(LOCAL_CFLAGS)))
+
+$(eval $(call ar-targets, libmath.a, $(OBJS)))
+
+# XXX AUTOGEN!
+d2d.o: d2d.c fdlibm.h
+
+$(eval $(call gen-rule, math-lib-clean,, rm -f $(OBJS) $(subdir)/*.$(DEPSUFFIX) $(subdir)/libmath.a))
+
+$(eval $(call gen-rule, math-lib-distclean, math-lib-clean, rm -f $(OBJS:.o=.d) ))
+
+# vim: ft=make
Index: lib/makefile.inc.new
===================================================================
--- lib/makefile.inc.new	(Revision 0)
+++ lib/makefile.inc.new	(Revision 0)
@@ -0,0 +1,13 @@
+
+LOCAL_SUBDIRS:=font math ubasic lang lua libc
+
+$(eval $(call gen-rule, lib-clean, $(foreach lsub,$(LOCAL_SUBDIRS),$(lsub)-lib-clean),))
+
+$(eval $(call gen-rule, lib-distclean, $(foreach lsub,$(LOCAL_SUBDIRS),$(lsub)-lib-distclean),))
+
+LOCAL_SUBDIRS:=$(call subdirize,$(LOCAL_SUBDIRS) )
+
+$(foreach subdir,$(LOCAL_SUBDIRS),$(eval include $(subdir)/makefile.inc.new) )
+
+
+# vim: filetype=make
Index: loader/s2is/resetcode/makefile.inc.new
===================================================================
--- loader/s2is/resetcode/makefile.inc.new	(Revision 0)
+++ loader/s2is/resetcode/makefile.inc.new	(Revision 0)
@@ -0,0 +1,6 @@
+
+# warning: library order matters!
+
+include $(TOPDIR)/loader/makefile_resetcode.inc.new
+
+# vim: ft=make
Index: loader/s2is/makefile.inc.new
===================================================================
--- loader/s2is/makefile.inc.new	(Revision 0)
+++ loader/s2is/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/loader/makefile_generic.inc.new
+
+# vim: ft=make
Index: loader/s3is/resetcode/makefile.inc.new
===================================================================
--- loader/s3is/resetcode/makefile.inc.new	(Revision 0)
+++ loader/s3is/resetcode/makefile.inc.new	(Revision 0)
@@ -0,0 +1,6 @@
+
+# warning: library order matters!
+
+include $(TOPDIR)/loader/makefile_resetcode.inc.new
+
+# vim: ft=make
Index: loader/s3is/makefile.inc.new
===================================================================
--- loader/s3is/makefile.inc.new	(Revision 0)
+++ loader/s3is/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/loader/makefile_generic.inc.new
+
+# vim: ft=make
Index: loader/ixus65_sd630/resetcode/makefile.inc.new
===================================================================
--- loader/ixus65_sd630/resetcode/makefile.inc.new	(Revision 0)
+++ loader/ixus65_sd630/resetcode/makefile.inc.new	(Revision 0)
@@ -0,0 +1,6 @@
+
+# warning: library order matters!
+
+include $(TOPDIR)/loader/makefile_resetcode.inc.new
+
+# vim: ft=make
Index: loader/ixus65_sd630/makefile.inc.new
===================================================================
--- loader/ixus65_sd630/makefile.inc.new	(Revision 0)
+++ loader/ixus65_sd630/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/loader/makefile_generic.inc.new
+
+# vim: ft=make
Index: loader/s5is/resetcode/makefile.inc.new
===================================================================
--- loader/s5is/resetcode/makefile.inc.new	(Revision 0)
+++ loader/s5is/resetcode/makefile.inc.new	(Revision 0)
@@ -0,0 +1,6 @@
+
+# warning: library order matters!
+
+include $(TOPDIR)/loader/makefile_resetcode.inc.new
+
+# vim: ft=make
Index: loader/s5is/makefile.inc.new
===================================================================
--- loader/s5is/makefile.inc.new	(Revision 0)
+++ loader/s5is/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/loader/makefile_generic.inc.new
+
+# vim: ft=make
Index: loader/ixus70_sd1000/resetcode/makefile.inc.new
===================================================================
--- loader/ixus70_sd1000/resetcode/makefile.inc.new	(Revision 0)
+++ loader/ixus70_sd1000/resetcode/makefile.inc.new	(Revision 0)
@@ -0,0 +1,6 @@
+
+# warning: library order matters!
+
+include $(TOPDIR)/loader/makefile_resetcode.inc.new
+
+# vim: ft=make
Index: loader/ixus70_sd1000/makefile.inc.new
===================================================================
--- loader/ixus70_sd1000/makefile.inc.new	(Revision 0)
+++ loader/ixus70_sd1000/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/loader/makefile_generic.inc.new
+
+# vim: ft=make
Index: loader/ixusW_sd430/resetcode/makefile.inc.new
===================================================================
--- loader/ixusW_sd430/resetcode/makefile.inc.new	(Revision 0)
+++ loader/ixusW_sd430/resetcode/makefile.inc.new	(Revision 0)
@@ -0,0 +1,6 @@
+
+# warning: library order matters!
+
+include $(TOPDIR)/loader/makefile_resetcode.inc.new
+
+# vim: ft=make
Index: loader/ixusW_sd430/makefile.inc.new
===================================================================
--- loader/ixusW_sd430/makefile.inc.new	(Revision 0)
+++ loader/ixusW_sd430/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/loader/makefile_generic.inc.new
+
+# vim: ft=make
Index: loader/ixus850_sd800/resetcode/makefile.inc.new
===================================================================
--- loader/ixus850_sd800/resetcode/makefile.inc.new	(Revision 0)
+++ loader/ixus850_sd800/resetcode/makefile.inc.new	(Revision 0)
@@ -0,0 +1,6 @@
+
+# warning: library order matters!
+
+include $(TOPDIR)/loader/makefile_resetcode.inc.new
+
+# vim: ft=make
Index: loader/ixus850_sd800/makefile.inc.new
===================================================================
--- loader/ixus850_sd800/makefile.inc.new	(Revision 0)
+++ loader/ixus850_sd800/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/loader/makefile_generic.inc.new
+
+# vim: ft=make
Index: loader/ixus40_sd300/resetcode/makefile.inc.new
===================================================================
--- loader/ixus40_sd300/resetcode/makefile.inc.new	(Revision 0)
+++ loader/ixus40_sd300/resetcode/makefile.inc.new	(Revision 0)
@@ -0,0 +1,6 @@
+
+# warning: library order matters!
+
+include $(TOPDIR)/loader/makefile_resetcode.inc.new
+
+# vim: ft=make
Index: loader/ixus40_sd300/makefile.inc.new
===================================================================
--- loader/ixus40_sd300/makefile.inc.new	(Revision 0)
+++ loader/ixus40_sd300/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/loader/makefile_generic.inc.new
+
+# vim: ft=make
Index: loader/a700/resetcode/makefile.inc.new
===================================================================
--- loader/a700/resetcode/makefile.inc.new	(Revision 0)
+++ loader/a700/resetcode/makefile.inc.new	(Revision 0)
@@ -0,0 +1,6 @@
+
+# warning: library order matters!
+
+include $(TOPDIR)/loader/makefile_resetcode.inc.new
+
+# vim: ft=make
Index: loader/a700/makefile.inc.new
===================================================================
--- loader/a700/makefile.inc.new	(Revision 0)
+++ loader/a700/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/loader/makefile_generic.inc.new
+
+# vim: ft=make
Index: loader/a620/resetcode/makefile.inc.new
===================================================================
--- loader/a620/resetcode/makefile.inc.new	(Revision 0)
+++ loader/a620/resetcode/makefile.inc.new	(Revision 0)
@@ -0,0 +1,6 @@
+
+# warning: library order matters!
+
+include $(TOPDIR)/loader/makefile_resetcode.inc.new
+
+# vim: ft=make
Index: loader/a620/makefile.inc.new
===================================================================
--- loader/a620/makefile.inc.new	(Revision 0)
+++ loader/a620/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/loader/makefile_generic.inc.new
+
+# vim: ft=make
Index: loader/a540/resetcode/makefile.inc.new
===================================================================
--- loader/a540/resetcode/makefile.inc.new	(Revision 0)
+++ loader/a540/resetcode/makefile.inc.new	(Revision 0)
@@ -0,0 +1,6 @@
+
+# warning: library order matters!
+
+include $(TOPDIR)/loader/makefile_resetcode.inc.new
+
+# vim: ft=make
Index: loader/a540/makefile.inc.new
===================================================================
--- loader/a540/makefile.inc.new	(Revision 0)
+++ loader/a540/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/loader/makefile_generic.inc.new
+
+# vim: ft=make
Index: loader/a720/resetcode/makefile.inc.new
===================================================================
--- loader/a720/resetcode/makefile.inc.new	(Revision 0)
+++ loader/a720/resetcode/makefile.inc.new	(Revision 0)
@@ -0,0 +1,6 @@
+
+# warning: library order matters!
+
+include $(TOPDIR)/loader/makefile_resetcode.inc.new
+
+# vim: ft=make
Index: loader/a720/makefile.inc.new
===================================================================
--- loader/a720/makefile.inc.new	(Revision 0)
+++ loader/a720/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/loader/makefile_generic.inc.new
+
+# vim: ft=make
Index: loader/makefile_resetcode.inc.new
===================================================================
--- loader/makefile_resetcode.inc.new	(Revision 0)
+++ loader/makefile_resetcode.inc.new	(Revision 0)
@@ -0,0 +1,30 @@
+
+# warning: library order matters!
+LDLIBS:=
+LDOPTS:=-nostdlib -Wl,--allow-shlib-undefined -Wl,--no-define-common,-EL,-T,$(topdir)tools/link-boot.ld
+LDOPTS+=-Wl,-N,-Ttext,$(RESTARTSTART)
+
+subdir:=$(subdir)/resetcode
+
+ASM_OBJS:=entry.o
+C_OBJS:=main.o
+OBJS:=$(call subdirize, $(ASM_OBJS) $(C_OBJS) )
+
+$(eval $(call compile-asm-targets, $(ASM_OBJS),,))
+$(eval $(call compile-targets, $(C_OBJS),,))
+
+$(eval $(call gen-rule, $(subdir)/main.bin, $(subdir)/main.elf, \
+	$(OBJDUMP) -z -d $(subdir)/main.elf > $(subdir)/main.dump; \
+	$(OBJCOPY) -O binary $(subdir)/main.elf $(subdir)/main.bin ) )
+
+$(eval $(call gen-rule, $(subdir)/main.elf, $(OBJS), \
+	$(CC) $(CFLAGS) -o $(subdir)/main.elf $(OBJS) $(LDLIBS) $(LDFLAGS) $(LDOPTS); \
+	( $(NM) $(subdir)/main.elf | grep ' U ' > $(subdir)/main.elf.syms ) && exit 1 || exit 0 ) )
+
+$(eval $(call gen-rule, resetcode-$(PLATFORM)-loader-clean,, \
+	$(SILENCE)rm -f $(OBJS) $(subdir)/*.$(DEPSUFFIX) $(subdir)/main.bin $(subdir)/main.elf $(subdir)/main.dump $(subdir)/main.elf.syms ) )
+
+$(eval $(call gen-rule, resetcode-$(PLATFORM)-loader-distclean,, \
+	$(SILENCE)rm -f $(OBJS) $(subdir)/main.bin $(subdir)/main.elf $(subdir)/main.dump $(subdir)/main.elf.syms ))
+
+# vim: ft=make
Index: loader/a640/resetcode/makefile.inc.new
===================================================================
--- loader/a640/resetcode/makefile.inc.new	(Revision 0)
+++ loader/a640/resetcode/makefile.inc.new	(Revision 0)
@@ -0,0 +1,6 @@
+
+# warning: library order matters!
+
+include $(TOPDIR)/loader/makefile_resetcode.inc.new
+
+# vim: ft=make
Index: loader/a640/makefile.inc.new
===================================================================
--- loader/a640/makefile.inc.new	(Revision 0)
+++ loader/a640/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/loader/makefile_generic.inc.new
+
+# vim: ft=make
Index: loader/a460/resetcode/makefile.inc.new
===================================================================
--- loader/a460/resetcode/makefile.inc.new	(Revision 0)
+++ loader/a460/resetcode/makefile.inc.new	(Revision 0)
@@ -0,0 +1,6 @@
+
+# warning: library order matters!
+
+include $(TOPDIR)/loader/makefile_resetcode.inc.new
+
+# vim: ft=make
Index: loader/a460/makefile.inc.new
===================================================================
--- loader/a460/makefile.inc.new	(Revision 0)
+++ loader/a460/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/loader/makefile_generic.inc.new
+
+# vim: ft=make
Index: loader/ixus60_sd600/resetcode/makefile.inc.new
===================================================================
--- loader/ixus60_sd600/resetcode/makefile.inc.new	(Revision 0)
+++ loader/ixus60_sd600/resetcode/makefile.inc.new	(Revision 0)
@@ -0,0 +1,6 @@
+
+# warning: library order matters!
+
+include $(TOPDIR)/loader/makefile_resetcode.inc.new
+
+# vim: ft=make
Index: loader/ixus60_sd600/makefile.inc.new
===================================================================
--- loader/ixus60_sd600/makefile.inc.new	(Revision 0)
+++ loader/ixus60_sd600/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/loader/makefile_generic.inc.new
+
+# vim: ft=make
Index: loader/s80/resetcode/makefile.inc.new
===================================================================
--- loader/s80/resetcode/makefile.inc.new	(Revision 0)
+++ loader/s80/resetcode/makefile.inc.new	(Revision 0)
@@ -0,0 +1,6 @@
+
+# warning: library order matters!
+
+include $(TOPDIR)/loader/makefile_resetcode.inc.new
+
+# vim: ft=make
Index: loader/s80/makefile.inc.new
===================================================================
--- loader/s80/makefile.inc.new	(Revision 0)
+++ loader/s80/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/loader/makefile_generic.inc.new
+
+# vim: ft=make
Index: loader/a560/resetcode/makefile.inc.new
===================================================================
--- loader/a560/resetcode/makefile.inc.new	(Revision 0)
+++ loader/a560/resetcode/makefile.inc.new	(Revision 0)
@@ -0,0 +1,6 @@
+
+# warning: library order matters!
+
+include $(TOPDIR)/loader/makefile_resetcode.inc.new
+
+# vim: ft=make
Index: loader/a560/makefile.inc.new
===================================================================
--- loader/a560/makefile.inc.new	(Revision 0)
+++ loader/a560/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/loader/makefile_generic.inc.new
+
+# vim: ft=make
Index: loader/ixus860_sd870/resetcode/makefile.inc.new
===================================================================
--- loader/ixus860_sd870/resetcode/makefile.inc.new	(Revision 0)
+++ loader/ixus860_sd870/resetcode/makefile.inc.new	(Revision 0)
@@ -0,0 +1,6 @@
+
+# warning: library order matters!
+
+include $(TOPDIR)/loader/makefile_resetcode.inc.new
+
+# vim: ft=make
Index: loader/ixus860_sd870/makefile.inc.new
===================================================================
--- loader/ixus860_sd870/makefile.inc.new	(Revision 0)
+++ loader/ixus860_sd870/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/loader/makefile_generic.inc.new
+
+# vim: ft=make
Index: loader/ixus960_sd950/resetcode/makefile.inc.new
===================================================================
--- loader/ixus960_sd950/resetcode/makefile.inc.new	(Revision 0)
+++ loader/ixus960_sd950/resetcode/makefile.inc.new	(Revision 0)
@@ -0,0 +1,6 @@
+
+# warning: library order matters!
+
+include $(TOPDIR)/loader/makefile_resetcode.inc.new
+
+# vim: ft=make
Index: loader/ixus960_sd950/makefile.inc.new
===================================================================
--- loader/ixus960_sd950/makefile.inc.new	(Revision 0)
+++ loader/ixus960_sd950/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/loader/makefile_generic.inc.new
+
+# vim: ft=make
Index: loader/tx1/resetcode/makefile.inc.new
===================================================================
--- loader/tx1/resetcode/makefile.inc.new	(Revision 0)
+++ loader/tx1/resetcode/makefile.inc.new	(Revision 0)
@@ -0,0 +1,6 @@
+
+# warning: library order matters!
+
+include $(TOPDIR)/loader/makefile_resetcode.inc.new
+
+# vim: ft=make
Index: loader/tx1/makefile.inc.new
===================================================================
--- loader/tx1/makefile.inc.new	(Revision 0)
+++ loader/tx1/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/loader/makefile_generic.inc.new
+
+# vim: ft=make
Index: loader/ixus55_sd450/resetcode/makefile.inc.new
===================================================================
--- loader/ixus55_sd450/resetcode/makefile.inc.new	(Revision 0)
+++ loader/ixus55_sd450/resetcode/makefile.inc.new	(Revision 0)
@@ -0,0 +1,6 @@
+
+# warning: library order matters!
+
+include $(TOPDIR)/loader/makefile_resetcode.inc.new
+
+# vim: ft=make
Index: loader/ixus55_sd450/makefile.inc.new
===================================================================
--- loader/ixus55_sd450/makefile.inc.new	(Revision 0)
+++ loader/ixus55_sd450/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/loader/makefile_generic.inc.new
+
+# vim: ft=make
Index: loader/ixus700_sd500/resetcode/makefile.inc.new
===================================================================
--- loader/ixus700_sd500/resetcode/makefile.inc.new	(Revision 0)
+++ loader/ixus700_sd500/resetcode/makefile.inc.new	(Revision 0)
@@ -0,0 +1,6 @@
+
+# warning: library order matters!
+
+include $(TOPDIR)/loader/makefile_resetcode.inc.new
+
+# vim: ft=make
Index: loader/ixus700_sd500/makefile.inc.new
===================================================================
--- loader/ixus700_sd500/makefile.inc.new	(Revision 0)
+++ loader/ixus700_sd500/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/loader/makefile_generic.inc.new
+
+# vim: ft=make
Index: loader/ixus800_sd700/resetcode/makefile.inc.new
===================================================================
--- loader/ixus800_sd700/resetcode/makefile.inc.new	(Revision 0)
+++ loader/ixus800_sd700/resetcode/makefile.inc.new	(Revision 0)
@@ -0,0 +1,6 @@
+
+# warning: library order matters!
+
+include $(TOPDIR)/loader/makefile_resetcode.inc.new
+
+# vim: ft=make
Index: loader/ixus800_sd700/makefile.inc.new
===================================================================
--- loader/ixus800_sd700/makefile.inc.new	(Revision 0)
+++ loader/ixus800_sd700/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/loader/makefile_generic.inc.new
+
+# vim: ft=make
Index: loader/ixus750_sd550/resetcode/makefile.inc.new
===================================================================
--- loader/ixus750_sd550/resetcode/makefile.inc.new	(Revision 0)
+++ loader/ixus750_sd550/resetcode/makefile.inc.new	(Revision 0)
@@ -0,0 +1,6 @@
+
+# warning: library order matters!
+
+include $(TOPDIR)/loader/makefile_resetcode.inc.new
+
+# vim: ft=make
Index: loader/ixus750_sd550/makefile.inc.new
===================================================================
--- loader/ixus750_sd550/makefile.inc.new	(Revision 0)
+++ loader/ixus750_sd550/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/loader/makefile_generic.inc.new
+
+# vim: ft=make
Index: loader/sx100is/resetcode/makefile.inc.new
===================================================================
--- loader/sx100is/resetcode/makefile.inc.new	(Revision 0)
+++ loader/sx100is/resetcode/makefile.inc.new	(Revision 0)
@@ -0,0 +1,6 @@
+
+# warning: library order matters!
+
+include $(TOPDIR)/loader/makefile_resetcode.inc.new
+
+# vim: ft=make
Index: loader/sx100is/makefile.inc.new
===================================================================
--- loader/sx100is/makefile.inc.new	(Revision 0)
+++ loader/sx100is/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/loader/makefile_generic.inc.new
+
+# vim: ft=make
Index: loader/a610/resetcode/makefile.inc.new
===================================================================
--- loader/a610/resetcode/makefile.inc.new	(Revision 0)
+++ loader/a610/resetcode/makefile.inc.new	(Revision 0)
@@ -0,0 +1,6 @@
+
+# warning: library order matters!
+
+include $(TOPDIR)/loader/makefile_resetcode.inc.new
+
+# vim: ft=make
Index: loader/a610/makefile.inc.new
===================================================================
--- loader/a610/makefile.inc.new	(Revision 0)
+++ loader/a610/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/loader/makefile_generic.inc.new
+
+# vim: ft=make
Index: loader/ixus50_sd400/resetcode/makefile.inc.new
===================================================================
--- loader/ixus50_sd400/resetcode/makefile.inc.new	(Revision 0)
+++ loader/ixus50_sd400/resetcode/makefile.inc.new	(Revision 0)
@@ -0,0 +1,6 @@
+
+# warning: library order matters!
+
+include $(TOPDIR)/loader/makefile_resetcode.inc.new
+
+# vim: ft=make
Index: loader/ixus50_sd400/makefile.inc.new
===================================================================
--- loader/ixus50_sd400/makefile.inc.new	(Revision 0)
+++ loader/ixus50_sd400/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/loader/makefile_generic.inc.new
+
+# vim: ft=make
Index: loader/a530/resetcode/makefile.inc.new
===================================================================
--- loader/a530/resetcode/makefile.inc.new	(Revision 0)
+++ loader/a530/resetcode/makefile.inc.new	(Revision 0)
@@ -0,0 +1,6 @@
+
+# warning: library order matters!
+
+include $(TOPDIR)/loader/makefile_resetcode.inc.new
+
+# vim: ft=make
Index: loader/a530/makefile.inc.new
===================================================================
--- loader/a530/makefile.inc.new	(Revision 0)
+++ loader/a530/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/loader/makefile_generic.inc.new
+
+# vim: ft=make
Index: loader/a710/resetcode/makefile.inc.new
===================================================================
--- loader/a710/resetcode/makefile.inc.new	(Revision 0)
+++ loader/a710/resetcode/makefile.inc.new	(Revision 0)
@@ -0,0 +1,6 @@
+
+# warning: library order matters!
+
+include $(TOPDIR)/loader/makefile_resetcode.inc.new
+
+# vim: ft=make
Index: loader/a710/makefile.inc.new
===================================================================
--- loader/a710/makefile.inc.new	(Revision 0)
+++ loader/a710/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/loader/makefile_generic.inc.new
+
+# vim: ft=make
Index: loader/a450/resetcode/makefile.inc.new
===================================================================
--- loader/a450/resetcode/makefile.inc.new	(Revision 0)
+++ loader/a450/resetcode/makefile.inc.new	(Revision 0)
@@ -0,0 +1,6 @@
+
+# warning: library order matters!
+
+include $(TOPDIR)/loader/makefile_resetcode.inc.new
+
+# vim: ft=make
Index: loader/a450/makefile.inc.new
===================================================================
--- loader/a450/makefile.inc.new	(Revision 0)
+++ loader/a450/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/loader/makefile_generic.inc.new
+
+# vim: ft=make
Index: loader/ixus950_sd850/resetcode/makefile.inc.new
===================================================================
--- loader/ixus950_sd850/resetcode/makefile.inc.new	(Revision 0)
+++ loader/ixus950_sd850/resetcode/makefile.inc.new	(Revision 0)
@@ -0,0 +1,6 @@
+
+# warning: library order matters!
+
+include $(TOPDIR)/loader/makefile_resetcode.inc.new
+
+# vim: ft=make
Index: loader/ixus950_sd850/makefile.inc.new
===================================================================
--- loader/ixus950_sd850/makefile.inc.new	(Revision 0)
+++ loader/ixus950_sd850/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/loader/makefile_generic.inc.new
+
+# vim: ft=make
Index: loader/a630/resetcode/makefile.inc.new
===================================================================
--- loader/a630/resetcode/makefile.inc.new	(Revision 0)
+++ loader/a630/resetcode/makefile.inc.new	(Revision 0)
@@ -0,0 +1,6 @@
+
+# warning: library order matters!
+
+include $(TOPDIR)/loader/makefile_resetcode.inc.new
+
+# vim: ft=make
Index: loader/a630/makefile.inc.new
===================================================================
--- loader/a630/makefile.inc.new	(Revision 0)
+++ loader/a630/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/loader/makefile_generic.inc.new
+
+# vim: ft=make
Index: loader/makefile_generic.inc.new
===================================================================
--- loader/makefile_generic.inc.new	(Revision 0)
+++ loader/makefile_generic.inc.new	(Revision 0)
@@ -0,0 +1,46 @@
+
+
+
+
+LDLIBS=
+LOADER_LDOPTS:=-nostdlib -Wl,--allow-shlib-undefined -Wl,--no-define-common,-EL,-T,$(TOPDIR)/tools/link-boot.ld
+LOADER_LDOPTS+=-Wl,-N,-Ttext,$(MEMBASEADDR)
+
+LOCAL_CFLAGS:=-I.
+
+CORE_FILE:=$(TOPDIR)/core/main.bin
+RESET_FILE:=$(subdir)/resetcode/main.bin
+
+LOCAL_CFLAGS+=-DCORE_FILE=\"$(CORE_FILE)\"
+LOCAL_CFLAGS+=-DRESET_FILE=\"$(RESET_FILE)\"
+
+$(eval $(call gen-rule, $(subdir)/main.bin, loader-main.bin, ))
+
+ASM_OBJS :=entry.o blobs.o
+C_OBJS := main.o 
+
+ASM_OBJS:=$(call subdirize,$(ASM_OBJS) )
+C_OBJS:=$(call subdirize,$(C_OBJS) )
+
+$(eval $(call compile-asm-targets, $(ASM_OBJS) , $(LOCAL_CFLAGS), $(CORE_FILE) $(RESET_FILE) ) )
+$(eval $(call compile-targets, $(C_OBJS) , $(LOCAL_CFLAGS) ) )
+
+
+OBJS:=$(ASM_OBJS) $(C_OBJS)
+
+$(eval $(call gen-rule, loader-main.bin, loader-main.elf, \
+	$(OBJDUMP) -z -d $(subdir)/main.elf > $(subdir)/main.dump; \
+	$(OBJCOPY) -O binary $(subdir)/main.elf $(subdir)/main.bin ))
+
+$(eval $(call gen-rule, loader-main.elf, $(OBJS), \
+	$(SILENCE)$(CC) $(CFLAGS) -o $(subdir)/main.elf $(OBJS) $(LDLIBS) $(LDFLAGS) $(LOADER_LDOPTS); \
+	( $(NM) $(subdir)/main.elf | grep ' U ' > $(subdir)/main.elf.syms ) && exit 1 || exit 0 ) )
+
+$(eval $(call gen-rule, $(PLATFORM)-loader-clean, resetcode-$(PLATFORM)-loader-clean, rm -f $(OBJS) $(subdir)/*.$(DEPSUFFIX) $(subdir)/main.bin $(subdir)/main.elf $(subdir)/main.dump $(subdir)/main.elf.syms))
+
+$(eval $(call gen-rule, $(PLATFORM)-loader-distclean, resetcode-$(PLATFORM)-loader-distclean loader-clean, rm -f reboot_core.h copy_and_reset.h ))
+
+LOCAL_SUBDIRS:=$(subdir)/resetcode
+$(foreach subdir,$(LOCAL_SUBDIRS),$(eval include $(subdir)/makefile.inc.new) )
+
+# vim: ft=make
Index: loader/a550/resetcode/makefile.inc.new
===================================================================
--- loader/a550/resetcode/makefile.inc.new	(Revision 0)
+++ loader/a550/resetcode/makefile.inc.new	(Revision 0)
@@ -0,0 +1,6 @@
+
+# warning: library order matters!
+
+include $(TOPDIR)/loader/makefile_resetcode.inc.new
+
+# vim: ft=make
Index: loader/a550/makefile.inc.new
===================================================================
--- loader/a550/makefile.inc.new	(Revision 0)
+++ loader/a550/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/loader/makefile_generic.inc.new
+
+# vim: ft=make
Index: loader/a650/resetcode/makefile.inc.new
===================================================================
--- loader/a650/resetcode/makefile.inc.new	(Revision 0)
+++ loader/a650/resetcode/makefile.inc.new	(Revision 0)
@@ -0,0 +1,6 @@
+
+# warning: library order matters!
+
+include $(TOPDIR)/loader/makefile_resetcode.inc.new
+
+# vim: ft=make
Index: loader/a650/makefile.inc.new
===================================================================
--- loader/a650/makefile.inc.new	(Revision 0)
+++ loader/a650/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/loader/makefile_generic.inc.new
+
+# vim: ft=make
Index: loader/a570/resetcode/makefile.inc.new
===================================================================
--- loader/a570/resetcode/makefile.inc.new	(Revision 0)
+++ loader/a570/resetcode/makefile.inc.new	(Revision 0)
@@ -0,0 +1,6 @@
+
+# warning: library order matters!
+
+include $(TOPDIR)/loader/makefile_resetcode.inc.new
+
+# vim: ft=make
Index: loader/a570/makefile.inc.new
===================================================================
--- loader/a570/makefile.inc.new	(Revision 0)
+++ loader/a570/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/loader/makefile_generic.inc.new
+
+# vim: ft=make
Index: loader/g7/resetcode/makefile.inc.new
===================================================================
--- loader/g7/resetcode/makefile.inc.new	(Revision 0)
+++ loader/g7/resetcode/makefile.inc.new	(Revision 0)
@@ -0,0 +1,6 @@
+
+# warning: library order matters!
+
+include $(TOPDIR)/loader/makefile_resetcode.inc.new
+
+# vim: ft=make
Index: loader/g7/makefile.inc.new
===================================================================
--- loader/g7/makefile.inc.new	(Revision 0)
+++ loader/g7/makefile.inc.new	(Revision 0)
@@ -0,0 +1,4 @@
+
+include $(TOPDIR)/loader/makefile_generic.inc.new
+
+# vim: ft=make
Index: loader/makefile.inc.new
===================================================================
--- loader/makefile.inc.new	(Revision 0)
+++ loader/makefile.inc.new	(Revision 0)
@@ -0,0 +1,16 @@
+
+
+
+LOCAL_SUBDIRS:=$(PLATFORM)
+
+$(eval $(call gen-rule, loader-clean, $(foreach lsub,$(LOCAL_SUBDIRS),$(lsub)-loader-clean), ))
+
+$(eval $(call gen-rule, loader-distclean, $(foreach lsub,$(LOCAL_SUBDIRS),$(lsub)-loader-distclean), ))
+
+LOCAL_SUBDIRS:=$(call subdirize,$(LOCAL_SUBDIRS) )
+
+$(foreach subdir,$(LOCAL_SUBDIRS),$(eval include $(subdir)/makefile.inc.new) )
+
+# vim: ft=make
+
+
