Got more NXFLAT examples to compile
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1891 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
6ad27ed177
commit
57650c2c6c
13 changed files with 32 additions and 23 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -47,7 +47,7 @@ all: $(BIN)
|
|||
$(OBJS): %.o: %.c
|
||||
$(NXFLATCC) -c $(NXFLATCFLAGS) $< -o $@
|
||||
|
||||
$(BIN): $OBJS)
|
||||
$(BIN): $(OBJS)
|
||||
$(NXFLATLD) $(NXFLATLDFLAGS) -o $@ $(OBJS)
|
||||
|
||||
clean:
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
****************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <pthread.h>
|
||||
#include <signal.h>
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ all: $(BIN)
|
|||
$(OBJS): %.o: %.c
|
||||
$(NXFLATCC) -c $(NXFLATCFLAGS) $< -o $@
|
||||
|
||||
$(BIN): $OBJS)
|
||||
$(BIN): $(OBJS)
|
||||
$(NXFLATLD) $(NXFLATLDFLAGS) -o $@ $(OBJS)
|
||||
|
||||
clean:
|
||||
|
|
|
@ -37,7 +37,9 @@
|
|||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
//***************************************************************************
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <cstdlib>
|
||||
|
||||
//***************************************************************************
|
||||
// Definitions
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
//***************************************************************************
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <cstdlib>
|
||||
|
||||
//***************************************************************************
|
||||
// Definitions
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
//***************************************************************************
|
||||
|
||||
//void *operator new[](size_t size)
|
||||
void *operator new[]((unsigned long size)
|
||||
void *operator new[](unsigned long nbytes)
|
||||
{
|
||||
// We have to allocate something
|
||||
|
||||
|
|
Loading…
Reference in a new issue