public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] RE: Problem with FAT32
@ 2009-03-20 11:09 Himanshu Patel
  2009-03-20 13:19 ` Himanshu Patel
  0 siblings, 1 reply; 9+ messages in thread
From: Himanshu Patel @ 2009-03-20 11:09 UTC (permalink / raw)
  To: eCos Discuss

Note that failure generally happens when we have opendir() or readdir()
calls. Any one has encountered such problem?

Regards,

Himanshu Patel

-----Original Message-----
From: Himanshu Patel 
Sent: Thursday, March 19, 2009 6:57 PM
To: 'eCos Discuss'
Subject: Problem with FAT32

Hi,

We are using FAT32 file system in our project. 

We are facing strange problem. When we test the file system commands
(open, close, read, write) all works very correctly in single thread.
However when we invoke other thread, then file system commands do not
work and board gets reset. 

We have allocated thread stack memory of  file system thread up to 10 KB
and for other thread is 4 KB. 

We have tried to combine both the threads  in one thread and then also
the results are the same (board gets reset). 

We have tried to find out problem by enabling asserts and tracing.
However we don't get any assert at the time of reset. 

What could be the issue? 

Regards,

Himanshu Patel

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [ECOS] RE: Problem with FAT32
  2009-03-20 11:09 [ECOS] RE: Problem with FAT32 Himanshu Patel
@ 2009-03-20 13:19 ` Himanshu Patel
  2009-03-20 13:44   ` Gary Thomas
  2009-03-20 14:04   ` Chris Zimman
  0 siblings, 2 replies; 9+ messages in thread
From: Himanshu Patel @ 2009-03-20 13:19 UTC (permalink / raw)
  To: 'eCos Discuss'

Gentle reminder...We are kind of stuck and delivery date is very near.

Regards,

Himanshu Patel

-----Original Message-----
From: ecos-discuss-owner@ecos.sourceware.org
[mailto:ecos-discuss-owner@ecos.sourceware.org] On Behalf Of Himanshu Patel
Sent: Thursday, March 19, 2009 8:12 PM
To: eCos Discuss
Subject: [ECOS] RE: Problem with FAT32

Note that failure generally happens when we have opendir() or readdir()
calls. Any one has encountered such problem?

Regards,

Himanshu Patel

-----Original Message-----
From: Himanshu Patel 
Sent: Thursday, March 19, 2009 6:57 PM
To: 'eCos Discuss'
Subject: Problem with FAT32

Hi,

We are using FAT32 file system in our project. 

We are facing strange problem. When we test the file system commands
(open, close, read, write) all works very correctly in single thread.
However when we invoke other thread, then file system commands do not
work and board gets reset. 

We have allocated thread stack memory of  file system thread up to 10 KB
and for other thread is 4 KB. 

We have tried to combine both the threads  in one thread and then also
the results are the same (board gets reset). 

We have tried to find out problem by enabling asserts and tracing.
However we don't get any assert at the time of reset. 

What could be the issue? 

Regards,

Himanshu Patel

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss





-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [ECOS] RE: Problem with FAT32
  2009-03-20 13:19 ` Himanshu Patel
@ 2009-03-20 13:44   ` Gary Thomas
  2009-03-20 14:17     ` Himanshu Patel
  2009-03-20 14:04   ` Chris Zimman
  1 sibling, 1 reply; 9+ messages in thread
From: Gary Thomas @ 2009-03-20 13:44 UTC (permalink / raw)
  To: Himanshu Patel; +Cc: 'eCos Discuss'

Himanshu Patel wrote:
> Gentle reminder...We are kind of stuck and delivery date is very near.

Gentle reply - this is a volunteer list, we'll help _when_ we can.

That said, more details are probably necessary in order to be able
to make any comments.
  * What [else] have you done to isolate the problem?
  * Are you running with asserts (and checks) enabled?
  * Can you duplicate it outside of your application?
  * Can you share [any of] the code that fails?

> -----Original Message-----
> From: ecos-discuss-owner@ecos.sourceware.org
> [mailto:ecos-discuss-owner@ecos.sourceware.org] On Behalf Of Himanshu Patel
> Sent: Thursday, March 19, 2009 8:12 PM
> To: eCos Discuss
> Subject: [ECOS] RE: Problem with FAT32
> 
> Note that failure generally happens when we have opendir() or readdir()
> calls. Any one has encountered such problem?
> 
> Regards,
> 
> Himanshu Patel
> 
> -----Original Message-----
> From: Himanshu Patel 
> Sent: Thursday, March 19, 2009 6:57 PM
> To: 'eCos Discuss'
> Subject: Problem with FAT32
> 
> Hi,
> 
> We are using FAT32 file system in our project. 
> 
> We are facing strange problem. When we test the file system commands
> (open, close, read, write) all works very correctly in single thread.
> However when we invoke other thread, then file system commands do not
> work and board gets reset. 
> 
> We have allocated thread stack memory of  file system thread up to 10 KB
> and for other thread is 4 KB. 
> 
> We have tried to combine both the threads  in one thread and then also
> the results are the same (board gets reset). 
> 
> We have tried to find out problem by enabling asserts and tracing.
> However we don't get any assert at the time of reset. 
> 
> What could be the issue? 
> 
> Regards,
> 
> Himanshu Patel
> 


-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [ECOS] RE: Problem with FAT32
  2009-03-20 13:19 ` Himanshu Patel
  2009-03-20 13:44   ` Gary Thomas
@ 2009-03-20 14:04   ` Chris Zimman
  1 sibling, 0 replies; 9+ messages in thread
From: Chris Zimman @ 2009-03-20 14:04 UTC (permalink / raw)
  To: Himanshu Patel, eCos Discuss

> Gentle reminder...We are kind of stuck and delivery date is very near.
>
> Note that failure generally happens when we have opendir() or readdir()
> calls. Any one has encountered such problem?
> 
> We are using FAT32 file system in our project.
> 
> We are facing strange problem. When we test the file system commands
> (open, close, read, write) all works very correctly in single thread.
> However when we invoke other thread, then file system commands do not
> work and board gets reset.
> 
> We have allocated thread stack memory of  file system thread up to 10
> KB
> and for other thread is 4 KB.
> 
> We have tried to combine both the threads  in one thread and then also
> the results are the same (board gets reset).
> 
> We have tried to find out problem by enabling asserts and tracing.
> However we don't get any assert at the time of reset.
> 
> What could be the issue?

These are exactly the types of situations that commercial support exists for.
What you are basically asking for here is for someone to help you debug your
code.  Please note there's a reason there isn't a
'ecos-i-want-paid-level-support-for-free@ecos.sourceware.org'  How about
throwing Gary or the eCosCentric guys a bone and support them for supporting
you?

--Chris

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [ECOS] RE: Problem with FAT32
  2009-03-20 13:44   ` Gary Thomas
@ 2009-03-20 14:17     ` Himanshu Patel
  2009-03-20 15:00       ` Gary Thomas
  0 siblings, 1 reply; 9+ messages in thread
From: Himanshu Patel @ 2009-03-20 14:17 UTC (permalink / raw)
  To: 'Gary Thomas'; +Cc: 'eCos Discuss'

[-- Attachment #1: Type: text/plain, Size: 3229 bytes --]

Hi Gary,

Please find my reply:
  * What [else] have you done to isolate the problem?
    [Himanshu] 
    1. We tried to integrate the file system operations with other thread
(now we have only one thread) and system is 
       running okay.
    2. We tried to increase the thread stack size and interrupt stack size.
But the results are the same. 

  * Are you running with asserts (and checks) enabled?
    [Himanshu] Yes...We have asserts enabled. But reset is not happening due
to assert. 

  * Can you duplicate it outside of your application?
    [Himanshu] We tried to run two simple threads (one doing file operation
and other doing writing on UART). Then also it     
    resets.  

  * Can you share [any of] the code that fails?
    [Himanshu] Okay...Please find herewith application code for your
reference. Note that this is very simple 
    application which we are using right now for basic testing.

Let me know if you need any further information which would help to identify
the problem/solution.

Regards,

Himanshu Patel

-----Original Message-----
From: Gary Thomas [mailto:gary@mlbassoc.com] 
Sent: Friday, March 20, 2009 4:39 PM
To: Himanshu Patel
Cc: 'eCos Discuss'
Subject: Re: [ECOS] RE: Problem with FAT32

Himanshu Patel wrote:
> Gentle reminder...We are kind of stuck and delivery date is very near.

Gentle reply - this is a volunteer list, we'll help _when_ we can.

That said, more details are probably necessary in order to be able
to make any comments.
  * What [else] have you done to isolate the problem?
  * Are you running with asserts (and checks) enabled?
  * Can you duplicate it outside of your application?
  * Can you share [any of] the code that fails?

> -----Original Message-----
> From: ecos-discuss-owner@ecos.sourceware.org
> [mailto:ecos-discuss-owner@ecos.sourceware.org] On Behalf Of Himanshu
Patel
> Sent: Thursday, March 19, 2009 8:12 PM
> To: eCos Discuss
> Subject: [ECOS] RE: Problem with FAT32
> 
> Note that failure generally happens when we have opendir() or readdir()
> calls. Any one has encountered such problem?
> 
> Regards,
> 
> Himanshu Patel
> 
> -----Original Message-----
> From: Himanshu Patel 
> Sent: Thursday, March 19, 2009 6:57 PM
> To: 'eCos Discuss'
> Subject: Problem with FAT32
> 
> Hi,
> 
> We are using FAT32 file system in our project. 
> 
> We are facing strange problem. When we test the file system commands
> (open, close, read, write) all works very correctly in single thread.
> However when we invoke other thread, then file system commands do not
> work and board gets reset. 
> 
> We have allocated thread stack memory of  file system thread up to 10 KB
> and for other thread is 4 KB. 
> 
> We have tried to combine both the threads  in one thread and then also
> the results are the same (board gets reset). 
> 
> We have tried to find out problem by enabling asserts and tracing.
> However we don't get any assert at the time of reset. 
> 
> What could be the issue? 
> 
> Regards,
> 
> Himanshu Patel
> 


-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------


[-- Attachment #2: fatfs1.c --]
[-- Type: application/octet-stream, Size: 17988 bytes --]

//==========================================================================
//
//      fatfs1.c
//
//      Test fileio system
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
// Copyright (C) 2004 eCosCentric Limited
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s):           nickg
// Contributors:        nickg
// Date:                2000-05-25
// Purpose:             Test fileio system
// Description:         This test uses the testfs to check out the initialization
//                      and basic operation of the fileio system
//                      
//                      
//                      
//                      
//                      
//              
//
//####DESCRIPTIONEND####
//
//==========================================================================

#include <pkgconf/hal.h>
#include <pkgconf/io_fileio.h>
#include <pkgconf/fs_fat.h>

#include <cyg/infra/cyg_trac.h>        // tracing macros
#include <cyg/infra/cyg_ass.h>         // assertion macros

#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <errno.h>
#include <string.h>
#include <dirent.h>
#include <stdio.h>

#include <cyg/fileio/fileio.h>

#include <cyg/infra/testcase.h>
#include <cyg/infra/diag.h>            // HAL polled output
#include <cyg/fs/fatfs.h>

#include <cyg/io/io.h>                  /* I/O functions */

//==========================================================================

#define SHOW_RESULT( _fn, _res ) \
diag_printf("<FAIL>: " #_fn "() returned %d %s\n", _res, _res<0?strerror(errno):"");

//==========================================================================

#define IOSIZE  100

#define LONGNAME1       "long_file_name_that_should_take_up_more_than_one_directory_entry_1"
#define LONGNAME2       "long_file_name_that_should_take_up_more_than_one_directory_entry_2"


//==========================================================================

#define IO1DIR 0xE0028018
#define IO1SET 0xE0028014
#define IO1CLR 0xE002801C
#define ENC_RESET        0x00020000  //pin P1.17
#define PUT32(reg, value) (*(volatile unsigned int*)(reg) = (value))
#if 0
#define NTHREADS					2
#define STACKSIZE					(CYGNUM_HAL_STACK_SIZE_TYPICAL)
static cyg_handle_t thread[NTHREADS];
static cyg_thread thread_obj [NTHREADS];
static char stack[NTHREADS][STACKSIZE];
#endif
void _Filemain(CYG_ADDRESS data);

#ifndef CYGPKG_LIBC_STRING

char *strcat( char *s1, const char *s2 )
{
    char *s = s1;
    while( *s1 ) s1++;
    while( (*s1++ = *s2++) != 0);
    return s;
}

#endif

//==========================================================================

static void listdir( char *name, int statp, int numexpected, int *numgot )
{
    int err;
    DIR *dirp;
    int num=0;
    
    diag_printf("<INFO>: reading directory %s\n",name);
    
    dirp = opendir( name );
    if( dirp == NULL ) SHOW_RESULT( opendir, -1 );

    for(;;)
    {
        struct dirent *entry = readdir( dirp );
        
        if( entry == NULL )
            break;
        num++;
        diag_printf("<INFO>: entry %14s",entry->d_name);
#ifdef CYGPKG_FS_FAT_RET_DIRENT_DTYPE
        diag_printf(" d_type %2x", entry->d_type);
#endif
        if( statp )
        {
            char fullname[PATH_MAX];
            struct stat sbuf;

            if( name[0] )
            {
                strcpy(fullname, name );
                if( !(name[0] == '/' && name[1] == 0 ) )
                    strcat(fullname, "/" );
            }
            else fullname[0] = 0;
            
            strcat(fullname, entry->d_name );
            
            err = stat( fullname, &sbuf );
            if( err < 0 )
            {
                if( errno == ENOSYS )
                    diag_printf(" <no status available>");
                else SHOW_RESULT( stat, err );
            }
            else
            {
                diag_printf(" [mode %08x ino %08x nlink %d size %ld]",
                            sbuf.st_mode,sbuf.st_ino,sbuf.st_nlink,(long)sbuf.st_size);
            }
#ifdef CYGPKG_FS_FAT_RET_DIRENT_DTYPE
            if ((entry->d_type & S_IFMT) != (sbuf.st_mode & S_IFMT))
              CYG_TEST_FAIL("File mode's don't match between dirent and stat");
#endif
        }

        diag_printf("\n");
    }

    err = closedir( dirp );
    if( err < 0 ) SHOW_RESULT( stat, err );
    if (numexpected >= 0 && num != numexpected)
        CYG_TEST_FAIL("Wrong number of dir entries\n");
    if ( numgot != NULL )
        *numgot = num;
}

//==========================================================================

static void createfile( char *name, size_t size )
{
    char buf[IOSIZE];
    int fd;
    ssize_t wrote;
    int i;
    int err;
    cyg_tick_count_t time_val1, time_val2;

    diag_printf("<INFO>: create file %s size %zd \n",name,size);

    err = access( name, F_OK );
    if( err < 0 && errno != EACCES ) SHOW_RESULT( access, err );
    
    for( i = 0; i < IOSIZE; i++ ) buf[i] = i%256;
 
    fd = open( name, O_WRONLY|O_CREAT );
    if( fd < 0 ) SHOW_RESULT( open, fd );

    while( size > 0 )
    {
        ssize_t len = size;
        if ( len > IOSIZE ) len = IOSIZE;
        
        wrote = write( fd, buf, len );
        if( wrote != len ) SHOW_RESULT( write, (int)wrote );        

        size -= wrote;
    }

    err = close( fd );
    if( err < 0 ) SHOW_RESULT( close, err );
}

//==========================================================================

static void maxfile( char *name )
{
    char buf[IOSIZE];
    int fd;
    ssize_t wrote;
    int i;
    int err;
    size_t size = 0;
    size_t prevsize = 0;
    
    diag_printf("<INFO>: create maximal file %s\n",name);
    diag_printf("<INFO>: This may take a few minutes\n");

    err = access( name, F_OK );
    if( err < 0 && errno != EACCES ) SHOW_RESULT( access, err );
    
    for( i = 0; i < IOSIZE; i++ ) buf[i] = i%256;
 
    fd = open( name, O_WRONLY|O_CREAT );
    if( fd < 0 ) SHOW_RESULT( open, fd );

    do
    {
        wrote = write( fd, buf, IOSIZE );
        //if( wrote < 0 ) SHOW_RESULT( write, wrote );        

        if( wrote >= 0 )
            size += wrote;

        if( (size-prevsize) > 100000 )
        {
            diag_printf("<INFO>: size = %zd \n", size);
            prevsize = size;
        }
        
    } while( wrote == IOSIZE );

    diag_printf("<INFO>: file size == %zd\n",size);

    err = close( fd );
    if( err < 0 ) SHOW_RESULT( close, err );
}

//==========================================================================

static void checkfile( char *name )
{
    char buf[IOSIZE];
    int fd;
    ssize_t done;
    int i;
    int err;
    off_t pos = 0;

    diag_printf("<INFO>: check file %s\n",name);
    
    err = access( name, F_OK );
    if( err != 0 ) SHOW_RESULT( access, err );

    fd = open( name, O_RDONLY );
    if( fd < 0 ) SHOW_RESULT( open, fd );

    for(;;)
    {
        done = read( fd, buf, IOSIZE );
        if( done < 0 ) SHOW_RESULT( read, (int)done );

        if( done == 0 ) break;

        for( i = 0; i < done; i++ )
            if( buf[i] != i%256 )
            {
                diag_printf("buf[%ld+%d](%02x) != %02x\n",pos,i,buf[i],i%256);
                CYG_TEST_FAIL("Data read not equal to data written\n");
            }
        
        pos += done;
    }

    err = close( fd );
    if( err < 0 ) SHOW_RESULT( close, err );
}

#ifdef CYGCFG_FS_FAT_USE_ATTRIBUTES
//==========================================================================

static void checkattrib(const char *name, 
                        const cyg_fs_attrib_t test_attrib )
{
    int err;
    cyg_fs_attrib_t file_attrib;

    diag_printf("<INFO>: check attrib %s\n",name);

    err = cyg_fs_get_attrib(name, &file_attrib);
    if( err != 0 ) SHOW_RESULT( stat, err );

    if ( (file_attrib & S_FATFS_ATTRIB) != test_attrib )
        diag_printf("<FAIL>: attrib %s incorrect\n\tExpected %x Was %x\n",
                    name,test_attrib,(file_attrib & S_FATFS_ATTRIB));
}
#endif // CYGCFG_FS_FAT_USE_ATTRIBUTES

//==========================================================================

static void copyfile( char *name2, char *name1 )
{

    int err;
    char buf[IOSIZE];
    int fd1, fd2;
    ssize_t done, wrote;

    diag_printf("<INFO>: copy file %s -> %s\n",name2,name1);

    err = access( name1, F_OK );
    if( err < 0 && errno != EACCES ) SHOW_RESULT( access, err );

    err = access( name2, F_OK );
    if( err != 0 ) SHOW_RESULT( access, err );
    
    fd1 = open( name1, O_WRONLY|O_CREAT );
    if( fd1 < 0 ) SHOW_RESULT( open, fd1 );

    fd2 = open( name2, O_RDONLY );
    if( fd2 < 0 ) SHOW_RESULT( open, fd2 );
    
    for(;;)
    {
        done = read( fd2, buf, IOSIZE );
        if( done < 0 ) SHOW_RESULT( read, (int)done );

        if( done == 0 ) break;

        wrote = write( fd1, buf, done );
        if( wrote != done ) SHOW_RESULT( write, (int) wrote );

        if( wrote != done ) break;
    }

    err = close( fd1 );
    if( err < 0 ) SHOW_RESULT( close, err );

    err = close( fd2 );
    if( err < 0 ) SHOW_RESULT( close, err );
    
}

//==========================================================================

static void comparefiles( char *name2, char *name1 )
{
    int err;
    char buf1[IOSIZE];
    char buf2[IOSIZE];
    int fd1, fd2;
    ssize_t done1, done2;
    int i;

    diag_printf("<INFO>: compare files %s == %s\n",name2,name1);

    err = access( name1, F_OK );
    if( err != 0 ) SHOW_RESULT( access, err );

    err = access( name1, F_OK );
    if( err != 0 ) SHOW_RESULT( access, err );
    
    fd1 = open( name1, O_RDONLY );
    if( fd1 < 0 ) SHOW_RESULT( open, fd1 );

    fd2 = open( name2, O_RDONLY );
    if( fd2 < 0 ) SHOW_RESULT( open, fd2 );
    
    for(;;)
    {
        done1 = read( fd1, buf1, IOSIZE );
        if( done1 < 0 ) SHOW_RESULT( read, (int)done1 );

        done2 = read( fd2, buf2, IOSIZE );
        if( done2 < 0 ) SHOW_RESULT( read, (int)done2 );

        if( done1 != done2 )
            diag_printf("Files different sizes\n");
        
        if( done1 == 0 ) break;

        for( i = 0; i < done1; i++ )
            if( buf1[i] != buf2[i] )
            {
                diag_printf("buf1[%d](%02x) != buf1[%d](%02x)\n",i,buf1[i],i,buf2[i]);
                CYG_TEST_FAIL("Data in files not equal\n");
            }
    }

    err = close( fd1 );
    if( err < 0 ) SHOW_RESULT( close, err );

    err = close( fd2 );
    if( err < 0 ) SHOW_RESULT( close, err );
    
}

//==========================================================================

void checkcwd( const char *cwd )
{
    static char cwdbuf[PATH_MAX];
    char *ret;

    ret = getcwd( cwdbuf, sizeof(cwdbuf));
    if( ret == NULL ) SHOW_RESULT( getcwd, (int)ret );    

    if( strcmp( cwdbuf, cwd ) != 0 )
    {
        diag_printf( "cwdbuf %s cwd %s\n",cwdbuf, cwd );
        CYG_TEST_FAIL( "Current directory mismatch");
    }
}
#if 0
static void FnBtNfcMain(cyg_addrword_t data)
{
	
    	cyg_io_handle_t handle;
	Cyg_ErrNo err;
	const char test_string[] = "serial example is working correctly!\n";
	cyg_uint32 len = strlen(test_string);
    	err = cyg_io_lookup( "/dev/ser1", &handle );
    	if (ENOERR != err) {
		printf("\nerror in ser1..\n");
	}
	while(1)
	{
		cyg_thread_delay(1);
        	cyg_io_write( handle, test_string, &len );
		printf("\nStackUsage..\n");
	}
}
#endif

//==========================================================================
void _Filemain (CYG_ADDRESS data)
{
    int err;
    int existingdirents=-1;
#if defined(CYGSEM_FILEIO_BLOCK_USAGE)
    struct cyg_fs_block_usage usage;
#endif

    CYG_TEST_INIT();

    // --------------------------------------------------------------

	//gpio_init();
    err = mount( "/dev/mmcdisk0/0", "/", "fatfs" );    
    if( err < 0 ) SHOW_RESULT( mount, err );    

		cyg_thread_delay(1);
    err = chdir( "/" );
    if( err < 0 ) SHOW_RESULT( chdir, err );

		cyg_thread_delay(1);
    checkcwd( "/" );
    
		cyg_thread_delay(1);
    listdir( "/", true, -1, &existingdirents );

		cyg_thread_delay(1);
    // --------------------------------------------------------------
#if defined(CYGSEM_FILEIO_BLOCK_USAGE)
    err = cyg_fs_getinfo("/", FS_INFO_BLOCK_USAGE, &usage, sizeof(usage));
    if( err < 0 ) SHOW_RESULT( cyg_fs_getinfo, err );
    diag_printf("<INFO>: total size: %6lld blocks, %10lld bytes\n",
		usage.total_blocks, usage.total_blocks * usage.block_size); 
    diag_printf("<INFO>: free size:  %6lld blocks, %10lld bytes\n",
		usage.free_blocks, usage.free_blocks * usage.block_size); 
    diag_printf("<INFO>: block size: %6u bytes\n", usage.block_size);
#endif
    // --------------------------------------------------------------

    createfile( "/foo", 20257 );
		cyg_thread_delay(1);
    checkfile( "foo" );
		cyg_thread_delay(1);
    copyfile( "foo", "fee");
		cyg_thread_delay(1);
    checkfile( "fee" );
		cyg_thread_delay(1);
    comparefiles( "foo", "/fee" );
		cyg_thread_delay(1);
    diag_printf("<INFO>: mkdir bar\n");
    err = mkdir( "/bar", 0 );
		cyg_thread_delay(1);
    if( err < 0 ) SHOW_RESULT( mkdir, err );

    listdir( "/" , true, existingdirents+3, NULL );
		cyg_thread_delay(1);

    copyfile( "fee", "/bar/fum" );
		cyg_thread_delay(1);
    checkfile( "bar/fum" );
		cyg_thread_delay(1);
    comparefiles( "/fee", "bar/fum" );
		cyg_thread_delay(1);

    diag_printf("<INFO>: cd bar\n");
    err = chdir( "bar" );
		cyg_thread_delay(1);
    if( err < 0 ) SHOW_RESULT( chdir, err );

    checkcwd( "/bar" );
    
		cyg_thread_delay(1);
    diag_printf("<INFO>: rename /foo bundy\n");    
    err = rename( "/foo", "bundy" );
		cyg_thread_delay(1);
    if( err < 0 ) SHOW_RESULT( rename, err );
    
    listdir( "/", true, existingdirents+2, NULL );
		cyg_thread_delay(1);
    listdir( "" , true, 4, NULL );
		cyg_thread_delay(1);

    checkfile( "/bar/bundy" );
		cyg_thread_delay(1);
    comparefiles("/fee", "bundy" );
		cyg_thread_delay(1);

#if defined(CYGSEM_FILEIO_BLOCK_USAGE)
    err = cyg_fs_getinfo("/", FS_INFO_BLOCK_USAGE, &usage, sizeof(usage));
    if( err < 0 ) SHOW_RESULT( cyg_fs_getinfo, err );
    diag_printf("<INFO>: total size: %6lld blocks, %10lld bytes\n",
		usage.total_blocks, usage.total_blocks * usage.block_size); 
    diag_printf("<INFO>: free size:  %6lld blocks, %10lld bytes\n",
		usage.free_blocks, usage.free_blocks * usage.block_size); 
    diag_printf("<INFO>: block size: %6u bytes\n", usage.block_size);
#endif
    // --------------------------------------------------------------

    //diag_printf("<INFO>: unlink fee\n");    
    //err = unlink( "/fee" );
    //if( err < 0 ) SHOW_RESULT( unlink, err );

    //diag_printf("<INFO>: unlink fum\n");        
    //err = unlink( "fum" );
    //if( err < 0 ) SHOW_RESULT( unlink, err );

    //diag_printf("<INFO>: unlink /bar/bundy\n");        
    //err = unlink( "/bar/bundy" );
    //if( err < 0 ) SHOW_RESULT( unlink, err );

    diag_printf("<INFO>: cd /\n");        
    err = chdir( "/" );
		cyg_thread_delay(1);
    //if( err < 0 ) SHOW_RESULT( chdir, err );

    //checkcwd( "/" );
    
    //diag_printf("<INFO>: rmdir /bar\n");        
    //err = rmdir( "/bar" );
    if( err < 0 ) SHOW_RESULT( rmdir, err );
    
    listdir( "/", false, existingdirents, NULL );

		cyg_thread_delay(1);
    // --------------------------------------------------------------

    diag_printf("<INFO>: umount /\n");    
    err = umount( "/" );
    if( err < 0 ) SHOW_RESULT( umount, err );    
    
    CYG_TEST_PASS_FINISH("fatfs1");
}

// -------------------------------------------------------------------------
// EOF fatfs1.c

[-- Attachment #3: iso7816_v2.c --]
[-- Type: application/octet-stream, Size: 6765 bytes --]

// ***************************************************************************
// * FILE               : iso7816.c
// * PURPOSE            : ISO/IEC 7816-3 implementations with TDA8029
// * DATE               : JAN-08
// * VERSION            : 1.0
// * AUTHOR             : Rushikesh
// * DESCRIPTION        : ??
// *                    : ??
// * REV. HISTORY       :  VERSION      DATE        CHANGES
// *                    : ??
// ***************************************************************************


//******************
// I N C L U D E S
//******************

// eCos includes
#include	<pkgconf/system.h>
#ifdef CYGPKG_KERNEL
# include <pkgconf/kernel.h>
#endif
#ifdef CYGPKG_LIBC
# include <pkgconf/libc.h>
#endif
#ifdef CYGPKG_IO_SERIAL
# include <pkgconf/io_serial.h>
#endif

#ifndef CYGFUN_KERNEL_API_C
# error Kernel API must be enabled to build this example
#endif

#ifndef CYGPKG_LIBC_STDIO
# error C library standard I/O must be enabled to build this example
#endif

#ifndef CYGPKG_IO_SERIAL_HALDIAG
# error I/O HALDIAG pseudo-device driver must be enabled to build this example
#endif

/* INCLUDES */

#include <stdio.h>                      /* printf */
#include <string.h>                     /* strlen */
#include <cyg/kernel/kapi.h>            /* All the kernel specific stuff */
#include <cyg/io/io.h>                  /* I/O functions */
#include <cyg/hal/hal_arch.h>           /* CYGNUM_HAL_STACK_SIZE_TYPICAL */

// eCos includes
#include <pkgconf/io.h>
#include <cyg/io/io.h>
#include <cyg/hal/hal_intr.h>
#include <cyg/io/devtab.h>
#include <cyg/infra/diag.h>
#include <cyg/hal/hal_io.h>
#include <cyg/hal/var_io.h>
#include <cyg/io/serialio.h>



//******************
// D E F I N E S
//******************
#define NTHREADS					4
#define STACKSIZE					(CYGNUM_HAL_STACK_SIZE_TYPICAL)

// if we will be using a receive then enable following macro
#define RECEIVE_THREAD_USED			1

// Priority levels for threads
#define INIT_PRIORITY				4

// Stack size of thread
#define STACK_SIZE					1024

// thread names
#define INIT_THREAD					0

// thread names
#define RECEIVE_THREAD				1



static cyg_handle_t thread[NTHREADS];
static cyg_thread thread_obj[NTHREADS];
static char stack[NTHREADS][STACKSIZE];


static cyg_io_handle_t _HandleScrUart;


//*********************************
// E X T E R N  P R O T O T Y P E S
//*********************************

extern void _Filemain (CYG_ADDRESS data);

// #######################################################################
// F O P S
// #######################################################################

/*******************************************************************************
* FUNCTION       : void _ThreadScrInit(cyg_addrword_t data)
* DESCRIPTION    : Thread to initailize the card.
* RETURNS        : None
* INPUT          : cyg_addrword_t data : NULL
* OUTPUT         : None
* INPUT/OUTPUT   : None
*******************************************************************************/
static void _ThreadScrInit(CYG_ADDRESS data)
{
    cyg_serial_info_t ScrUartCfg;
    cyg_uint32 Length;
    unsigned int dwAddr;
    unsigned int dwRegValue;
    unsigned char bRxBuffer[30];
    unsigned int  dwRxLength;
    printf("\n-----------------------------");
	printf("\nSCR Application Build: 107");
    printf("\n-----------------------------\n\n");
	printf("\nInitThread...");
    if(cyg_io_lookup("/dev/ser1", &_HandleScrUart) == ENOERR)
    {
        printf("\nSerialPort found!");
        ScrUartCfg.baud = CYGNUM_SERIAL_BAUD_38400;
        ScrUartCfg.word_length = CYGNUM_SERIAL_WORD_LENGTH_8;
        ScrUartCfg.stop = CYGNUM_SERIAL_STOP_1;
        ScrUartCfg.parity = CYGNUM_SERIAL_PARITY_NONE;
        ScrUartCfg.flags = 0x01;
        Length = sizeof(ScrUartCfg );
        if(cyg_io_set_config(_HandleScrUart,
                            CYG_IO_SET_CONFIG_SERIAL_INFO,
                            &ScrUartCfg,
                            &Length) == ENOERR)
        {
            // No error in configuration.
            printf("\nUART configured successfully");
			printf("\nChecking modem signals");
			dwAddr = CYGARC_HAL_LPC24XX_REG_U1MCR;
			HAL_READ_UINT8(dwAddr, dwRegValue);
			printf("\n  Reading U1MCR = 0x%x",dwRegValue);
			dwRegValue &= ~(CYGARC_HAL_LPC24XX_REG_U1MCR_DTR |
			                CYGARC_HAL_LPC24XX_REG_U1MCR_RTS |
							CYGARC_HAL_LPC24XX_REG_U1MCR_LOOPBACK);
			HAL_WRITE_UINT8(dwAddr, dwRegValue);
			printf("\n  Written U1MCR = 0x%x",dwRegValue);
			// Write a dummy byte to start communication.
        }

    }
    else
    {
        printf("\nSerialPort NOT found!");
    }


	cyg_thread_exit();

}
/*******************************************************************************
* FUNCTION       : void _ThreadScrReceive(cyg_addrword_t data)
* DESCRIPTION    : Thread to receive data over uart.
* RETURNS        : None
* INPUT          : cyg_addrword_t data : NULL
* OUTPUT         : None
* INPUT/OUTPUT   : None
*******************************************************************************/
static void _ThreadScrReceive(CYG_ADDRESS data)
{
    // The 10 count is temporary, ideally we should receive
    // single byte at a time.
    unsigned char bStorage[10];
    unsigned int dwLen = 1;
    unsigned int dwOffset = 0;

    printf("\nReceiveThread...");

    while(1)
    {
        // Read data from uart.
        // This should be a blocking call.
		dwLen = 1;
        cyg_io_read(_HandleScrUart, bStorage, &dwLen);
	printf("\nRxLen = %d",dwLen);
    }
}




void cyg_user_start(void)
//void scr_start(void)
{
    // Initialize a init thread.
#if 1
    cyg_thread_create(4, _ThreadScrInit, (cyg_addrword_t) 0, "scr_init",
                      (void *)stack[0], STACKSIZE, &thread[0], &thread_obj[0]);
    cyg_thread_resume(thread[0]);

    cyg_thread_create(4, _ThreadScrReceive, (cyg_addrword_t) 0, "scr_rcv",
                      (void *)stack[1], STACKSIZE, &thread[1], &thread_obj[1]);
    cyg_thread_resume(thread[1]);

    /*cyg_thread_create(4, _ThreadScrTest, (cyg_addrword_t) 0, "scr_test",
                      (void *)stack[2], STACKSIZE, &thread[2], &thread_obj[2]);
    cyg_thread_resume(thread[2]);*/
    cyg_thread_create(6, _Filemain, (cyg_addrword_t) 0, "FileOp_APP",
                      (void *)stack[3], STACKSIZE, &thread[3], &thread_obj[3]);
						cyg_thread_resume(thread[3]);
#endif
}
// #######################################################################
// M O D U L E  D E C L A R A T I O N S
// #######################################################################



[-- Attachment #4: Type: text/plain, Size: 148 bytes --]

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [ECOS] RE: Problem with FAT32
  2009-03-20 14:17     ` Himanshu Patel
@ 2009-03-20 15:00       ` Gary Thomas
  2009-03-20 16:51         ` Himanshu Patel
  0 siblings, 1 reply; 9+ messages in thread
From: Gary Thomas @ 2009-03-20 15:00 UTC (permalink / raw)
  To: Himanshu Patel; +Cc: 'eCos Discuss'

Himanshu Patel wrote:
> Hi Gary,
> 
> Please find my reply:
>   * What [else] have you done to isolate the problem?
>     [Himanshu] 
>     1. We tried to integrate the file system operations with other thread
> (now we have only one thread) and system is 
>        running okay.
>     2. We tried to increase the thread stack size and interrupt stack size.
> But the results are the same. 
> 
>   * Are you running with asserts (and checks) enabled?
>     [Himanshu] Yes...We have asserts enabled. But reset is not happening due
> to assert. 
> 
>   * Can you duplicate it outside of your application?
>     [Himanshu] We tried to run two simple threads (one doing file operation
> and other doing writing on UART). Then also it     
>     resets.  

Isolate this test.  Does it only fail when using MMC/SD access?

> 
>   * Can you share [any of] the code that fails?
>     [Himanshu] Okay...Please find herewith application code for your
> reference. Note that this is very simple 
>     application which we are using right now for basic testing.

Not terribly useful, frankly.  I'm not interested in reading 1000 lines
of random code without any guidance, etc.  For example, how does your
'fatfs1.c' differ from the standard one?  Does it fail as well?

> Let me know if you need any further information which would help to identify
> the problem/solution.

What you'll get here is at best _guidance_, not analysis and debug.
As Chris said, that's what *paid* support is for.

> -----Original Message-----
> From: Gary Thomas [mailto:gary@mlbassoc.com] 
> Sent: Friday, March 20, 2009 4:39 PM
> To: Himanshu Patel
> Cc: 'eCos Discuss'
> Subject: Re: [ECOS] RE: Problem with FAT32
> 
> Himanshu Patel wrote:
>> Gentle reminder...We are kind of stuck and delivery date is very near.
> 
> Gentle reply - this is a volunteer list, we'll help _when_ we can.
> 
> That said, more details are probably necessary in order to be able
> to make any comments.
>   * What [else] have you done to isolate the problem?
>   * Are you running with asserts (and checks) enabled?
>   * Can you duplicate it outside of your application?
>   * Can you share [any of] the code that fails?
> 
>> -----Original Message-----
>> From: ecos-discuss-owner@ecos.sourceware.org
>> [mailto:ecos-discuss-owner@ecos.sourceware.org] On Behalf Of Himanshu
> Patel
>> Sent: Thursday, March 19, 2009 8:12 PM
>> To: eCos Discuss
>> Subject: [ECOS] RE: Problem with FAT32
>>
>> Note that failure generally happens when we have opendir() or readdir()
>> calls. Any one has encountered such problem?
>>
>> Regards,
>>
>> Himanshu Patel
>>
>> -----Original Message-----
>> From: Himanshu Patel 
>> Sent: Thursday, March 19, 2009 6:57 PM
>> To: 'eCos Discuss'
>> Subject: Problem with FAT32
>>
>> Hi,
>>
>> We are using FAT32 file system in our project. 
>>
>> We are facing strange problem. When we test the file system commands
>> (open, close, read, write) all works very correctly in single thread.
>> However when we invoke other thread, then file system commands do not
>> work and board gets reset. 
>>
>> We have allocated thread stack memory of  file system thread up to 10 KB
>> and for other thread is 4 KB. 
>>
>> We have tried to combine both the threads  in one thread and then also
>> the results are the same (board gets reset). 
>>
>> We have tried to find out problem by enabling asserts and tracing.
>> However we don't get any assert at the time of reset. 
>>
>> What could be the issue? 
>>
>> Regards,
>>
>> Himanshu Patel
>>
> 
> 


-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [ECOS] RE: Problem with FAT32
  2009-03-20 15:00       ` Gary Thomas
@ 2009-03-20 16:51         ` Himanshu Patel
  2009-03-20 17:25           ` Gary Thomas
  0 siblings, 1 reply; 9+ messages in thread
From: Himanshu Patel @ 2009-03-20 16:51 UTC (permalink / raw)
  To: 'Gary Thomas'; +Cc: 'eCos Discuss'

Hi Gary,

'fatfs1.c' is the same as the standard one. It does fail when we have other
thread with IO operation (for example accessing UART).

Regards,

Himanshu Patel

-----Original Message-----
From: Gary Thomas [mailto:gary@mlbassoc.com] 
Sent: Friday, March 20, 2009 7:34 PM
To: Himanshu Patel
Cc: 'eCos Discuss'
Subject: Re: [ECOS] RE: Problem with FAT32

Himanshu Patel wrote:
> Hi Gary,
> 
> Please find my reply:
>   * What [else] have you done to isolate the problem?
>     [Himanshu] 
>     1. We tried to integrate the file system operations with other thread
> (now we have only one thread) and system is 
>        running okay.
>     2. We tried to increase the thread stack size and interrupt stack
size.
> But the results are the same. 
> 
>   * Are you running with asserts (and checks) enabled?
>     [Himanshu] Yes...We have asserts enabled. But reset is not happening
due
> to assert. 
> 
>   * Can you duplicate it outside of your application?
>     [Himanshu] We tried to run two simple threads (one doing file
operation
> and other doing writing on UART). Then also it     
>     resets.  

Isolate this test.  Does it only fail when using MMC/SD access?

> 
>   * Can you share [any of] the code that fails?
>     [Himanshu] Okay...Please find herewith application code for your
> reference. Note that this is very simple 
>     application which we are using right now for basic testing.

Not terribly useful, frankly.  I'm not interested in reading 1000 lines
of random code without any guidance, etc.  For example, how does your
'fatfs1.c' differ from the standard one?  Does it fail as well?

> Let me know if you need any further information which would help to
identify
> the problem/solution.

What you'll get here is at best _guidance_, not analysis and debug.
As Chris said, that's what *paid* support is for.

> -----Original Message-----
> From: Gary Thomas [mailto:gary@mlbassoc.com] 
> Sent: Friday, March 20, 2009 4:39 PM
> To: Himanshu Patel
> Cc: 'eCos Discuss'
> Subject: Re: [ECOS] RE: Problem with FAT32
> 
> Himanshu Patel wrote:
>> Gentle reminder...We are kind of stuck and delivery date is very near.
> 
> Gentle reply - this is a volunteer list, we'll help _when_ we can.
> 
> That said, more details are probably necessary in order to be able
> to make any comments.
>   * What [else] have you done to isolate the problem?
>   * Are you running with asserts (and checks) enabled?
>   * Can you duplicate it outside of your application?
>   * Can you share [any of] the code that fails?
> 
>> -----Original Message-----
>> From: ecos-discuss-owner@ecos.sourceware.org
>> [mailto:ecos-discuss-owner@ecos.sourceware.org] On Behalf Of Himanshu
> Patel
>> Sent: Thursday, March 19, 2009 8:12 PM
>> To: eCos Discuss
>> Subject: [ECOS] RE: Problem with FAT32
>>
>> Note that failure generally happens when we have opendir() or readdir()
>> calls. Any one has encountered such problem?
>>
>> Regards,
>>
>> Himanshu Patel
>>
>> -----Original Message-----
>> From: Himanshu Patel 
>> Sent: Thursday, March 19, 2009 6:57 PM
>> To: 'eCos Discuss'
>> Subject: Problem with FAT32
>>
>> Hi,
>>
>> We are using FAT32 file system in our project. 
>>
>> We are facing strange problem. When we test the file system commands
>> (open, close, read, write) all works very correctly in single thread.
>> However when we invoke other thread, then file system commands do not
>> work and board gets reset. 
>>
>> We have allocated thread stack memory of  file system thread up to 10 KB
>> and for other thread is 4 KB. 
>>
>> We have tried to combine both the threads  in one thread and then also
>> the results are the same (board gets reset). 
>>
>> We have tried to find out problem by enabling asserts and tracing.
>> However we don't get any assert at the time of reset. 
>>
>> What could be the issue? 
>>
>> Regards,
>>
>> Himanshu Patel
>>
> 
> 


-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------




-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [ECOS] RE: Problem with FAT32
  2009-03-20 16:51         ` Himanshu Patel
@ 2009-03-20 17:25           ` Gary Thomas
  2009-03-26 16:52             ` Himanshu Patel
  0 siblings, 1 reply; 9+ messages in thread
From: Gary Thomas @ 2009-03-20 17:25 UTC (permalink / raw)
  To: Himanshu Patel; +Cc: 'eCos Discuss'

Himanshu Patel wrote:
> Hi Gary,
> 
> 'fatfs1.c' is the same as the standard one. It does fail when we have other
> thread with IO operation (for example accessing UART).

Then it's not the same as the standard one, is it?  The file you sent
is not a stand alone test showing your problem.  I also note that your
modified test accesses a MMC/SD drive - does the problem still happen
if you use some other disk, for example a RAM disk?

Either show us how to duplicate your failure, e.g. how you modified
that test to add additional threads, how to run it, etc, or stop bothering
this public forum.

> -----Original Message-----
> From: Gary Thomas [mailto:gary@mlbassoc.com] 
> Sent: Friday, March 20, 2009 7:34 PM
> To: Himanshu Patel
> Cc: 'eCos Discuss'
> Subject: Re: [ECOS] RE: Problem with FAT32
> 
> Himanshu Patel wrote:
>> Hi Gary,
>>
>> Please find my reply:
>>   * What [else] have you done to isolate the problem?
>>     [Himanshu] 
>>     1. We tried to integrate the file system operations with other thread
>> (now we have only one thread) and system is 
>>        running okay.
>>     2. We tried to increase the thread stack size and interrupt stack
> size.
>> But the results are the same. 
>>
>>   * Are you running with asserts (and checks) enabled?
>>     [Himanshu] Yes...We have asserts enabled. But reset is not happening
> due
>> to assert. 
>>
>>   * Can you duplicate it outside of your application?
>>     [Himanshu] We tried to run two simple threads (one doing file
> operation
>> and other doing writing on UART). Then also it     
>>     resets.  
> 
> Isolate this test.  Does it only fail when using MMC/SD access?
> 
>>   * Can you share [any of] the code that fails?
>>     [Himanshu] Okay...Please find herewith application code for your
>> reference. Note that this is very simple 
>>     application which we are using right now for basic testing.
> 
> Not terribly useful, frankly.  I'm not interested in reading 1000 lines
> of random code without any guidance, etc.  For example, how does your
> 'fatfs1.c' differ from the standard one?  Does it fail as well?
> 
>> Let me know if you need any further information which would help to
> identify
>> the problem/solution.
> 
> What you'll get here is at best _guidance_, not analysis and debug.
> As Chris said, that's what *paid* support is for.
> 
>> -----Original Message-----
>> From: Gary Thomas [mailto:gary@mlbassoc.com] 
>> Sent: Friday, March 20, 2009 4:39 PM
>> To: Himanshu Patel
>> Cc: 'eCos Discuss'
>> Subject: Re: [ECOS] RE: Problem with FAT32
>>
>> Himanshu Patel wrote:
>>> Gentle reminder...We are kind of stuck and delivery date is very near.
>> Gentle reply - this is a volunteer list, we'll help _when_ we can.
>>
>> That said, more details are probably necessary in order to be able
>> to make any comments.
>>   * What [else] have you done to isolate the problem?
>>   * Are you running with asserts (and checks) enabled?
>>   * Can you duplicate it outside of your application?
>>   * Can you share [any of] the code that fails?
>>
>>> -----Original Message-----
>>> From: ecos-discuss-owner@ecos.sourceware.org
>>> [mailto:ecos-discuss-owner@ecos.sourceware.org] On Behalf Of Himanshu
>> Patel
>>> Sent: Thursday, March 19, 2009 8:12 PM
>>> To: eCos Discuss
>>> Subject: [ECOS] RE: Problem with FAT32
>>>
>>> Note that failure generally happens when we have opendir() or readdir()
>>> calls. Any one has encountered such problem?
>>>
>>> Regards,
>>>
>>> Himanshu Patel
>>>
>>> -----Original Message-----
>>> From: Himanshu Patel 
>>> Sent: Thursday, March 19, 2009 6:57 PM
>>> To: 'eCos Discuss'
>>> Subject: Problem with FAT32
>>>
>>> Hi,
>>>
>>> We are using FAT32 file system in our project. 
>>>
>>> We are facing strange problem. When we test the file system commands
>>> (open, close, read, write) all works very correctly in single thread.
>>> However when we invoke other thread, then file system commands do not
>>> work and board gets reset. 
>>>
>>> We have allocated thread stack memory of  file system thread up to 10 KB
>>> and for other thread is 4 KB. 
>>>
>>> We have tried to combine both the threads  in one thread and then also
>>> the results are the same (board gets reset). 
>>>
>>> We have tried to find out problem by enabling asserts and tracing.
>>> However we don't get any assert at the time of reset. 
>>>
>>> What could be the issue? 
>>>
>>> Regards,
>>>
>>> Himanshu Patel
>>>
>>
> 
> 


-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [ECOS] RE: Problem with FAT32
  2009-03-20 17:25           ` Gary Thomas
@ 2009-03-26 16:52             ` Himanshu Patel
  0 siblings, 0 replies; 9+ messages in thread
From: Himanshu Patel @ 2009-03-26 16:52 UTC (permalink / raw)
  To: 'eCos Discuss'

Hi All,

The problem has got resolved. There was exception happening in the micro SD
drive

Thank you.

Regards,

Himanshu Patel

-----Original Message-----
From: ecos-discuss-owner@ecos.sourceware.org
[mailto:ecos-discuss-owner@ecos.sourceware.org] On Behalf Of Gary Thomas
Sent: Friday, March 20, 2009 9:31 PM
To: Himanshu Patel
Cc: 'eCos Discuss'
Subject: Re: [ECOS] RE: Problem with FAT32

Himanshu Patel wrote:
> Hi Gary,
> 
> 'fatfs1.c' is the same as the standard one. It does fail when we have
other
> thread with IO operation (for example accessing UART).

Then it's not the same as the standard one, is it?  The file you sent
is not a stand alone test showing your problem.  I also note that your
modified test accesses a MMC/SD drive - does the problem still happen
if you use some other disk, for example a RAM disk?

Either show us how to duplicate your failure, e.g. how you modified
that test to add additional threads, how to run it, etc, or stop bothering
this public forum.

> -----Original Message-----
> From: Gary Thomas [mailto:gary@mlbassoc.com] 
> Sent: Friday, March 20, 2009 7:34 PM
> To: Himanshu Patel
> Cc: 'eCos Discuss'
> Subject: Re: [ECOS] RE: Problem with FAT32
> 
> Himanshu Patel wrote:
>> Hi Gary,
>>
>> Please find my reply:
>>   * What [else] have you done to isolate the problem?
>>     [Himanshu] 
>>     1. We tried to integrate the file system operations with other thread
>> (now we have only one thread) and system is 
>>        running okay.
>>     2. We tried to increase the thread stack size and interrupt stack
> size.
>> But the results are the same. 
>>
>>   * Are you running with asserts (and checks) enabled?
>>     [Himanshu] Yes...We have asserts enabled. But reset is not happening
> due
>> to assert. 
>>
>>   * Can you duplicate it outside of your application?
>>     [Himanshu] We tried to run two simple threads (one doing file
> operation
>> and other doing writing on UART). Then also it     
>>     resets.  
> 
> Isolate this test.  Does it only fail when using MMC/SD access?
> 
>>   * Can you share [any of] the code that fails?
>>     [Himanshu] Okay...Please find herewith application code for your
>> reference. Note that this is very simple 
>>     application which we are using right now for basic testing.
> 
> Not terribly useful, frankly.  I'm not interested in reading 1000 lines
> of random code without any guidance, etc.  For example, how does your
> 'fatfs1.c' differ from the standard one?  Does it fail as well?
> 
>> Let me know if you need any further information which would help to
> identify
>> the problem/solution.
> 
> What you'll get here is at best _guidance_, not analysis and debug.
> As Chris said, that's what *paid* support is for.
> 
>> -----Original Message-----
>> From: Gary Thomas [mailto:gary@mlbassoc.com] 
>> Sent: Friday, March 20, 2009 4:39 PM
>> To: Himanshu Patel
>> Cc: 'eCos Discuss'
>> Subject: Re: [ECOS] RE: Problem with FAT32
>>
>> Himanshu Patel wrote:
>>> Gentle reminder...We are kind of stuck and delivery date is very near.
>> Gentle reply - this is a volunteer list, we'll help _when_ we can.
>>
>> That said, more details are probably necessary in order to be able
>> to make any comments.
>>   * What [else] have you done to isolate the problem?
>>   * Are you running with asserts (and checks) enabled?
>>   * Can you duplicate it outside of your application?
>>   * Can you share [any of] the code that fails?
>>
>>> -----Original Message-----
>>> From: ecos-discuss-owner@ecos.sourceware.org
>>> [mailto:ecos-discuss-owner@ecos.sourceware.org] On Behalf Of Himanshu
>> Patel
>>> Sent: Thursday, March 19, 2009 8:12 PM
>>> To: eCos Discuss
>>> Subject: [ECOS] RE: Problem with FAT32
>>>
>>> Note that failure generally happens when we have opendir() or readdir()
>>> calls. Any one has encountered such problem?
>>>
>>> Regards,
>>>
>>> Himanshu Patel
>>>
>>> -----Original Message-----
>>> From: Himanshu Patel 
>>> Sent: Thursday, March 19, 2009 6:57 PM
>>> To: 'eCos Discuss'
>>> Subject: Problem with FAT32
>>>
>>> Hi,
>>>
>>> We are using FAT32 file system in our project. 
>>>
>>> We are facing strange problem. When we test the file system commands
>>> (open, close, read, write) all works very correctly in single thread.
>>> However when we invoke other thread, then file system commands do not
>>> work and board gets reset. 
>>>
>>> We have allocated thread stack memory of  file system thread up to 10 KB
>>> and for other thread is 4 KB. 
>>>
>>> We have tried to combine both the threads  in one thread and then also
>>> the results are the same (board gets reset). 
>>>
>>> We have tried to find out problem by enabling asserts and tracing.
>>> However we don't get any assert at the time of reset. 
>>>
>>> What could be the issue? 
>>>
>>> Regards,
>>>
>>> Himanshu Patel
>>>
>>
> 
> 


-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss





-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-03-26 15:29 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-20 11:09 [ECOS] RE: Problem with FAT32 Himanshu Patel
2009-03-20 13:19 ` Himanshu Patel
2009-03-20 13:44   ` Gary Thomas
2009-03-20 14:17     ` Himanshu Patel
2009-03-20 15:00       ` Gary Thomas
2009-03-20 16:51         ` Himanshu Patel
2009-03-20 17:25           ` Gary Thomas
2009-03-26 16:52             ` Himanshu Patel
2009-03-20 14:04   ` Chris Zimman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).