This creates a 8051 build that can run in 24Kb of RAM

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@26 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2007-03-01 21:05:55 +00:00
parent fb61b0b76b
commit bcd6ba97bd
52 changed files with 278 additions and 156 deletions
+10 -2
View File
@@ -40,13 +40,21 @@ MKDEP = $(TOPDIR)/tools/mkdeps.sh
ASRCS =
AOBJS = $(ASRCS:.S=$(OBJEXT))
CSRCS = main.c dev_null.c mutex.c cancel.c sem.c cond.c
CSRCS = main.c dev_null.c
ifneq ($(CONFIG_DISABLE_PTHREAD),y)
CSRCS += cancel.c cond.c mutex.c sem.c
endif
ifneq ($(CONFIG_DISABLE_SIGNALS),y)
CSRCS += timedwait.c sighand.c
CSRCS += sighand.c
ifneq ($(CONFIG_DISABLE_PTHREAD),y)
CSRCS += timedwait.c
endif
endif
ifneq ($(CONFIG_DISABLE_MQUEUE),y)
ifneq ($(CONFIG_DISABLE_PTHREAD),y)
CSRCS += mqueue.c
endif
endif
COBJS = $(CSRCS:.c=$(OBJEXT))
+8 -4
View File
@@ -50,7 +50,9 @@
* Private Data
************************************************************/
static char buffer[1024];
#if CONFIG_NFILE_DESCRIPTORS > 0
static FAR char buffer[1024];
/************************************************************
* Public Functions
@@ -64,14 +66,14 @@ int dev_null(void)
fd = open("/dev/null", O_RDWR);
if (fd < 0)
{
fprintf(stderr, "dev_null: Failed to open /dev/null\n");
printf("dev_null: ERROR Failed to open /dev/null\n");
return -1;
}
nbytes = read(fd, buffer, 1024);
if (nbytes < 0)
{
fprintf(stderr, "dev_null: Failed to read from /dev/null\n");
printf("dev_null: ERROR Failed to read from /dev/null\n");
close(fd);
return -1;
}
@@ -80,7 +82,7 @@ int dev_null(void)
nbytes = write(fd, buffer, 1024);
if (nbytes < 0)
{
fprintf(stderr, "dev_null: Failed to write to /dev/null\n");
printf("dev_null: ERROR Failed to write to /dev/null\n");
close(fd);
return -1;
}
@@ -89,3 +91,5 @@ int dev_null(void)
close(fd);
return 0;
}
#endif /*CONFIG_NFILE_DESCRIPTORS */
+27 -7
View File
@@ -64,8 +64,10 @@ static FAR char arg2[] = "Arg2";
static FAR char arg3[] = "Arg3";
static FAR char arg4[] = "Arg4";
#if CONFIG_NFILE_DESCRIPTORS > 0
static char write_data1[] = "Standard I/O Check: write fd=1\n";
static char write_data2[] = "Standard I/O Check: write fd=2\n";
#endif
static char *args[NARGS] = { arg1, arg2, arg3, arg4 };
/************************************************************
@@ -82,8 +84,8 @@ static int user_main(int argc, char *argv[])
if (argc != NARGS + 1)
{
fprintf(stderr, "user_main: Error expected argc=%d got argc=%d\n",
NARGS+1, argc);
printf("user_main: Error expected argc=%d got argc=%d\n",
NARGS+1, argc);
}
for (i = 0; i <= NARGS; i++)
@@ -95,38 +97,48 @@ static int user_main(int argc, char *argv[])
{
if (strcmp(argv[i], args[i-1]) != 0)
{
fprintf(stderr, "user_main: ERROR argv[%d]: Expected \"%s\" found \"%s\"\n",
i, argv[i], args[i-1]);
printf("user_main: ERROR argv[%d]: Expected \"%s\" found \"%s\"\n",
i, argv[i], args[i-1]);
}
}
#if CONFIG_NFILE_DESCRIPTORS > 0
/* Checkout /dev/null */
dev_null();
#endif
#ifndef CONFIG_DISABLE_PTHREAD
/* Verify pthreads and pthread mutex */
mutex_test();
#endif
#ifndef CONFIG_DISABLE_PTHREAD
/* Verify pthread cancellation */
cancel_test();
#endif
#ifndef CONFIG_DISABLE_PTHREAD
/* Verify pthreads and semaphores */
sem_test();
#endif
#ifndef CONFIG_DISABLE_PTHREAD
/* Verify pthreads and condition variables */
cond_test();
#endif
#ifndef CONFIG_DISABLE_SIGNALS
#if !defined(CONFIG_DISABLE_SIGNALS) && !defined(CONFIG_DISABLE_PTHREAD)
/* Verify pthreads and condition variable timed waits */
timedwait_test();
#endif
#ifndef CONFIG_DISABLE_MQUEUE
#if !defined(CONFIG_DISABLE_MQUEUE) && !defined(CONFIG_DISABLE_PTHREAD)
/* Verify pthreads and message queues */
mqueue_test();
@@ -165,10 +177,17 @@ int user_start(int parm1, int parm2, int parm3, int parm4)
/* Verify that we can communicate */
#if CONFIG_NFILE_DESCRIPTORS > 0
write(1, write_data1, sizeof(write_data1));
#endif
printf("user_start: Standard I/O Check: printf\n");
#if CONFIG_NFILE_DESCRIPTORS > 1
write(2, write_data2, sizeof(write_data2));
#endif
#if CONFIG_NFILE_STREAMS > 0
fprintf(stderr, "user_start: Standard I/O Check: fprintf to stderr\n");
#endif
/* Verify that we can spawn a new task */
@@ -176,11 +195,12 @@ int user_start(int parm1, int parm2, int parm3, int parm4)
arg1, arg2, arg3, arg4);
if (result == ERROR)
{
fprintf(stderr, "user_start: Failed to start user_main\n");
printf("user_start: ERROR Failed to start user_main\n");
}
else
{
printf("user_start: Started user_main at PID=%d\n", result);
}
return 0;
}