From 233925a450ebb3dd4002b3ddf73bd265a726cbaa Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Thu, 29 Jul 2010 01:18:19 +0200 Subject: [PATCH] first step at building the main binary --- bootloader/application.c | 22 ++-------------------- firmware/drivers/lcd-16bit.c | 2 -- firmware/target/hosted/android/system-android.c | 20 ++++++++++++++++++++ tools/configure | 1 + uisimulator/uisimulator.make | 18 ++++++++++++++++-- 5 files changed, 39 insertions(+), 24 deletions(-) diff --git a/bootloader/application.c b/bootloader/application.c index b7656b410..25ce9f46a 100644 --- a/bootloader/application.c +++ b/bootloader/application.c @@ -36,26 +36,11 @@ #include "disk.h" #include "panic.h" #include "power.h" - -char *stackbegin; -char *stackend; - extern int show_logo(); JNIEXPORT void JNICALL Java_com_example_rbboot_RockboxBootloader_main (JNIEnv *, jobject); -JNIEnv *env_ptr; -jobject RbBl_instance; -jclass RbBl_class; -void Java_com_example_rbboot_RockboxBootloader_main(JNIEnv *env, jobject this) -{ - env_ptr = env; - RbBl_instance = this; - RbBl_class = (*env)->GetObjectClass(env, this); - main(); -} - void test_tick(void) { /* @@ -87,16 +72,13 @@ void test_thread2(void) int main(void) { - /* hack!!! */ - volatile int stack = 0; - stackbegin = stackend = (char*)&stack; int delay = 1<<20; long tick; LOG("Hello Rockbox!"); - - lcd_init(); system_init(); kernel_init(); + + lcd_init(); button_init_device(); lcd_setfont(FONT_SYSFIXED); printf("hello"); diff --git a/firmware/drivers/lcd-16bit.c b/firmware/drivers/lcd-16bit.c index 1e8b610d2..f8b4272f7 100644 --- a/firmware/drivers/lcd-16bit.c +++ b/firmware/drivers/lcd-16bit.c @@ -75,9 +75,7 @@ void lcd_init(void) /* Call device specific init */ lcd_init_device(); -/* scroll_init(); -*/ } /*** Viewports ***/ diff --git a/firmware/target/hosted/android/system-android.c b/firmware/target/hosted/android/system-android.c index 0bf0d24b1..a3aec4d15 100644 --- a/firmware/target/hosted/android/system-android.c +++ b/firmware/target/hosted/android/system-android.c @@ -26,3 +26,23 @@ void system_exception_wait(void) { } void system_reboot(void) { } void power_off(void) { } void system_init(void) { } + + + +char *stackbegin; +char *stackend; +JNIEnv *env_ptr; +jobject RbBl_instance; +jclass RbBl_class; + +/* this is the entry point of the android app initially called by jni */ +void Java_com_example_rbboot_RockboxBootloader_main(JNIEnv *env, jobject this) +{ + /* hack!!! */ + volatile int stack = 0; + stackbegin = stackend = (char*)&stack; + env_ptr = env; + RbBl_instance = this; + RbBl_class = (*env)->GetObjectClass(env, this); + main(); +} diff --git a/tools/configure b/tools/configure index 92c3d5bbc..b62a2718e 100755 --- a/tools/configure +++ b/tools/configure @@ -126,6 +126,7 @@ appcc () { if [ "$1" = "sdl" ]; then simcc $1 elif [ "$1" = "android" ]; then + app_type=$1 androidcc fi } diff --git a/uisimulator/uisimulator.make b/uisimulator/uisimulator.make index 17c82b9b2..efeba0d76 100644 --- a/uisimulator/uisimulator.make +++ b/uisimulator/uisimulator.make @@ -31,8 +31,22 @@ $(SIMLIB): $$(SIMOBJ) $(UIBMP) $(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null # SIMLIB needs to be linked twice for some reason -#~ $(BUILDDIR)/$(BINARY): $$(OBJ) $(SIMLIB) $(VOICESPEEXLIB) $(FIRMLIB) $(SKINLIB) - #~ $(call PRINTS,LD $(BINARY))$(CC) -o $@ $^ $(SIMLIB) $(LDOPTS) $(GLOBAL_LDOPTS) +ifeq (0,1) +$(BUILDDIR)/$(BINARY): $$(OBJ) $(SIMLIB) $(VOICESPEEXLIB) $(FIRMLIB) $(SKINLIB) + $(call PRINTS,LD $(BINARY))$(CC) -o $@ $^ $(SIMLIB) $(LDOPTS) $(GLOBAL_LDOPTS) +$(BUILDDIR)/$(BINARY): $$(OBJ) $$(FIRMLIB) $$(SIMLIB) $$(FIRMLIB) +else +ifeq (1,1) +$(BUILDDIR)/$(BINARY): $$(OBJ) $(SIMLIB) $(VOICESPEEXLIB) $(FIRMLIB) $(SKINLIB) + $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -nostdlib -o $@ $^ \ + $(FIRMLIB) -lgcc $(LDOPTS) -L$(BUILDDIR)/firmware $(GLOBAL_LDOPTS) \ + -Wl,-shared,-Bsymbolic -Wl,-soname,$(BINARY) -llog -Wl,-Map,$(BUILDDIR)/rockbox.map +else + $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -nostdlib -o $@ \ + $^ $(FIRMLIB) -lgcc $(LDOPTS) -L$(BUILDDIR)/firmware \ + -llog $(GLOBAL_LDOPTS) -Wl,-Map,$(BUILDDIR)/bootloader.map +endif +endif $(BUILDDIR)/uisimulator/%.o: $(ROOTDIR)/uisimulator/%.c $(SILENT)mkdir -p $(dir $@) -- 2.11.4.GIT