summaryrefslogtreecommitdiff
path: root/nuttx/examples
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-06-16 23:45:07 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-06-16 23:45:07 +0000
commit2a3f404d973bd45e16ed4def539458c905b6fbda (patch)
treea4b161ea10f0a22f23435bcb2ce9145965a0ac50 /nuttx/examples
parent1bb56fb39d8db0c9a419818f82fa7e517cad55bc (diff)
downloadpx4-nuttx-2a3f404d973bd45e16ed4def539458c905b6fbda.tar.gz
px4-nuttx-2a3f404d973bd45e16ed4def539458c905b6fbda.tar.bz2
px4-nuttx-2a3f404d973bd45e16ed4def539458c905b6fbda.zip
Got more NXFLAT examples to compile
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1891 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/examples')
-rw-r--r--nuttx/examples/nxflat/tests/hello++/Makefile6
-rw-r--r--nuttx/examples/nxflat/tests/hello++/hello++2.cpp4
-rw-r--r--nuttx/examples/nxflat/tests/hello++/hello++3.cpp4
-rw-r--r--nuttx/examples/nxflat/tests/hello++/hello++4.cpp4
-rw-r--r--nuttx/examples/nxflat/tests/mutex/Makefile2
-rw-r--r--nuttx/examples/nxflat/tests/mutex/mutex.c1
-rw-r--r--nuttx/examples/nxflat/tests/pthread/Makefile2
-rw-r--r--nuttx/examples/nxflat/tests/pthread/pthread.c2
-rw-r--r--nuttx/examples/nxflat/tests/signal/signal.c12
-rw-r--r--nuttx/examples/nxflat/tests/task/task.c14
10 files changed, 29 insertions, 22 deletions
diff --git a/nuttx/examples/nxflat/tests/hello++/Makefile b/nuttx/examples/nxflat/tests/hello++/Makefile
index dc2693219..b1c9977bc 100644
--- a/nuttx/examples/nxflat/tests/hello++/Makefile
+++ b/nuttx/examples/nxflat/tests/hello++/Makefile
@@ -68,7 +68,7 @@ $(CXXOBJS): %.o: %.cpp
# without actually have libstdc++
$(LIBSTDC_STUBS_LIB):
- $(MAKE) -C $(LIBSTDC_STUBS_DIR)
+ $(MAKE) -C $(LIBSTDC_STUBS_DIR) TOPDIR=$(TOPDIR)
# BIN1 and BIN2 link just like C code because they contain no
# static constructors. BIN1 is equivalent to a C hello world;
@@ -76,10 +76,10 @@ $(LIBSTDC_STUBS_LIB):
# not statically initialized.
$(BIN1): $(OBJS1)
- $(XFLATLD) -o $@ $^
+ $(NXFLATLD) -o $@ $^
$(BIN2): $(OBJS2) $(LIBSTDC_STUBS_LIB)
- $(XFLATLD) -o $@ $^
+ $(NXFLATLD) -o $@ $^
# BIN3 and BIN4 require that we include --cxx in the xflat-ld command.
# This will instruct xflat-ld that we want it to put togethe the correct
diff --git a/nuttx/examples/nxflat/tests/hello++/hello++2.cpp b/nuttx/examples/nxflat/tests/hello++/hello++2.cpp
index 4f189699e..3b03bbb0d 100644
--- a/nuttx/examples/nxflat/tests/hello++/hello++2.cpp
+++ b/nuttx/examples/nxflat/tests/hello++/hello++2.cpp
@@ -59,7 +59,7 @@ public:
CThingSayer(void)
{
printf("CThingSayer::CThingSayer: I am!\n");
- szWhatToSay = NULL;
+ szWhatToSay = (const char*)NULL;
}
~CThingSayer(void)
@@ -70,7 +70,7 @@ public:
printf("CThingSayer::~CThingSayer: I will never say '%s' again\n",
szWhatToSay);
}
- szWhatToSay = NULL;
+ szWhatToSay = (const char*)NULL;
}
void Initialize(const char *czSayThis)
diff --git a/nuttx/examples/nxflat/tests/hello++/hello++3.cpp b/nuttx/examples/nxflat/tests/hello++/hello++3.cpp
index b41d09664..236f5def0 100644
--- a/nuttx/examples/nxflat/tests/hello++/hello++3.cpp
+++ b/nuttx/examples/nxflat/tests/hello++/hello++3.cpp
@@ -74,7 +74,7 @@ static CThingSayer MyThingSayer;
CThingSayer::CThingSayer(void)
{
printf("CThingSayer::CThingSayer: I am!\n");
- szWhatToSay = NULL;
+ szWhatToSay = (const char*)NULL;
}
CThingSayer::~CThingSayer(void)
@@ -85,7 +85,7 @@ CThingSayer::~CThingSayer(void)
printf("CThingSayer::~CThingSayer: I will never say '%s' again\n",
szWhatToSay);
}
- szWhatToSay = NULL;
+ szWhatToSay = (const char*)NULL;
}
void CThingSayer::Initialize(const char *czSayThis)
diff --git a/nuttx/examples/nxflat/tests/hello++/hello++4.cpp b/nuttx/examples/nxflat/tests/hello++/hello++4.cpp
index b6c0c488c..60c8b2a45 100644
--- a/nuttx/examples/nxflat/tests/hello++/hello++4.cpp
+++ b/nuttx/examples/nxflat/tests/hello++/hello++4.cpp
@@ -91,7 +91,7 @@ static CThingSayer MyThingSayer;
CThingSayer::CThingSayer(void)
{
cout << "CThingSayer::CThingSayer: I am!" << endl;
- szWhatToSay = (char*)NULL;
+ szWhatToSay = (const char*)NULL;
}
CThingSayer::~CThingSayer(void)
@@ -102,7 +102,7 @@ CThingSayer::~CThingSayer(void)
cout << "CThingSayer::~CThingSayer: I will never say '"
<< szWhatToSay << "' again" << endl;
}
- szWhatToSay = (char*)NULL;
+ szWhatToSay = (const char*)NULL;
}
void CThingSayer::Initialize(const char *czSayThis)
diff --git a/nuttx/examples/nxflat/tests/mutex/Makefile b/nuttx/examples/nxflat/tests/mutex/Makefile
index 6ba0b6736..314ed5224 100644
--- a/nuttx/examples/nxflat/tests/mutex/Makefile
+++ b/nuttx/examples/nxflat/tests/mutex/Makefile
@@ -47,7 +47,7 @@ all: $(BIN)
$(OBJS): %.o: %.c
$(NXFLATCC) -c $(NXFLATCFLAGS) $< -o $@
-$(BIN): $OBJS)
+$(BIN): $(OBJS)
$(NXFLATLD) $(NXFLATLDFLAGS) -o $@ $(OBJS)
clean:
diff --git a/nuttx/examples/nxflat/tests/mutex/mutex.c b/nuttx/examples/nxflat/tests/mutex/mutex.c
index 5fdbdac5d..dc42331ee 100644
--- a/nuttx/examples/nxflat/tests/mutex/mutex.c
+++ b/nuttx/examples/nxflat/tests/mutex/mutex.c
@@ -38,6 +38,7 @@
****************************************************************************/
#include <stdio.h>
+#include <stdlib.h>
#include <pthread.h>
#include <signal.h>
diff --git a/nuttx/examples/nxflat/tests/pthread/Makefile b/nuttx/examples/nxflat/tests/pthread/Makefile
index eadba85ab..c1103d71c 100644
--- a/nuttx/examples/nxflat/tests/pthread/Makefile
+++ b/nuttx/examples/nxflat/tests/pthread/Makefile
@@ -47,7 +47,7 @@ all: $(BIN)
$(OBJS): %.o: %.c
$(NXFLATCC) -c $(NXFLATCFLAGS) $< -o $@
-$(BIN): $OBJS)
+$(BIN): $(OBJS)
$(NXFLATLD) $(NXFLATLDFLAGS) -o $@ $(OBJS)
clean:
diff --git a/nuttx/examples/nxflat/tests/pthread/pthread.c b/nuttx/examples/nxflat/tests/pthread/pthread.c
index 89b489302..a3977b3fc 100644
--- a/nuttx/examples/nxflat/tests/pthread/pthread.c
+++ b/nuttx/examples/nxflat/tests/pthread/pthread.c
@@ -37,7 +37,9 @@
* Included Files
****************************************************************************/
+#include <stdio.h>
#include <stdlib.h>
+#include <unistd.h>
#include <pthread.h>
/****************************************************************************
diff --git a/nuttx/examples/nxflat/tests/signal/signal.c b/nuttx/examples/nxflat/tests/signal/signal.c
index 68d96702e..52fc206d9 100644
--- a/nuttx/examples/nxflat/tests/signal/signal.c
+++ b/nuttx/examples/nxflat/tests/signal/signal.c
@@ -37,11 +37,13 @@
* Included Files
****************************************************************************/
-#include <stdio.h> /* For printf(), fprintf(), etc. */
-#include <signal.h> /* For signal(), sigaction(), etc. */
-#include <unistd.h> /* For usleep() */
-#include <errno.h> /* For errno */
-#include <sys/types.h> /* (needed by getpid()) */
+#include <sys/types.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
/****************************************************************************
* Definitions
diff --git a/nuttx/examples/nxflat/tests/task/task.c b/nuttx/examples/nxflat/tests/task/task.c
index 28ec88d5f..969409409 100644
--- a/nuttx/examples/nxflat/tests/task/task.c
+++ b/nuttx/examples/nxflat/tests/task/task.c
@@ -41,6 +41,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
+#include <string.h>
#include <sched.h>
#include <semaphore.h>
#include <errno.h>
@@ -49,6 +50,7 @@
* Private Data
****************************************************************************/
+static char child_name[] = "child";
static char child_arg[] = "Hello from your parent!";
static sem_t g_sem;
@@ -56,7 +58,7 @@ static sem_t g_sem;
* Privite Functions
****************************************************************************/
-int child_task(int argc, char **argv, char **envp)
+int child_task(int argc, char **argv)
{
printf("Child: execv was successful!\n");
printf("Child: argc=%d\n", argc);
@@ -70,9 +72,9 @@ int child_task(int argc, char **argv, char **envp)
printf("Child: argv[0]=\"%s\"\n", argv[0]);
- if (strcmp(argv[0], my_path) != 0)
+ if (strcmp(argv[0], child_name) != 0)
{
- printf("Child: expected argv[0] to be \"%s\"\n", my_path);
+ printf("Child: expected argv[0] to be \"%s\"\n", child_name);
printf("Child: Exit-ting with status=3\n");
exit(3);
}
@@ -81,7 +83,7 @@ int child_task(int argc, char **argv, char **envp)
if (strcmp(argv[1], child_arg) != 0)
{
- printf("Child: expected argv[1] to be \"%s\"\n", parent_arg);
+ printf("Child: expected argv[1] to be \"%s\"\n", child_arg);
printf("Child: Exit-ting with status=4\n");
exit(4);
}
@@ -95,7 +97,7 @@ int child_task(int argc, char **argv, char **envp)
* Public Functions
****************************************************************************/
-int main(int argc, char **argv, char **envp)
+int main(int argc, char **argv)
{
pid_t parent_pid = getpid();
char *child_argv[2];
@@ -109,7 +111,7 @@ int main(int argc, char **argv, char **envp)
child_argv[0] = child_arg;
child_argv[1] = 0;
- ret = task_create("child", 50, 512, child_task, &child_arg);
+ ret = task_create(child_name, 50, 512, child_task, child_argv);
if (ret != 0)
{
printf("Parent: task_create failed: %d\n", errno);