public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: "Tomasz Kutyła" <tkutyla@marp.pl>
To: ecos-discuss@ecos.sourceware.org
Subject: Re: [ECOS] system ASSERT problem
Date: Wed, 21 Mar 2007 10:32:00 -0000	[thread overview]
Message-ID: <460109A2.3030708@marp.pl> (raw)
In-Reply-To: <20070321101435.GA17731@lunn.ch>


>> I got strange problem with my application. When I compile system with 
>> global compiler flags
>>
>> -ml -m4 -O2 -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef 
>> -Woverloaded-virtual -ggdb -ffunction-sections -fdata-sections -fno-rtti 
>> -fno-exceptions -fvtable-gc -finit-priority -save-temps
>>
>> I got info on terminal:
>>
>> ASSERT FAIL: <3>mcard.c[193]int mcard_write_bmask() Valid card handler 
>> required
>> ASSERT FAIL: mcard.c             [ 193] int 
>> mcard_write_bmask()                                                         
>> Valid card handler required
>>
>> But when I remove '-O2' flag the problems doesn't occur. What can be the 
>> problem???
>>     
>
> There is no mcard.c in the repository, so i guess it is something you
> have added. Without the code it is hard to guess what is happening.
Below is the code that generates the ASSERT:

int mcard_write_bmask(mcard_t *card)
{
   CYG_CHECK_DATA_PTR(card, "valid card pointer required");
   CYG_CHECK_DATA_PTR(card->bmask, "valid mask pointer required");
   CYG_ASSERT(card->mcard_hdl,"Valid card handler required");

   if( !card->mcard_hdl ) return -EINVAL;
   if( !card->bmask ) return -EINVAL;

   int e;
   e = mcard_verify_card(card);
   if( e ) return e;

   e = cyg_io_set_config(card->mcard_hdl,CYG_IO_SET_CONFIG_CARD_LOCK,0,0);
   if( e ) return -EIO;

   cyg_uint32 address = card->header.bmask_offset;
    cyg_uint32 len = sizeof(cyg_uint32);
    
cyg_io_set_config(card->mcard_hdl,CYG_IO_SET_CONFIG_CARD_WRITE_POS,&address,&len);
    len = card->header.bmask_size;
 
    e = cyg_io_write(card->mcard_hdl,card->bmask,&len);
   
   cyg_io_set_config(card->mcard_hdl,CYG_IO_SET_CONFIG_CARD_UNLOCK,0,0);

   if( e ) return -EIO;

   return ENOERR;
}

**************************

and the mcard_write_bmask function is called from function below:

typedef struct mcard_t
{
   cyg_io_handle_t   mcard_hdl;
   mcard_header_t    header;
   mcard_bmask_t    *bmask;
   cyg_uint8         opened;
} mcard_t;

int I::formatCard()
{
   int e;

   mcard_t mcard;
   mcard.mcard_hdl = 0;
   e = mcard_open(&mcard);
   if( e ) return -1;

   MCARD_PRINT_HEADER(&mcard.header);

   CLEAR_BUF(mcard.bmask,mcard.header.bmask_size);
   e = mcard_write_bmask(&mcard);
   if( e ) return e;

   MCARD_PRINT_BMASK(&mcard);

   mcard_pdata_t pdata;
   CLEAR_BUF(&pdata,sizeof(mcard_pdata_t))
   e = mcard_write_pdata(&mcard, &pdata);
   if( e ) return e;

   MCARD_PRINT_PDATA(&pdata);

   return 0;
}

-- 
Tomasz Kutyla, Design Engineer
MARP Electronic Sp. z o.o., ul. Pachonskiego 9, 31-223 Krakow
tel. +48 12 415-87-29 (ext. 35), mob.: +48 693 112 191
fax +48 12 415-86-80

e-mail: tkutyla@marp.pl; http://www.marp.pl


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

  reply	other threads:[~2007-03-21 10:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-21 10:09 Tomasz Kutyła
2007-03-21 10:14 ` Andrew Lunn
2007-03-21 10:32   ` Tomasz Kutyła [this message]
2007-03-21 13:36     ` Andrew Lunn
2007-03-21 16:00       ` Tomasz Kutyla
2007-03-21 16:03         ` Andrew Lunn
2007-03-21 15:09     ` Kurt Siedenburg
2007-03-21 15:47 bob.koninckx
2007-03-21 16:02 ` Tomasz Kutyla
2007-03-21 17:23 bob.koninckx
2007-03-26 15:39 ` Tomasz Kutyla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=460109A2.3030708@marp.pl \
    --to=tkutyla@marp.pl \
    --cc=ecos-discuss@ecos.sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).