aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuji Mano <yuji.mano@am.sony.com>2009-03-17 11:16:48 -0700
committerYuji Mano <yuji.mano@am.sony.com>2009-03-17 11:16:48 -0700
commitaa8b9e7a7477aa711b5157d70126fec2ec265541 (patch)
treee30153cc2a6a4744b2b91615cc8e4952ab1962e0
parentbc662b860b591c54773afc930ebdf66a9c67232a (diff)
downloadmars-src-aa8b9e7a7477aa711b5157d70126fec2ec265541.tar.gz
samples: ELF format compatibility
This patch is to update the workload module sample for compatibility with the base workload module elf loader patch. The module elf loading is now handled internally by the workload queue API. The workload module no longer should be compiled with the -N linker option. Tasks should also no longer be compiled with the -N linker option. Signed-off-by: Yuji Mano <yuji.mano@am.sony.com>
-rw-r--r--samples/config.mk2
-rw-r--r--samples/workload_module/host.c27
2 files changed, 4 insertions, 25 deletions
diff --git a/samples/config.mk b/samples/config.mk
index 53560f7..9b75f08 100644
--- a/samples/config.mk
+++ b/samples/config.mk
@@ -32,7 +32,7 @@ PPU_EMBEDSPU = $(PPU_CROSS)embedspu
SPU_CROSS = spu-
SPU_CC = $(SPU_CROSS)gcc
SPU_CFLAGS = -Wall -O3 -funroll-loops
-SPU_LDFLAGS = -lmars_base -Wl,-N -Wl,-gc-sections
+SPU_LDFLAGS = -lmars_base -Wl,-gc-sections
SPU_WM_CFLAGS = $(SPU_CFLAGS)
SPU_WM_LDFLAGS = \
diff --git a/samples/workload_module/host.c b/samples/workload_module/host.c
index 40f044d..878d060 100644
--- a/samples/workload_module/host.c
+++ b/samples/workload_module/host.c
@@ -42,15 +42,11 @@ extern struct spe_program_handle mpu_workload_module_prog;
static struct mars_context *mars_ctx;
-struct mars_workload_module module __attribute__((aligned(16)));
-
int main(void)
{
int ret;
uint16_t workload_id;
uint64_t workload_ea;
- const Elf32_Ehdr *ehdr;
- const Elf32_Phdr *phdr;
printf(INFO);
@@ -60,28 +56,14 @@ int main(void)
return 1;
}
- ret = mars_workload_queue_add_begin(mars_ctx, &workload_id, &workload_ea);
+ ret = mars_workload_queue_add_begin(mars_ctx, &workload_id, &workload_ea,
+ mpu_workload_module_prog.elf_image,
+ "Sample Module");
if (ret != MARS_SUCCESS) {
printf("MARS workload queue add begin failed! (%d)\n", ret);
return 1;
}
- ehdr = mpu_workload_module_prog.elf_image;
- phdr = mpu_workload_module_prog.elf_image + ehdr->e_phoff;
-
- module.exec_size = phdr->p_filesz;
- module.exec_ea =
- mars_ea_map((void *)ehdr + phdr->p_offset, module.exec_size);
- if (!module.exec_ea) {
- printf("MARS workload ELF can not be loaded!\n");
- return 1;
- }
- module.bss_size = phdr->p_memsz - phdr->p_filesz;
- module.entry = ehdr->e_entry;
-
- mars_ea_put(workload_ea, &module, sizeof(module));
- mars_ea_sync();
-
ret = mars_workload_queue_add_end(mars_ctx, workload_id);
if (ret != MARS_SUCCESS) {
printf("MARS workload queue add end failed! (%d)\n", ret);
@@ -106,7 +88,6 @@ int main(void)
return 1;
}
-
ret = mars_workload_queue_remove_begin(mars_ctx, workload_id, 0);
if (ret != MARS_SUCCESS) {
printf("MARS workload queue remove begin failed! (%d)\n", ret);
@@ -119,8 +100,6 @@ int main(void)
return 1;
}
- mars_ea_unmap(module.exec_ea, module.exec_size);
-
ret = mars_context_destroy(mars_ctx);
if (ret) {
printf("MARS context destroy failed! (%d)\n", ret);