diff options
Diffstat (limited to 'apps/examples/elf')
-rw-r--r-- | apps/examples/elf/Kconfig | 16 | ||||
-rw-r--r-- | apps/examples/elf/Makefile | 9 | ||||
-rw-r--r-- | apps/examples/elf/elf_main.c (renamed from apps/examples/elf/elf_main) | 22 | ||||
-rw-r--r-- | apps/examples/elf/tests/errno/Makefile | 2 | ||||
-rw-r--r-- | apps/examples/elf/tests/hello++/Makefile | 2 | ||||
-rw-r--r-- | apps/examples/elf/tests/hello/Makefile | 2 | ||||
-rw-r--r-- | apps/examples/elf/tests/longjmp/Makefile | 2 | ||||
-rw-r--r-- | apps/examples/elf/tests/mutex/Makefile | 2 | ||||
-rw-r--r-- | apps/examples/elf/tests/pthread/Makefile | 2 | ||||
-rw-r--r-- | apps/examples/elf/tests/signal/Makefile | 2 | ||||
-rw-r--r-- | apps/examples/elf/tests/struct/Makefile | 2 | ||||
-rw-r--r-- | apps/examples/elf/tests/task/Makefile | 2 |
12 files changed, 46 insertions, 19 deletions
diff --git a/apps/examples/elf/Kconfig b/apps/examples/elf/Kconfig index aca36f1b9..c62a98486 100644 --- a/apps/examples/elf/Kconfig +++ b/apps/examples/elf/Kconfig @@ -10,4 +10,20 @@ config EXAMPLES_ELF Enable the ELF loader example if EXAMPLES_ELF +config EXAMPLES_ELF_DEVMINOR + int "ROMFS Minor Device Number" + default 0 + ---help--- + The minor device number of the ROMFS block. For example, the N in /dev/ramN. + Used for registering the RAM block driver that will hold the ROMFS file system + containing the ELF executables to be tested. Default: 0 + +config EXAMPLES_ELF_DEVPATH + string "ROMFS Devie Path" + default "/dev/ram0" + ---help--- + The path to the ROMFS block driver device. This must match EXAMPLES_ELF_DEVMINOR. + Used for registering the RAM block driver that will hold the ROMFS file system + containing the ELF executables to be tested. Default: "/dev/ram0" + endif diff --git a/apps/examples/elf/Makefile b/apps/examples/elf/Makefile index 640e8e427..23a6bcb6f 100644 --- a/apps/examples/elf/Makefile +++ b/apps/examples/elf/Makefile @@ -61,7 +61,7 @@ ROOTDEPPATH = --dep-path . VPATH = all: .built -.PHONY: headers clean depend disclean +.PHONY: headers clean_tests clean depend disclean $(AOBJS): %$(OBJEXT): %.S $(call ASSEMBLE, $<, $@) @@ -72,7 +72,7 @@ $(COBJS): %$(OBJEXT): %.c headers: @$(MAKE) -C tests TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" CROSSDEV=$(CROSSDEV) -.built: $(OBJS) +.built: headers $(OBJS) @( for obj in $(OBJS) ; do \ $(call ARCHIVE, $(BIN), $${obj}); \ done ; ) @@ -88,7 +88,10 @@ context: depend: .depend -clean: +clean_tests: + @$(MAKE) -C tests TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" CROSSDEV=$(CROSSDEV) clean + +clean: clean_tests @rm -f *.o *~ .*.swp .built $(call CLEAN) diff --git a/apps/examples/elf/elf_main b/apps/examples/elf/elf_main.c index c58b13ffc..5699dd284 100644 --- a/apps/examples/elf/elf_main +++ b/apps/examples/elf/elf_main.c @@ -89,9 +89,16 @@ #define SECTORSIZE 512 #define NSECTORS(b) (((b)+SECTORSIZE-1)/SECTORSIZE) -#define ROMFSDEV "/dev/ram0" #define MOUNTPT "/mnt/romfs" +#ifndef CONFIG_EXAMPLES_ELF_DEVMINOR +# define CONFIG_EXAMPLES_ELF_DEVMINOR 0 +#endif + +#ifndef CONFIG_EXAMPLES_ELF_DEVPATH +# define CONFIG_EXAMPLES_ELF_DEVPATH "/dev/ram0" +#endif + /* If CONFIG_DEBUG is enabled, use dbg instead of printf so that the * output will be synchronous with the debug output. */ @@ -166,8 +173,9 @@ int elf_main(int argc, char *argv[]) /* Create a ROM disk for the ROMFS filesystem */ - message("Registering romdisk\n"); - ret = romdisk_register(0, romfs_img, NSECTORS(romfs_img_len), SECTORSIZE); + message("Registering romdisk at /dev/ram%d\n", CONFIG_EXAMPLES_ELF_DEVMINOR); + ret = romdisk_register(CONFIG_EXAMPLES_ELF_DEVMINOR, romfs_img, + NSECTORS(romfs_img_len), SECTORSIZE); if (ret < 0) { err("ERROR: romdisk_register failed: %d\n", ret); @@ -178,13 +186,13 @@ int elf_main(int argc, char *argv[]) /* Mount the file system */ message("Mounting ROMFS filesystem at target=%s with source=%s\n", - MOUNTPT, ROMFSDEV); + MOUNTPT, CONFIG_EXAMPLES_ELF_DEVPATH); - ret = mount(ROMFSDEV, MOUNTPT, "romfs", MS_RDONLY, NULL); + ret = mount(CONFIG_EXAMPLES_ELF_DEVPATH, MOUNTPT, "romfs", MS_RDONLY, NULL); if (ret < 0) { err("ERROR: mount(%s,%s,romfs) failed: %s\n", - ROMFSDEV, MOUNTPT, errno); + CONFIG_EXAMPLES_ELF_DEVPATH, MOUNTPT, errno); elf_uninitialize(); } @@ -219,6 +227,6 @@ int elf_main(int argc, char *argv[]) sleep(4); } - message("End-of-Test.. Exit-ing\n"); + message("End-of-Test.. Exiting\n"); return 0; } diff --git a/apps/examples/elf/tests/errno/Makefile b/apps/examples/elf/tests/errno/Makefile index d3b12aa2e..3c299b16d 100644 --- a/apps/examples/elf/tests/errno/Makefile +++ b/apps/examples/elf/tests/errno/Makefile @@ -39,7 +39,7 @@ BIN = errno SRCS = $(BIN).c -OBJS = $(BIN:.c=.o) +OBJS = $(SRCS:.c=.o) all: $(BIN) diff --git a/apps/examples/elf/tests/hello++/Makefile b/apps/examples/elf/tests/hello++/Makefile index b3d07d262..9de52cfa1 100644 --- a/apps/examples/elf/tests/hello++/Makefile +++ b/apps/examples/elf/tests/hello++/Makefile @@ -64,7 +64,7 @@ all: $(BIN1) $(BIN2) $(BIN3) $(BIN4) $(OBJS): %.o: %.cpp @echo "CC: $<" - @$(CXX) -c $(CXXPICFLAGS) $< -o $@ + @$(CXX) -c $(CXXFLAGS) $< -o $@ # This contains libstdc++ stubs to that you can build C++ code # without actually having libstdc++ diff --git a/apps/examples/elf/tests/hello/Makefile b/apps/examples/elf/tests/hello/Makefile index 3b9b06ac4..c3a3dacaf 100644 --- a/apps/examples/elf/tests/hello/Makefile +++ b/apps/examples/elf/tests/hello/Makefile @@ -39,7 +39,7 @@ BIN = hello SRCS = $(BIN).c -OBJS = $(BIN:.c=.o) +OBJS = $(SRCS:.c=.o) all: $(BIN) diff --git a/apps/examples/elf/tests/longjmp/Makefile b/apps/examples/elf/tests/longjmp/Makefile index 12d6e443c..d737718e0 100644 --- a/apps/examples/elf/tests/longjmp/Makefile +++ b/apps/examples/elf/tests/longjmp/Makefile @@ -39,7 +39,7 @@ BIN = longjmp SRCS = $(BIN).c -OBJS = $(BIN:.c=.o) +OBJS = $(SRCS:.c=.o) all: $(BIN) diff --git a/apps/examples/elf/tests/mutex/Makefile b/apps/examples/elf/tests/mutex/Makefile index 632fed9dd..7f0a5493e 100644 --- a/apps/examples/elf/tests/mutex/Makefile +++ b/apps/examples/elf/tests/mutex/Makefile @@ -39,7 +39,7 @@ BIN = mutex SRCS = $(BIN).c -OBJS = $(BIN:.c=.o) +OBJS = $(SRCS:.c=.o) all: $(BIN) diff --git a/apps/examples/elf/tests/pthread/Makefile b/apps/examples/elf/tests/pthread/Makefile index fae6144c2..8db290e6e 100644 --- a/apps/examples/elf/tests/pthread/Makefile +++ b/apps/examples/elf/tests/pthread/Makefile @@ -39,7 +39,7 @@ BIN = pthread SRCS = $(BIN).c -OBJS = $(BIN:.c=.o) +OBJS = $(SRCS:.c=.o) all: $(BIN) diff --git a/apps/examples/elf/tests/signal/Makefile b/apps/examples/elf/tests/signal/Makefile index 270444032..4338aa48d 100644 --- a/apps/examples/elf/tests/signal/Makefile +++ b/apps/examples/elf/tests/signal/Makefile @@ -39,7 +39,7 @@ BIN = signal SRCS = $(BIN).c -OBJS = $(BIN:.c=.o) +OBJS = $(SRCS:.c=.o) all: $(BIN) diff --git a/apps/examples/elf/tests/struct/Makefile b/apps/examples/elf/tests/struct/Makefile index f98a65e25..c15d8fc47 100644 --- a/apps/examples/elf/tests/struct/Makefile +++ b/apps/examples/elf/tests/struct/Makefile @@ -38,7 +38,7 @@ CFLAGS += -I. -BIN = struct +BIN = struct SRCS = struct_main.c struct_dummy.c OBJS = $(SRCS:.c=.o) diff --git a/apps/examples/elf/tests/task/Makefile b/apps/examples/elf/tests/task/Makefile index 28047965e..208b228b3 100644 --- a/apps/examples/elf/tests/task/Makefile +++ b/apps/examples/elf/tests/task/Makefile @@ -39,7 +39,7 @@ BIN = task SRCS = $(BIN).c -OBJS = $(BIN:.c=.o) +OBJS = $(SRCS:.c=.o) all: $(BIN) |