Help: Creating a file...

Alex kbyte at iol.pt
Fri Jul 9 09:11:13 UTC 2004


Hi all,

I still cant create a file using rtems i386 686 bsp, linux :-(
Does rtems has any default file system ?
The code works well but I cant see the file :-(

I want to do the folowing:
I try the rtems program using a floppy disk, and grup booting.
I want to create a file in that floppy disk when I execute the rtems program, is this possible?
Do I need any extra tool?
Any tips? advices? Source code? 



Please see the source code i am using (from rtems samples):
The code work well, but where are the file?

Thanks a lot...


#include <bsp.h>
#include <fcntl.h>

#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_EXECUTIVE_RAM_SIZE              (2048*1024)
#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES          4 
#define CONFIGURE_MAXIMUM_SEMAPHORES              20
#define CONFIGURE_MAXIMUM_TASKS                   20
#define CONFIGURE_MAXIMUM_TIMERS                  20
#define CONFIGURE_MAXIMUM_PERIODS                 1
#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS  10
#define CONFIGURE_INIT_TASK_STACK_SIZE            (32*1024)
#define CONFIGURE_INIT_TASK_PRIORITY              90
#define CONFIGURE_INIT_TASK_INITIAL_MODES         (RTEMS_PREEMPT | \
                                                   RTEMS_NO_TIMESLICE | \
                                                   RTEMS_NO_ASR | \
                                                   RTEMS_INTERRUPT_LEVEL(0))
#define CONFIGURE_MICROSECONDS_PER_TICK           10486
#define CONFIGURE_INIT
rtems_task Init(rtems_task_argument argument);

#define CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE
rtems_driver_address_table Device_drivers[] = {
   CONSOLE_DRIVER_TABLE_ENTRY,
   CLOCK_DRIVER_TABLE_ENTRY,
};

#include <confdefs.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <rtems.h>
#include <rtems/error.h>
#include <rtems/libio.h>
//#include "m68360.h"
#include <stdlib.h>
#include <errno.h>


rtems_task
Init(rtems_task_argument ignored)
{
   int fd;
   FILE *fp;
   char str[256];


   /***********************************************************************
    * Print the boot-up message.
    **********************************************************************/
   printf("File init program \n\n");
   printf("%s\n", _RTEMS_version);

   printf("Here we go!\n");
   fp = fopen("test", "w");
   fprintf(fp, "Hello world!!!\n");
   fclose(fp);

   fp = fopen("test", "r");
   fgets(str, 200, fp);
   printf("read: %s\n", str);
   fclose(fp);

   fd = open("test", O_RDONLY);
   if (fd == -1)
   {
      printf("Starting on the wrong foot....\n");
   }
   fp = fdopen(fd, "r");
   if (fp == NULL)
   {
      printf("Crap, man!  Nothing ever goes my way!\n");
      close(fd);
   }
   else
   {
      printf("Soon, I will be able to take over the world!\n");
      fgets(str, 200, fp);
      printf("%s\n", str);
      fclose(fp);
   }

   while (1)
   {
      rtems_task_wake_after(100);
   }


   exit(0);
}


___________________________________________________________________________________________

Maisfutebol - a paixão do futebol actualizada ao minuto.
Saiba tudo sobre o Euro 2004 e vibre com as emoções do futebol.
http://www.maisfutebol.iol.pt/




More information about the users mailing list