From 67b1faa23c59f2284aab49aafb94f14185f6ac4a Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 7 Nov 2014 15:35:09 -0600 Subject: BAS: Fix some build errors wtih apps/examples/bastest --- apps/examples/Make.defs | 4 ++++ apps/examples/bastest/.gitignore | 2 ++ apps/examples/bastest/Kconfig | 2 +- apps/examples/bastest/Makefile | 24 +++++++++++++++--------- apps/examples/bastest/bastest_main.c | 13 ++++++++++--- 5 files changed, 32 insertions(+), 13 deletions(-) (limited to 'apps/examples') diff --git a/apps/examples/Make.defs b/apps/examples/Make.defs index 8a09a1ee1..050eefef5 100644 --- a/apps/examples/Make.defs +++ b/apps/examples/Make.defs @@ -38,6 +38,10 @@ ifeq ($(CONFIG_EXAMPLES_ADC),y) CONFIGURED_APPS += examples/adc endif +ifeq ($(CONFIG_EXAMPLES_BASTEST),y) +CONFIGURED_APPS += examples/bastest +endif + ifeq ($(CONFIG_EXAMPLES_BUTTONS),y) CONFIGURED_APPS += examples/buttons endif diff --git a/apps/examples/bastest/.gitignore b/apps/examples/bastest/.gitignore index fa1ec7579..af17d4c1b 100644 --- a/apps/examples/bastest/.gitignore +++ b/apps/examples/bastest/.gitignore @@ -1,6 +1,8 @@ /Make.dep /.depend /.built +/romfs.img +/romfs.h /*.asm /*.obj /*.rel diff --git a/apps/examples/bastest/Kconfig b/apps/examples/bastest/Kconfig index 3c56df48d..c12281d6d 100644 --- a/apps/examples/bastest/Kconfig +++ b/apps/examples/bastest/Kconfig @@ -8,7 +8,7 @@ config EXAMPLES_BASTEST default n depends on INTERPRETERS_BAS ---help--- - Mount the ROMFS file system containing the BAS test files. + Mount the ROMFS file system containing the BAS test files at /mnt/romfs. if EXAMPLES_BASTEST diff --git a/apps/examples/bastest/Makefile b/apps/examples/bastest/Makefile index 144a9cfd6..f6f788570 100644 --- a/apps/examples/bastest/Makefile +++ b/apps/examples/bastest/Makefile @@ -78,8 +78,8 @@ endif BASTEST_DIR = $(APPDIR)$(DELIM)examples$(DELIM)bastest TESTS_DIR = $(BASTEST_DIR)$(DELIM)tests -ROMFS_IMG = $(BASTEST_DIR)$(DELIM)romfs.img -ROMFS_HDR = $(BASTEST_DIR)$(DELIM)romfs.h +ROMFS_IMG = romfs.img +ROMFS_HDR = romfs.h PROGNAME = bastest$(EXEEXT) @@ -98,15 +98,19 @@ $(AOBJS): %$(OBJEXT): %.S $(COBJS) $(MAINOBJ): %$(OBJEXT): %.c $(call COMPILE, $<, $@) -.built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - # Create the romfs.h header file from the tests/ directory +$(ROMFS_IMG) : + $(Q) genromfs -f $@ -d $(TESTS_DIR) -V "BASTEST" + $(ROMFS_HDR) : $(ROMFS_IMG) - $(Q) genromfs -f $@ -d $(TESTS_DIR) -V "BASTEST" - $(Q) (xxd -i romfs.img | sed -e "s/^unsigned/static const unsigned/g" >$@) + $(Q) (xxd -i $(ROMFS_IMG) | sed -e "s/^unsigned/static const unsigned/g" >$@) + +# Add the BASTEST object to the archive + +.built: $(ROMFS_HDR) $(OBJS) + $(call ARCHIVE, $(BIN), $(OBJS)) + @touch .built # Link and install the program binary @@ -123,7 +127,7 @@ install: endif -# Register the NSH builtin appliation +# Register the NSH builtin application ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile @@ -147,6 +151,8 @@ clean: $(call CLEAN) distclean: clean + $(call DELFILE, $(ROMFS_HDR)) + $(call DELFILE, $(ROMFS_IMG)) $(call DELFILE, Make.dep) $(call DELFILE, .depend) diff --git a/apps/examples/bastest/bastest_main.c b/apps/examples/bastest/bastest_main.c index 3cf70c681..fe6da27f8 100644 --- a/apps/examples/bastest/bastest_main.c +++ b/apps/examples/bastest/bastest_main.c @@ -38,7 +38,12 @@ ****************************************************************************/ #include + +#include #include +#include + +#include #include "romfs.h" @@ -93,6 +98,8 @@ int main(int argc, FAR char *argv[]) int bastest_main(int argc, char *argv[]) #endif { + int ret; + /* Create a ROM disk for the ROMFS filesystem */ printf("Registering romdisk at /dev/ram%d\n", CONFIG_EXAMPLES_BASTEST_DEVMINOR); @@ -100,19 +107,19 @@ int bastest_main(int argc, char *argv[]) NSECTORS(romfs_img_len), SECTORSIZE); if (ret < 0) { - err("ERROR: romdisk_register failed: %d\n", ret); + fprintf(stderr, "ERROR: romdisk_register failed: %d\n", ret); return 1; } /* Mount the file system */ - message("Mounting ROMFS filesystem at target=%s with source=%s\n", + printf("Mounting ROMFS filesystem at target=%s with source=%s\n", MOUNTPT, CONFIG_EXAMPLES_BASTEST_DEVPATH); ret = mount(CONFIG_EXAMPLES_BASTEST_DEVPATH, MOUNTPT, "romfs", MS_RDONLY, NULL); if (ret < 0) { - err("ERROR: mount(%s,%s,romfs) failed: %s\n", + fprintf(stderr, "ERROR: mount(%s,%s,romfs) failed: %s\n", CONFIG_EXAMPLES_BASTEST_DEVPATH, MOUNTPT, errno); return 1; } -- cgit v1.2.3