[Cbe-oss-dev] [PATCH 12/17]MARS/modules/task: Dont use embedspu

Yuji Mano yuji.mano at am.sony.com
Wed Dec 3 13:59:13 EST 2008


From: Kazunori Asayama <asayama at sm.sony.co.jp>

Stop using embedspu script (task module)

This patch stops using embedspu script and embed MPU's ELFs in host's
binaries just as byte streams. This change is a preparation for hybrid
systems.

Signed-off-by: Kazunori Asayama <asayama at sm.sony.co.jp>
---
 modules/task/README                   |    2 --
 modules/task/src/host/configure.ac.in |    2 --
 modules/task/src/host/lib/Makefile.am |   24 +++++++++++-------------
 modules/task/src/host/lib/task.c      |    4 ++--
 4 files changed, 13 insertions(+), 19 deletions(-)

Index: b/modules/task/README
===================================================================
--- a/modules/task/README	2008-11-27 19:09:48.000000000 +0900
+++ b/modules/task/README	2008-11-27 19:10:29.000000000 +0900
@@ -90,7 +90,6 @@ For example, when using the Cell SDK too
 -------------------
   ./configure \
     --with-mars-platform=cell \
-    PPU_EMBEDSPU=ppu-embedspu \
     PPU_CC=ppu-gcc PPU_CFLAGS="-O3 -funroll-loops -m32" \
     SPU_CC=spu-gcc SPU_CFLAGS="-O3 -funroll-loops"
 
@@ -99,7 +98,6 @@ For example, when using the Cell SDK too
   ./configure \
     --libdir="/usr/lib64" \
     --with-mars-platform=cell \
-    PPU_EMBEDSPU=ppu-embedspu \
     PPU_CC=ppu-gcc PPU_CFLAGS="-O3 -funroll-loops -m64" \
     SPU_CC=spu-gcc SPU_CFLAGS="-O3 -funroll-loops"
 
Index: b/modules/task/src/host/configure.ac.in
===================================================================
--- a/modules/task/src/host/configure.ac.in	2008-11-27 19:09:48.000000000 +0900
+++ b/modules/task/src/host/configure.ac.in	2008-11-27 19:10:29.000000000 +0900
@@ -42,8 +42,6 @@ AC_CONFIG_MARS_HOST
 
 AC_CONFIG_AUX_DIR([.])
 
-AC_CHECK_TOOL([EMBEDSPU], [embedspu], [embedspu-not-found])
-
 AC_PROG_LIBTOOL
 AM_INIT_AUTOMAKE
 AC_SUBST([DESTDIR])
Index: b/modules/task/src/host/lib/Makefile.am
===================================================================
--- a/modules/task/src/host/lib/Makefile.am	2008-11-27 19:09:48.000000000 +0900
+++ b/modules/task/src/host/lib/Makefile.am	2008-11-27 19:17:11.000000000 +0900
@@ -100,19 +100,15 @@ libmars_task_la_SOURCES = \
 	task_semaphore.c \
 	task_signal.c
 
-nodist_libmars_task_la_SOURCES = mars_task_module.eo
+nodist_libmars_task_la_SOURCES = \
+	mars_task_module.c
 
-libmars_task_la_DEPENDENCIES = mars_task_module.eo
-
-mars_task_module.eo: ${MARS_TASK_MODULE}
-	@mkdir -p .libs
-	$(EMBEDSPU) $(CFLAGS) mars_task_module_entry  $< $@
-	$(EMBEDSPU) $(CFLAGS) -fPIC -DPIC mars_task_module_entry  $< .libs/$@
-
-.eo.lo:
-	@echo "# Generated by ltmain.sh - GNU libtool" > $@
-	@echo "pic_object='.libs/"$<"'" >> $@
-	@echo "non_pic_object='"$<"'" >> $@
+mars_task_module.c: ${MARS_TASK_MODULE}
+	echo '__attribute__((aligned(128))) const unsigned char mars_task_module_entry[] = {' > $@.tmp
+	od -v -A n -t x1 ${MARS_TASK_MODULE} | \
+		sed -e 's/  */,0x/g' -e 's/^,//' -e 's/ *$$/,/' >> $@.tmp
+	echo '};' >> $@.tmp
+	mv -f $@.tmp $@
 
 # library version-info rules (current:revision:age):
 # * increment 'current', if API is changed and compatibility is broken.
@@ -127,4 +123,6 @@ libmars_task_la_LDFLAGS = \
 
 libmars_task_la_LIBADD = -lmars_core
 
-CLEANFILES = *.eo *.map
+BUILT_SOURCES = mars_task_module.c
+
+CLEANFILES = mars_task_module.c *.eo *.map
Index: b/modules/task/src/host/lib/task.c
===================================================================
--- a/modules/task/src/host/lib/task.c	2008-11-27 19:09:48.000000000 +0900
+++ b/modules/task/src/host/lib/task.c	2008-11-27 19:10:29.000000000 +0900
@@ -50,7 +50,7 @@
 
 #include "task_internal_types.h"
 
-extern struct spe_program_handle mars_task_module_entry;
+extern const unsigned char mars_task_module_entry[];
 
 const struct mars_task_context_save_unit mars_task_context_save_all[] =
 {
@@ -92,7 +92,7 @@ int mars_task_create(struct mars_context
 		return MARS_ERROR_PARAMS;
 
 	/* process elf header information */
-	ehdr_module = (Elf32_Ehdr *)mars_task_module_entry.elf_image;
+	ehdr_module = (Elf32_Ehdr *)mars_task_module_entry;
 	phdr_module = (Elf32_Phdr *)
 		((void *)ehdr_module + ehdr_module->e_phoff);
 






More information about the cbe-oss-dev mailing list