public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Giri Raja <giri_amf@yahoo.com>
Cc: ecos-discuss@ecos.sourceware.org
Subject: Re: [ECOS] Problems in programming in FLASH - EB40A
Date: Sat, 21 Aug 2004 07:54:00 -0000	[thread overview]
Message-ID: <20040821075429.GF28592@lunn.ch> (raw)
In-Reply-To: <20040820234301.89469.qmail@web53804.mail.yahoo.com>

On Fri, Aug 20, 2004 at 04:43:01PM -0700, Giri Raja wrote:
> Hi,
>    I'm using a simple test program to program and read
> from the FLASH memory in EB40A. I have a buffer that
> contains all the data that is needed to store in the
> FLASH. when I make the type of this buffer to be a chr
> array, then I do not get any problems. however if I
> define it to be of type cyg_uint8 or unsigned chr,
> then I'm not sure if the data is written into the
> FLASH properly. I check the validity of the
> flash_program by doing a flash_read and printing out
> the contents. 
> when the type was cyg_uint8 or unsigned chr, I see
> only the first few bytes of the array written
> properly, and then they keep repeating.

The type of char should have no effect on the program to flash.

> 
> here is the code that I'm using.
> 
> #include <cyg/kernel/kapi.h>
> #include <cyg/hal/hal_platform_ints.h>
> #include <cyg/io/io.h>
> #include <cyg/io/ttyio.h>
> #include <stdio.h>
> #include <string.h>
> #include <stdlib.h>
> #include <cyg/hal/hal_io.h>
> #include <cyg/infra/diag.h>
> #include <cyg/io/flash.h>
>                                                       
>                                                       
>                
> extern "C"  {
>         void cyg_user_start(void);
> }
>                                                       
>                                                       
>                
> void cyg_user_start(void)
> {
>         int err,i ;
>         unsigned char input_bytes[10];
>         int length;
>         char *err_address ;
>         unsigned char readStr[10] ;
>         int p_base = 0x01030000;
>                                                       
>                                                       
>                
>         for(i = 0; i < 10; i++)
>                 input_bytes[i] = (unsigned
> char)(i+10);
>                                                       
>                                                       
>                
>         flash_init(diag_printf);
>         length = 10;
>                                                       
>                                                       
>                
>         for(i = 0; i < 10; i++)
>                 diag_printf("the chrs - input_byes[%d]
> = %u\n", i, input_bytes[i]);
>                                                       

What about eraseing before writing?
                                                       
>                
>         err = flash_program((void *)&p_base, (void
> *)input_bytes, length, (void **)&err_address);
>                                                       
>                                                       
>                
>         flash_read((void *)&p_base, (void *)readStr,
> length, (void **)&err_address);
>         for(i = 0; i < length; i++)
>                 diag_printf("byte[%d] = %u\n", i,
> readStr[i]) ;
>                                                       
>                                                       
>                
> Thank you very much.
> 
> Giri.
> 
>         return ;
> }
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 
> -- 
> 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

      reply	other threads:[~2004-08-21  7:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-20 23:43 Giri Raja
2004-08-21  7:54 ` Andrew Lunn [this message]

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=20040821075429.GF28592@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=ecos-discuss@ecos.sourceware.org \
    --cc=giri_amf@yahoo.com \
    /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).